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
diff options
context:
space:
mode:
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2005-10-07 01:55:11 +0400
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2005-10-07 01:55:11 +0400
commitdaeb7fea07a1c12a3689585059ab79bcfe5b309a (patch)
tree66c72cbe4cc2c9dfc879ef319d2a77903961d4df
parent8dc6646de1add233f6c278bbb76daaebe364c58e (diff)
parent61f495df7df48f541aa3f2d6601505ae9555e804 (diff)
svn path=/branches/mono-1-1-7/mcs/; revision=51376
-rw-r--r--mcs/class/System.Web/.cvsignore7
-rw-r--r--mcs/class/System.Web/Assembly/AssemblyInfo.cs117
-rw-r--r--mcs/class/System.Web/Assembly/ChangeLog53
-rw-r--r--mcs/class/System.Web/Assembly/Consts.cs73
-rw-r--r--mcs/class/System.Web/Assembly/Locale.cs45
-rw-r--r--mcs/class/System.Web/ChangeLog700
-rw-r--r--mcs/class/System.Web/Makefile63
-rw-r--r--mcs/class/System.Web/System.Web.Administration/ChangeLog3
-rw-r--r--mcs/class/System.Web/System.Web.Administration/WebAdminUserControl.cs42
-rw-r--r--mcs/class/System.Web/System.Web.Caching/Cache.cs445
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CacheDefinitions.cs62
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CacheDependency.cs222
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CacheEntry.cs277
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CacheExpires.cs123
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CachedRawResponse.cs104
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CachedVaryBy.cs120
-rw-r--r--mcs/class/System.Web/System.Web.Caching/ChangeLog237
-rw-r--r--mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs630
-rw-r--r--mcs/class/System.Web/System.Web.Caching/OutputCacheModule.cs181
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/AspComponentFoundry.cs195
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs690
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/AspParser.cs471
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs330
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs349
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/BuildProviderResultFlags.cs41
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs178
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/ChangeLog966
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/CompilationException.cs118
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/Directive.cs142
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/ExpressionBuilder.cs57
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/ExpressionBuilderContext.cs61
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/GlobalAsaxCompiler.cs104
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/IImplicitResourceProvider.cs42
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/ILocation.cs43
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/IResourceReader.cs39
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/ImplicitResourceKey.cs43
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/Location.cs92
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs207
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/ParseException.cs111
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/TagAttributes.cs198
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/TagType.cs46
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs1208
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs76
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs143
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/AdapterDictionary.cs47
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/AnonymousIdentificationSection.cs128
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/AssemblyCollection.cs77
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/AssemblyInfo.cs70
-rwxr-xr-xmcs/class/System.Web/System.Web.Configuration/AuthConfig.cs216
-rwxr-xr-xmcs/class/System.Web/System.Web.Configuration/AuthenticationConfigHandler.cs157
-rwxr-xr-xmcs/class/System.Web/System.Web.Configuration/AuthenticationMode.cs40
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/AuthenticationSection.cs81
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/AuthorizationConfig.cs178
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/AuthorizationConfigHandler.cs95
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/AuthorizationRuleAction.cs40
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/BuildProvider.cs90
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/BuildProviderAppliesTo.cs43
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/BuildProviderCollection.cs103
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/ChangeLog457
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/ClientTargetSectionHandler.cs65
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/CodeSubDirectoriesCollection.cs92
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/CodeSubDirectory.cs61
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/CompilationConfiguration.cs209
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/CompilationConfigurationHandler.cs196
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/CompilationSection.cs189
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/Compiler.cs116
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/CompilerCollection.cs140
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/CustomErrorsConfigHandler.cs183
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/CustomErrorsMode.cs41
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/ExpressionBuilder.cs71
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/ExpressionBuilderCollection.cs105
-rwxr-xr-xmcs/class/System.Web/System.Web.Configuration/FormsAuthPasswordFormat.cs39
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/FormsAuthenticationConfiguration.cs43
-rwxr-xr-xmcs/class/System.Web/System.Web.Configuration/FormsProtectionEnum.cs40
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/GlobalizationConfiguration.cs76
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/GlobalizationConfigurationHandler.cs163
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HandlerFactoryConfiguration.cs122
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HandlerFactoryProxy.cs36
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HandlerItem.cs165
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HttpCapabilitiesBase.cs66
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HttpConfigurationContext.cs50
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HttpHandlersSectionHandler.cs158
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HttpModulesConfigurationHandler.cs102
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HttpRuntimeConfig.cs96
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HttpRuntimeConfigurationHandler.cs108
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/IRemoteWebConfigurationHostServer.cs49
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/InternalSection.cs54
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/MachineKeyConfig.cs159
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/MachineKeyConfigHandler.cs93
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/MachineKeyValidation.cs46
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/ModuleItem.cs71
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/ModulesConfiguration.cs96
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/PagesConfiguration.cs81
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/PagesConfigurationHandler.cs120
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/PagesEnableSessionState.cs41
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/PagesToCountAction.cs40
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/PassportAuthentication.cs43
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/ProcessModelComAuthenticationLevel.cs45
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/ProcessModelComImpersonationLevel.cs43
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/ProcessModelLogLevel.cs41
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/SerializationMode.cs42
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/SiteMapSection.cs80
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/TraceConfig.cs75
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/TraceConfigurationHandler.cs110
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/TraceDisplayMode.cs40
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs944
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/WebControlsSectionHandler.cs136
-rw-r--r--mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs96
-rw-r--r--mcs/class/System.Web/System.Web.Handlers/ChangeLog46
-rw-r--r--mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs186
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/AppDomainFactory.cs156
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs103
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/ChangeLog132
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs49
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IAppManagerAppDomainFactory.cs41
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IApplicationHost.cs46
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IHttpWorkerRequestHandler.cs40
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IISAPIRuntime.cs46
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IProcessHost.cs74
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IProcessHostFactoryHelper.cs39
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IProcessHostSupportFunction.cs57
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IProcessPingCallback.cs40
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IQueueHost.cs50
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IRegisteredObject.cs40
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/ISAPIRuntime.cs69
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs328
-rw-r--r--mcs/class/System.Web/System.Web.Mail/Base64AttachmentEncoder.cs105
-rw-r--r--mcs/class/System.Web/System.Web.Mail/ChangeLog101
-rw-r--r--mcs/class/System.Web/System.Web.Mail/IAttachmentEncoder.cs39
-rw-r--r--mcs/class/System.Web/System.Web.Mail/MailAddress.cs135
-rw-r--r--mcs/class/System.Web/System.Web.Mail/MailAddressCollection.cs89
-rw-r--r--mcs/class/System.Web/System.Web.Mail/MailAttachment.cs67
-rw-r--r--mcs/class/System.Web/System.Web.Mail/MailEncoding.cs50
-rw-r--r--mcs/class/System.Web/System.Web.Mail/MailFormat.cs50
-rw-r--r--mcs/class/System.Web/System.Web.Mail/MailHeader.cs113
-rw-r--r--mcs/class/System.Web/System.Web.Mail/MailMessage.cs156
-rw-r--r--mcs/class/System.Web/System.Web.Mail/MailMessageWrapper.cs257
-rw-r--r--mcs/class/System.Web/System.Web.Mail/MailPriority.cs54
-rw-r--r--mcs/class/System.Web/System.Web.Mail/MailUtil.cs88
-rw-r--r--mcs/class/System.Web/System.Web.Mail/RelatedBodyPart.cs72
-rw-r--r--mcs/class/System.Web/System.Web.Mail/SmtpClient.cs291
-rw-r--r--mcs/class/System.Web/System.Web.Mail/SmtpException.cs38
-rw-r--r--mcs/class/System.Web/System.Web.Mail/SmtpMail.cs108
-rw-r--r--mcs/class/System.Web/System.Web.Mail/SmtpResponse.cs86
-rw-r--r--mcs/class/System.Web/System.Web.Mail/SmtpStream.cs208
-rw-r--r--mcs/class/System.Web/System.Web.Mail/ToUUEncodingTransform.cs133
-rw-r--r--mcs/class/System.Web/System.Web.Mail/UUAttachmentEncoder.cs97
-rw-r--r--mcs/class/System.Web/System.Web.Management/ChangeLog25
-rw-r--r--mcs/class/System.Web/System.Web.Management/EventNotificationType.cs44
-rw-r--r--mcs/class/System.Web/System.Web.Management/IRegiisUtility.cs62
-rw-r--r--mcs/class/System.Web/System.Web.Management/IRegisterCreateITypeLib.cs58
-rw-r--r--mcs/class/System.Web/System.Web.Management/IWebEventCustomEvaluator.cs40
-rw-r--r--mcs/class/System.Web/System.Web.Management/RuleFiringRecord.cs54
-rw-r--r--mcs/class/System.Web/System.Web.Management/SessionStateType.cs40
-rw-r--r--mcs/class/System.Web/System.Web.Management/SqlFeatures.cs45
-rw-r--r--mcs/class/System.Web/System.Web.Management/WebApplicationInformation.cs84
-rw-r--r--mcs/class/System.Web/System.Web.Management/WebBaseEvent.cs136
-rw-r--r--mcs/class/System.Web/System.Web.Management/WebEventFormatter.cs67
-rw-r--r--mcs/class/System.Web/System.Web.Profile/ChangeLog3
-rw-r--r--mcs/class/System.Web/System.Web.Profile/ProfileAuthenticationOption.cs39
-rw-r--r--mcs/class/System.Web/System.Web.Security/.cvsignore1
-rw-r--r--mcs/class/System.Web/System.Web.Security/AccessMembershipProvider.cs174
-rw-r--r--mcs/class/System.Web/System.Web.Security/AccessRoleProvider.cs118
-rw-r--r--mcs/class/System.Web/System.Web.Security/ActiveDirectoryMembershipProvider.cs174
-rw-r--r--mcs/class/System.Web/System.Web.Security/AnonymousIdentificationEventArgs.cs52
-rw-r--r--mcs/class/System.Web/System.Web.Security/AnonymousIdentificationEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.Security/AnonymousIdentificationModule.cs61
-rw-r--r--mcs/class/System.Web/System.Web.Security/ChangeLog228
-rw-r--r--mcs/class/System.Web/System.Web.Security/CookieProtection.cs41
-rw-r--r--mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventArgs.cs53
-rw-r--r--mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.Security/DefaultAuthenticationModule.cs66
-rw-r--r--mcs/class/System.Web/System.Web.Security/FileAuthorizationModule.cs48
-rw-r--r--mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs463
-rw-r--r--mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventArgs.cs66
-rw-r--r--mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventHandler.cs35
-rw-r--r--mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs121
-rw-r--r--mcs/class/System.Web/System.Web.Security/FormsAuthenticationTicket.cs208
-rw-r--r--mcs/class/System.Web/System.Web.Security/FormsIdentity.cs75
-rw-r--r--mcs/class/System.Web/System.Web.Security/Membership.cs162
-rw-r--r--mcs/class/System.Web/System.Web.Security/MembershipCreateStatus.cs47
-rw-r--r--mcs/class/System.Web/System.Web.Security/MembershipCreateUserException.cs47
-rw-r--r--mcs/class/System.Web/System.Web.Security/MembershipOnlineStatus.cs40
-rw-r--r--mcs/class/System.Web/System.Web.Security/MembershipPasswordException.cs40
-rw-r--r--mcs/class/System.Web/System.Web.Security/MembershipPasswordFormat.cs40
-rw-r--r--mcs/class/System.Web/System.Web.Security/MembershipProvider.cs64
-rw-r--r--mcs/class/System.Web/System.Web.Security/MembershipProviderCollection.cs50
-rw-r--r--mcs/class/System.Web/System.Web.Security/MembershipSortOptions.cs43
-rw-r--r--mcs/class/System.Web/System.Web.Security/MembershipUser.cs162
-rw-r--r--mcs/class/System.Web/System.Web.Security/MembershipUserCollection.cs109
-rw-r--r--mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventArgs.cs75
-rw-r--r--mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.Security/PassportAuthenticationModule.cs52
-rw-r--r--mcs/class/System.Web/System.Web.Security/PassportIdentity.cs489
-rw-r--r--mcs/class/System.Web/System.Web.Security/RoleManagerEventArgs.cs56
-rw-r--r--mcs/class/System.Web/System.Web.Security/RoleManagerEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.Security/RoleManagerModule.cs54
-rw-r--r--mcs/class/System.Web/System.Web.Security/RolePrincipal.cs142
-rw-r--r--mcs/class/System.Web/System.Web.Security/RoleProvider.cs56
-rw-r--r--mcs/class/System.Web/System.Web.Security/RoleProviderCollection.cs50
-rw-r--r--mcs/class/System.Web/System.Web.Security/Roles.cs205
-rw-r--r--mcs/class/System.Web/System.Web.Security/SqlMembershipProvider.cs174
-rw-r--r--mcs/class/System.Web/System.Web.Security/SqlRoleProvider.cs118
-rw-r--r--mcs/class/System.Web/System.Web.Security/UrlAuthorizationModule.cs74
-rw-r--r--mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventArgs.cs75
-rw-r--r--mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.Security/WindowsAuthenticationModule.cs53
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/ChangeLog327
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs218
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/IHttpSessionState.cs71
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/IReadOnlySessionState.cs36
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/IRequiresSessionState.cs36
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/ISessionHandler.cs44
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/ISessionIDModule.cs48
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/ISessionStateItemCollection.cs53
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/IStateRuntime.cs53
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/RemoteStateServer.cs75
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionConfig.cs112
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs209
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionId.cs87
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionInProcHandler.cs91
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionSQLServerHandler.cs245
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionStateActionFlags.cs36
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionStateItemExpireCallback.cs38
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionStateMode.cs41
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs208
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionStateSectionHandler.cs100
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionStateServerHandler.cs138
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionStateStoreData.cs66
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/StateRuntime.cs50
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/StateServerItem.cs73
-rw-r--r--mcs/class/System.Web/System.Web.UI.Adapters/ChangeLog3
-rw-r--r--mcs/class/System.Web/System.Web.UI.Adapters/WmlPostFieldType.cs40
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog418
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs119
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs93
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs124
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs143
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControlBuilder.cs22
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs171
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs44
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlHead.cs165
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlHeadBuilder.cs53
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs122
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs103
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs86
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs70
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs115
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs63
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs145
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs134
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs113
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs453
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelectBuilder.cs32
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs200
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs158
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs84
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs156
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs83
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs137
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTitle.cs61
-rw-r--r--mcs/class/System.Web/System.Web.UI.Imaging/ChangeLog5
-rw-r--r--mcs/class/System.Web/System.Web.UI.Imaging/ImageScaleMode.cs41
-rw-r--r--mcs/class/System.Web/System.Web.UI.Imaging/ImageType.cs41
-rw-r--r--mcs/class/System.Web/System.Web.UI.Imaging/StorageType.cs38
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ChangeLog115
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConnectionConsumerCallback.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConnectionPoint.cs84
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConnectionPointType.cs35
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConnectionProviderCallback.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConsumerConnectionPoint.cs57
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IField.cs44
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IFilter.cs47
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IParameters.cs47
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IPersonalizable.cs46
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IRow.cs44
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ITable.cs45
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ITrackingPersonalizable.cs48
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ITransformerConfigurationControl.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IVersioningPersonalizable.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IWebActionable.cs41
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IWebEditable.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IWebPart.cs46
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IWebPartHttpHandler.cs41
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/Part.cs127
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/PartChromeState.cs35
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/PartChromeType.cs38
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/PersonalizationScope.cs35
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ProviderConnectionPoint.cs56
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/TypeCollection.cs77
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPart.cs210
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartAuthorizationEventArgs.cs49
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartAuthorizationEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartCancelEventArgs.cs53
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartCancelEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartConnectionsEventArgs.cs80
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartConnectionsEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayMode.cs51
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayModeCancelEventArgs.cs53
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayModeCancelEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayModeEventArgs.cs51
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayModeEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartEventArgs.cs52
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartExportMode.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartHelpMode.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartPageMenuMode.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerb.cs194
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerbCollection.cs77
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerbsEventArgs.cs54
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerbsEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/.cvsignore3
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/AccessDataSource.cs129
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/AccessDataSourceView.cs85
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventArgs.cs116
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventHandler.cs38
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs526
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/AdType.cs39
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/AssociatedControlConverter.cs51
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/AuthenticateEventArgs.cs51
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/AuthenticateEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/AutoCompleteType.cs68
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/AutoGeneratedField.cs146
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/AutoGeneratedFieldProperties.cs106
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs416
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/BaseDataBoundControl.cs145
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/BaseDataList.cs471
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs473
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/BorderStyle.cs50
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/BoundColumn.cs206
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/BoundField.cs242
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/BulletStyle.cs46
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/BulletedList.cs314
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/BulletedListDisplayMode.cs38
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/BulletedListEventArgs.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/BulletedListEventHandler.cs34
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/Button.cs340
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ButtonColumn.cs232
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ButtonColumnType.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ButtonField.cs197
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ButtonFieldBase.cs110
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ButtonType.cs38
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs1416
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CalendarDay.cs121
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/CalendarSelectionMode.cs44
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog2825
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs487
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxField.cs143
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs381
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ChildTable.cs46
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CollectionDataSource.cs84
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CommandEventArgs.cs71
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CommandEventHandler.cs38
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CommandField.cs405
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CompareValidator.cs146
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CompositeControl.cs68
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CompositeDataBoundControl.cs71
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Content.cs56
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ContentControlBuilder.cs60
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ContentDirection.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ContentPlaceHolder.cs49
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ContentPlaceHolderBuilder.cs44
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ControlIDConverter.cs101
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ControlParameter.cs132
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ControlPropertyNameConverter.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CookieParameter.cs99
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CreateUserErrorEventArgs.cs50
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CreateUserErrorEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs141
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataBoundControl.cs203
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataControlButton.cs170
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataControlCellType.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataControlField.cs402
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldCell.cs56
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldCollection.cs152
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldHeaderCell.cs87
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataControlRowState.cs39
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataControlRowType.cs39
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs1607
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumn.cs460
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumnCollection.cs230
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventArgs.cs70
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventHandler.cs38
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridItem.cs110
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemCollection.cs104
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventArgs.cs58
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventHandler.cs38
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/DataGridLinkButton.cs75
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventArgs.cs71
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventHandler.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridPagerStyle.cs334
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventArgs.cs71
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventHandler.cs37
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/DataGridTableInternal.cs53
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataKey.cs147
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataKeyArray.cs117
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataKeyCollection.cs104
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/DataList.cs1063
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventArgs.cs70
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventHandler.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListItem.cs136
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListItemCollection.cs104
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventArgs.cs61
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventHandler.cs37
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/DataSourceInternal.cs129
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/DayNameFormat.cs44
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventArgs.cs81
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventHandler.cs38
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs1740
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewCommandEventArgs.cs50
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewCommandEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewDeleteEventArgs.cs70
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewDeleteEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewDeletedEventArgs.cs83
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewDeletedEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewInsertEventArgs.cs64
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewInsertEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewInsertedEventArgs.cs82
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewInsertedEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewMode.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewModeEventArgs.cs59
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewModeEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewPageEventArgs.cs53
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewPageEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewRow.cs82
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewRowCollection.cs85
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewUpdateEventArgs.cs76
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewUpdateEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewUpdatedEventArgs.cs95
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewUpdatedEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs277
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DynamicImageParameterMode.cs35
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/EditCommandColumn.cs170
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/FirstDayOfWeek.cs48
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs324
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FontNamesConverter.cs84
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/FontSize.cs51
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FontUnit.cs239
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FontUnitConverter.cs140
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormParameter.cs93
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs1423
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewCommandEventArgs.cs50
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewCommandEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewDeleteEventArgs.cs72
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewDeleteEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewDeletedEventArgs.cs81
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewDeletedEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewInsertEventArgs.cs64
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewInsertEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewInsertedEventArgs.cs81
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewInsertedEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewMode.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewModeEventArgs.cs59
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewModeEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewPageEventArgs.cs53
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewPageEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewRow.cs82
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewUpdateEventArgs.cs76
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewUpdateEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewUpdatedEventArgs.cs95
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormViewUpdatedEventHandler.cs34
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/GridLines.cs44
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs1846
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridView.js21
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewCancelEditEventArgs.cs53
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewCancelEditEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewCommandEventArgs.cs58
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewCommandEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewDeleteEventArgs.cs70
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewDeleteEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewDeletedEventArgs.cs82
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewDeletedEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewEditEventArgs.cs53
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewEditEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewPageEventArgs.cs53
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewPageEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewRow.cs108
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewRowCollection.cs81
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewRowEventArgs.cs50
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewRowEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewSelectEventArgs.cs53
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewSelectEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewSortEventArgs.cs60
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewSortEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewUpdateEventArgs.cs76
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewUpdateEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewUpdatedEventArgs.cs95
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridViewUpdatedEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/HiddenField.cs40
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/HierarchicalDataBoundControl.cs121
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlign.cs48
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlignConverter.cs72
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/HotSpotMode.cs37
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/HyperLink.cs241
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs262
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkControlBuilder.cs48
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkField.cs275
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/IButtonControl.cs50
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ICallbackContainer.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ICompositeControlDesignerAccessor.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/IPostBackContainer.cs43
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/IRepeatInfoUser.cs50
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Image.cs198
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ImageAlign.cs50
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs396
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ImageField.cs329
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ImageFieldMode.cs35
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ImageMapEventArgs.cs50
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ImageMapEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Label.cs153
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LabelControlBuilder.cs48
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs322
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonControlBuilder.cs52
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonInternal.cs76
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs241
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs640
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ListItem.cs300
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs383
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ListItemControlBuilder.cs57
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ListItemType.cs48
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ListSelectionMode.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Literal.cs109
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LiteralControlBuilder.cs57
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LiteralMode.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Localize.cs47
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Login.cs59
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LoginFailureAction.cs38
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LoginTextLayout.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LogoutAction.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MailMessageEventArgs.cs52
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MailMessageEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs1284
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Menu.js190
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MenuEventArgs.cs62
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MenuEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MenuItem.cs520
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MenuItemBinding.cs360
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MenuItemBindingCollection.cs104
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MenuItemCollection.cs248
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MenuItemStyle.cs162
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MenuItemStyleCollection.cs104
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MenuItemTemplateContainer.cs73
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventArgs.cs71
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventHandler.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MultiView.cs195
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/NextPrevFormat.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSource.cs352
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceDisposingEventArgs.cs51
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceDisposingEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceEventArgs.cs50
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceFilteringEventArgs.cs51
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceFilteringEventHandler.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceMethodEventArgs.cs52
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceMethodEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceSelectingEventArgs.cs58
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceSelectingEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceStatusEventArgs.cs78
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceStatusEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceView.cs1038
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Orientation.cs35
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs554
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/PagerButtons.cs37
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/PagerMode.cs42
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/PagerPosition.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/PagerSettings.cs307
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs135
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Parameter.cs287
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ParameterCollection.cs234
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/PathDirection.cs35
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolder.cs49
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolderControlBuilder.cs52
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/QueryStringParameter.cs94
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs178
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs364
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs159
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RegularExpressionValidator.cs111
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/RepeatDirection.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs408
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/RepeatLayout.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs593
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventArgs.cs70
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventHandler.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItem.cs96
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemCollection.cs104
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventArgs.cs61
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventHandler.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs90
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ScrollBars.cs39
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SelectedDatesCollection.cs146
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SendMailErrorEventArgs.cs57
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SendMailErrorEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventArgs.cs66
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventHandler.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SessionParameter.cs94
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SiteMapDataSource.cs79
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SiteMapDataSourceView.cs68
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SiteMapHierarchicalDataSourceView.cs54
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SiteMapNodeItemEventArgs.cs49
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SiteMapNodeItemEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SiteMapNodeItemType.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SiteMapNodeType.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SiteMapViewType.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SortDirection.cs35
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSource.cs299
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceCommandEventArgs.cs53
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceCommandEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceMode.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceSelectingEventArgs.cs55
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceSelectingEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceStatusEventArgs.cs73
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceStatusEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceView.cs519
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/StringArrayConverter.cs63
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Style.cs608
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SubMenuStyle.cs139
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Table.cs250
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableCaptionAlign.cs38
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs215
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableCellCollection.cs202
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableCellControlBuilder.cs52
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderCell.cs47
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderScope.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableItemStyle.cs216
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableRow.cs136
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableRowCollection.cs202
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableRowSection.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs294
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableViewMode.cs35
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TargetConverter.cs76
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TemplateColumn.cs141
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TemplateField.cs201
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/TextAlign.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs340
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TextBoxControlBuilder.cs57
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/TextBoxMode.cs43
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/TitleFormat.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TreeNode.cs682
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeBinding.cs344
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeBindingCollection.cs104
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeCollection.cs243
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeEventArgs.cs50
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeSelectAction.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeStyle.cs199
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeStyleCollection.cs104
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeTypes.cs39
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TreeView.cs1371
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TreeView.js77
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TreeViewImageSet.cs49
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs292
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/UnitConverter.cs115
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/UnitType.cs49
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ValidatedControlConverter.cs119
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ValidationCompareOperator.cs47
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ValidationDataType.cs45
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummary.cs306
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ValidationSummaryDisplayMode.cs43
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ValidatorDisplay.cs43
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/VerticalAlign.cs47
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlignConverter.cs72
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/View.cs83
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ViewCollection.cs67
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/WebColorConverter.cs95
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs577
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/WizardNavigationEventArgs.cs62
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/WizardNavigationEventHandler.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/WizardStepType.cs38
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs261
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/XmlBuilder.cs78
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSource.cs320
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSourceNodeDescriptor.cs123
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSourcePropertyDescriptor.cs95
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSourceView.cs83
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchicalDataSourceView.cs55
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchicalEnumerable.cs66
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchyData.cs237
-rw-r--r--mcs/class/System.Web/System.Web.UI/.cvsignore1
-rw-r--r--mcs/class/System.Web/System.Web.UI/ApplicationFileParser.cs94
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/AttributeCollection.cs104
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/BaseParser.cs148
-rw-r--r--mcs/class/System.Web/System.Web.UI/BasePartialCachingControl.cs185
-rw-r--r--mcs/class/System.Web/System.Web.UI/BoundPropertyEntry.cs61
-rw-r--r--mcs/class/System.Web/System.Web.UI/BuildMethod.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI/BuildTemplateMethod.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI/ChangeLog2038
-rw-r--r--mcs/class/System.Web/System.Web.UI/ClientScriptManager.cs395
-rw-r--r--mcs/class/System.Web/System.Web.UI/CodeBuilder.cs64
-rw-r--r--mcs/class/System.Web/System.Web.UI/CodeRenderBuilder.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI/CollectionBuilder.cs80
-rw-r--r--mcs/class/System.Web/System.Web.UI/CompilationMode.cs38
-rw-r--r--mcs/class/System.Web/System.Web.UI/CompiledBindableTemplateBuilder.cs59
-rw-r--r--mcs/class/System.Web/System.Web.UI/CompiledTemplateBuilder.cs50
-rw-r--r--mcs/class/System.Web/System.Web.UI/ConflictOptions.cs37
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/ConstructorNeedsTagAttribute.cs52
-rw-r--r--mcs/class/System.Web/System.Web.UI/Control.cs1112
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/ControlBuilder.cs495
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/ControlBuilderAttribute.cs68
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/ControlCollection.cs243
-rw-r--r--mcs/class/System.Web/System.Web.UI/ControlSkinProc.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI/ControlValuePropertyAttribute.cs85
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/CssStyleCollection.cs145
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/DataBinder.cs221
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/DataBinding.cs81
-rw-r--r--mcs/class/System.Web/System.Web.UI/DataBindingBuilder.cs45
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/DataBindingCollection.cs113
-rw-r--r--mcs/class/System.Web/System.Web.UI/DataBindingHandlerAttribute.cs70
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/DataBoundLiteralControl.cs106
-rw-r--r--mcs/class/System.Web/System.Web.UI/DataSourceCacheExpiry.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI/DataSourceCapabilities.cs40
-rw-r--r--mcs/class/System.Web/System.Web.UI/DataSourceControl.cs101
-rw-r--r--mcs/class/System.Web/System.Web.UI/DataSourceOperation.cs40
-rw-r--r--mcs/class/System.Web/System.Web.UI/DataSourceSelectArguments.cs140
-rw-r--r--mcs/class/System.Web/System.Web.UI/DataSourceView.cs208
-rw-r--r--mcs/class/System.Web/System.Web.UI/DataSourceViewOperationCallback.cs39
-rw-r--r--mcs/class/System.Web/System.Web.UI/DataSourceViewSelectCallback.cs40
-rw-r--r--mcs/class/System.Web/System.Web.UI/DesignTimeParseData.cs87
-rw-r--r--mcs/class/System.Web/System.Web.UI/DesignTimeTemplateParser.cs73
-rw-r--r--mcs/class/System.Web/System.Web.UI/DesignerDataBoundLiteralControl.cs78
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/EmptyControlCollection.cs51
-rw-r--r--mcs/class/System.Web/System.Web.UI/ExpressionBinding.cs96
-rw-r--r--mcs/class/System.Web/System.Web.UI/ExpressionBindingCollection.cs144
-rw-r--r--mcs/class/System.Web/System.Web.UI/ExtractTemplateValuesMethod.cs40
-rw-r--r--mcs/class/System.Web/System.Web.UI/FilterableAttribute.cs117
-rw-r--r--mcs/class/System.Web/System.Web.UI/HierarchicalDataSourceControl.cs77
-rw-r--r--mcs/class/System.Web/System.Web.UI/HierarchicalDataSourceView.cs48
-rw-r--r--mcs/class/System.Web/System.Web.UI/Html32TextWriter.cs308
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlControlPersistableAttribute.cs50
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs1110
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs91
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs79
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs127
-rw-r--r--mcs/class/System.Web/System.Web.UI/IAttributeAccessor.cs41
-rw-r--r--mcs/class/System.Web/System.Web.UI/IBindableTemplate.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI/ICallbackEventHandler.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI/ICheckBoxControl.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI/IControlBuilderAccessor.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI/IControlDesignerAccessor.cs48
-rw-r--r--mcs/class/System.Web/System.Web.UI/IControlTypeFilter.cs44
-rw-r--r--mcs/class/System.Web/System.Web.UI/IDReferencePropertyAttribute.cs67
-rw-r--r--mcs/class/System.Web/System.Web.UI/IDataBindingsAccessor.cs41
-rw-r--r--mcs/class/System.Web/System.Web.UI/IDataItemContainer.cs45
-rw-r--r--mcs/class/System.Web/System.Web.UI/IDataSource.cs44
-rw-r--r--mcs/class/System.Web/System.Web.UI/IDataSourceViewSchemaAccessor.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI/IEditableTextControl.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI/IExpressionsAccessor.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI/IFilterResolutionService.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI/IHierarchicalDataSource.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI/IHierarchicalEnumerable.cs40
-rw-r--r--mcs/class/System.Web/System.Web.UI/IHierarchyData.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI/IItemPaginationInfo.cs47
-rw-r--r--mcs/class/System.Web/System.Web.UI/IMobileTextWriter.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI/INamingContainer.cs39
-rw-r--r--mcs/class/System.Web/System.Web.UI/INavigateUIData.cs41
-rw-r--r--mcs/class/System.Web/System.Web.UI/IPageHeader.cs46
-rw-r--r--mcs/class/System.Web/System.Web.UI/IPaginationContainer.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI/IPaginationInfo.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI/IParserAccessor.cs40
-rw-r--r--mcs/class/System.Web/System.Web.UI/IPostBackDataHandler.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI/IPostBackEventHandler.cs40
-rw-r--r--mcs/class/System.Web/System.Web.UI/IResourceResolutionService.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI/IResourceUrlGenerator.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI/IStateFormatter.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI/IStateManager.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI/IStaticTextControl.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI/IStyleSheet.cs44
-rw-r--r--mcs/class/System.Web/System.Web.UI/ITagNameToTypeMapper.cs41
-rw-r--r--mcs/class/System.Web/System.Web.UI/ITemplate.cs40
-rw-r--r--mcs/class/System.Web/System.Web.UI/ITextControl.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI/IThemeResolutionService.cs44
-rw-r--r--mcs/class/System.Web/System.Web.UI/IUrlResolutionService.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI/IUserControlDesignerAccessor.cs38
-rw-r--r--mcs/class/System.Web/System.Web.UI/IUserControlTypeResolutionService.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI/IValidator.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI/IgnoreUnknownContentAttribute.cs44
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/ImageClickEventArgs.cs46
-rw-r--r--mcs/class/System.Web/System.Web.UI/ImageClickEventHandler.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI/KeyedList.cs216
-rw-r--r--mcs/class/System.Web/System.Web.UI/KeyedListEnumerator.cs88
-rw-r--r--mcs/class/System.Web/System.Web.UI/ListSourceHelper.cs56
-rw-r--r--mcs/class/System.Web/System.Web.UI/LiteralControl.cs71
-rw-r--r--mcs/class/System.Web/System.Web.UI/LosFormatter.cs80
-rw-r--r--mcs/class/System.Web/System.Web.UI/MasterPage.cs69
-rw-r--r--mcs/class/System.Web/System.Web.UI/MasterPageParser.cs69
-rw-r--r--mcs/class/System.Web/System.Web.UI/ObjectConverter.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI/ObjectStateFormatter.cs877
-rw-r--r--mcs/class/System.Web/System.Web.UI/ObjectTag.cs40
-rw-r--r--mcs/class/System.Web/System.Web.UI/ObjectTagBuilder.cs105
-rw-r--r--mcs/class/System.Web/System.Web.UI/OutputCacheLocation.cs47
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/Page.cs1430
-rw-r--r--mcs/class/System.Web/System.Web.UI/PageHandlerFactory.cs48
-rw-r--r--mcs/class/System.Web/System.Web.UI/PageParser.cs349
-rw-r--r--mcs/class/System.Web/System.Web.UI/Pair.cs61
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/ParseChildrenAttribute.cs112
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/PartialCachingAttribute.cs93
-rw-r--r--mcs/class/System.Web/System.Web.UI/PartialCachingControl.cs58
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/PersistChildrenAttribute.cs71
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/PersistenceMode.cs43
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/PersistenceModeAttribute.cs82
-rw-r--r--mcs/class/System.Web/System.Web.UI/PostBackOptions.cs134
-rw-r--r--mcs/class/System.Web/System.Web.UI/PropertyConverter.cs145
-rw-r--r--mcs/class/System.Web/System.Web.UI/PropertyEntry.cs69
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/RenderMethod.cs34
-rw-r--r--mcs/class/System.Web/System.Web.UI/RootBuilder.cs143
-rw-r--r--mcs/class/System.Web/System.Web.UI/SimpleHandlerFactory.cs54
-rw-r--r--mcs/class/System.Web/System.Web.UI/SimplePropertyEntry.cs49
-rw-r--r--mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs465
-rw-r--r--mcs/class/System.Web/System.Web.UI/StateBag.cs277
-rw-r--r--mcs/class/System.Web/System.Web.UI/StateItem.cs68
-rw-r--r--mcs/class/System.Web/System.Web.UI/StateManagedCollection.cs352
-rw-r--r--mcs/class/System.Web/System.Web.UI/StaticPartialCachingControl.cs72
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/TagPrefixAttribute.cs58
-rw-r--r--mcs/class/System.Web/System.Web.UI/TemplateBuilder.cs130
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/TemplateContainerAttribute.cs63
-rw-r--r--mcs/class/System.Web/System.Web.UI/TemplateContentType.cs38
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/TemplateControl.cs319
-rw-r--r--mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs179
-rw-r--r--mcs/class/System.Web/System.Web.UI/TemplateInstance.cs38
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/TemplateParser.cs606
-rw-r--r--mcs/class/System.Web/System.Web.UI/ThemeableAttribute.cs108
-rw-r--r--mcs/class/System.Web/System.Web.UI/ToolboxDataAttribute.cs79
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/Triplet.cs61
-rw-r--r--mcs/class/System.Web/System.Web.UI/TwoWayBoundPropertyEntry.cs61
-rw-r--r--mcs/class/System.Web/System.Web.UI/UrlPropertyAttribute.cs84
-rw-r--r--mcs/class/System.Web/System.Web.UI/UrlTypes.cs41
-rw-r--r--mcs/class/System.Web/System.Web.UI/UserControl.cs261
-rw-r--r--mcs/class/System.Web/System.Web.UI/UserControlControlBuilder.cs47
-rw-r--r--mcs/class/System.Web/System.Web.UI/UserControlParser.cs86
-rw-r--r--mcs/class/System.Web/System.Web.UI/Utils.cs96
-rw-r--r--mcs/class/System.Web/System.Web.UI/ValidationPropertyAttribute.cs48
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/ValidatorCollection.cs90
-rw-r--r--mcs/class/System.Web/System.Web.UI/VerificationConditionalOperator.cs38
-rw-r--r--mcs/class/System.Web/System.Web.UI/VerificationReportLevel.cs39
-rw-r--r--mcs/class/System.Web/System.Web.UI/VerificationRule.cs39
-rw-r--r--mcs/class/System.Web/System.Web.UI/WebHandlerParser.cs60
-rw-r--r--mcs/class/System.Web/System.Web.UI/WebResourceAttribute.cs50
-rw-r--r--mcs/class/System.Web/System.Web.UI/WebServiceParser.cs60
-rw-r--r--mcs/class/System.Web/System.Web.UI/XPathBinder.cs103
-rw-r--r--mcs/class/System.Web/System.Web.UI/XhtmlMobileDocType.cs39
-rw-r--r--mcs/class/System.Web/System.Web.Util/.cvsignore1
-rw-r--r--mcs/class/System.Web/System.Web.Util/AltSerialization.cs183
-rw-r--r--mcs/class/System.Web/System.Web.Util/ChangeLog232
-rw-r--r--mcs/class/System.Web/System.Web.Util/DataSourceHelper.cs88
-rw-r--r--mcs/class/System.Web/System.Web.Util/ICalls.cs45
-rw-r--r--mcs/class/System.Web/System.Web.Util/NativeFileChangeEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web.Util/TimeUtil.cs45
-rw-r--r--mcs/class/System.Web/System.Web.Util/TransactedCallback.cs32
-rw-r--r--mcs/class/System.Web/System.Web.Util/Transactions.cs53
-rw-r--r--mcs/class/System.Web/System.Web.Util/UrlUtils.cs427
-rw-r--r--mcs/class/System.Web/System.Web.Util/WebEncoding.cs70
-rw-r--r--mcs/class/System.Web/System.Web.Util/WebEqualComparer.cs124
-rw-r--r--mcs/class/System.Web/System.Web.Util/WebHashCodeProvider.cs61
-rw-r--r--mcs/class/System.Web/System.Web.Util/WebTrace.cs119
-rw-r--r--mcs/class/System.Web/System.Web.Util/WorkItem.cs44
-rw-r--r--mcs/class/System.Web/System.Web.Util/WorkItemCallback.cs32
-rwxr-xr-xmcs/class/System.Web/System.Web.dll.sources892
-rw-r--r--mcs/class/System.Web/System.Web/.cvsignore2
-rw-r--r--mcs/class/System.Web/System.Web/ApplicationShutdownReason.cs52
-rw-r--r--mcs/class/System.Web/System.Web/BeginEventHandler.cs37
-rw-r--r--mcs/class/System.Web/System.Web/CapabilitiesLoader.cs259
-rw-r--r--mcs/class/System.Web/System.Web/ChangeLog1685
-rw-r--r--mcs/class/System.Web/System.Web/EndEventHandler.cs34
-rw-r--r--mcs/class/System.Web/System.Web/HtmlizedException.cs63
-rw-r--r--mcs/class/System.Web/System.Web/HttpApplication.cs1617
-rw-r--r--mcs/class/System.Web/System.Web/HttpApplicationFactory.cs413
-rw-r--r--mcs/class/System.Web/System.Web/HttpApplicationState.cs273
-rw-r--r--mcs/class/System.Web/System.Web/HttpAsyncResult.cs85
-rwxr-xr-xmcs/class/System.Web/System.Web/HttpBrowserCapabilities.cs444
-rw-r--r--mcs/class/System.Web/System.Web/HttpCachePolicy.cs345
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheRevalidation.cs38
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheValidateHandler.cs37
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs140
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs133
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheability.cs41
-rw-r--r--mcs/class/System.Web/System.Web/HttpClientCertificate.cs168
-rw-r--r--mcs/class/System.Web/System.Web/HttpCompileException.cs66
-rw-r--r--mcs/class/System.Web/System.Web/HttpContext.cs431
-rw-r--r--mcs/class/System.Web/System.Web/HttpCookie.cs207
-rw-r--r--mcs/class/System.Web/System.Web/HttpCookieCollection.cs171
-rw-r--r--mcs/class/System.Web/System.Web/HttpCookieMode.cs41
-rw-r--r--mcs/class/System.Web/System.Web/HttpDataTransferMode.cs39
-rw-r--r--mcs/class/System.Web/System.Web/HttpException.cs290
-rw-r--r--mcs/class/System.Web/System.Web/HttpFileCollection.cs94
-rw-r--r--mcs/class/System.Web/System.Web/HttpForbiddenHandler.cs48
-rw-r--r--mcs/class/System.Web/System.Web/HttpHelper.cs69
-rw-r--r--mcs/class/System.Web/System.Web/HttpMethodNotAllowedHandler.cs45
-rw-r--r--mcs/class/System.Web/System.Web/HttpModuleCollection.cs94
-rw-r--r--mcs/class/System.Web/System.Web/HttpMultipartContentParser.cs219
-rw-r--r--mcs/class/System.Web/System.Web/HttpParseException.cs109
-rw-r--r--mcs/class/System.Web/System.Web/HttpPostedFile.cs77
-rw-r--r--mcs/class/System.Web/System.Web/HttpRequest.cs1286
-rw-r--r--mcs/class/System.Web/System.Web/HttpRequestPriority.cs40
-rw-r--r--mcs/class/System.Web/System.Web/HttpRequestStream.cs165
-rw-r--r--mcs/class/System.Web/System.Web/HttpRequestValidationException.cs55
-rw-r--r--mcs/class/System.Web/System.Web/HttpResponse.cs1074
-rw-r--r--mcs/class/System.Web/System.Web/HttpResponseHeader.cs73
-rw-r--r--mcs/class/System.Web/System.Web/HttpResponseStream.cs108
-rw-r--r--mcs/class/System.Web/System.Web/HttpResponseStreamProxy.cs67
-rw-r--r--mcs/class/System.Web/System.Web/HttpRuntime.cs594
-rw-r--r--mcs/class/System.Web/System.Web/HttpServerUtility.cs411
-rw-r--r--mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs195
-rw-r--r--mcs/class/System.Web/System.Web/HttpUnhandledException.cs48
-rw-r--r--mcs/class/System.Web/System.Web/HttpUtility.cs849
-rw-r--r--mcs/class/System.Web/System.Web/HttpValidationStatus.cs38
-rw-r--r--mcs/class/System.Web/System.Web/HttpValueCollection.cs220
-rw-r--r--mcs/class/System.Web/System.Web/HttpWorkerRequest.cs556
-rw-r--r--mcs/class/System.Web/System.Web/HttpWriter.cs233
-rw-r--r--mcs/class/System.Web/System.Web/IHttpAsyncHandler.cs39
-rw-r--r--mcs/class/System.Web/System.Web/IHttpHandler.cs37
-rw-r--r--mcs/class/System.Web/System.Web/IHttpHandlerFactory.cs40
-rw-r--r--mcs/class/System.Web/System.Web/IHttpMapPath.cs40
-rw-r--r--mcs/class/System.Web/System.Web/IHttpModule.cs35
-rw-r--r--mcs/class/System.Web/System.Web/MimeTypes.cs493
-rw-r--r--mcs/class/System.Web/System.Web/NoParamsInvoker.cs57
-rw-r--r--mcs/class/System.Web/System.Web/ParserError.cs69
-rw-r--r--mcs/class/System.Web/System.Web/ParserErrorCollection.cs97
-rw-r--r--mcs/class/System.Web/System.Web/ProcessInfo.cs111
-rw-r--r--mcs/class/System.Web/System.Web/ProcessModelInfo.cs71
-rw-r--r--mcs/class/System.Web/System.Web/ProcessShutdownReason.cs44
-rw-r--r--mcs/class/System.Web/System.Web/ProcessStatus.cs38
-rw-r--r--mcs/class/System.Web/System.Web/QueueManager.cs125
-rw-r--r--mcs/class/System.Web/System.Web/ReusableMemoryStream.cs277
-rwxr-xr-xmcs/class/System.Web/System.Web/ServerVariablesCollection.cs238
-rw-r--r--mcs/class/System.Web/System.Web/SiteMap.cs87
-rw-r--r--mcs/class/System.Web/System.Web/SiteMapNode.cs352
-rw-r--r--mcs/class/System.Web/System.Web/SiteMapNodeCollection.cs148
-rw-r--r--mcs/class/System.Web/System.Web/SiteMapProvider.cs254
-rw-r--r--mcs/class/System.Web/System.Web/SiteMapProviderCollection.cs66
-rw-r--r--mcs/class/System.Web/System.Web/SiteMapResolveEventArgs.cs60
-rw-r--r--mcs/class/System.Web/System.Web/StaticFileHandler.cs83
-rw-r--r--mcs/class/System.Web/System.Web/TODOAttribute.cs58
-rw-r--r--mcs/class/System.Web/System.Web/TimeoutManager.cs127
-rw-r--r--mcs/class/System.Web/System.Web/TraceContext.cs167
-rw-r--r--mcs/class/System.Web/System.Web/TraceData.cs458
-rw-r--r--mcs/class/System.Web/System.Web/TraceManager.cs124
-rw-r--r--mcs/class/System.Web/System.Web/TraceMode.cs37
-rw-r--r--mcs/class/System.Web/System.Web/WebCategoryAttribute.cs51
-rw-r--r--mcs/class/System.Web/System.Web/WebSysDescriptionAttribute.cs58
-rw-r--r--mcs/class/System.Web/System.Web/XmlSiteMapProvider.cs178
-rw-r--r--mcs/class/System.Web/System.Web_test.dll.sources5
-rw-r--r--mcs/class/System.Web/Test/DataBinderTests.cs206
-rw-r--r--mcs/class/System.Web/Test/Makefile9
-rw-r--r--mcs/class/System.Web/Test/System.Web.Caching/CacheStress.cs109
-rw-r--r--mcs/class/System.Web/Test/System.Web.Caching/Makefile8
-rw-r--r--mcs/class/System.Web/Test/System.Web.Caching/README10
-rw-r--r--mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog4
-rw-r--r--mcs/class/System.Web/Test/System.Web.UI.WebControls/TestControlIDConverter.cs85
-rw-r--r--mcs/class/System.Web/Test/System.Web.UI/ChangeLog3
-rw-r--r--mcs/class/System.Web/Test/System.Web.UI/TestUrlPropertyAttribute.cs115
-rw-r--r--mcs/class/System.Web/Test/System.Web/ChangeLog13
-rw-r--r--mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs91
-rw-r--r--mcs/class/System.Web/Test/System.Web/HttpServerUtilityTest.cs85
-rw-r--r--mcs/class/System.Web/Test/System.Web/HttpUtilityTest.cs72
-rw-r--r--mcs/class/System.Web/Test/TestMonoWeb/AsyncHandler.cs103
-rw-r--r--mcs/class/System.Web/Test/TestMonoWeb/AsyncModule.cs36
-rw-r--r--mcs/class/System.Web/Test/TestMonoWeb/AsyncOperation.cs42
-rw-r--r--mcs/class/System.Web/Test/TestMonoWeb/Makefile38
-rw-r--r--mcs/class/System.Web/Test/TestMonoWeb/README5
-rw-r--r--mcs/class/System.Web/Test/TestMonoWeb/SyncHandler.cs16
-rw-r--r--mcs/class/System.Web/Test/TestMonoWeb/SyncModule.cs37
-rw-r--r--mcs/class/System.Web/Test/TestMonoWeb/Test1.cs46
-rw-r--r--mcs/class/System.Web/Test/test.aspx29
-rw-r--r--mcs/class/System.Web/Test/test2.aspx101
-rw-r--r--mcs/class/System.Web/Test/test3.aspx23
-rw-r--r--mcs/class/System.Web/Test/test4.aspx119
-rw-r--r--mcs/class/System.Web/Test/test5.aspx121
-rw-r--r--mcs/class/System.Web/Test/test6.aspx83
-rw-r--r--mcs/class/System.Web/makefile.trace12
-rw-r--r--mcs/class/System.Web/resources/ChangeLog31
-rw-r--r--mcs/class/System.Web/resources/TreeView_dash.gifbin0 -> 69 bytes
-rw-r--r--mcs/class/System.Web/resources/TreeView_dashminus.gifbin0 -> 344 bytes
-rw-r--r--mcs/class/System.Web/resources/TreeView_dashplus.gifbin0 -> 342 bytes
-rw-r--r--mcs/class/System.Web/resources/TreeView_i.gifbin0 -> 82 bytes
-rw-r--r--mcs/class/System.Web/resources/TreeView_l.gifbin0 -> 79 bytes
-rw-r--r--mcs/class/System.Web/resources/TreeView_lminus.gifbin0 -> 352 bytes
-rw-r--r--mcs/class/System.Web/resources/TreeView_lplus.gifbin0 -> 350 bytes
-rw-r--r--mcs/class/System.Web/resources/TreeView_minus.gifbin0 -> 337 bytes
-rwxr-xr-xmcs/class/System.Web/resources/TreeView_noexpand.gifbin0 -> 58 bytes
-rw-r--r--mcs/class/System.Web/resources/TreeView_plus.gifbin0 -> 339 bytes
-rw-r--r--mcs/class/System.Web/resources/TreeView_r.gifbin0 -> 72 bytes
-rw-r--r--mcs/class/System.Web/resources/TreeView_rminus.gifbin0 -> 352 bytes
-rw-r--r--mcs/class/System.Web/resources/TreeView_rplus.gifbin0 -> 350 bytes
-rw-r--r--mcs/class/System.Web/resources/TreeView_t.gifbin0 -> 85 bytes
-rw-r--r--mcs/class/System.Web/resources/TreeView_tminus.gifbin0 -> 357 bytes
-rw-r--r--mcs/class/System.Web/resources/TreeView_tplus.gifbin0 -> 355 bytes
-rw-r--r--mcs/class/System.Web/resources/arrow_down.gifbin0 -> 60 bytes
-rw-r--r--mcs/class/System.Web/resources/arrow_minus.gifbin0 -> 60 bytes
-rw-r--r--mcs/class/System.Web/resources/arrow_noexpand.gifbin0 -> 65 bytes
-rw-r--r--mcs/class/System.Web/resources/arrow_plus.gifbin0 -> 65 bytes
-rw-r--r--mcs/class/System.Web/resources/arrow_up.gifbin0 -> 61 bytes
-rw-r--r--mcs/class/System.Web/resources/box_empty.gifbin0 -> 90 bytes
-rw-r--r--mcs/class/System.Web/resources/box_full.gifbin0 -> 86 bytes
-rw-r--r--mcs/class/System.Web/resources/box_minus.gifbin0 -> 294 bytes
-rw-r--r--mcs/class/System.Web/resources/box_noexpand.gifbin0 -> 294 bytes
-rw-r--r--mcs/class/System.Web/resources/box_plus.gifbin0 -> 298 bytes
-rw-r--r--mcs/class/System.Web/resources/callback.js60
-rw-r--r--mcs/class/System.Web/resources/contact.gifbin0 -> 1008 bytes
-rw-r--r--mcs/class/System.Web/resources/dot_empty.gifbin0 -> 89 bytes
-rw-r--r--mcs/class/System.Web/resources/dot_full.gifbin0 -> 87 bytes
-rw-r--r--mcs/class/System.Web/resources/dots.gifbin0 -> 96 bytes
-rw-r--r--mcs/class/System.Web/resources/inbox.gifbin0 -> 393 bytes
-rw-r--r--mcs/class/System.Web/resources/star_empty.gifbin0 -> 92 bytes
-rw-r--r--mcs/class/System.Web/resources/star_full.gifbin0 -> 92 bytes
-rw-r--r--mcs/class/System.Web/resources/warning.gifbin0 -> 1106 bytes
-rw-r--r--mcs/class/System.Web/resources/webform.js13
1005 files changed, 133420 insertions, 0 deletions
diff --git a/mcs/class/System.Web/.cvsignore b/mcs/class/System.Web/.cvsignore
new file mode 100644
index 00000000000..a8e56dbfbd2
--- /dev/null
+++ b/mcs/class/System.Web/.cvsignore
@@ -0,0 +1,7 @@
+*.dll
+.makefrag
+.response
+Temp.build
+lib
+library-deps.stamp
+semantic.cache
diff --git a/mcs/class/System.Web/Assembly/AssemblyInfo.cs b/mcs/class/System.Web/Assembly/AssemblyInfo.cs
new file mode 100644
index 00000000000..c622206af5f
--- /dev/null
+++ b/mcs/class/System.Web/Assembly/AssemblyInfo.cs
@@ -0,0 +1,117 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Ximian, Inc. http://www.ximian.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;
+using System.Reflection;
+using System.Resources;
+using System.Security;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Web.UI;
+
+// General Information about the System.Web assembly
+
+#if (NET_1_0)
+ [assembly: AssemblyVersion("1.0.3300.0")]
+ [assembly: SatelliteContractVersion("1.0.3300.0")]
+#elif (NET_2_0)
+ [assembly: AssemblyVersion ("2.0.3600.0")]
+ [assembly: SatelliteContractVersion ("2.0.3600.0")]
+#elif (NET_1_1)
+ [assembly: AssemblyVersion("1.0.5000.0")]
+ [assembly: SatelliteContractVersion("1.0.5000.0")]
+#endif
+
+[assembly: AssemblyTitle("System.Web.dll")]
+[assembly: AssemblyDescription("System.Web.dll")]
+[assembly: AssemblyConfiguration("Development version")]
+[assembly: AssemblyCompany("MONO development team")]
+[assembly: AssemblyProduct("MONO CLI")]
+[assembly: AssemblyCopyright("(c) 2003 Various Authors")]
+[assembly: AssemblyTrademark("")]
+
+[assembly: CLSCompliant(true)]
+[assembly: ComVisible(false)]
+[assembly: AssemblyDefaultAlias("System.Web.dll")]
+[assembly: AssemblyInformationalVersion("0.0.0.1")]
+[assembly: NeutralResourcesLanguage("en-US")]
+
+[assembly: AllowPartiallyTrustedCallers()]
+[assembly: TagPrefix("System.Web.UI.WebControls", "asp")]
+
+[assembly: AssemblyDelaySign(true)]
+[assembly: AssemblyKeyFile("../msfinal.pub")]
+
+// Resources
+
+#if NET_2_0
+
+[assembly: WebResource ("TreeView_noexpand.gif", "image/gif")]
+[assembly: WebResource ("TreeView_dash.gif", "image/gif")]
+[assembly: WebResource ("TreeView_dashminus.gif", "image/gif")]
+[assembly: WebResource ("TreeView_dashplus.gif", "image/gif")]
+[assembly: WebResource ("TreeView_i.gif", "image/gif")]
+[assembly: WebResource ("TreeView_l.gif", "image/gif")]
+[assembly: WebResource ("TreeView_lminus.gif", "image/gif")]
+[assembly: WebResource ("TreeView_lplus.gif", "image/gif")]
+[assembly: WebResource ("TreeView_minus.gif", "image/gif")]
+[assembly: WebResource ("TreeView_plus.gif", "image/gif")]
+[assembly: WebResource ("TreeView_r.gif", "image/gif")]
+[assembly: WebResource ("TreeView_rminus.gif", "image/gif")]
+[assembly: WebResource ("TreeView_rplus.gif", "image/gif")]
+[assembly: WebResource ("TreeView_t.gif", "image/gif")]
+[assembly: WebResource ("TreeView_tminus.gif", "image/gif")]
+[assembly: WebResource ("TreeView_tplus.gif", "image/gif")]
+[assembly: WebResource ("arrow_minus.gif", "image/gif")]
+[assembly: WebResource ("arrow_noexpand.gif", "image/gif")]
+[assembly: WebResource ("arrow_plus.gif", "image/gif")]
+[assembly: WebResource ("box_full.gif", "image/gif")]
+[assembly: WebResource ("box_empty.gif", "image/gif")]
+[assembly: WebResource ("box_minus.gif", "image/gif")]
+[assembly: WebResource ("box_noexpand.gif", "image/gif")]
+[assembly: WebResource ("box_plus.gif", "image/gif")]
+[assembly: WebResource ("contact.gif", "image/gif")]
+[assembly: WebResource ("dot_empty.gif", "image/gif")]
+[assembly: WebResource ("dot_full.gif", "image/gif")]
+[assembly: WebResource ("dots.gif", "image/gif")]
+[assembly: WebResource ("inbox.gif", "image/gif")]
+[assembly: WebResource ("star_empty.gif", "image/gif")]
+[assembly: WebResource ("star_full.gif", "image/gif")]
+[assembly: WebResource ("warning.gif", "image/gif")]
+[assembly: WebResource ("arrow_up.gif", "image/gif")]
+[assembly: WebResource ("arrow_down.gif", "image/gif")]
+
+[assembly: WebResource ("TreeView.js", "text/javascript")]
+[assembly: WebResource ("Menu.js", "text/javascript")]
+[assembly: WebResource ("GridView.js", "text/javascript")]
+[assembly: WebResource ("callback.js", "text/javascript")]
+[assembly: WebResource ("webform.js", "text/javascript")]
+
+#endif
diff --git a/mcs/class/System.Web/Assembly/ChangeLog b/mcs/class/System.Web/Assembly/ChangeLog
new file mode 100644
index 00000000000..c65c9306344
--- /dev/null
+++ b/mcs/class/System.Web/Assembly/ChangeLog
@@ -0,0 +1,53 @@
+2005-03-11 Lluis Sanchez Gual <lluis@novell.com>
+
+ * AssemblyInfo.cs: Registered GridView.js script.
+
+2005-02-05 Lluis Sanchez Gual <lluis@novell.com>
+
+ * AssemblyInfo.cs: Registered webform.js script.
+
+2005-01-10 Lluis Sanchez Gual <lluis@novell.com>
+
+ * AssemblyInfo.cs: More resources.
+
+2004-12-10 Lluis Sanchez Gual <lluis@novell.com>
+
+ * AssemblyInfo.cs: Added resource attribute for menu script.
+
+2004-12-02 Lluis Sanchez Gual <lluis@novell.com>
+
+ * AssemblyInfo.cs: Added more resource attributes.
+
+2004-11-26 Lluis Sanchez Gual <lluis@novell.com>
+
+ * AssemblyInfo.cs: Added more resource attributes.
+
+2004-11-23 Lluis Sanchez Gual <lluis@novell.com>
+
+ * AssemblyInfo.cs: Added missing ifdef NET_2_0.
+
+2004-11-23 Lluis Sanchez Gual <lluis@novell.com>
+
+ * AssemblyInfo.cs: Added resource attributes.
+
+2003-11-13 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * AssemblyInfo.cs: Added attribute
+
+2003-08-01 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * Consts.cs: Added entry
+
+2003-07-30 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * AssemblyInfo.cs: Removed attribute
+
+2003-07-30 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * Locale.cs: Added
+
+2003-07-17 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * AssemblyInfo.cs: Added
+ * ChangeLog: Added
+ * Consts.cs: Added
diff --git a/mcs/class/System.Web/Assembly/Consts.cs b/mcs/class/System.Web/Assembly/Consts.cs
new file mode 100644
index 00000000000..5bae0f4da45
--- /dev/null
+++ b/mcs/class/System.Web/Assembly/Consts.cs
@@ -0,0 +1,73 @@
+//
+// Consts.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Andreas Nahr
+//
+// NOTE:
+// Ensure that every constant is defined for every version symbol!
+//
+
+//
+// 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.
+//
+
+// This class contains constants that are dependent on the defined symbols
+// Use it to shorten and make code more maintainable in situations like:
+//
+//#if (NET_1_0)
+// [Designer ("System.Diagnostics.Design.ProcessDesigner, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (IDesigner))]
+//#endif
+//#if (NET_1_1)
+// [Designer ("System.Diagnostics.Design.ProcessDesigner, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (IDesigner))]
+//#endif
+//
+// by changing them into:
+//
+// [Designer ("System.Diagnostics.Design.ProcessDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+//
+
+internal sealed class Consts
+{
+
+ private Consts ()
+ {
+ }
+
+#if (NET_1_0)
+
+ public const string AssemblySystem_Design = "System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+ public const string AssemblySystem_Drawing_Design = "System.Drawing.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+ public const string AssemblyMicrosoft_VSDesigner = "Microsoft.VSDesigner, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+
+//#elif (NET_1_1)
+#else
+ // NET_1_1 is seen as default if somebody 'forgets' to specify any of the symbols
+ // to ensure we are not breaking the build in this case
+
+ public const string AssemblySystem_Design = "System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+ public const string AssemblySystem_Drawing_Design = "System.Drawing.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+ public const string AssemblyMicrosoft_VSDesigner = "Microsoft.VSDesigner, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+
+#endif
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/Assembly/Locale.cs b/mcs/class/System.Web/Assembly/Locale.cs
new file mode 100644
index 00000000000..92fbf2abe01
--- /dev/null
+++ b/mcs/class/System.Web/Assembly/Locale.cs
@@ -0,0 +1,45 @@
+//
+// Locale.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2001 - 2003 Ximian, Inc (http://www.ximian.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.
+//
+
+internal sealed class Locale {
+
+ private Locale ()
+ {
+ }
+
+ /// <summary>
+ /// Returns the translated message for the current locale
+ /// </summary>
+ public static string GetText (string msg)
+ {
+ return msg;
+ }
+}
diff --git a/mcs/class/System.Web/ChangeLog b/mcs/class/System.Web/ChangeLog
new file mode 100644
index 00000000000..5c267017377
--- /dev/null
+++ b/mcs/class/System.Web/ChangeLog
@@ -0,0 +1,700 @@
+2005-04-22 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added new files:
+ System.Web.UI.WebControls/HyperLinkField.cs
+
+2005-04-21 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added new files:
+ System.Web.UI.WebControls/FormView.cs
+ System.Web.UI.WebControls/FormViewRow.cs
+ System.Web.UI/IEditableTextControl.cs
+
+2005-04-15 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added new files:
+ System.Web.UI/CompiledBindableTemplateBuilder.cs
+
+2005-04-08 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added new files:
+ System.Web.UI.WebControls/DetailsView.cs
+ System.Web.UI.WebControls/DetailsViewRow.cs
+ System.Web.UI.WebControls/DetailsViewRowCollection.cs
+
+2005-04-07 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added new files:
+ System.Web.UI.WebControls/ObjectDataSourceFilteringEventArgs.cs
+ System.Web.UI.WebControls/ObjectDataSourceFilteringEventHandler.cs
+
+2005-04-01 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added new files:
+ System.Web.UI.WebControls/ButtonField.cs
+ System.Web.UI.WebControls/CheckBoxField.cs
+ System.Web.UI.WebControls/DataControlFieldHeaderCell.cs
+ System.Web.UI.WebControls/HiddenField.cs
+ System.Web.UI.WebControls/ImageField.cs
+ System.Web.UI.WebControls/ObjectDataSource.cs
+ System.Web.UI.WebControls/ObjectDataSourceView.cs
+ System.Web.UI.WebControls/TemplateField.cs
+
+2005-03-23 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added new files:
+ System.Web.UI.WebControls/AutoGeneratedField.cs
+ System.Web.UI.WebControls/AutoGeneratedFieldProperties.cs
+
+2005-03-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.dll.sources: added new files in System.Web.Configuration.
+
+2005-03-11 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Makefile: Added new resource file: GridView.js.
+ * System.Web.dll.sources: Added more files to the build:
+ System.Web.UI.WebControls/ButtonFieldBase.cs
+ System.Web.UI.WebControls/CommandField.cs
+ System.Web.UI.WebControls/DataControlButton.cs
+
+2005-03-04 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added more files to the build:
+ System.Web.UI.WebControls/ChildTable.cs
+ System.Web.UI.WebControls/DataKey.cs
+ System.Web.UI.WebControls/DataKeyArray.cs
+ System.Web.UI.WebControls/GridViewCommandEventArgs.cs
+ System.Web.UI.WebControls/GridViewCommandEventHandler.cs
+ System.Web.UI.WebControls/GridViewRowEventArgs.cs
+ System.Web.UI.WebControls/GridViewRowEventHandler.cs
+ System.Web.UI.WebControls/StringArrayConverter.cs
+
+2005-02-25 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added new files:
+ System.Web.UI.WebControls/BoundField.cs
+ System.Web.UI.WebControls/CompositeDataBoundControl.cs
+ System.Web.UI.WebControls/DataControlFieldCollection.cs
+ System.Web.UI.WebControls/GridView.cs
+ System.Web.UI.WebControls/GridViewRow.cs
+ System.Web.UI.WebControls/GridViewRowCollection.cs
+ System.Web.UI.WebControls/PagerSettings.cs
+ System.Web.UI.WebControls/XmlDataSourceNodeDescriptor.cs
+ System.Web.UI.WebControls/XmlDataSourcePropertyDescriptor.cs
+
+2005-02-23 Sebastien Pouliot <sebastien@ximian.com>
+
+ * System.Web_test.dll.sources: Added new unit tests for
+ HttpRequest, HttpServerUtility and HttpUtility to test for XSS.
+
+2005-02-18 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: New file:
+ System.Web.UI.WebControls/CollectionDataSource.cs
+
+2005-02-10 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: New files:
+ System.Web.UI/ICheckBoxControl.cs
+ System.Web.UI/IStaticTextControl.cs
+ System.Web.UI/ITextControl.cs
+
+2005-02-04 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Makefile: Added resource file.
+
+2005-02-02 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added some files to the build:
+ System.Web.UI.WebControls/CompositeControl.cs
+ System.Web.UI.WebControls/ControlPropertyNameConverter.cs
+
+2005-01-28 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added new files:
+ System.Web.UI.WebControls/MultiView.cs
+ System.Web.UI.WebControls/View.cs
+ System.Web.UI.WebControls/ViewCollection.cs
+
+2005-01-21 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added new files:
+ System.Web.UI.WebControls/Content.cs
+ System.Web.UI.WebControls/ContentControlBuilder.cs
+ System.Web.UI.WebControls/ContentPlaceHolder.cs
+ System.Web.UI.WebControls/ContentPlaceHolderBuilder.cs
+ System.Web.UI/MasterPage.cs
+ System.Web.UI/MasterPageParser.cs
+
+2005-01-10 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added new files:
+ System.Web.UI.WebControls/MenuItemTemplateContainer.cs
+ System.Web.UI.WebControls/SubMenuStyle.cs
+ * Makefile: Added those files to the build.
+
+2004-12-20 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added some new files to the build.
+
+2004-12-10 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Makefile: Added Menu script.
+
+2004-12-02 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added new files:
+ System.Web.UI.WebControls/Menu.cs
+ System.Web.UI.WebControls/MenuEventArgs.cs
+ System.Web.UI.WebControls/MenuEventHandler.cs
+ System.Web.UI.WebControls/MenuItem.cs
+ System.Web.UI.WebControls/MenuItemBinding.cs
+ System.Web.UI.WebControls/MenuItemBindingCollection.cs
+ System.Web.UI.WebControls/MenuItemCollection.cs
+ System.Web.UI.WebControls/MenuItemStyle.cs
+ System.Web.UI.WebControls/MenuItemStyleCollection.cs
+
+2004-12-02 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Makefile: Added more TreeView resources.
+
+2004-11-30 Raja R Harinath <rharinath@novell.com>
+
+ * Makefile (RESOURCE_FILES): Make sure that we distribute these,
+ irrespective of the profile.
+ (OTHER_RES): New.
+
+2004-11-29 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added DataControlField.cs and
+ DataControlFieldCell.cs.
+
+2004-11-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.dll.sources: added ReusableMemoryStream.
+
+2004-11-26 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added new file:
+ System.Web.UI/ClientScriptManager
+ * Makefile: Added more resources.
+
+2004-11-25 Raja R Harinath <rharinath@novell.com>
+
+ * Makefile (RESOURCE_FILES): New. List set of resources.
+ (EXTRA_DISTFILES): New. Distribute them.
+
+2004-11-23 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Makefile: Added TreeView resources.
+ * System.Web.dll.sources: Added new files:
+ System.Web.UI.WebControls/BaseDataBoundControl.cs
+ System.Web.UI.WebControls/HierarchicalDataBoundControl.cs
+ System.Web.UI.WebControls/TreeNode.cs
+ System.Web.UI.WebControls/TreeNodeBinding.cs
+ System.Web.UI.WebControls/TreeNodeBindingCollection.cs
+ System.Web.UI.WebControls/TreeNodeCollection.cs
+ System.Web.UI.WebControls/TreeNodeEventArgs.cs
+ System.Web.UI.WebControls/TreeNodeEventHandler.cs
+ System.Web.UI.WebControls/TreeNodeStyle.cs
+ System.Web.UI.WebControls/TreeNodeStyleCollection.cs
+ System.Web.UI.WebControls/TreeView.cs
+
+2004-11-19 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new file:
+ System.Web.UI.WebControls/AccessDataSourceView.cs.
+
+2004-11-18 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added new files:
+ System.Web.Security/ActiveDirectoryMembershipProvider.cs
+ System.Web.Security/MembershipProvider.cs
+ System.Web.Security/RoleProvider.cs
+ System.Web.UI.WebControls/SiteMapDataSource.cs
+ System.Web.UI.WebControls/SiteMapHierarchicalDataSourceView.cs
+ System.Web/ParserError.cs
+ System.Web/ParserErrorCollection.cs
+ System.Web/SiteMapResolveEventArgs.cs
+
+2004-11-15 Lluis Sanchez Gual <lluis@novell.com>
+
+ * System.Web.dll.sources: Added new files:
+ System.Web.Configuration/AdapterDictionary.cs
+ System.Web.Configuration/AnonymousIdentificationSection.cs
+ System.Web.Configuration/AssemblyCollection.cs
+ System.Web.Configuration/AssemblyInfo.cs
+ System.Web.Configuration/AuthenticationSection.cs
+ System.Web.Configuration/FormsAuthenticationConfiguration.cs
+ System.Web.Configuration/InternalSection.cs
+ System.Web.Configuration/PassportAuthentication.cs
+
+2004-10-20 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new class in System.Web.UI.
+
+2004-10-12 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web_test.dll.sources: Added new test case source file.
+
+2004-10-12 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new class in System.Web.UI.
+
+2004-10-11 Sanjay Gupta <gsanjay@novell.com>
+
+ * makefile: Added flag to build System.Web_test.dll.
+
+2004-10-08 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web_test.dll.sources: Added new file.
+
+2004-10-08 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new classes in
+ System.Web.UI.WebControls.
+
+2004-09-30 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added and removed an enumeration in
+ System.Web.UI.WebControls.
+
+2004-09-29 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new classes in
+ System.Web.UI.WebControls.WebParts.
+
+2004-09-29 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new classes in
+ System.Web.UI.WebControls.WebParts.
+
+2004-09-28 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new classes in
+ System.Web.UI.WebControls.WebParts.
+
+2004-09-24 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new attribute class in System.Web.UI.
+
+2004-09-14 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new attribute classes in System.Web.UI.
+
+2004-09-07 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new class in System.Web.UI.WebControls.
+
+2004-09-03 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new interface and classes in
+ System.Web.UI namespace.
+
+2004-08-31 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new interfaces in
+ System.Web.UI.WebControls.WebParts namespace.
+
+2004-08-31 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new *EventArgs.cs and *EventHandler in
+ System.Web.UI.WebControls namespace.
+
+2004-08-31 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new delegates in System.Web.SessionState
+ and System.Web.UI.
+
+2004-08-31 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new interfaces in System.Web.SessionState
+ and System.Web.UI.
+
+2004-08-18 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new file RelatedBodyPart.cs.
+
+2004-08-05 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new interfaces to System.Web.UI.WebControls and
+ a class to System.Web.UI.
+
+2004-08-05 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new interfaces to System.Web.SessionState.
+
+2004-08-04 Sanjay Gupta <gsanjay@novell.com>
+
+ * System.Web.dll.sources: Added new enums.
+
+2004-08-02 Duncan Mak <duncan@ximian.com>
+
+ * System.Web.dll.sources: Added new enums and interfaces,
+ re-ordered alphabetically.
+
+2004-06-08 Alon Gazit <along@mainsoft.com>
+
+ * System.Web.dll.sources: added ServerVariablesCollection.
+
+2004-06-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.dll.sources: removed CSCompiler.cs
+
+2004-06-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.dll.sources: removing ServerVariablesCollection. It does
+ not compile.
+
+2004-06-07 Alon Gazit <along@mainsoft.com>
+
+ * System.Web.dll.sources: added ServerVariablesCollection.
+
+2004-05-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.dll.sources: added Html32TextWriter.
+
+2004-04-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.dll.sources: removed unused/obsolete files from
+ System.Web.Util.
+
+2004-02-09 Jackson Harper <jackson@ximian.com>
+
+ * System.Web.dll.sources: Remove System.Web.Caching.Watcher from
+ build. We are now using FileSystemWatcher.
+
+2004-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.dll.sources: added new files in S.W.Configuration.
+
+2004-01-11 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * makefile: Dependency to EnterpriseServices.dll added
+ * System.Web.dll.sources: Added 4 files in System.Util, sorted Web.Util
+ file names.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * System.Web.dll.sources: Add TraceConfig.cs and
+ TraceConfigurationHandler.cs to the build.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * System.Web.dll.sources: Add TraceData.cs and TraceManager.cs to
+ build.
+
+2003-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.dll.sources: added HttpRequestValidationException.
+
+2003-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.dll.sources: added CustomErrorsConfigHandler.cs
+
+2003-12-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.dll.sources: added CapabilitiesLoader.cs
+
+2003-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.dll.sources: added WebConfigurationSettings.
+
+2003-11-25 Jackson Harper <jackson@ximian.com>
+
+ * System.web.dll.sources: Add AltSerialization.cs to the build
+
+2003-11-24 Jackson Harper <jackson@ximian.com>
+
+ * System.web.dll.sources: Add State server classes to build.
+
+2003-11-21 Jackson Harper <jackson@ximian.com>
+
+ * System.web.dll.sources: Add CachedVaryBy.cs to the build
+
+2003-11-21 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * System.Web.dll.sources: added XmlBuilder.cs
+
+2003-11-20 Jackson Harper <jackson@ximian.com>
+
+ * System.web.dll.sources: add OutputCacheModule.cs and
+ CachedRawResponse.cs to the build.
+
+2003-11-19 Todd Berman <tberman@gentoo.org>
+
+ * System.Web.dll.sources: Add KeyedList.cs and KeyedListEnumerator.cs
+
+2003-11-18 Todd Berman <tberman@gentoo.org>
+
+ * System.Web.dll.sources: Add ParameterCollection.cs
+
+2003-11-13 Jackson Harper <jackson@ximian.com>
+
+ * System.web.dll.sources: Add System.Web.Util.TimeUtil.cs to the
+ build
+
+2003-11-06 Jackson Harper <jackson@ximian.com>
+
+ * System.web.dll.sources: Add SessionId.cs to build
+
+2003-11-03 Jackson Harper <jackson@ximian.com>
+
+ * System.Web.dll.sources: Add SessionSQLServerHandler.cs
+ * makefile: Reference System.Data.dll
+
+2003-10-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.dll.sources: added WebControlsSectionHandler.cs
+
+2003-07-30 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * System.Web.dll.sources: added Locale.cs
+
+2003-07-30 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * System.Web.dll.sources: added new files to System.Web.SessionState and System.Web.UI
+
+2003-07-25 Ravi Pratap <ravi@ximian.com>
+
+ * everywhere: Remove uses of direct invocation of the 'Invoke'
+ method on a delegate type - that is error cs1533 now flagged by
+ mcs.
+
+2003-07-17 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * System.Web.dll.sources:
+ * list: HtmlControlPersistableAttribute.cs, IgnoreUnknownContentAttribute.cs added
+
+2003-07-17 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * System.Web.dll.sources:
+ * list: System.Web.UI/IUserControlDesignerAccessor.cs added
+
+2003-07-17 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * System.Web.dll.sources:
+ * list: AssemblyInfo.cs added, Consts.cs added
+
+2003-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: sorted, added a couple of missing files and 3 new ones.
+
+2003-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added CollectionBuilder and TemplateBuilder.
+
+2003-04-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added Watcher.cs
+
+2003-03-31 Stefan Grling <stefan@gorling.se>
+
+ * list: added new files to System.Web.SessionState
+
+2003-03-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added SessionConfig.cs and SessionStateSectionHandler.cs
+
+2003-02-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added AuthorizationConfig and AuthorizationConfigHandler.
+
+2003-02-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added a couple of new files.
+
+2002-11-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added new file.
+
+2002-11-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added/removed files.
+
+2002-11-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * makefile.gnu: s/MONO_PATH_PREFIX/MONO_PATH/
+
+2002-10-28 Duncan Mak <duncan@ximian.com>
+
+ * list: added DataGridLinkButton.cs.
+
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added WebEncoding.cs
+
+2002-10-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * makefile.trace: used to build System.Web.dll with trace enabled.
+ * System.Web.build: added trace and clean targets.
+
+2002-10-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.build: added options (commented out) to activate tracing.
+
+2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added new file in System.Web.Handlers.
+
+2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added new files in System.Web.Configuration.
+
+2002-09-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added new files in System.Web.
+
+2002-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added PageHandlerFactory.
+
+2002-09-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added 2 new files (DataGrid*Internal.cs).
+
+2002-09-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added new files.
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added new files in System.Web.Security
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added HorizontalAlignConverter and VerticalAlignConverter.
+
+2002-08-05 Patrik Torstensson <ptorsten@hotmail.com>
+ * list:
+ Add System.Web/ApplicationFactory.cs
+ Add System.Web/HttpAsyncResult.cs
+ Add System.Web.Configuration/GlobalizationConfiguration.cs
+ Add System.Web.Configuration/HandlerFactoryConfiguration.cs
+ Add System.Web.Configuration/HandlerFactoryProxy.cs
+ Add System.Web.Configuration/HandlerItem.cs
+ Add System.Web.Configuration/ModuleItem.cs
+ Add System.Web.Configuration/ModulesConfiguration.cs
+
+2002-07-24 Tim Coleman <tim@timcoleman.com>
+ * list:
+ Add System.Web/ProcessInfo.cs
+ Add System.Web/HttpCompileException.cs
+ Add System.Web/HttpParseException.cs
+ Add System.Web/HttpUnhandledException.cs
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added some more files from System.Web.Hosting.
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.build: removed some more excludes.
+
+2002-07-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: updated. Currently mcs cannot compile System.Web because it
+ cannot find NameObjectCollectionBase.KeysCollection.
+
+ * System.Web.build: don't display unused event nor always default value
+ warnings by now.
+
+2002-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: updated and reformatted.
+
+2002-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.build: added /debug flag. I wanna see line numbers in
+ exceptions thrown.
+
+2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.Security:
+ * System.Web.SessionState: new directories.
+
+2002-05-17 Duncan Mak <duncan@ximian.com>
+
+ * System.Web.build: Added new arguments: "/noconfig",
+ "/r:System.Drawing.dll" and "/r:System.Xml.dll".
+
+2002-05-10 Duncan Mak <duncan@ximian.com>
+
+ * System.Web.build: Include the System.Web.UI.HtmlControls namespace.
+
+ * Page.cs:
+ * ValidatorCollection.cs: Stubs to make things compile for
+ now. Added one dummy method (RegisterClientScriptFile) that's used
+ in the existing codebase, but not in MS docs.
+
+2002-04-26 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Added directory: System.Web.Mail
+
+2002-04-10 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * System.Web -- Assembly build.
+
+ The basic runtime support is now working, we can now start working
+ on the runtime flow system (thread pool etc) and also start testing
+ the parser and control framework. (224 files are compiled)
+
+2002-03-26 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web.Security: Removed all files. Will do it later.
+ May be someone else like to do it for the time being.
+
+2002-03-17 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web -- Assembly build.
+ Another milestone reached. Compiled 195 classes successfully.
+ Build includes System.Web.UI.WebControls and all the dependencies
+ for the namespace.
+
+2002-03-05 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web.Security: Added directory.
+
+2002-03-04 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web.UI.WebContorls: Virtually complete. See
+ System.Web.UI.WebControls/ChangeLog for a comprehensensive
+ description of what's left and where. But, don't go for
+ a build at this stage. There are a few classes left in
+ System.Web namespace that need to be filled-up, though
+ I will try to fix up the current state to be able to make
+ a build.
+
+2001-12-20 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ Did first successful build of System.Web.dll that included
+ System.Web.UI.WebControls namespace. Though, not updating
+ the System.Web.build file, since with the changes that
+ followed, the build again fails :(
+
+2001-11-30 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web.WebUtils: Removed
+ * System.Web.Utils : Added --- replacement of WebUtils
+
+2001-11-08 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web.WebUtils: Added directory
+
+2001-08-22 Bob Smith <bob@thestuff.net>
+
+ * Added directory: System.Web.UI.HtmlControls
+ * Added directory: Test
+
+2001-08-17 Bob Smith <bob@thestuff.net>
+
+ * Added directory: System.Web.UI
+
+2001-08-09 Bob Smith <bob@thestuff.net>
+
+ * Added directory: System.Web
+
+2001-07-20 Patrik Torstensson (Patrik.Torstensson@labs2.com)
+
+ * Added directory: System.Web.Caching
diff --git a/mcs/class/System.Web/Makefile b/mcs/class/System.Web/Makefile
new file mode 100644
index 00000000000..8615051c181
--- /dev/null
+++ b/mcs/class/System.Web/Makefile
@@ -0,0 +1,63 @@
+thisdir = class/System.Web
+SUBDIRS = Test
+include ../../build/rules.make
+
+RESOURCE_FILES = \
+ resources/arrow_minus.gif \
+ resources/arrow_noexpand.gif \
+ resources/arrow_plus.gif \
+ resources/arrow_up.gif \
+ resources/arrow_down.gif \
+ resources/box_full.gif \
+ resources/box_empty.gif \
+ resources/box_minus.gif \
+ resources/box_noexpand.gif \
+ resources/box_plus.gif \
+ resources/contact.gif \
+ resources/dot_empty.gif \
+ resources/dot_full.gif \
+ resources/dots.gif \
+ resources/inbox.gif \
+ resources/star_empty.gif \
+ resources/star_full.gif \
+ resources/warning.gif \
+ resources/TreeView_noexpand.gif \
+ resources/TreeView_dash.gif \
+ resources/TreeView_dashminus.gif \
+ resources/TreeView_dashplus.gif \
+ resources/TreeView_i.gif \
+ resources/TreeView_l.gif \
+ resources/TreeView_lminus.gif \
+ resources/TreeView_lplus.gif \
+ resources/TreeView_minus.gif \
+ resources/TreeView_plus.gif \
+ resources/TreeView_r.gif \
+ resources/TreeView_rminus.gif \
+ resources/TreeView_rplus.gif \
+ resources/TreeView_t.gif \
+ resources/TreeView_tminus.gif \
+ resources/TreeView_tplus.gif \
+ resources/callback.js \
+ resources/webform.js \
+ System.Web.UI.WebControls/GridView.js \
+ System.Web.UI.WebControls/TreeView.js \
+ System.Web.UI.WebControls/Menu.js
+
+ifeq (net_2_0, $(PROFILE))
+OTHER_RES = $(RESOURCE_FILES)
+endif
+
+LIBRARY = System.Web.dll
+LIB_MCS_FLAGS = \
+ /nowarn:649 \
+ /r:$(corlib) \
+ /r:System.dll \
+ /r:System.Drawing.dll \
+ /r:System.Data.dll \
+ /r:System.Xml.dll \
+ /r:System.EnterpriseServices.dll \
+ $(OTHER_RES:%=/resource:%)
+
+EXTRA_DISTFILES = $(RESOURCE_FILES)
+
+include ../../build/library.make
diff --git a/mcs/class/System.Web/System.Web.Administration/ChangeLog b/mcs/class/System.Web/System.Web.Administration/ChangeLog
new file mode 100644
index 00000000000..547cab8e3dc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Administration/ChangeLog
@@ -0,0 +1,3 @@
+2004-08-02 Duncan Mak <duncan@ximian.com>
+
+ * WebAdminUserControl.cs (DatabaseType): Added. \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.Administration/WebAdminUserControl.cs b/mcs/class/System.Web/System.Web.Administration/WebAdminUserControl.cs
new file mode 100644
index 00000000000..90c828ed1f0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Administration/WebAdminUserControl.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.Administration.WebAdminUserControl.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+using System.Web.UI;
+
+namespace System.Web.Administration
+{
+ public class WebAdminUserControl : UserControl {
+ public enum DatabaseType
+ {
+ Access = 0,
+ Sql = 1
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Caching/Cache.cs b/mcs/class/System.Web/System.Web.Caching/Cache.cs
new file mode 100644
index 00000000000..762bfaf47aa
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/Cache.cs
@@ -0,0 +1,445 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson
+// Daniel Cazzulino [DHC] (dcazzulino@users.sf.net)
+//
+
+//
+// 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;
+using System.Collections;
+using System.Threading;
+
+namespace System.Web.Caching {
+ public sealed class Cache : IEnumerable {
+
+ public static readonly DateTime NoAbsoluteExpiration = DateTime.MaxValue;
+ public static readonly TimeSpan NoSlidingExpiration = TimeSpan.Zero;
+
+ // Helper objects
+ private CacheExpires _objExpires;
+
+ // The data storage
+ private Hashtable _arrEntries;
+ private ReaderWriterLock _lockEntries;
+ private int _nItems;
+
+ static private TimeSpan _datetimeOneYear = TimeSpan.FromDays (365);
+
+
+ public Cache () {
+ _nItems = 0;
+
+ _lockEntries = new ReaderWriterLock ();
+ _arrEntries = new Hashtable ();
+
+ _objExpires = new CacheExpires (this);
+ }
+
+ /// <summary>
+ /// Internal method to create a enumerator and over all public
+ /// items in the cache and is used by GetEnumerator method.
+ /// </summary>
+ /// <returns>
+ /// Returns IDictionaryEnumerator that contains all public items in the cache
+ /// </returns>
+ private IDictionaryEnumerator CreateEnumerator () {
+ Hashtable objTable;
+
+ //Locking with -1 provides a non-expiring lock.
+ _lockEntries.AcquireReaderLock (-1);
+ try {
+ // Create a new hashtable to return as collection of public items
+ objTable = new Hashtable (_arrEntries.Count);
+
+ foreach (DictionaryEntry objEntry in _arrEntries) {
+ if (objEntry.Key == null)
+ continue;
+
+ CacheEntry entry = (CacheEntry) objEntry.Value;
+ if (entry.IsPublic)
+ objTable.Add (objEntry.Key, entry.Item);
+ }
+ } finally {
+ _lockEntries.ReleaseReaderLock ();
+ }
+
+ return objTable.GetEnumerator ();
+ }
+
+
+ IEnumerator IEnumerable.GetEnumerator () {
+ return GetEnumerator ();
+ }
+
+ public IDictionaryEnumerator GetEnumerator () {
+ return CreateEnumerator ();
+ }
+
+ internal void Touch(string strKey) {
+ GetEntry (strKey);
+ }
+
+ /// <summary>
+ /// Adds the specified item to the Cache object with
+ /// dependencies, expiration and priority policies, and a
+ /// delegate you can use to notify your application when the
+ /// inserted item is removed from the Cache.
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ /// <param name="objDependency">
+ /// The file or cache key dependencies for the item. When any
+ /// dependency changes, the object becomes invalid and is removed
+ /// from the cache. If there are no dependencies, this paramter
+ /// contains a null reference.
+ /// </param>
+ /// <param name="absolutExpiration">
+ /// The time at which the added object expires and is removed from the cache.
+ /// </param>
+ /// <param name="slidingExpiration">
+ /// The interval between the time the added object was last
+ /// accessed and when that object expires. If this value is the
+ /// equivalent of 20 minutes, the object expires and is removed
+ /// from the cache 20 minutes after it is last accessed.
+ /// </param>
+ /// <param name="enumPriority">
+ /// The relative cost of the object, as expressed by the
+ /// CacheItemPriority enumeration. The cache uses this value when
+ /// it evicts objects; objects with a lower cost are removed from
+ /// the cache before objects with a higher cost.
+ /// </param>
+ /// <param name="eventRemoveCallback">
+ /// A delegate that, if provided, is called when an object is
+ /// removed from the cache. You can use this to notify
+ /// applications when their objects are deleted from the
+ /// cache.
+ /// </param>
+ /// <returns>The Object item added to the Cache.</returns>
+ public object Add (string strKey, object objItem, CacheDependency objDependency,
+ DateTime absolutExpiration, TimeSpan slidingExpiration,
+ CacheItemPriority enumPriority, CacheItemRemovedCallback eventRemoveCallback) {
+
+ return Add (strKey, objItem, objDependency, absolutExpiration,
+ slidingExpiration, enumPriority, eventRemoveCallback, true, false);
+ }
+
+ private object Add (string strKey,
+ object objItem,
+ CacheDependency objDependency,
+ DateTime absolutExpiration,
+ TimeSpan slidingExpiration,
+ CacheItemPriority enumPriority,
+ CacheItemRemovedCallback eventRemoveCallback,
+ bool pub,
+ bool overwrite) {
+
+ if (strKey == null)
+ throw new ArgumentNullException ("strKey");
+
+ if (objItem == null)
+ throw new ArgumentNullException ("objItem");
+
+ if (slidingExpiration > _datetimeOneYear)
+ throw new ArgumentOutOfRangeException ("slidingExpiration");
+
+ CacheEntry objEntry;
+ CacheEntry objOldEntry = null;
+
+ long longHitRange = 10000;
+
+ // todo: check decay and make up the minHit range
+
+ objEntry = new CacheEntry (this,
+ strKey,
+ objItem,
+ objDependency,
+ eventRemoveCallback,
+ absolutExpiration,
+ slidingExpiration,
+ longHitRange,
+ pub,
+ enumPriority);
+
+ _lockEntries.AcquireWriterLock (-1);
+ try {
+ _nItems++;
+ if (_arrEntries.Contains (strKey)) {
+ if (overwrite)
+ objOldEntry = _arrEntries [strKey] as CacheEntry;
+ else
+ return null;
+ }
+
+ objEntry.Hit ();
+ _arrEntries [strKey] = objEntry;
+
+ // If we have any kind of expiration add into the CacheExpires
+ // Do this under the lock so no-one can retrieve the objEntry
+ // before it is fully initialized.
+ if (objEntry.HasSlidingExpiration || objEntry.HasAbsoluteExpiration) {
+ if (objEntry.HasSlidingExpiration)
+ objEntry.Expires = DateTime.UtcNow.Ticks + objEntry.SlidingExpiration;
+
+ _objExpires.Add (objEntry);
+ }
+ } finally {
+ _lockEntries.ReleaseLock ();
+ }
+
+ if (objOldEntry != null) {
+ if (objOldEntry.HasAbsoluteExpiration || objOldEntry.HasSlidingExpiration)
+ _objExpires.Remove (objOldEntry);
+
+ objOldEntry.Close (CacheItemRemovedReason.Removed);
+ }
+
+ return objEntry.Item;
+ }
+
+ /// <summary>
+ /// Inserts an item into the Cache object with a cache key to
+ /// reference its location and using default values provided by
+ /// the CacheItemPriority enumeration.
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ public void Insert (string strKey, object objItem) {
+ Add (strKey, objItem, null, NoAbsoluteExpiration, NoSlidingExpiration,
+ CacheItemPriority.Default, null, true, true);
+ }
+
+ /// <summary>
+ /// Inserts an object into the Cache that has file or key dependencies.
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ /// <param name="objDependency">
+ /// The file or cache key dependencies for the item. When any
+ /// dependency changes, the object becomes invalid and is removed
+ /// from the cache. If there are no dependencies, this paramter
+ /// contains a null reference.
+ /// </param>
+ public void Insert (string strKey, object objItem, CacheDependency objDependency) {
+ Add (strKey, objItem, objDependency, NoAbsoluteExpiration, NoSlidingExpiration,
+ CacheItemPriority.Default, null, true, true);
+ }
+
+ /// <summary>
+ /// Inserts an object into the Cache with dependencies and expiration policies.
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ /// <param name="objDependency">
+ /// The file or cache key dependencies for the item. When any
+ /// dependency changes, the object becomes invalid and is removed
+ /// from the cache. If there are no dependencies, this paramter
+ /// contains a null reference.
+ /// </param>
+ /// <param name="absolutExpiration">
+ /// The time at which the added object expires and is removed from the cache.
+ /// </param>
+ /// <param name="slidingExpiration">The interval between the
+ /// time the added object was last accessed and when that object
+ /// expires. If this value is the equivalent of 20 minutes, the
+ /// object expires and is removed from the cache 20 minutes after
+ /// it is last accessed.
+ /// </param>
+ public void Insert (string strKey, object objItem, CacheDependency objDependency,
+ DateTime absolutExpiration, TimeSpan slidingExpiration) {
+
+ Add (strKey, objItem, objDependency, absolutExpiration, slidingExpiration,
+ CacheItemPriority.Default, null, true, true);
+ }
+
+ /// <summary>
+ /// Inserts an object into the Cache object with dependencies,
+ /// expiration and priority policies, and a delegate you can use
+ /// to notify your application when the inserted item is removed
+ /// from the Cache.
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ /// <param name="objDependency">
+ /// The file or cache key dependencies for the item. When any
+ /// dependency changes, the object becomes invalid and is removed
+ /// from the cache. If there are no dependencies, this paramter
+ /// contains a null reference.
+ /// </param>
+ /// <param name="absolutExpiration">
+ /// The time at which the added object expires and is removed from the cache.
+ /// </param>
+ /// <param name="slidingExpiration">
+ /// The interval between the time the added object was last
+ /// accessed and when that object expires. If this value is the
+ /// equivalent of 20 minutes, the object expires and is removed
+ /// from the cache 20 minutes after it is last accessed.
+ /// </param>
+ /// <param name="enumPriority">The relative cost of the object,
+ /// as expressed by the CacheItemPriority enumeration. The cache
+ /// uses this value when it evicts objects; objects with a lower
+ /// cost are removed from the cache before objects with a higher
+ /// cost.
+ /// </param>
+ /// <param name="eventRemoveCallback">A delegate that, if
+ /// provided, is called when an object is removed from the cache.
+ /// You can use this to notify applications when their objects
+ /// are deleted from the cache.
+ /// </param>
+ public void Insert (string strKey, object objItem, CacheDependency objDependency,
+ DateTime absolutExpiration, TimeSpan slidingExpiration,
+ CacheItemPriority enumPriority, CacheItemRemovedCallback eventRemoveCallback) {
+
+ Add (strKey, objItem, objDependency, absolutExpiration, slidingExpiration,
+ enumPriority, eventRemoveCallback, true, true);
+ }
+
+ // Called from other internal System.Web methods to add non-public objects into
+ // cache, like output cache etc
+ internal void InsertPrivate (string strKey, object objItem, CacheDependency objDependency,
+ DateTime absolutExpiration, TimeSpan slidingExpiration,
+ CacheItemPriority enumPriority, CacheItemRemovedCallback eventRemoveCallback) {
+
+ Add (strKey, objItem, objDependency, absolutExpiration, slidingExpiration,
+ enumPriority, eventRemoveCallback, false, true);
+ }
+
+ /// <summary>
+ /// Removes the specified item from the Cache object.
+ /// </summary>
+ /// <param name="strKey">The cache key for the cache item to remove.</param>
+ /// <returns>
+ /// The item removed from the Cache. If the value in the key
+ /// parameter is not found, returns a null reference.
+ /// </returns>
+ public object Remove (string strKey) {
+ return Remove (strKey, CacheItemRemovedReason.Removed);
+ }
+
+ /// <summary>
+ /// Internal method that updates the cache, decremenents the
+ /// number of existing items and call close on the cache entry.
+ /// This method is also used from the ExpiresBuckets class to
+ /// remove an item during GC flush.
+ /// </summary>
+ /// <param name="strKey">The cache key for the cache item to remove.</param>
+ /// <param name="enumReason">Reason why the item is removed.</param>
+ /// <returns>
+ /// The item removed from the Cache. If the value in the key
+ /// parameter is not found, returns a null reference.
+ /// </returns>
+ internal object Remove (string strKey, CacheItemRemovedReason enumReason) {
+ CacheEntry objEntry = null;
+
+ if (strKey == null)
+ throw new ArgumentNullException ("strKey");
+
+ _lockEntries.AcquireWriterLock (-1);
+ try {
+ objEntry = _arrEntries [strKey] as CacheEntry;
+ if (null == objEntry)
+ return null;
+
+ _arrEntries.Remove (strKey);
+ _nItems--;
+ }
+ finally {
+ _lockEntries.ReleaseWriterLock ();
+ }
+
+ if (objEntry.HasAbsoluteExpiration || objEntry.HasSlidingExpiration)
+ _objExpires.Remove (objEntry);
+
+ objEntry.Close (enumReason);
+ return objEntry.Item;
+ }
+
+ /// <summary>
+ /// Retrieves the specified item from the Cache object.
+ /// </summary>
+ /// <param name="strKey">The identifier for the cache item to retrieve.</param>
+ /// <returns>The retrieved cache item, or a null reference.</returns>
+ public object Get (string strKey) {
+ CacheEntry objEntry = GetEntry (strKey);
+
+ if (objEntry == null)
+ return null;
+
+ return objEntry.Item;
+ }
+
+ internal CacheEntry GetEntry (string strKey) {
+ CacheEntry objEntry = null;
+ long ticksNow = DateTime.UtcNow.Ticks;
+
+ if (strKey == null)
+ throw new ArgumentNullException ("strKey");
+
+ _lockEntries.AcquireReaderLock (-1);
+ try {
+ objEntry = _arrEntries [strKey] as CacheEntry;
+ if (null == objEntry)
+ return null;
+ }
+ finally {
+ _lockEntries.ReleaseReaderLock ();
+ }
+
+ if (objEntry.HasSlidingExpiration || objEntry.HasAbsoluteExpiration) {
+ if (objEntry.Expires < ticksNow) {
+ Remove (strKey, CacheItemRemovedReason.Expired);
+ return null;
+ }
+ }
+
+ objEntry.Hit ();
+ if (objEntry.HasSlidingExpiration) {
+ objEntry.Expires = ticksNow + objEntry.SlidingExpiration;
+ }
+
+ return objEntry;
+ }
+
+ /// <summary>
+ /// Gets the number of items stored in the cache.
+ /// </summary>
+ public int Count {
+ get { return _nItems; }
+ }
+
+ /// <summary>
+ /// Gets or sets the cache item at the specified key.
+ /// </summary>
+ public object this [string strKey] {
+ get {
+ return Get (strKey);
+ }
+
+ set {
+ Insert (strKey, value);
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Caching/CacheDefinitions.cs b/mcs/class/System.Web/System.Web.Caching/CacheDefinitions.cs
new file mode 100644
index 00000000000..fa9fadbfc3b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/CacheDefinitions.cs
@@ -0,0 +1,62 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson
+//
+
+//
+// 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.
+//
+
+namespace System.Web.Caching
+{
+ /// <summary>
+ /// Specifies the relative priority of items stored in the Cache.
+ /// </summary>
+ public enum CacheItemPriority {
+ Low = 1,
+ BelowNormal = 2,
+ Normal = 3,
+ Default = 3,
+ AboveNormal = 4,
+ High = 5,
+ NotRemovable
+ }
+
+ /// <summary>
+ /// Specifies the reason an item was removed from the Cache.
+ /// </summary>
+ public enum CacheItemRemovedReason {
+ Removed = 1,
+ Expired = 2,
+ Underused = 3,
+ DependencyChanged = 4
+ }
+
+ /// <summary>
+ /// Defines a callback method for notifying applications when a cached item is removed from the Cache.
+ /// </summary>
+ /// <param name="key">The index location for the item removed from the cache. </param>
+ /// <param name="value">The Object item removed from the cache. </param>
+ /// <param name="reason">The reason the item was removed from the cache, as specified by the CacheItemRemovedReason enumeration.</param>
+ public delegate void CacheItemRemovedCallback(string key, object value, CacheItemRemovedReason reason);
+
+}
diff --git a/mcs/class/System.Web/System.Web.Caching/CacheDependency.cs b/mcs/class/System.Web/System.Web.Caching/CacheDependency.cs
new file mode 100644
index 00000000000..718b88dd082
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/CacheDependency.cs
@@ -0,0 +1,222 @@
+//
+// System.Web.Caching.CacheDependency
+//
+// Authors:
+// Patrik Torstensson
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2003 Ximian, Inc. (http://www.ximian.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;
+using System.IO;
+using System.Web;
+
+namespace System.Web.Caching
+{
+ internal class CacheDependencyChangedArgs : EventArgs
+ {
+ string key;
+
+ public CacheDependencyChangedArgs (string key)
+ {
+ this.key = key;
+ }
+
+ public string Key {
+ get { return key; }
+ }
+ }
+
+ internal delegate void CacheDependencyChangedHandler (object sender, CacheDependencyChangedArgs args);
+
+ public sealed class CacheDependency : IDisposable
+ {
+ static string [] noStrings = new string [0];
+ static CacheDependency noDependency = new CacheDependency ();
+ bool changed;
+ bool disposed;
+ CacheEntry [] entries;
+ CacheItemRemovedCallback removedDelegate;
+ FileSystemWatcher [] watchers;
+
+ private CacheDependency ()
+ {
+ }
+
+ public CacheDependency (string filename)
+ : this (filename, DateTime.MaxValue)
+ {
+ }
+
+ public CacheDependency (string filename, DateTime start)
+ : this (new string [] {filename}, null, null, start)
+ {
+ }
+
+ public CacheDependency (string [] filenames)
+ : this (filenames, null, null, DateTime.MaxValue)
+ {
+ }
+
+ public CacheDependency (string [] filenames, DateTime start)
+ : this (filenames, null, null, start)
+ {
+ }
+
+ public CacheDependency (string [] filenames, string [] cachekeys)
+ : this (filenames, cachekeys, null, DateTime.MaxValue)
+ {
+ }
+
+ public CacheDependency (string [] filenames, string [] cachekeys, DateTime start)
+ : this (filenames, cachekeys, null, start)
+ {
+ }
+
+ public CacheDependency (string [] filenames, string [] cachekeys, CacheDependency dependency)
+ : this (filenames, cachekeys, dependency, DateTime.MaxValue)
+ {
+ }
+
+ public CacheDependency (string [] filenames,
+ string [] cachekeys,
+ CacheDependency dependency,
+ DateTime start)
+ {
+ Cache cache = HttpRuntime.Cache;
+
+ if (filenames == null)
+ filenames = noStrings;
+
+ foreach (string file in filenames) {
+ if (file == null)
+ throw new ArgumentNullException ("filenames");
+ }
+
+ if (cachekeys == null)
+ cachekeys = noStrings;
+
+ int missing_keys = 0;
+ foreach (string ck in cachekeys) {
+ if (ck == null)
+ throw new ArgumentNullException ("cachekeys");
+ if (cache.GetEntry (ck) == null)
+ missing_keys++;
+ }
+
+ if (dependency == null)
+ dependency = noDependency;
+
+
+ this.changed = dependency.changed;
+ if (changed == true)
+ return;
+
+ int nentries = cachekeys.Length + ((dependency.entries == null) ? 0 :
+ dependency.entries.Length) - missing_keys;
+
+ if (nentries != 0) {
+ this.removedDelegate = new CacheItemRemovedCallback (CacheItemRemoved);
+ this.entries = new CacheEntry [nentries];
+
+ int i = 0;
+ if (dependency.entries != null) {
+ foreach (CacheEntry entry in dependency.entries) {
+ entry._onRemoved += removedDelegate;
+ entries [i++] = entry;
+ }
+ }
+
+ for (int c=0; c<cachekeys.Length; c++) {
+ CacheEntry entry = cache.GetEntry (cachekeys [c]);
+ if (entry == null)
+ continue;
+ entry._onRemoved += removedDelegate;
+ entries [i++] = entry;
+ }
+ }
+
+ if (filenames.Length > 0) {
+ watchers = new FileSystemWatcher [filenames.Length];
+ for (int i=0; i<filenames.Length; i++)
+ watchers [i] = CreateWatcher (filenames [i]);
+ }
+ }
+
+ private FileSystemWatcher CreateWatcher (string file)
+ {
+ FileSystemWatcher watcher = new FileSystemWatcher ();
+
+ watcher.Path = Path.GetFullPath (Path.GetDirectoryName (file));
+ watcher.Filter = Path.GetFileName (file);
+
+ watcher.Changed += new FileSystemEventHandler (OnFileChanged);
+ watcher.Created += new FileSystemEventHandler (OnFileChanged);
+ watcher.Deleted += new FileSystemEventHandler (OnFileChanged);
+
+ watcher.EnableRaisingEvents = true;
+
+ return watcher;
+ }
+
+ private void OnFileChanged (object sender, FileSystemEventArgs e)
+ {
+ OnChanged (sender, e);
+ }
+
+ void CacheItemRemoved (string key, object value, CacheItemRemovedReason reason)
+ {
+ OnChanged (this, EventArgs.Empty);
+ }
+
+ void OnChanged (object sender, EventArgs args)
+ {
+ if (changed || disposed)
+ return;
+
+ changed = true;
+ if (Changed != null)
+ Changed (this, new CacheDependencyChangedArgs (null));
+ }
+
+ public void Dispose ()
+ {
+ for (int i=0; i<watchers.Length; i++)
+ watchers [i].Dispose ();
+ }
+
+ public bool HasChanged
+ {
+ get { return changed; }
+ }
+
+ internal CacheEntry [] GetCacheEntries ()
+ {
+ return entries;
+ }
+
+ internal event CacheDependencyChangedHandler Changed;
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs b/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs
new file mode 100644
index 00000000000..8cfe4c64ab0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs
@@ -0,0 +1,277 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson
+// Daniel Cazzulino (dcazzulino@users.sf.net)
+//
+
+//
+// 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;
+using System.Threading;
+
+namespace System.Web.Caching {
+ /// <summary>
+ /// Class responsible for representing a cache entry.
+ /// </summary>
+ internal class CacheEntry {
+ internal enum Flags {
+ Removed = 0,
+ Public = 1
+ }
+
+ private CacheItemPriority _enumPriority;
+
+ private long _longHits;
+
+ private byte _byteExpiresBucket;
+ private int _intExpiresIndex;
+
+ private long _ticksExpires;
+ private long _ticksSlidingExpiration;
+
+ private string _strKey;
+ private object _objItem;
+
+ private long _longMinHits;
+
+ private Flags _enumFlags;
+
+ private CacheDependency _objDependency;
+ private Cache _objCache;
+
+ internal static readonly byte NoBucketHash = byte.MaxValue;
+ internal static readonly int NoIndexInBucket = int.MaxValue;
+
+ internal event CacheItemRemovedCallback _onRemoved;
+
+ private ReaderWriterLock _lock = new ReaderWriterLock();
+
+ /// <summary>
+ /// Constructs a new cache entry
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ /// <param name="objDependency">The file or cache key dependencies for the item. When any dependency changes, the object becomes invalid and is removed from the cache. If there are no dependencies, this paramter contains a null reference.</param>
+ /// <param name="dtExpires">The time at which the added object expires and is removed from the cache. </param>
+ /// <param name="tsSpan">The interval between the time the added object was last accessed and when that object expires. If this value is the equivalent of 20 minutes, the object expires and is removed from the cache 20 minutes after it is last accessed.</param>
+ /// <param name="longMinHits">Used to detect and control if the item should be flushed due to under usage</param>
+ /// <param name="boolPublic">Defines if the item is public or not</param>
+ /// <param name="enumPriority">The relative cost of the object, as expressed by the CacheItemPriority enumeration. The cache uses this value when it evicts objects; objects with a lower cost are removed from the cache before objects with a higher cost.</param>
+ internal CacheEntry (Cache objManager, string strKey, object objItem, CacheDependency objDependency, CacheItemRemovedCallback eventRemove,
+ System.DateTime dtExpires, System.TimeSpan tsSpan, long longMinHits, bool boolPublic, CacheItemPriority enumPriority ) {
+ if (boolPublic)
+ _enumFlags |= Flags.Public;
+
+ _strKey = strKey;
+ _objItem = objItem;
+ _objCache = objManager;
+
+ _onRemoved += eventRemove;
+
+ _enumPriority = enumPriority;
+
+ _ticksExpires = dtExpires.ToUniversalTime ().Ticks;
+
+ _ticksSlidingExpiration = tsSpan.Ticks;
+
+ // If we have a sliding expiration it overrides the absolute expiration (MS behavior)
+ // This is because sliding expiration causes the absolute expiration to be
+ // moved after each period, and the absolute expiration is the value used
+ // for all expiration calculations.
+ if (tsSpan.Ticks != Cache.NoSlidingExpiration.Ticks)
+ _ticksExpires = System.DateTime.UtcNow.AddTicks(_ticksSlidingExpiration).Ticks;
+
+ _objDependency = objDependency;
+ if (_objDependency != null)
+ // Add the entry to the cache dependency handler (we support multiple entries per handler)
+ _objDependency.Changed += new CacheDependencyChangedHandler (OnChanged);
+
+ _longMinHits = longMinHits;
+ }
+
+
+ internal void OnChanged (object sender, CacheDependencyChangedArgs objDependency) {
+ _objCache.Remove (_strKey, CacheItemRemovedReason.DependencyChanged);
+ }
+
+ /// <summary>
+ /// Cleans up the cache entry, removes the cache dependency and calls the remove delegate.
+ /// </summary>
+ /// <param name="enumReason">The reason why the cache entry are going to be removed</param>
+ internal void Close(CacheItemRemovedReason enumReason) {
+ Delegate [] removedEvents = null;
+
+ _lock.AcquireWriterLock(-1);
+ try {
+ // Check if the item already is removed
+ if ((_enumFlags & Flags.Removed) != 0)
+ return;
+
+ _enumFlags |= Flags.Removed;
+
+ if (_onRemoved != null)
+ removedEvents = _onRemoved.GetInvocationList ();
+ }
+ finally {
+ _lock.ReleaseWriterLock();
+ }
+
+ if (removedEvents != null) {
+ // Call the delegate to tell that we are now removing the entry
+ if ((_enumFlags & Flags.Public) != 0) {
+ foreach (Delegate del in removedEvents) {
+ CacheItemRemovedCallback removed = (CacheItemRemovedCallback) del;
+ try {
+ removed (_strKey, _objItem, enumReason);
+ }
+ catch (System.Exception obj) {
+ HttpApplicationFactory.SignalError (obj);
+ }
+ }
+ }
+ else {
+ foreach (Delegate del in removedEvents) {
+ CacheItemRemovedCallback removed = (CacheItemRemovedCallback) del;
+ try {
+ removed (_strKey, _objItem, enumReason);
+ }
+ catch (Exception) {
+ }
+ }
+ }
+ }
+
+ _lock.AcquireWriterLock(-1);
+ try {
+ // If we have a dependency, remove the entry
+ if (_objDependency != null)
+ _objDependency.Changed -= new CacheDependencyChangedHandler (OnChanged);
+ }
+ finally {
+ _lock.ReleaseWriterLock();
+ }
+ }
+
+ internal bool HasUsage {
+ get {
+ if (_longMinHits == System.Int64.MaxValue)
+ return false;
+
+ return true;
+ }
+ }
+
+ internal bool HasAbsoluteExpiration {
+ get {
+ if (_ticksExpires == Cache.NoAbsoluteExpiration.Ticks)
+ return false;
+
+ return true;
+ }
+ }
+
+ internal bool HasSlidingExpiration {
+ get {
+ if (_ticksSlidingExpiration == Cache.NoSlidingExpiration.Ticks)
+ return false;
+
+ return true;
+ }
+ }
+
+ internal byte ExpiresBucket {
+ get {
+ return _byteExpiresBucket;
+ }
+ set {
+ _byteExpiresBucket = value;
+ }
+ }
+
+ internal int ExpiresIndex {
+ get {
+ return _intExpiresIndex;
+ }
+
+ set {
+ _intExpiresIndex = value;
+ }
+ }
+
+ internal long Expires {
+ get {
+ return _ticksExpires;
+ }
+ set {
+ _ticksExpires = value;
+ }
+ }
+
+ internal long SlidingExpiration {
+ get {
+ return _ticksSlidingExpiration;
+ }
+ }
+
+ internal object Item {
+ get {
+ return _objItem;
+ }
+ }
+
+ internal string Key {
+ get {
+ return _strKey;
+ }
+ }
+
+ internal long Hits {
+ get {
+ return _longHits;
+ }
+ }
+
+ internal long MinimumHits {
+ get {
+ return _longMinHits;
+ }
+ }
+
+ internal CacheItemPriority Priority {
+ get {
+ return _enumPriority;
+ }
+ }
+
+ internal bool IsPublic {
+ get {
+ return (_enumFlags & Flags.Public) != 0;
+ }
+ }
+
+ internal void Hit () {
+ Interlocked.Increment (ref _longHits);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs b/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs
new file mode 100644
index 00000000000..53b8afd8570
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs
@@ -0,0 +1,123 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson
+// Daniel Cazzulino (dcazzulino@users.sf.net)
+//
+
+//
+// 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;
+using System.Collections;
+using System.Threading;
+
+namespace System.Web.Caching {
+ /// <summary>
+ /// Class responsible for handling time based flushing of entries in the cache. The class creates
+ /// and manages 60 buckets each holding every item that expires that minute. The bucket calculated
+ /// for an entry is one minute more than the timeout just to make sure that the item end up in the
+ /// bucket where it should be flushed.
+ /// </summary>
+ internal class CacheExpires : IDisposable {
+ static int _intFlush;
+ /// <summary>
+ /// 1 bucket == 1 minute == 10M ticks (1 second) * 60
+ /// </summary>
+ static long _ticksPerBucket = 600000000;
+ /// <summary>
+ /// 1 cycle == 1 hour
+ /// </summary>
+ static long _ticksPerCycle = _ticksPerBucket * 60;
+
+ private ExpiresBucket[] _arrBuckets;
+ private Timer _objTimer;
+ private Cache _objManager;
+
+ private object _lockObj = new object ();
+
+ internal CacheExpires (Cache objManager) {
+ _objManager = objManager;
+ Initialize();
+ }
+
+ private void Initialize () {
+ // Create one bucket per minute
+ _arrBuckets = new ExpiresBucket [60];
+
+ byte bytePos = 0;
+ do {
+ _arrBuckets [bytePos] = new ExpiresBucket (bytePos, _objManager);
+ bytePos++;
+ } while (bytePos < 60);
+
+ // GC Bucket controller
+ _intFlush = System.DateTime.UtcNow.Minute - 1;
+ _objTimer = new System.Threading.Timer (new System.Threading.TimerCallback (GarbageCleanup), null, 10000, 60000);
+ }
+
+ /// <summary>
+ /// Adds a Cache entry to the correct flush bucket.
+ /// </summary>
+ /// <param name="objEntry">Cache entry to add.</param>
+ internal void Add (CacheEntry objEntry) {
+ long now = DateTime.UtcNow.Ticks;
+ if (objEntry.Expires < now)
+ objEntry.Expires = now;
+
+ _arrBuckets [GetHashBucket (objEntry.Expires)].Add (objEntry);
+ }
+
+ internal void Remove (CacheEntry objEntry) {
+ if (objEntry.ExpiresBucket != CacheEntry.NoBucketHash)
+ _arrBuckets [objEntry.ExpiresBucket].Remove (objEntry);
+ }
+
+ internal void GarbageCleanup (object State) {
+ int bucket;
+
+ // We lock here if FlushExpiredItems take time
+ lock (_lockObj) {
+ bucket = (++_intFlush) % 60;
+ }
+
+ // Flush expired items in the current bucket (defined by _intFlush)
+ _arrBuckets [bucket].FlushExpiredItems ();
+ }
+
+ private int GetHashBucket (long ticks) {
+ // Get bucket to add expire item into, add one minute to the bucket just to make sure that we get it in the bucket gc
+ return (int) (((((ticks + 60000) % _ticksPerCycle) / _ticksPerBucket) + 1) % 60);
+ }
+
+ /// <summary>
+ /// Called by the cache for cleanup.
+ /// </summary>
+ public void Dispose () {
+ // Cleanup the internal timer
+ if (_objTimer != null) {
+ _objTimer.Dispose();
+ _objTimer = null;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Caching/CachedRawResponse.cs b/mcs/class/System.Web/System.Web.Caching/CachedRawResponse.cs
new file mode 100644
index 00000000000..c2204648ffa
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/CachedRawResponse.cs
@@ -0,0 +1,104 @@
+//
+// System.Web.Caching.CachedRawResponse
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2003 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
+// "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;
+using System.Text;
+using System.Collections;
+
+namespace System.Web.Caching {
+
+ internal class CachedRawResponse {
+
+ private HttpCachePolicy policy;
+ private CachedVaryBy varyby;
+ private int status_code;
+ private string status_desc;
+ private int content_length;
+ private ArrayList headers;
+ private HttpResponseHeader date_header;
+ private byte[] buffer;
+
+ internal CachedRawResponse (HttpCachePolicy policy)
+ {
+ this.policy = policy;
+ this.buffer = new byte [HttpWriter.MaxBufferSize];
+ }
+
+ internal HttpCachePolicy Policy {
+ get { return policy; }
+ set { policy = value; }
+ }
+
+ internal CachedVaryBy VaryBy {
+ get { return varyby; }
+ set { varyby = value; }
+ }
+
+ internal int StatusCode {
+ get { return status_code; }
+ set { status_code = value; }
+ }
+
+ internal string StatusDescription {
+ get { return status_desc; }
+ set { status_desc = value; }
+ }
+
+ internal int ContentLength {
+ get { return content_length; }
+ set { content_length = value; }
+ }
+
+ internal ArrayList Headers {
+ get { return headers; }
+ }
+
+ internal HttpResponseHeader DateHeader {
+ get { return date_header; }
+ set { date_header = value; }
+ }
+
+ internal void SetHeaders (ArrayList headers) {
+ this.headers = headers;
+ }
+
+ internal void SetData (byte[] buffer)
+ {
+ this.buffer = buffer;
+ }
+
+ internal byte[] GetData ()
+ {
+ return buffer;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Caching/CachedVaryBy.cs b/mcs/class/System.Web/System.Web.Caching/CachedVaryBy.cs
new file mode 100644
index 00000000000..5f3d3416eac
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/CachedVaryBy.cs
@@ -0,0 +1,120 @@
+//
+// System.Web.Caching.CachedVaryBy
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2003 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
+// "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;
+using System.Text;
+using System.Collections;
+
+namespace System.Web.Caching {
+
+ internal class CachedVaryBy {
+
+ private string[] prms;
+ private string[] headers;
+ private string custom;
+ private string key;
+ private ArrayList item_list;
+ private bool wildCardParams;
+
+ internal CachedVaryBy (HttpCachePolicy policy, string key)
+ {
+ prms = policy.VaryByParams.GetParamNames ();
+ headers = policy.VaryByHeaders.GetHeaderNames ();
+ custom = policy.GetVaryByCustom ();
+ this.key = key;
+ item_list = new ArrayList ();
+ wildCardParams = policy.VaryByParams ["*"];
+ }
+
+ internal ArrayList ItemList {
+ get { return item_list; }
+ }
+
+ internal string Key {
+ get { return key; }
+ }
+
+ internal string CreateKey (string file_path, HttpContext context)
+ {
+ StringBuilder builder = new StringBuilder ();
+ HttpApplication app = context.ApplicationInstance;
+ HttpRequest request = context.Request;
+
+ builder.Append ("CachedRawResponse\n");
+ builder.Append (file_path);
+ builder.Append ('\n');
+ builder.Append ("METHOD:" + request.HttpMethod);
+ builder.Append ('\n');
+
+ if (prms != null) {
+ for (int i=0; i<prms.Length; i++) {
+ if (request.Params [prms [i]] == null)
+ continue;
+ builder.Append ("VP:");
+ builder.Append (prms [i]);
+ builder.Append ('=');
+ builder.Append (request.Params [prms [i]]);
+ builder.Append ('\n');
+ }
+ } else if (wildCardParams) {
+ foreach (string p in request.Params) {
+ builder.Append ("VP:");
+ builder.Append (p);
+ builder.Append ('=');
+ builder.Append (request.Params [p]);
+ builder.Append ('\n');
+ }
+ }
+
+ if (headers != null) {
+ for (int i=0; i<headers.Length; i++) {
+ builder.Append ("VH:");
+ builder.Append (headers [i]);
+ builder.Append ('=');
+ builder.Append (request.Headers [headers [i]]);
+ builder.Append ('\n');
+ }
+ }
+
+ if (custom != null) {
+ string s = app.GetVaryByCustomString (context, custom);
+ builder.Append ("VC:");
+ builder.Append (custom);
+ builder.Append ('=');
+ builder.Append (s != null ? s : "__null__");
+ builder.Append ('\n');
+ }
+
+ return builder.ToString ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Caching/ChangeLog b/mcs/class/System.Web/System.Web.Caching/ChangeLog
new file mode 100644
index 00000000000..7978a3cb29b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/ChangeLog
@@ -0,0 +1,237 @@
+2005-04-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ExpiresBuckets.cs:
+ * Cache.cs:
+ * CacheExpires.cs: fix NullReferenceException thrown sometimes when
+ using sliding expiration and under high load. Patch by Eyal Alayuf from
+ Mainsoft.
+
+2005-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CacheDependency.cs: remove warnings.
+
+2005-04-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CachedVaryBy.cs: fixed VaryByParam and wildcard (*). Patch by Ilya
+ Kharmatsky (Mainsoft) that fixes bug #73981.
+
+2005-04-01 Lluis Sanchez Gual <lluis@novell.com>
+
+ * CachedRawResponse.cs: Fix warning.
+
+2004-11-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CacheEntry.cs: convert the external DateTime to GMT, as everything
+ else uses that timezone. Fixes bug #69194.
+
+2004-10-03 Ben Maurer <bmaurer@ximian.com>
+
+ * Cache.cs, CacheEntry.cs, CacheExpires.cs, ExpiresBuckets.cs:
+ use UtcNow rather than Now.
+
+2004-05-27 Patrik Torstensson <totte@hiddenpeaks.com>
+
+ * ExpiresBucket.cs (FlushExpiredItems): fix csc and a typo bug
+
+2004-05-27 Patrik Torstensson <totte@hiddenpeaks.com>
+
+ * CacheEntry.cs,CacheExpires.cs,ExpiresBucket.cs,
+ Cache.cs : Fixed deadlock issues, fixed
+ items not correctly being flushed, fixed update
+ of item when expiration has been updated more
+ than 1 min (placed in wrong bucket),
+ fixed deadlock during cache callback when item
+ is removed due to expiriation.
+
+ Rewrite of locking handling in Cache class, leading
+ to better performance and less bugs.
+
+ This rewrite is due to a number of bugs found
+ in the output caching during load (leading to memory
+ leaks and deadlocks)
+
+2004-05-16 Patrik Torstensson <totte@hiddenpeaks.com>
+
+ * ExpiresBucket.cs: Style changes plus;
+ (Update): Fixed possible lock bug (bug 54531)
+ (Expand): remove lock optimization due to it can cause newly
+ added items to be lost.
+ (Remove): fixed possible lock bug.
+
+2004-04-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Cache.cs: fix from Jan Jaros for NullRef (bug #56996).
+
+2004-04-07 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * Cache.cs, CacheEntry.cs, ExpiresBuckets.cs: The value to use to
+ specify infinite timeout in ReaderWriterLock is -1, not 0.
+
+2004-03-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Watcher.cs: Removed file. Jackson made it obsolete and already
+ removed it from the .sources file.
+
+2004-02-09 Jackson Harper <jackson@ximian.com>
+
+ * ExpiresBucket.cs: Remove duplicate code. Fixes bug #54031.
+
+2004-02-09 Jackson Harper <jackson@ximian.com>
+
+ * Cache.cs: Close entries that are removed.
+ * CacheDependency.cs: Use FileSystemWatcher instead of custom
+ Watcher for file dependencies.
+ * OutputCacheModule.cs: Make the varyby objects dependent on the
+ cached page.
+
+2004-02-05 Jackson Harper <jackson@ximian.com>
+
+ * CacheDependency.cs: Handle cache keys that have not been added
+ to the cache yet.
+
+2004-02-02 Jackson Harper <jackson@ximian.com>
+
+ * OutputCacheModule.cs: We can use file dependancies now.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * Cache.cs: Return null when items are expired but have not been
+ removed yet.
+ * OutputCacheModule.cs: Handle sliding expirations. Remove hacks
+ checking if the item is expired, the cache no longer returns
+ expired items.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * Cache.cs: When using sliding expiration update the cache objects
+ expires time as well as the expires entry expire time because the
+ objects expire time is checked when objects are pulled out. This
+ fixex bug #52778.
+
+2004-01-11 Jackson Harper <jackson@ximian.com>
+
+ * OutputCacheModule.cs: Remove varyby objects when there are no
+ more raw responses that belong to them.
+ * CachedRawResponse.cs: Keep a reference to the VaryBy object that
+ this response belongs to this is so the varyby can be cleaned up.
+ * CachedVaryBy.cs: Keep a reference to the keys that belong to the
+ varyby and a reference to the varyby's key.
+
+2004-01-04 Jackson Harper <jackson@ximian.com>
+
+ * OutputCacheModule.cs: Dont cache items when trace is enabled.
+
+2004-01-04 Jackson Harper <jackson@ximian.com>
+
+ * OutputCacheModule.cs: Update the date header value.
+ * CachedRawResponse.cs: Expose a ref to the date header, so it can
+ be easily set/updated. Remove unused methods and vars.
+
+2004-01-04 Jackson Harper <jackson@ximian.com>
+
+ * CacheDependency.cs: Copy all the entries into the entries array,
+ set on removed callback for items that we are dependent on.
+ * Cache.cs: Add method to get CacheEntry objects.
+ * OutputCacheModule.cs: Make raw repsonse entries dependent on
+ their varyby param entries.
+
+2004-01-04 Jackson Harper <jackson@ximian.com>
+
+ * OutputCacheModule.cs: VaryBy keys now need the HttpContext not just the request.
+ * CachedVaryBy.cs: Handle vary by headers, and vary by custom.
+
+2004-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ExpiresBuckets.cs: set _intPos when expanding the array. Fixes bug
+ 52541. Patch by Jan Jaros (mono-bug@jerryweb.info).
+
+2003-11-21 Jackson Harper <jackson@ximian.com>
+
+ * OutputCacheModule.cs: Only cache a page if it has a 200 status
+ code. Fix tabbing.
+ * CachedVaryBy.cs: Give raw response keys a name, use the
+ httpmethod in the key, and delimit items with \n so it is easier
+ to read when debugging.
+
+2003-11-21 Jackson Harper <jackson@ximian.com>
+
+ * OutputCacheModule.cs: Store a CachedVaryBy object for each
+ cached page. Then store a CachedRawResponse for each combination
+ of varried parameters for a page.
+ * CachedRawResponse.cs: Do not need to store param values anymore
+ those are stored in the CachedVaryBy now. Get the content length
+ so we dont send back the entire buffer.
+ * CachedVaryBy.cs: New file - holds the varyby data for a page,
+ and a method to generate a key based on params. Right now this
+ only works with VaryByParams. TODO: support VaryByHeaders and
+ VaryByCustom.
+
+2003-11-20 Jackson Harper <jackson@ximian.com>
+
+ * Cache.cs: New method so non public cache items can be added.
+ * CachedRawResponse.cs: New file - A snapshot of a response that
+ is stored in the cache and can be used to create a new response.
+ * OutputCacheModule.cs: Module for inserting and retrieving
+ responses from the cache.
+
+2003-04-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CacheDependency.cs:
+ * CacheEntry.cs:
+ * Watcher.cs: added a FileSystemWatcher-like class for dependency checking.
+
+2003-03-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Cache.cs:
+ * CacheDefinitions.cs:
+ * CacheDependency.cs:
+ * CacheEntry.cs:
+ * CacheExpires.cs:
+ * ExpiresBuckets.cs: reformatted, make class status page happier. Does
+ not work yet (wait for the next patch).
+
+2002-12-27 Daniel Cazzulino <dcazzulino@users.sf.net>
+
+ * CacheEntry.cs: several changes. New constants, use of constants
+ defined in Cache.cs, modified locks to optimize perf. Fixed property
+ sets which weren't using the keyword value to set the new values
+ (don't know how this worked before!).
+
+ * Cache.cs: changed singleton implementation to only create the object
+ when actually used. Changed Insert overloads to use constants
+ defined instead of hard values.
+
+ * ExpiresBuchets: major changes. All locking now uses ReaderWriterLock
+ class. Bucket now efectively reuses free indexes from removed items
+ to avoid unnecessary expansions. Expansion now uses Array.CopyTo to
+ add elements to the new list. Added private Int32Collection to
+ handle int indexes efficiently (thanks Shawn Van Ness). See comments
+ there.
+
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Cache.cs: little fixes.
+
+2002-07-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CacheDefinitions.cs: fixed a couple of enums.
+
+ * CacheDependency.cs: the class is sealed.
+
+2002-06-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CacheDependency.cs: fixed a couple of typos and don't throw
+ NotImplementedException in constructors.
+
+2001-12-21 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * CacheDependency.cs: Some unimplemented methods to make build
+
+2001-07-20 Patrik Torstensson (Patrik.Torstensson@labs2.com)
+
+ * Cache.cs: Implemented. (90% ready)
+ * CacheDefinitions.cs: Implemented.
+ * CacheDependency.cs: Added. (20% ready)
+ * CacheExpires: Implemented.
+ * CacheEntry.cs: Implemented. (95% ready, going to be changed due to CacheDependecy support)
+ * ExpiresBuckets.cs: Implemented.
diff --git a/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs b/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs
new file mode 100644
index 00000000000..cbe901611fe
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs
@@ -0,0 +1,630 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Daniel Cazzulino [DHC] (dcazzulino@users.sf.net)
+//
+
+//
+// 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;
+using System.Collections;
+using System.Threading;
+
+namespace System.Web.Caching {
+ /// <summary>
+ /// Responsible for holding a cache entry in the linked list bucket.
+ /// </summary>
+ internal struct ExpiresEntry {
+ internal CacheEntry Entry;
+ internal long TicksExpires;
+ internal int _intNext;
+ }
+
+ /// <summary>
+ /// Holds cache entries that has a expiration in a bucket list.
+ /// </summary>
+ internal class ExpiresBucket {
+ private static int MIN_ENTRIES = 4;
+
+ private byte _byteID;
+ private int _intSize;
+ private int _intCount;
+ private int _intNext;
+
+ private Cache _objManager;
+
+ private ExpiresEntry [] _arrEntries;
+
+ private System.Threading.ReaderWriterLock _lock = new System.Threading.ReaderWriterLock();
+
+ /// <summary>
+ /// Keeps a list of indexes in the list which are available to place new items. [DHC]
+ /// </summary>
+ private Int32Collection _freeidx = new Int32Collection();
+
+ /// <summary>
+ /// Constructs a new bucket.
+ /// </summary>
+ /// <param name="bucket">Current bucket ID.</param>
+ /// <param name="objManager">Cache manager reponsible for the item(s) in the expires bucket.</param>
+ internal ExpiresBucket (byte bucket, Cache objManager) {
+ _objManager = objManager;
+ Initialize(bucket);
+ }
+
+ /// <summary>
+ /// Initializes the expires bucket, creates a linked list of MIN_ENTRIES.
+ /// </summary>
+ /// <param name="bucket">Bucket ID.</param>
+ private void Initialize (byte bucket) {
+ _byteID = bucket;
+ _intNext = 0;
+ _intCount = 0;
+
+ _arrEntries = new ExpiresEntry [MIN_ENTRIES];
+ _intSize = MIN_ENTRIES;
+
+ int intPos = 0;
+ do {
+ _arrEntries[intPos]._intNext = intPos + 1;
+ intPos++;
+ } while (intPos < _intSize);
+
+ _arrEntries[_intSize - 1]._intNext = -1;
+ }
+
+ /// <summary>
+ /// Expands the bucket linked array list.
+ /// </summary>
+ private void Expand () {
+ _lock.AcquireWriterLock(-1);
+ try {
+ int oldsize = _intSize;
+ _intSize *= 2;
+
+ // Copy items to the new list.
+ ExpiresEntry[] newlist = new ExpiresEntry[_intSize];
+ _arrEntries.CopyTo(newlist, 0);
+
+ // Set last element to point to the next new empty element
+ _intNext = oldsize;
+ newlist[oldsize - 1]._intNext = oldsize;
+
+ // Initialize positions for the rest of new elements.
+ for (int i = oldsize; i < _intSize; i++) {
+ newlist[i]._intNext = i + 1;
+ }
+
+ // Last item signals the expansion of the list.
+ newlist[_intSize - 1]._intNext = -1;
+
+ // Replace the existing list.
+ _arrEntries = newlist;
+ }
+ finally {
+ _lock.ReleaseWriterLock();
+ }
+
+ }
+
+ /// <summary>
+ /// Adds a cache entry into the expires bucket.
+ /// </summary>
+ /// <param name="objEntry">Cache Entry object to be added.</param>
+ internal void Add (CacheEntry objEntry) {
+ _lock.AcquireWriterLock(-1);
+ try {
+ if (_intNext == -1) {
+ if (_freeidx.Count == 0)
+ Expand();
+ else {
+ _intNext = _freeidx[0];
+ _freeidx.Remove(_intNext);
+ }
+ }
+
+ _arrEntries[_intNext].Entry = objEntry;
+
+ objEntry.ExpiresBucket = _byteID;
+ objEntry.ExpiresIndex = _intNext;
+
+ // If there are free indexes in the list, reuse them for the _next value.
+ if (_freeidx.Count != 0) {
+ _intNext = _freeidx [0];
+ _freeidx.Remove(_intNext);
+ } else
+ _intNext = _arrEntries[_intNext]._intNext;
+
+ _intCount++;
+ }
+ finally {
+ _lock.ReleaseWriterLock();
+ }
+ }
+
+ /// <summary>
+ /// Removes a cache entry from the expires bucket.
+ /// </summary>
+ /// <param name="objEntry">Cache entry to be removed.</param>
+ internal void Remove(CacheEntry objEntry) {
+ _lock.AcquireWriterLock(-1);
+ try {
+ if (objEntry.ExpiresIndex == CacheEntry.NoIndexInBucket)
+ return;
+
+ _intCount--;
+
+ // Push the index as a free one.
+ _freeidx.Add(objEntry.ExpiresIndex);
+
+ _arrEntries[objEntry.ExpiresIndex].Entry = null;
+ // Clear bucket-related values from the item.
+ objEntry.ExpiresBucket = CacheEntry.NoBucketHash;
+ objEntry.ExpiresIndex = CacheEntry.NoIndexInBucket;
+ }
+ finally {
+ //Releases both reader & writer locks
+ _lock.ReleaseWriterLock();
+ }
+ }
+
+ /// <summary>
+ /// Flushes all cache entries that has expired and removes them from the cache manager.
+ /// </summary>
+ internal void FlushExpiredItems() {
+ ExpiresEntry objEntry;
+ ArrayList removeList = null;
+ ArrayList flushList = null;
+ int intPos;
+ long ticksNow;
+
+ ticksNow = DateTime.UtcNow.Ticks;
+
+ intPos = 0;
+ // Lookup all items that needs to be removed, this is done in a two part
+ // operation to minimize the locking time.
+ _lock.AcquireReaderLock (-1);
+ try {
+ do {
+ objEntry = _arrEntries [intPos];
+ if (null != objEntry.Entry &&
+ ((objEntry.Entry.Expires < ticksNow) || objEntry.Entry.ExpiresBucket != _byteID))
+ {
+ if (null == removeList)
+ removeList = new ArrayList ();
+
+ removeList.Add (objEntry);
+ }
+
+ intPos++;
+ } while (intPos < _intSize);
+ }
+ finally {
+ _lock.ReleaseReaderLock ();
+ }
+
+ if (null != removeList) {
+ flushList = new ArrayList (removeList.Count);
+
+ _lock.AcquireWriterLock (-1);
+ try {
+ foreach (ExpiresEntry entry in removeList) {
+ ExpiresEntry e = entry;
+ int id = entry.Entry.ExpiresIndex;
+ if (id == CacheEntry.NoIndexInBucket)
+ continue;
+
+ //push the index for reuse
+ _freeidx.Add (id);
+
+ if (entry.Entry.ExpiresBucket == _byteID) {
+ // add to our flush list
+ flushList.Add (e.Entry);
+
+ // Remove from bucket
+ e.Entry.ExpiresBucket = CacheEntry.NoBucketHash;
+ e.Entry.ExpiresIndex = CacheEntry.NoIndexInBucket;
+ }
+
+ e.Entry = null;
+
+ // Entries is structs, put it back
+ _arrEntries [id] = e;
+ }
+ }
+ finally {
+ _lock.ReleaseWriterLock ();
+ }
+
+ // We can call this without locks, it can takes time due to callbacks to user code
+ foreach (CacheEntry entry in flushList)
+ _objManager.Remove (entry.Key, CacheItemRemovedReason.Expired);
+
+ flushList = null;
+ removeList = null;
+ }
+ }
+
+ /// <summary>
+ /// Returns the current size of the expires bucket.
+ /// </summary>
+ internal int Size {
+ get {
+ return _intSize;
+ }
+ }
+
+ /// <summary>
+ /// Returns number of items in the bucket.
+ /// </summary>
+ internal int Count {
+ get {
+ return _intCount;
+ }
+ }
+
+ #region Private Int32Collection
+ /* This file has been automatically generated by TextBox -- DO NOT EDIT! */
+ /*
+ Int32Collection
+ Int32Collection.Enumerator
+
+ These C# classes implement a strongly-typed collection of
+ Int32 objects.
+
+ The internal representation is an array of Int32, so the performance
+ characteristics will be more like a vector than a list, to use STL terminology.
+
+ The implementation is optimized for value-types, as it goes to great length to
+ avoid the overhead of boxing and unboxing. But it should also work well for
+ reference types.
+
+ Mad props to Nick Wienholt <sheyenne@bigpond.com> for assisting me in
+ this research, and the testing, the benchmarking, and of course, the
+ implementation!
+
+ Last but not least, a quick shout out to Kit George, for his generous
+ contribution to the dotnet mailing list -- a code-generator for
+ CollectionBase-derived classes:
+ http://discuss.develop.com/archives/wa.exe?A2=ind0107C&L=DOTNET&P=R35911
+ This was the original inspiration for the fine code you are now enjoying.
+
+ - Shawn Van Ness
+
+ Other folks who've contributed:
+ Ethan Smith <ethan.smith@pobox.com> (minor perf. improvements)
+ Joel Mueller <jmueller@swiftk.com> (major perf. improvements)
+ Chris Sells <csells@sellsbrothers.com> (generative programming guru)
+ Patrice Lafond <plafond@hemisphere.bm> (a bug fix -- yikes!)
+ */
+
+ /// <summary>
+ /// An optimized collection for holding <see cref="Int32"/> values.
+ /// </summary>
+ [System.Serializable]
+ private class Int32Collection : System.Collections.ICollection, System.Collections.IList, System.Collections.IEnumerable {
+ #region Private vars & ctors
+ private const int DefaultMinimumCapacity = 16;
+
+ private System.Int32[] m_array = new System.Int32[DefaultMinimumCapacity];
+ private int m_count = 0;
+ private int m_version = 0;
+
+ /// <summary />
+ public Int32Collection() {
+ }
+
+ /// <summary />
+ public Int32Collection(Int32Collection collection) {
+ AddRange(collection); }
+
+ /// <summary />
+ public Int32Collection(System.Int32[] array) {
+ AddRange(array); }
+ #endregion
+
+ #region Public members
+
+ /// <summary />
+ public int Count {
+ get {
+ return m_count; }
+ }
+
+ /// <summary />
+ public void CopyTo(System.Int32[] array) {
+ this.CopyTo(array, 0);
+ }
+
+ /// <summary />
+ public void CopyTo(System.Int32[] array, int start) {
+ if (m_count > array.GetUpperBound(0)+1-start)
+ throw new System.ArgumentException("Destination array was not long enough.");
+
+ // for (int i=0; i < m_count; ++i) array[start+i] = m_array[i];
+ System.Array.Copy(m_array, 0, array, start, m_count);
+ }
+
+ /// <summary />
+ public System.Int32 this[int index] {
+ get {
+ ValidateIndex(index); // throws
+ return m_array[index];
+ }
+ set {
+ ValidateIndex(index); // throws
+
+ ++m_version;
+ m_array[index] = value;
+ }
+ }
+
+ /// <summary />
+ public int Add(System.Int32 item) {
+ if (NeedsGrowth())
+ Grow();
+
+ ++m_version;
+ m_array[m_count] = item;
+
+ return m_count++;
+ }
+
+ /// <summary />
+ public void Clear() {
+ ++m_version;
+ m_array = new System.Int32[DefaultMinimumCapacity];
+ m_count = 0;
+ }
+
+ /// <summary />
+ public bool Contains(System.Int32 item) {
+ return ((IndexOf(item) == -1)?false:true);
+ }
+
+ /// <summary />
+ public int IndexOf(System.Int32 item) {
+ for (int i=0; i < m_count; ++i)
+ if (m_array[i].Equals(item))
+ return i;
+ return -1;
+ }
+
+ /// <summary />
+ public void Insert(int position, System.Int32 item) {
+ ValidateIndex(position,true); // throws
+
+ if (NeedsGrowth())
+ Grow();
+
+ ++m_version;
+ System.Array.Copy(m_array, position, m_array, position+1, m_count-position);
+
+ m_array[position] = item;
+ m_count++;
+ }
+
+ /// <summary />
+ public void Remove(System.Int32 item) {
+ int index = IndexOf(item);
+ if (index < 0)
+ throw new System.ArgumentException("Cannot remove the specified item because it was not found in the specified Collection.");
+
+ RemoveAt(index);
+ }
+
+ /// <summary />
+ public void RemoveAt(int index) {
+ ValidateIndex(index); // throws
+
+ ++m_version;
+ m_count--;
+ System.Array.Copy(m_array, index+1, m_array, index, m_count-index);
+
+ if (NeedsTrimming())
+ Trim();
+ }
+
+ // Public helpers (just to mimic some nice features of ArrayList)
+
+ /// <summary />
+ public int Capacity {
+ get {
+ return m_array.Length; }
+ set {
+ if (value < m_count) value = m_count;
+ if (value < DefaultMinimumCapacity) value = DefaultMinimumCapacity;
+
+ if (m_array.Length == value) return;
+
+ ++m_version;
+
+ System.Int32[] temp = new System.Int32[value];
+ System.Array.Copy(m_array, 0, temp, 0, m_count);
+ m_array = temp;
+ }
+ }
+
+ /// <summary />
+ public void AddRange(Int32Collection collection) {
+ ++m_version;
+
+ Capacity += collection.Count;
+ System.Array.Copy(collection.m_array, 0, this.m_array, m_count, collection.m_count);
+ m_count += collection.Count;
+ }
+
+ /// <summary />
+ public void AddRange(System.Int32[] array) {
+ ++m_version;
+
+ Capacity += array.Length;
+ System.Array.Copy(array, 0, this.m_array, m_count, array.Length);
+ m_count += array.Length;
+ }
+ #endregion
+
+ #region Private helper methods
+ private void ValidateIndex(int index) {
+ ValidateIndex(index,false);
+ }
+
+ private void ValidateIndex(int index, bool allowEqualEnd) {
+ int max = (allowEqualEnd)?(m_count):(m_count-1);
+ if (index < 0 || index > max)
+ throw new System.ArgumentOutOfRangeException("Index was out of range. Must be non-negative and less than the size of the collection.", (object)index, "Specified argument was out of the range of valid values.");
+ }
+
+ private bool NeedsGrowth() {
+ return (m_count >= Capacity);
+ }
+
+ private void Grow() {
+ if (NeedsGrowth())
+ Capacity = m_count*2;
+ }
+
+ private bool NeedsTrimming() {
+ return (m_count <= Capacity/2);
+ }
+
+ private void Trim() {
+ if (NeedsTrimming())
+ Capacity = m_count;
+ }
+ #endregion
+
+ #region System.Collections.ICollection implementation
+ bool System.Collections.ICollection.IsSynchronized {
+ get {
+ return m_array.IsSynchronized; }
+ }
+
+ object System.Collections.ICollection.SyncRoot {
+ get {
+ return m_array.SyncRoot; }
+ }
+
+ void System.Collections.ICollection.CopyTo(System.Array array, int start) {
+ this.CopyTo((System.Int32[])array, start);
+ }
+ #endregion
+
+ #region System.Collections.IList implementation
+ bool System.Collections.IList.IsFixedSize {
+ get {
+ return false; }
+ }
+
+ bool System.Collections.IList.IsReadOnly {
+ get {
+ return false; }
+ }
+
+ object System.Collections.IList.this[int index] {
+ get { return (object)this[index]; }
+ set { this[index] = (System.Int32)value; }
+ }
+
+ int System.Collections.IList.Add(object item) {
+ return this.Add((System.Int32)item);
+ }
+
+ bool System.Collections.IList.Contains(object item) {
+ return this.Contains((System.Int32)item);
+ }
+
+ int System.Collections.IList.IndexOf(object item) {
+ return this.IndexOf((System.Int32)item);
+ }
+
+ void System.Collections.IList.Insert(int position, object item) {
+ this.Insert(position, (System.Int32)item);
+ }
+
+ void System.Collections.IList.Remove(object item) {
+ this.Remove((System.Int32)item);
+ }
+ #endregion
+
+ #region System.Collections.IEnumerable and enumerator implementation
+ /// <summary />
+ public Enumerator GetEnumerator() {
+ return new Enumerator(this);
+ }
+
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
+ return GetEnumerator();
+ }
+
+ // Nested enumerator class
+ /// <summary />
+ public class Enumerator : System.Collections.IEnumerator {
+ private Int32Collection m_collection;
+ private int m_index;
+ private int m_version;
+
+ // Construction
+
+ /// <summary />
+ public Enumerator(Int32Collection tc) {
+ m_collection = tc;
+ m_index = -1;
+ m_version = tc.m_version;
+ }
+
+ /// <summary />
+ public System.Int32 Current {
+ get {
+ return m_collection[m_index]; }
+ }
+
+ /// <summary />
+ public bool MoveNext() {
+ if (m_version != m_collection.m_version)
+ throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");
+
+ ++m_index;
+ return (m_index < m_collection.Count)?true:false;
+ }
+
+ /// <summary />
+ public void Reset() {
+ if (m_version != m_collection.m_version)
+ throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");
+
+ m_index = -1;
+ }
+
+ object System.Collections.IEnumerator.Current {
+ get {
+ return (object)(this.Current); }
+ }
+ }
+ #endregion
+ }
+ #endregion
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Caching/OutputCacheModule.cs b/mcs/class/System.Web/System.Web.Caching/OutputCacheModule.cs
new file mode 100644
index 00000000000..e2d4b5139bc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/OutputCacheModule.cs
@@ -0,0 +1,181 @@
+//
+// System.Web.Caching.OutputCacheModule
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2003 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
+// "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.IO;
+using System.Web;
+using System.Web.Util;
+using System.Collections;
+
+namespace System.Web.Caching {
+
+ internal sealed class OutputCacheModule : IHttpModule {
+
+ private CacheItemRemovedCallback response_removed;
+
+ public OutputCacheModule ()
+ {
+ }
+
+ public void Dispose ()
+ {
+ }
+
+ public void Init (HttpApplication app)
+ {
+ app.AddOnResolveRequestCacheAsync (
+ new BeginEventHandler (OnBeginRequestCache),
+ new EndEventHandler (OnEndRequestCache));
+
+ app.AddOnUpdateRequestCacheAsync (
+ new BeginEventHandler (OnBeginUpdateCache),
+ new EndEventHandler (OnEndUpdateCache));
+
+ response_removed = new CacheItemRemovedCallback (OnRawResponseRemoved);
+ }
+
+ IAsyncResult OnBeginRequestCache (object o, EventArgs args, AsyncCallback cb, object data)
+ {
+ HttpApplication app = (HttpApplication) o;
+ HttpContext context = app.Context;
+
+ string vary_key = context.Request.FilePath;
+ CachedVaryBy varyby = context.Cache [vary_key] as CachedVaryBy;
+ string key;
+ CachedRawResponse c;
+
+ if (varyby == null)
+ goto leave;
+
+ key = varyby.CreateKey (vary_key, context);
+ c = context.Cache [key] as CachedRawResponse;
+
+ if (c != null) {
+
+ context.Response.ClearContent ();
+ context.Response.BinaryWrite (c.GetData (), 0, c.ContentLength);
+
+ context.Response.ClearHeaders ();
+ c.DateHeader.Value = TimeUtil.ToUtcTimeString (DateTime.Now);
+ context.Response.SetCachedHeaders (c.Headers);
+
+ context.Response.StatusCode = c.StatusCode;
+ context.Response.StatusDescription = c.StatusDescription;
+
+ app.CompleteRequest ();
+ }
+
+ leave:
+ HttpAsyncResult result = new HttpAsyncResult (cb,this);
+ result.Complete (true, o, null);
+
+ return result;
+ }
+
+ void OnEndRequestCache (IAsyncResult result)
+ {
+ }
+
+ IAsyncResult OnBeginUpdateCache (object o, EventArgs args, AsyncCallback cb, object data)
+ {
+ HttpApplication app = (HttpApplication) o;
+ HttpContext context = app.Context;
+ HttpAsyncResult result;
+
+ if (context.Response.IsCached && context.Response.StatusCode == 200 &&
+ !context.Trace.IsEnabled)
+ DoCacheInsert (context);
+
+ result = new HttpAsyncResult (cb, this);
+ result.Complete (true, o, null);
+ return result;
+ }
+
+ void OnEndUpdateCache (IAsyncResult result)
+ {
+ }
+
+ private void DoCacheInsert (HttpContext context)
+ {
+ string vary_key = context.Request.FilePath;
+ string key;
+ CachedVaryBy varyby = context.Cache [vary_key] as CachedVaryBy;
+ CachedRawResponse prev = null;
+ bool lookup = true;
+
+ if (varyby == null) {
+ string path = context.Request.MapPath (vary_key);
+ string [] files = new string [] { path };
+ string [] keys = new string [0];
+ varyby = new CachedVaryBy (context.Response.Cache, vary_key);
+ context.Cache.InsertPrivate (vary_key, varyby,
+ new CacheDependency (files, keys),
+ Cache.NoAbsoluteExpiration,
+ Cache.NoSlidingExpiration,
+ CacheItemPriority.Normal, null);
+ lookup = false;
+ }
+
+ key = varyby.CreateKey (vary_key, context);
+
+ if (lookup)
+ prev = context.Cache [key] as CachedRawResponse;
+
+ if (prev == null) {
+ CachedRawResponse c = context.Response.GetCachedResponse ();
+ string [] files = new string [] { };
+ string [] keys = new string [] { vary_key };
+ bool sliding = context.Response.Cache.Sliding;
+
+ context.Cache.InsertPrivate (key, c, new CacheDependency (files, keys),
+ (sliding ? Cache.NoAbsoluteExpiration :
+ context.Response.Cache.Expires),
+ (sliding ? TimeSpan.FromSeconds (
+ context.Response.Cache.Duration) :
+ Cache.NoSlidingExpiration),
+ CacheItemPriority.Normal, response_removed);
+ c.VaryBy = varyby;
+ varyby.ItemList.Add (key);
+ }
+ }
+
+ private void OnRawResponseRemoved (string key, object value, CacheItemRemovedReason reason)
+ {
+ CachedRawResponse c = (CachedRawResponse) value;
+
+ c.VaryBy.ItemList.Remove (key);
+ if (c.VaryBy.ItemList.Count != 0)
+ return;
+
+ Cache cache = HttpRuntime.Cache;
+ cache.Remove (c.VaryBy.Key);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/AspComponentFoundry.cs b/mcs/class/System.Web/System.Web.Compilation/AspComponentFoundry.cs
new file mode 100644
index 00000000000..7b2fcd27fb2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/AspComponentFoundry.cs
@@ -0,0 +1,195 @@
+//
+// System.Web.Compilation.AspComponentFoundry
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+
+namespace System.Web.Compilation
+{
+ internal class AspComponentFoundry
+ {
+ private Hashtable foundries;
+
+ public AspComponentFoundry ()
+ {
+ foundries = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant,
+ CaseInsensitiveComparer.DefaultInvariant);
+
+ Assembly sw = typeof (AspComponentFoundry).Assembly;
+ RegisterFoundry ("asp", sw, "System.Web.UI.WebControls");
+ RegisterFoundry ("", "object", typeof (System.Web.UI.ObjectTag));
+ }
+
+ public Type GetComponentType (string foundryName, string tag)
+ {
+ Foundry foundry = foundries [foundryName] as Foundry;
+ if (foundry == null)
+ return null;
+
+ return foundry.GetType (tag);
+ }
+
+ public void RegisterFoundry (string foundryName,
+ Assembly assembly,
+ string nameSpace)
+ {
+ AssemblyFoundry foundry = new AssemblyFoundry (assembly, nameSpace);
+ InternalRegister (foundryName, foundry);
+ }
+
+ public void RegisterFoundry (string foundryName,
+ string tagName,
+ Type type)
+ {
+ TagNameFoundry foundry = new TagNameFoundry (tagName, type);
+ InternalRegister (foundryName, foundry);
+ }
+
+ void InternalRegister (string foundryName, Foundry foundry)
+ {
+ object f = foundries [foundryName];
+ if (f is CompoundFoundry) {
+ ((CompoundFoundry) f).Add (foundry);
+ } else if (f == null || (f is AssemblyFoundry && foundry is AssemblyFoundry)) {
+ // If more than 1 namespace/assembly specified, the last one is used.
+ foundries [foundryName] = foundry;
+ } else if (f != null) {
+ CompoundFoundry compound = new CompoundFoundry (foundryName);
+ compound.Add ((Foundry) f);
+ compound.Add (foundry);
+ foundries [foundryName] = compound;
+ }
+ }
+
+ public bool LookupFoundry (string foundryName)
+ {
+ return foundries.Contains (foundryName);
+ }
+
+ abstract class Foundry
+ {
+ public abstract Type GetType (string componentName);
+ }
+
+
+ class TagNameFoundry : Foundry
+ {
+ string tagName;
+ Type type;
+
+ public TagNameFoundry (string tagName, Type type)
+ {
+ this.tagName = tagName;
+ this.type = type;
+ }
+
+ public override Type GetType (string componentName)
+ {
+ if (0 != String.Compare (componentName, tagName, true))
+ return null;
+
+ return type;
+ }
+
+ public string TagName {
+ get { return tagName; }
+ }
+ }
+
+ class AssemblyFoundry : Foundry
+ {
+ string nameSpace;
+ Assembly assembly;
+
+ public AssemblyFoundry (Assembly assembly, string nameSpace)
+ {
+ this.assembly = assembly;
+ this.nameSpace = nameSpace;
+ }
+
+ public override Type GetType (string componentName)
+ {
+ return assembly.GetType (nameSpace + "." + componentName, true, true);
+ }
+ }
+
+ class CompoundFoundry : Foundry
+ {
+ AssemblyFoundry assemblyFoundry;
+ Hashtable tagnames;
+ string tagPrefix;
+
+ public CompoundFoundry (string tagPrefix)
+ {
+ this.tagPrefix = tagPrefix;
+ tagnames = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant,
+ CaseInsensitiveComparer.DefaultInvariant);
+ }
+
+ public void Add (Foundry foundry)
+ {
+ if (foundry is AssemblyFoundry) {
+ assemblyFoundry = (AssemblyFoundry) foundry;
+ return;
+ }
+
+ TagNameFoundry tn = (TagNameFoundry) foundry;
+ string tagName = tn.TagName;
+ if (tagnames.Contains (tagName)) {
+ string msg = String.Format ("{0}:{1} already registered.", tagPrefix, tagName);
+ throw new ApplicationException (msg);
+ }
+ tagnames.Add (tagName, foundry);
+ }
+
+ public override Type GetType (string componentName)
+ {
+ Type type = null;
+ if (assemblyFoundry != null) {
+ try {
+ type = assemblyFoundry.GetType (componentName);
+ return type;
+ } catch { }
+ }
+
+ Foundry foundry = tagnames [componentName] as Foundry;
+ if (foundry == null) {
+ string msg = String.Format ("Type {0} not registered for prefix {1}",
+ componentName, tagPrefix);
+ throw new ApplicationException (msg);
+ }
+
+ return foundry.GetType (componentName);
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs b/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs
new file mode 100644
index 00000000000..cd331f2fdaa
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs
@@ -0,0 +1,690 @@
+//
+// System.Web.Compilation.AspGenerator
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.CodeDom.Compiler;
+using System.IO;
+using System.Text;
+using System.Web.Caching;
+using System.Web.Configuration;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+using System.Web.Util;
+
+namespace System.Web.Compilation
+{
+ class BuilderLocation
+ {
+ public ControlBuilder Builder;
+ public ILocation Location;
+
+ public BuilderLocation (ControlBuilder builder, ILocation location)
+ {
+ this.Builder = builder;
+ this.Location = location;
+ }
+ }
+
+ class BuilderLocationStack : Stack
+ {
+ public override void Push (object o)
+ {
+ if (!(o is BuilderLocation))
+ throw new InvalidOperationException ();
+
+ base.Push (o);
+ }
+
+ public virtual void Push (ControlBuilder builder, ILocation location)
+ {
+ BuilderLocation bl = new BuilderLocation (builder, location);
+ Push (bl);
+ }
+
+ public new BuilderLocation Peek ()
+ {
+ return (BuilderLocation) base.Peek ();
+ }
+
+ public new BuilderLocation Pop ()
+ {
+ return (BuilderLocation) base.Pop ();
+ }
+
+ public ControlBuilder Builder {
+ get { return Peek ().Builder; }
+ }
+ }
+
+ class ParserStack
+ {
+ Hashtable files;
+ Stack parsers;
+ AspParser current;
+
+ public ParserStack ()
+ {
+ files = new Hashtable (); // may be this should be case sensitive for windows
+ parsers = new Stack ();
+ }
+
+ public bool Push (AspParser parser)
+ {
+ if (files.Contains (parser.Filename))
+ return false;
+
+ files [parser.Filename] = true;
+ parsers.Push (parser);
+ current = parser;
+ return true;
+ }
+
+ public AspParser Pop ()
+ {
+ if (parsers.Count == 0)
+ return null;
+
+ files.Remove (current.Filename);
+ AspParser result = (AspParser) parsers.Pop ();
+ if (parsers.Count > 0)
+ current = (AspParser) parsers.Peek ();
+ else
+ current = null;
+
+ return result;
+ }
+
+ public AspParser Parser {
+ get { return current; }
+ }
+
+ public string Filename {
+ get { return current.Filename; }
+ }
+ }
+
+ class TagStack
+ {
+ Stack tags;
+
+ public TagStack ()
+ {
+ tags = new Stack ();
+ }
+
+ public void Push (string tagid)
+ {
+ tags.Push (tagid);
+ }
+
+ public string Pop ()
+ {
+ if (tags.Count == 0)
+ return null;
+
+ return (string) tags.Pop ();
+ }
+
+ public bool CompareTo (string tagid)
+ {
+ if (tags.Count == 0)
+ return false;
+
+ return 0 == String.Compare (tagid, (string) tags.Peek (), true);
+ }
+
+ public int Count {
+ get { return tags.Count; }
+ }
+
+ public string Current {
+ get { return (string) tags.Peek (); }
+ }
+ }
+
+ class AspGenerator
+ {
+ ParserStack pstack;
+ BuilderLocationStack stack;
+ TemplateParser tparser;
+ StringBuilder text;
+ RootBuilder rootBuilder;
+ bool inScript, javascript;
+ ILocation location;
+ bool isApplication;
+ StringBuilder tagInnerText = new StringBuilder ();
+ static Hashtable emptyHash = new Hashtable ();
+ bool inForm;
+ bool useOtherTags;
+
+ public AspGenerator (TemplateParser tparser)
+ {
+ this.tparser = tparser;
+ tparser.AddDependency (tparser.InputFile);
+ text = new StringBuilder ();
+ stack = new BuilderLocationStack ();
+ rootBuilder = new RootBuilder (tparser);
+ stack.Push (rootBuilder, null);
+ tparser.RootBuilder = rootBuilder;
+ pstack = new ParserStack ();
+ }
+
+ public AspParser Parser {
+ get { return pstack.Parser; }
+ }
+
+ public string Filename {
+ get { return pstack.Filename; }
+ }
+
+ BaseCompiler GetCompilerFromType ()
+ {
+ Type type = tparser.GetType ();
+ if (type == typeof (PageParser))
+ return new PageCompiler ((PageParser) tparser);
+
+ if (type == typeof (ApplicationFileParser))
+ return new GlobalAsaxCompiler ((ApplicationFileParser) tparser);
+
+ if (type == typeof (UserControlParser))
+ return new UserControlCompiler ((UserControlParser) tparser);
+#if NET_2_0
+ if (type == typeof(MasterPageParser))
+ return new UserControlCompiler ((UserControlParser) tparser);
+#endif
+
+ throw new Exception ("Got type: " + type);
+ }
+
+ void InitParser (string filename)
+ {
+ StreamReader reader = new StreamReader (filename, WebEncoding.FileEncoding);
+ AspParser parser = new AspParser (filename, reader);
+ reader.Close ();
+ parser.Error += new ParseErrorHandler (ParseError);
+ parser.TagParsed += new TagParsedHandler (TagParsed);
+ parser.TextParsed += new TextParsedHandler (TextParsed);
+ if (!pstack.Push (parser))
+ throw new ParseException (Location, "Infinite recursion detected including file: " + filename);
+ tparser.AddDependency (filename);
+ }
+
+ void DoParse ()
+ {
+ pstack.Parser.Parse ();
+ if (text.Length > 0)
+ FlushText ();
+
+ pstack.Pop ();
+ }
+
+ public Type GetCompiledType ()
+ {
+ Type type = (Type) HttpRuntime.Cache.Get ("@@Type" + tparser.InputFile);
+ if (type != null) {
+ return type;
+ }
+
+ isApplication = tparser.DefaultDirectiveName == "application";
+ InitParser (Path.GetFullPath (tparser.InputFile));
+
+ DoParse ();
+#if DEBUG
+ PrintTree (rootBuilder, 0);
+#endif
+
+ if (stack.Count > 1)
+ throw new ParseException (stack.Builder.location,
+ "Expecting </" + stack.Builder.TagName + "> " + stack.Builder);
+
+ BaseCompiler compiler = GetCompilerFromType ();
+
+ type = compiler.GetCompiledType ();
+ CacheDependency cd = new CacheDependency ((string[])
+ tparser.Dependencies.ToArray (typeof (string)));
+
+ HttpRuntime.Cache.Insert ("@@Type" + tparser.InputFile, type, cd);
+ return type;
+ }
+
+#if DEBUG
+ static void PrintTree (ControlBuilder builder, int indent)
+ {
+ if (builder == null)
+ return;
+
+ string i = new string ('\t', indent);
+ Console.Write (i);
+ Console.WriteLine ("b: {0} id: {1} type: {2} parent: {3}",
+ builder, builder.ID, builder.ControlType, builder.parentBuilder);
+
+ if (builder.Children != null)
+ foreach (object o in builder.Children) {
+ if (o is ControlBuilder)
+ PrintTree ((ControlBuilder) o, indent++);
+ }
+ }
+
+ static void PrintLocation (ILocation loc)
+ {
+ Console.WriteLine ("\tFile name: " + loc.Filename);
+ Console.WriteLine ("\tBegin line: " + loc.BeginLine);
+ Console.WriteLine ("\tEnd line: " + loc.EndLine);
+ Console.WriteLine ("\tBegin column: " + loc.BeginColumn);
+ Console.WriteLine ("\tEnd column: " + loc.EndColumn);
+ Console.WriteLine ("\tPlainText: " + loc.PlainText);
+ Console.WriteLine ();
+ }
+#endif
+
+ void ParseError (ILocation location, string message)
+ {
+ throw new ParseException (location, message);
+ }
+
+ void TagParsed (ILocation location, TagType tagtype, string tagid, TagAttributes attributes)
+ {
+ this.location = new Location (location);
+ if (tparser != null)
+ tparser.Location = location;
+
+ if (text.Length != 0)
+ FlushText ();
+
+ if (0 == String.Compare (tagid, "script", true)) {
+ if (ProcessScript (tagtype, attributes))
+ return;
+ }
+
+ switch (tagtype) {
+ case TagType.Directive:
+ if (tagid == "")
+ tagid = tparser.DefaultDirectiveName;
+
+ tparser.AddDirective (tagid, attributes.GetDictionary (null));
+ break;
+ case TagType.Tag:
+ if (ProcessTag (tagid, attributes, tagtype)) {
+ useOtherTags = true;
+ break;
+ }
+
+ if (useOtherTags) {
+ stack.Builder.EnsureOtherTags ();
+ stack.Builder.OtherTags.Add (tagid);
+ }
+
+ TextParsed (location, location.PlainText);
+ break;
+ case TagType.Close:
+ bool notServer = (useOtherTags && TryRemoveTag (tagid, stack.Builder.OtherTags));
+ if (!notServer && CloseControl (tagid))
+ break;
+
+ TextParsed (location, location.PlainText);
+ break;
+ case TagType.SelfClosing:
+ int count = stack.Count;
+ if (!ProcessTag (tagid, attributes, tagtype)) {
+ TextParsed (location, location.PlainText);
+ } else if (stack.Count != count) {
+ CloseControl (tagid);
+ }
+ break;
+ case TagType.DataBinding:
+ goto case TagType.CodeRender;
+ case TagType.CodeRenderExpression:
+ goto case TagType.CodeRender;
+ case TagType.CodeRender:
+ if (isApplication)
+ throw new ParseException (location, "Invalid content for application file.");
+
+ ProcessCode (tagtype, tagid, location);
+ break;
+ case TagType.Include:
+ if (isApplication)
+ throw new ParseException (location, "Invalid content for application file.");
+
+ string file = attributes ["virtual"] as string;
+ bool isvirtual = (file != null);
+ if (!isvirtual)
+ file = attributes ["file"] as string;
+
+ if (isvirtual) {
+ file = tparser.MapPath (file);
+ } else {
+ file = GetIncludeFilePath (tparser.BaseDir, file);
+ }
+
+ InitParser (file);
+ DoParse ();
+ break;
+ default:
+ break;
+ }
+ //PrintLocation (location);
+ }
+
+ static bool TryRemoveTag (string tagid, ArrayList otags)
+ {
+ if (otags == null || otags.Count == 0)
+ return false;
+
+ int idx = otags.Count - 1;
+ string otagid = (string) otags [idx];
+ if (0 != String.Compare (tagid, otagid, true))
+ return false;
+
+ otags.RemoveAt (idx);
+ return true;
+ }
+
+ static string GetIncludeFilePath (string basedir, string filename)
+ {
+ if (Path.DirectorySeparatorChar == '/')
+ filename = filename.Replace ("\\", "/");
+
+ return Path.GetFullPath (Path.Combine (basedir, filename));
+ }
+
+ void TextParsed (ILocation location, string text)
+ {
+ if (text.IndexOf ("<%") != -1 && !inScript) {
+ if (this.text.Length > 0)
+ FlushText ();
+ CodeRenderParser r = new CodeRenderParser (text, stack.Builder);
+ r.AddChildren ();
+ return;
+ }
+
+ this.text.Append (text);
+ //PrintLocation (location);
+ }
+
+ void FlushText ()
+ {
+ string t = text.ToString ();
+ text.Length = 0;
+ if (inScript) {
+ // TODO: store location
+ tparser.Scripts.Add (t);
+ return;
+ }
+
+ if (tparser.DefaultDirectiveName == "application" && t.Trim () != "")
+ throw new ParseException (location, "Content not valid for application file.");
+
+ ControlBuilder current = stack.Builder;
+ current.AppendLiteralString (t);
+ if (current.NeedsTagInnerText ()) {
+ tagInnerText.Append (t);
+ }
+ }
+
+ bool ProcessTag (string tagid, TagAttributes atts, TagType tagtype)
+ {
+ if ((atts == null || !atts.IsRunAtServer ()) && String.Compare (tagid, "tbody", true) == 0) {
+ // MS completely ignores tbody or, if runat="server", fails when compiling
+ if (stack.Count > 0)
+ return stack.Builder.ChildrenAsProperties;
+
+ return false;
+ }
+
+ if (isApplication) {
+ if (String.Compare (tagid, "object", true) != 0)
+ throw new ParseException (location, "Invalid tag for application file.");
+ }
+
+ ControlBuilder parent = stack.Builder;
+ ControlBuilder builder = null;
+ Hashtable htable = (atts != null) ? atts.GetDictionary (null) : emptyHash;
+ if (stack.Count > 1) {
+ try {
+ builder = parent.CreateSubBuilder (tagid, htable, null, tparser, location);
+ } catch (TypeLoadException e) {
+ throw new ParseException (Location, "Type not found.", e);
+ } catch (Exception e) {
+ throw new ParseException (Location, e.Message, e);
+ }
+ }
+
+ if (builder == null && atts != null && atts.IsRunAtServer ()) {
+ string id = htable ["id"] as string;
+ if (id != null && !CodeGenerator.IsValidLanguageIndependentIdentifier (id))
+ throw new ParseException (Location, "'" + id + "' is not a valid identifier");
+
+ try {
+ builder = rootBuilder.CreateSubBuilder (tagid, htable, null, tparser, location);
+ } catch (TypeLoadException e) {
+ throw new ParseException (Location, "Type not found.", e);
+ } catch (Exception e) {
+ throw new ParseException (Location, e.Message, e);
+ }
+ }
+
+ if (builder == null)
+ return false;
+
+ builder.location = location;
+ builder.ID = htable ["id"] as string;
+ if (typeof (HtmlForm).IsAssignableFrom (builder.ControlType)) {
+ if (inForm)
+ throw new ParseException (location, "Only one <form> allowed.");
+
+ inForm = true;
+ }
+
+ if (builder.HasBody () && !(builder is ObjectTagBuilder)) {
+ if (builder is TemplateBuilder) {
+ // push the id list
+ }
+ stack.Push (builder, location);
+ } else {
+ if (!isApplication && builder is ObjectTagBuilder) {
+ ObjectTagBuilder ot = (ObjectTagBuilder) builder;
+ if (ot.Scope != null && ot.Scope != "")
+ throw new ParseException (location, "Scope not allowed here");
+
+ if (tagtype == TagType.Tag) {
+ stack.Push (builder, location);
+ return true;
+ }
+ }
+
+ parent.AppendSubBuilder (builder);
+ builder.CloseControl ();
+ }
+
+ return true;
+ }
+
+ bool ProcessScript (TagType tagtype, TagAttributes attributes)
+ {
+ if (tagtype != TagType.Close) {
+ if (attributes != null && attributes.IsRunAtServer ()) {
+ CheckLanguage ((string) attributes ["language"]);
+ if (tagtype == TagType.Tag) {
+ Parser.VerbatimID = "script";
+ inScript = true;
+ } //else if (tagtype == TagType.SelfClosing)
+ // load script file here
+
+ return true;
+ } else {
+ if (tagtype != TagType.SelfClosing) {
+ Parser.VerbatimID = "script";
+ javascript = true;
+ }
+ TextParsed (location, location.PlainText);
+ return true;
+ }
+ }
+
+ bool result;
+ if (inScript) {
+ result = inScript;
+ inScript = false;
+ } else {
+ result = javascript;
+ javascript = false;
+ TextParsed (location, location.PlainText);
+ }
+
+ return result;
+ }
+
+ bool CloseControl (string tagid)
+ {
+ ControlBuilder current = stack.Builder;
+ string btag = current.TagName;
+ if (String.Compare (btag, "tbody", true) != 0 && String.Compare (tagid, "tbody", true) == 0) {
+ if (!current.ChildrenAsProperties) {
+ try {
+ TextParsed (location, location.PlainText);
+ FlushText ();
+ } catch {}
+ }
+ return true;
+ }
+
+ if (0 != String.Compare (tagid, btag, true))
+ return false;
+
+ // if (current is TemplateBuilder)
+ // pop from the id list
+ if (current.NeedsTagInnerText ()) {
+ try {
+ current.SetTagInnerText (tagInnerText.ToString ());
+ } catch (Exception e) {
+ throw new ParseException (current.location, e.Message, e);
+ }
+
+ tagInnerText.Length = 0;
+ }
+
+ if (typeof (HtmlForm).IsAssignableFrom (current.ControlType)) {
+ inForm = false;
+ }
+
+ current.CloseControl ();
+ stack.Pop ();
+ stack.Builder.AppendSubBuilder (current);
+ return true;
+ }
+
+ bool ProcessCode (TagType tagtype, string code, ILocation location)
+ {
+ ControlBuilder b = null;
+ if (tagtype == TagType.CodeRender)
+ b = new CodeRenderBuilder (code, false, location);
+ else if (tagtype == TagType.CodeRenderExpression)
+ b = new CodeRenderBuilder (code, true, location);
+ else if (tagtype == TagType.DataBinding)
+ b = new DataBindingBuilder (code, location);
+ else
+ throw new HttpException ("Should never happen");
+
+ stack.Builder.AppendSubBuilder (b);
+ return true;
+ }
+
+ public ILocation Location {
+ get { return location; }
+ }
+
+ void CheckLanguage (string lang)
+ {
+ if (lang == null || lang == "")
+ return;
+
+ if (String.Compare (lang, tparser.Language, true) == 0)
+ return;
+
+ CompilationConfiguration cfg = CompilationConfiguration.GetInstance (HttpContext.Current);
+ if (!cfg.Compilers.CompareLanguages (tparser.Language, lang)) {
+ throw new ParseException (Location,
+ String.Format ("Trying to mix language '{0}' and '{1}'.",
+ tparser.Language, lang));
+ }
+ }
+
+ // Used to get CodeRender tags in attribute values
+ class CodeRenderParser
+ {
+ string str;
+ ControlBuilder builder;
+
+ public CodeRenderParser (string str, ControlBuilder builder)
+ {
+ this.str = str;
+ this.builder = builder;
+ }
+
+ public void AddChildren ()
+ {
+ int index = str.IndexOf ("<%");
+ if (index > 0) {
+ TextParsed (null, str.Substring (0, index));
+ str = str.Substring (index);
+ }
+
+ AspParser parser = new AspParser ("@@inner_string@@", new StringReader (str));
+ parser.Error += new ParseErrorHandler (ParseError);
+ parser.TagParsed += new TagParsedHandler (TagParsed);
+ parser.TextParsed += new TextParsedHandler (TextParsed);
+ parser.Parse ();
+ }
+
+ void TagParsed (ILocation location, TagType tagtype, string tagid, TagAttributes attributes)
+ {
+ if (tagtype == TagType.CodeRender)
+ builder.AppendSubBuilder (new CodeRenderBuilder (tagid, false, location));
+ else if (tagtype == TagType.CodeRenderExpression)
+ builder.AppendSubBuilder (new CodeRenderBuilder (tagid, true, location));
+ else if (tagtype == TagType.DataBinding)
+ builder.AppendSubBuilder (new DataBindingBuilder (tagid, location));
+ else
+ builder.AppendLiteralString (location.PlainText);
+ }
+
+ void TextParsed (ILocation location, string text)
+ {
+ builder.AppendLiteralString (text);
+ }
+
+ void ParseError (ILocation location, string message)
+ {
+ throw new ParseException (location, message);
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/AspParser.cs b/mcs/class/System.Web/System.Web.Compilation/AspParser.cs
new file mode 100644
index 00000000000..ab1f1503423
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/AspParser.cs
@@ -0,0 +1,471 @@
+//
+// System.Web.Compilation.AspParser
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.IO;
+using System.Text;
+
+namespace System.Web.Compilation
+{
+ delegate void ParseErrorHandler (ILocation location, string message);
+ delegate void TextParsedHandler (ILocation location, string text);
+ delegate void TagParsedHandler (ILocation location, TagType tagtype, string id, TagAttributes attributes);
+
+ class AspParser : ILocation
+ {
+ AspTokenizer tokenizer;
+ int beginLine, endLine;
+ int beginColumn, endColumn;
+ int beginPosition, endPosition;
+ string filename;
+ string fileText;
+ string verbatimID;
+
+ public AspParser (string filename, TextReader input)
+ {
+ this.filename = filename;
+ fileText = input.ReadToEnd ();
+ StringReader reader = new StringReader (fileText);
+ tokenizer = new AspTokenizer (reader);
+ }
+
+ public int BeginLine {
+ get { return beginLine; }
+ }
+
+ public int BeginColumn {
+ get { return beginColumn; }
+ }
+
+ public int EndLine {
+ get { return endLine; }
+ }
+
+ public int EndColumn {
+ get { return endColumn; }
+ }
+
+ public string PlainText {
+ get {
+ if (beginPosition >= endPosition)
+ return null;
+
+ return fileText.Substring (beginPosition, endPosition - beginPosition);
+ }
+ }
+
+ public string Filename {
+ get { return filename; }
+ }
+
+ public string VerbatimID {
+ set {
+ tokenizer.Verbatim = true;
+ verbatimID = value.ToUpper ();
+ }
+ }
+
+ bool Eat (int expected_token)
+ {
+ if (tokenizer.get_token () != expected_token) {
+ tokenizer.put_back ();
+ return false;
+ }
+
+ endLine = tokenizer.EndLine;
+ endColumn = tokenizer.EndColumn;
+ return true;
+ }
+
+ void BeginElement ()
+ {
+ beginLine = tokenizer.BeginLine;
+ beginColumn = tokenizer.BeginColumn;
+ beginPosition = tokenizer.Position - 1;
+ }
+
+ void EndElement ()
+ {
+ endLine = tokenizer.EndLine;
+ endColumn = tokenizer.EndColumn;
+ endPosition = tokenizer.Position;
+ }
+
+ public void Parse ()
+ {
+ int token;
+ string id;
+ TagAttributes attributes;
+ TagType tagtype = TagType.Text;
+ StringBuilder text = new StringBuilder ();
+
+ while ((token = tokenizer.get_token ()) != Token.EOF) {
+ BeginElement ();
+
+ if (tokenizer.Verbatim){
+ string end_verbatim = "</" + verbatimID + ">";
+ string verbatim_text = GetVerbatim (token, end_verbatim);
+
+ if (verbatim_text == null)
+ OnError ("Unexpected EOF processing " + verbatimID);
+
+ tokenizer.Verbatim = false;
+
+ EndElement ();
+ endPosition -= end_verbatim.Length;
+ OnTextParsed (verbatim_text);
+ beginPosition = endPosition;
+ endPosition += end_verbatim.Length;
+ OnTagParsed (TagType.Close, verbatimID, null);
+ continue;
+ }
+
+ if (token == '<') {
+ GetTag (out tagtype, out id, out attributes);
+ EndElement ();
+ if (tagtype == TagType.ServerComment)
+ continue;
+
+ if (tagtype == TagType.Text)
+ OnTextParsed (id);
+ else
+ OnTagParsed (tagtype, id, attributes);
+
+ continue;
+ }
+
+ if (tokenizer.Value.Trim () == "" && tagtype == TagType.Directive) {
+ continue;
+ }
+
+ text.Length = 0;
+ do {
+ text.Append (tokenizer.Value);
+ token = tokenizer.get_token ();
+ } while (token != '<' && token != Token.EOF);
+
+ tokenizer.put_back ();
+ EndElement ();
+ OnTextParsed (text.ToString ());
+ }
+ }
+
+ bool GetInclude (string str, out string pathType, out string filename)
+ {
+ pathType = null;
+ filename = null;
+ str = str.Substring (2).Trim ();
+ int len = str.Length;
+ int lastQuote = str.LastIndexOf ('"');
+ if (len < 10 || lastQuote != len - 1)
+ return false;
+
+ if (!str.ToLower ().StartsWith ("#include "))
+ return false;
+
+ str = str.Substring (9).Trim ();
+ bool isfile = (str.ToLower ().StartsWith ("file"));
+ if (!isfile && !str.ToLower ().StartsWith ("virtual"))
+ return false;
+
+ pathType = (isfile) ? "file" : "virtual";
+ if (str.Length < pathType.Length + 3)
+ return false;
+
+ str = str.Substring (pathType.Length).Trim ();
+ if (str.Length < 3 || str [0] != '=')
+ return false;
+
+ int index = 1;
+ for (; index < str.Length; index++) {
+ if (Char.IsWhiteSpace (str [index]))
+ index++;
+ else if (str [index] == '"')
+ break;
+ }
+
+ if (index == str.Length || index == lastQuote)
+ return false;
+
+ str = str.Substring (index);
+ if (str.Length == 2) { // only quotes
+ OnError ("Empty file name.");
+ return false;
+ }
+
+ filename = str.Trim ().Substring (index, str.Length - 2);
+ if (filename.LastIndexOf ('"') != -1)
+ return false; // file=""" -> no error
+
+ return true;
+ }
+
+ void GetTag (out TagType tagtype, out string id, out TagAttributes attributes)
+ {
+ int token = tokenizer.get_token ();
+
+ tagtype = TagType.ServerComment;
+ id = null;
+ attributes = null;
+ switch (token){
+ case '%':
+ GetServerTag (out tagtype, out id, out attributes);
+ break;
+ case '/':
+ if (!Eat (Token.IDENTIFIER))
+ OnError ("expecting TAGNAME");
+
+ id = tokenizer.Value;
+ if (!Eat ('>'))
+ OnError ("expecting '>'. Got '" + id + "'");
+
+ tagtype = TagType.Close;
+ break;
+ case '!':
+ bool double_dash = Eat (Token.DOUBLEDASH);
+ if (double_dash)
+ tokenizer.put_back ();
+
+ tokenizer.Verbatim = true;
+ string end = double_dash ? "-->" : ">";
+ string comment = GetVerbatim (tokenizer.get_token (), end);
+ tokenizer.Verbatim = false;
+ if (comment == null)
+ OnError ("Unfinished HTML comment/DTD");
+
+ string pathType, filename;
+ if (double_dash && GetInclude (comment, out pathType, out filename)) {
+ tagtype = TagType.Include;
+ attributes = new TagAttributes ();
+ attributes.Add (pathType, filename);
+ } else {
+ tagtype = TagType.Text;
+ id = "<!" + comment + end;
+ }
+ break;
+ case Token.IDENTIFIER:
+ if (this.filename == "@@inner_string@@") {
+ // Actually not tag but "xxx < yyy" stuff in inner_string!
+ tagtype = TagType.Text;
+ tokenizer.InTag = false;
+ id = "<" + tokenizer.Odds + tokenizer.Value;
+ } else {
+ id = tokenizer.Value;
+ try {
+ attributes = GetAttributes ();
+ } catch (Exception e) {
+ OnError (e.Message);
+ break;
+ }
+
+ tagtype = TagType.Tag;
+ if (Eat ('/') && Eat ('>')) {
+ tagtype = TagType.SelfClosing;
+ } else if (!Eat ('>')) {
+ if (attributes.IsRunAtServer ()) {
+ OnError ("The server tag is not well formed.");
+ break;
+ }
+ tokenizer.Verbatim = true;
+ attributes.Add ("", GetVerbatim (tokenizer.get_token (), ">") + ">");
+ tokenizer.Verbatim = false;
+ }
+ }
+
+ break;
+ default:
+ tagtype = TagType.Text;
+ tokenizer.InTag = false;
+ id = "<" + tokenizer.Value;
+ break;
+ }
+ }
+
+ TagAttributes GetAttributes ()
+ {
+ int token;
+ TagAttributes attributes;
+ string id;
+
+ 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 ('%')) {
+ 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);
+ }
+ }
+
+ tokenizer.put_back ();
+ return attributes;
+ }
+
+ string GetVerbatim (int token, string end)
+ {
+ StringBuilder vb_text = new StringBuilder ();
+ int i = 0;
+
+ if (tokenizer.Value.Length > 1){
+ // May be we have a put_back token that is not a single character
+ vb_text.Append (tokenizer.Value);
+ token = tokenizer.get_token ();
+ }
+
+ while (token != Token.EOF){
+ if (Char.ToUpper ((char) token) == end [i]){
+ if (++i >= end.Length)
+ break;
+ token = tokenizer.get_token ();
+ continue;
+ } else if (i > 0) {
+ for (int j = 0; j < i; j++)
+ vb_text.Append (end [j]);
+ i = 0;
+ }
+
+ vb_text.Append ((char) token);
+ token = tokenizer.get_token ();
+ }
+
+ return RemoveComments (vb_text.ToString ());
+ }
+
+ string RemoveComments (string text)
+ {
+ int end;
+ int start = text.IndexOf ("<%--");
+
+ while (start != -1) {
+ end = text.IndexOf ("--%>");
+ if (end == -1 || end <= start + 1)
+ break;
+
+ text = text.Remove (start, end - start + 4);
+ start = text.IndexOf ("<%--");
+ }
+
+ return text;
+ }
+
+ void GetServerTag (out TagType tagtype, out string id, out TagAttributes attributes)
+ {
+ string inside_tags;
+ bool old = tokenizer.ExpectAttrValue;
+
+ tokenizer.ExpectAttrValue = false;
+ if (Eat ('@')){
+ tokenizer.ExpectAttrValue = old;
+ tagtype = TagType.Directive;
+ id = "";
+ if (Eat (Token.DIRECTIVE))
+ id = tokenizer.Value;
+
+ attributes = GetAttributes ();
+ if (!Eat ('%') || !Eat ('>'))
+ OnError ("expecting '%>'");
+
+ return;
+ }
+
+ if (Eat (Token.DOUBLEDASH)) {
+ tokenizer.ExpectAttrValue = old;
+ tokenizer.Verbatim = true;
+ inside_tags = GetVerbatim (tokenizer.get_token (), "--%>");
+ tokenizer.Verbatim = false;
+ id = null;
+ attributes = null;
+ tagtype = TagType.ServerComment;
+ return;
+ }
+
+ tokenizer.ExpectAttrValue = old;
+ bool varname;
+ bool databinding;
+ varname = Eat ('=');
+ databinding = !varname && Eat ('#');
+
+ tokenizer.Verbatim = true;
+ inside_tags = GetVerbatim (tokenizer.get_token (), "%>");
+ tokenizer.Verbatim = false;
+ id = inside_tags;
+ attributes = null;
+ tagtype = (databinding ? TagType.DataBinding :
+ (varname ? TagType.CodeRenderExpression : TagType.CodeRender));
+ }
+
+ public event ParseErrorHandler Error;
+ public event TagParsedHandler TagParsed;
+ public event TextParsedHandler TextParsed;
+
+ void OnError (string msg)
+ {
+ if (Error != null)
+ Error (this, msg);
+ }
+
+ void OnTagParsed (TagType tagtype, string id, TagAttributes attributes)
+ {
+ if (TagParsed != null)
+ TagParsed (this, tagtype, id, attributes);
+ }
+
+ void OnTextParsed (string text)
+ {
+ if (TextParsed != null)
+ TextParsed (this, text);
+ }
+ }
+
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs b/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs
new file mode 100644
index 00000000000..231c7236a84
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs
@@ -0,0 +1,330 @@
+//
+// System.Web.Compilation.AspTokenizer
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.IO;
+using System.Text;
+
+namespace System.Web.Compilation
+{
+ class Token
+ {
+ public const int EOF = 0x0200000;
+ public const int IDENTIFIER = 0x0200001;
+ public const int DIRECTIVE = 0x0200002;
+ public const int ATTVALUE = 0x0200003;
+ public const int TEXT = 0x0200004;
+ public const int DOUBLEDASH = 0x0200005;
+ public const int CLOSING = 0x0200006;
+ }
+
+ class AspTokenizer
+ {
+ TextReader sr;
+ int current_token;
+ StringBuilder sb, odds;
+ int col, line;
+ int begcol, begline;
+ int position;
+ bool inTag;
+ bool expectAttrValue;
+ bool hasPutBack;
+ bool verbatim;
+ bool have_value;
+ bool have_unget;
+ int unget_value;
+ string val;
+
+ public AspTokenizer (TextReader reader)
+ {
+ this.sr = reader;
+ sb = new StringBuilder ();
+ odds= new StringBuilder();
+ col = line = 1;
+ hasPutBack = inTag = false;
+ }
+
+ public bool Verbatim
+ {
+ get { return verbatim; }
+ set { verbatim = value; }
+ }
+
+ public void put_back ()
+ {
+ if (hasPutBack)
+ throw new HttpException ("put_back called twice!");
+
+ hasPutBack = true;
+ position -= Value.Length;
+ }
+
+ public int get_token ()
+ {
+ if (hasPutBack){
+ hasPutBack = false;
+ position += Value.Length;
+ return current_token;
+ }
+
+ begline = line;
+ begcol = col;
+ have_value = false;
+ current_token = NextToken ();
+ return current_token;
+ }
+
+ bool is_identifier_start_character (char c)
+ {
+ return (Char.IsLetter (c) || c == '_' );
+ }
+
+ bool is_identifier_part_character (char c)
+ {
+ return (Char.IsLetterOrDigit (c) || c == '_' || c == '-');
+ }
+
+ void ungetc (int value)
+ {
+ have_unget = true;
+ unget_value = value;
+
+ // Only '/' passes through here now.
+ // If we ever let \n here, update 'line'
+ position--;
+ col--;
+ }
+
+ int read_char ()
+ {
+ int c;
+ if (have_unget) {
+ c = unget_value;
+ have_unget = false;
+ } else {
+ c = sr.Read ();
+ }
+
+ if (c == '\r' && sr.Peek () == '\n') {
+ c = sr.Read ();
+ position++;
+ }
+
+ if (c == '\n'){
+ col = -1;
+ line++;
+ }
+
+ if (c != -1) {
+ col++;
+ position++;
+ }
+
+ return c;
+ }
+
+ int ReadAttValue (int start)
+ {
+ int quoteChar = 0;
+ bool quoted = false;
+
+ if (start == '"' || start == '\'') {
+ quoteChar = start;
+ quoted = true;
+ } else {
+ sb.Append ((char) start);
+ }
+
+ int c;
+ int last = 0;
+ bool inServerTag = false;
+
+ while ((c = sr.Peek ()) != -1) {
+ if (c == '%' && last == '<') {
+ inServerTag = true;
+ } else if (inServerTag && c == '>' && last == '%') {
+ inServerTag = false;
+ } else if (!inServerTag) {
+ if (!quoted && c == '/') {
+ read_char ();
+ c = sr.Peek ();
+ if (c == -1) {
+ c = '/';
+ } else if (c == '>') {
+ ungetc ('/');
+ break;
+ }
+ } else if (!quoted && (c == '>' || Char.IsWhiteSpace ((char) c))) {
+ break;
+ } else if (quoted && c == quoteChar && last != '\\') {
+ read_char ();
+ break;
+ }
+ }
+
+ sb.Append ((char) c);
+ read_char ();
+ last = c;
+ }
+
+ return Token.ATTVALUE;
+ }
+
+ int NextToken ()
+ {
+ int c;
+
+ sb.Length = 0;
+ odds.Length=0;
+ while ((c = read_char ()) != -1){
+ if (verbatim){
+ inTag = false;
+ sb.Append ((char) c);
+ return c;
+ }
+
+ if (inTag && expectAttrValue && (c == '"' || c == '\''))
+ return ReadAttValue (c);
+
+ if (c == '<'){
+ inTag = true;
+ sb.Append ((char) c);
+ return c;
+ }
+
+ if (c == '>'){
+ inTag = false;
+ sb.Append ((char) c);
+ return c;
+ }
+
+ if (current_token == '<' && "%/!".IndexOf ((char) c) != -1){
+ sb.Append ((char) c);
+ return c;
+ }
+
+ if (inTag && current_token == '%' && "@#=".IndexOf ((char) c) != -1){
+ sb.Append ((char) c);
+ return c;
+ }
+
+ if (inTag && c == '-' && sr.Peek () == '-'){
+ sb.Append ("--");
+ read_char ();
+ return Token.DOUBLEDASH;
+ }
+
+ if (!inTag){
+ sb.Append ((char) c);
+ while ((c = sr.Peek ()) != -1 && c != '<')
+ sb.Append ((char) read_char ());
+
+ return (c != -1 || sb.Length > 0) ? Token.TEXT : Token.EOF;
+ }
+
+ if (inTag && current_token == '=' && !Char.IsWhiteSpace ((char) c))
+ return ReadAttValue (c);
+
+ if (inTag && is_identifier_start_character ((char) c)){
+ sb.Append ((char) c);
+ while ((c = sr.Peek ()) != -1) {
+ if (!is_identifier_part_character ((char) c) && c != ':')
+ break;
+ sb.Append ((char) read_char ());
+ }
+
+ if (current_token == '@' && Directive.IsDirective (sb.ToString ()))
+ return Token.DIRECTIVE;
+
+ return Token.IDENTIFIER;
+ }
+
+ if (!Char.IsWhiteSpace ((char) c)) {
+ sb.Append ((char) c);
+ return c;
+ }
+ // keep otherwise discarded characters in case we need.
+ odds.Append((char) c);
+ }
+
+ return Token.EOF;
+ }
+
+ public string Value {
+ get {
+ if (have_value)
+ return val;
+
+ have_value = true;
+ val = sb.ToString ();
+ return val;
+ }
+ }
+
+ public string Odds {
+ get {
+ return odds.ToString();
+ }
+ }
+
+ public bool InTag {
+ get { return inTag; }
+ set { inTag = value; }
+ }
+
+ // Hack for preventing confusion with VB comments (see bug #63451)
+ public bool ExpectAttrValue {
+ get { return expectAttrValue; }
+ set { expectAttrValue = value; }
+ }
+
+ public int BeginLine {
+ get { return begline; }
+ }
+
+ public int BeginColumn {
+ get { return begcol; }
+ }
+
+ public int EndLine {
+ get { return line; }
+ }
+
+ public int EndColumn {
+ get { return col; }
+ }
+
+ public int Position {
+ get { return position; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs
new file mode 100644
index 00000000000..18ef9895b9d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs
@@ -0,0 +1,349 @@
+//
+// System.Web.Compilation.BaseCompiler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) Copyright 2002,2003 Ximian, Inc (http://www.ximian.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;
+using System.CodeDom;
+using System.CodeDom.Compiler;
+using System.Collections;
+using System.Reflection;
+using System.Text;
+using System.Web.UI;
+using System.Web.Configuration;
+using System.IO;
+
+namespace System.Web.Compilation
+{
+ abstract class BaseCompiler
+ {
+ protected static string dynamicBase = AppDomain.CurrentDomain.SetupInformation.DynamicBase;
+ TemplateParser parser;
+ CodeDomProvider provider;
+ ICodeCompiler compiler;
+ CodeCompileUnit unit;
+ CodeNamespace mainNS;
+ CompilerParameters compilerParameters;
+ protected CodeTypeDeclaration mainClass;
+ protected CodeTypeReferenceExpression mainClassExpr;
+ protected static CodeThisReferenceExpression thisRef = new CodeThisReferenceExpression ();
+
+ protected BaseCompiler (TemplateParser parser)
+ {
+ compilerParameters = new CompilerParameters ();
+ this.parser = parser;
+ }
+
+ void Init ()
+ {
+ unit = new CodeCompileUnit ();
+ mainNS = new CodeNamespace ("ASP");
+ unit.Namespaces.Add (mainNS);
+ mainClass = new CodeTypeDeclaration (parser.ClassName);
+ mainClass.TypeAttributes = TypeAttributes.Public;
+ mainNS.Types.Add (mainClass);
+ mainClass.BaseTypes.Add (new CodeTypeReference (parser.BaseType.FullName));
+ mainClassExpr = new CodeTypeReferenceExpression ("ASP." + parser.ClassName);
+ foreach (object o in parser.Imports) {
+ if (o is string)
+ mainNS.Imports.Add (new CodeNamespaceImport ((string) o));
+ }
+
+ if (parser.Assemblies != null) {
+ foreach (object o in parser.Assemblies) {
+ if (o is string)
+ unit.ReferencedAssemblies.Add ((string) o);
+ }
+ }
+
+ // Late-bound generators specifics (as for MonoBASIC/VB.NET)
+ unit.UserData["RequireVariableDeclaration"] = parser.ExplicitOn;
+ unit.UserData["AllowLateBound"] = !parser.StrictOn;
+
+ AddInterfaces ();
+ AddClassAttributes ();
+ CreateStaticFields ();
+ AddApplicationAndSessionObjects ();
+ AddScripts ();
+ CreateConstructor (null, null);
+ }
+
+ protected virtual void CreateStaticFields ()
+ {
+ CodeMemberField fld = new CodeMemberField (typeof (bool), "__intialized");
+ fld.Attributes = MemberAttributes.Private | MemberAttributes.Static;
+ fld.InitExpression = new CodePrimitiveExpression (false);
+ mainClass.Members.Add (fld);
+ }
+
+ protected virtual void CreateConstructor (CodeStatementCollection localVars,
+ CodeStatementCollection trueStmt)
+ {
+ CodeConstructor ctor = new CodeConstructor ();
+ ctor.Attributes = MemberAttributes.Public;
+ mainClass.Members.Add (ctor);
+
+ if (localVars != null)
+ ctor.Statements.AddRange (localVars);
+
+ CodeTypeReferenceExpression r;
+ r = new CodeTypeReferenceExpression (mainNS.Name + "." + mainClass.Name);
+ CodeFieldReferenceExpression intialized;
+ intialized = new CodeFieldReferenceExpression (r, "__intialized");
+
+ CodeBinaryOperatorExpression bin;
+ bin = new CodeBinaryOperatorExpression (intialized,
+ CodeBinaryOperatorType.ValueEquality,
+ new CodePrimitiveExpression (false));
+
+ CodeAssignStatement assign = new CodeAssignStatement (intialized,
+ new CodePrimitiveExpression (true));
+
+ CodeConditionStatement cond = new CodeConditionStatement (bin, assign);
+ if (trueStmt != null)
+ cond.TrueStatements.AddRange (trueStmt);
+
+ ctor.Statements.Add (cond);
+ }
+
+ void AddScripts ()
+ {
+ if (parser.Scripts == null || parser.Scripts.Count == 0)
+ return;
+
+ foreach (object o in parser.Scripts) {
+ if (o is string)
+ mainClass.Members.Add (new CodeSnippetTypeMember ((string) o));
+ }
+ }
+
+ protected virtual void CreateMethods ()
+ {
+ }
+
+ protected virtual void AddInterfaces ()
+ {
+ if (parser.Interfaces == null)
+ return;
+
+ foreach (object o in parser.Interfaces) {
+ if (o is string)
+ mainClass.BaseTypes.Add (new CodeTypeReference ((string) o));
+ }
+ }
+
+ protected virtual void AddClassAttributes ()
+ {
+ }
+
+ protected virtual void AddApplicationAndSessionObjects ()
+ {
+ }
+
+ /* Utility methods for <object> stuff */
+ protected void CreateApplicationOrSessionPropertyForObject (Type type,
+ string propName,
+ bool isApplication,
+ bool isPublic)
+ {
+ /* if isApplication this generates (the 'cachedapp' field is created earlier):
+ private MyNS.MyClass app {
+ get {
+ if ((this.cachedapp == null)) {
+ this.cachedapp = ((MyNS.MyClass)
+ (this.Application.StaticObjects.GetObject("app")));
+ }
+ return this.cachedapp;
+ }
+ }
+
+ else, this is for Session:
+ private MyNS.MyClass ses {
+ get {
+ return ((MyNS.MyClass) (this.Session.StaticObjects.GetObject("ses")));
+ }
+ }
+
+ */
+
+ CodeExpression result = null;
+
+ CodeMemberProperty prop = new CodeMemberProperty ();
+ prop.Type = new CodeTypeReference (type);
+ prop.Name = propName;
+ if (isPublic)
+ prop.Attributes = MemberAttributes.Public | MemberAttributes.Final;
+ else
+ prop.Attributes = MemberAttributes.Private | MemberAttributes.Final;
+
+ CodePropertyReferenceExpression p1;
+ if (isApplication)
+ p1 = new CodePropertyReferenceExpression (thisRef, "Application");
+ else
+ p1 = new CodePropertyReferenceExpression (thisRef, "Session");
+
+ CodePropertyReferenceExpression p2;
+ p2 = new CodePropertyReferenceExpression (p1, "StaticObjects");
+
+ CodeMethodReferenceExpression getobject;
+ getobject = new CodeMethodReferenceExpression (p2, "GetObject");
+
+ CodeMethodInvokeExpression invoker;
+ invoker = new CodeMethodInvokeExpression (getobject,
+ new CodePrimitiveExpression (propName));
+
+ CodeCastExpression cast = new CodeCastExpression (prop.Type, invoker);
+
+ if (isApplication) {
+ CodeFieldReferenceExpression field;
+ field = new CodeFieldReferenceExpression (thisRef, "cached" + propName);
+
+ CodeConditionStatement stmt = new CodeConditionStatement();
+ stmt.Condition = new CodeBinaryOperatorExpression (field,
+ CodeBinaryOperatorType.IdentityEquality,
+ new CodePrimitiveExpression (null));
+
+ CodeAssignStatement assign = new CodeAssignStatement ();
+ assign.Left = field;
+ assign.Right = cast;
+ stmt.TrueStatements.Add (assign);
+ prop.GetStatements.Add (stmt);
+ result = field;
+ } else {
+ result = cast;
+ }
+
+ prop.GetStatements.Add (new CodeMethodReturnStatement (result));
+ mainClass.Members.Add (prop);
+ }
+
+ protected string CreateFieldForObject (Type type, string name)
+ {
+ string fieldName = "cached" + name;
+ CodeMemberField f = new CodeMemberField (type, fieldName);
+ f.Attributes = MemberAttributes.Private;
+ mainClass.Members.Add (f);
+ return fieldName;
+ }
+
+ protected void CreatePropertyForObject (Type type, string propName, string fieldName, bool isPublic)
+ {
+ CodeFieldReferenceExpression field = new CodeFieldReferenceExpression (thisRef, fieldName);
+ CodeMemberProperty prop = new CodeMemberProperty ();
+ prop.Type = new CodeTypeReference (type);
+ prop.Name = propName;
+ if (isPublic)
+ prop.Attributes = MemberAttributes.Public | MemberAttributes.Final;
+ else
+ prop.Attributes = MemberAttributes.Private | MemberAttributes.Final;
+
+ CodeConditionStatement stmt = new CodeConditionStatement();
+ stmt.Condition = new CodeBinaryOperatorExpression (field,
+ CodeBinaryOperatorType.IdentityEquality,
+ new CodePrimitiveExpression (null));
+
+ CodeObjectCreateExpression create = new CodeObjectCreateExpression (prop.Type);
+ stmt.TrueStatements.Add (new CodeAssignStatement (field, create));
+ prop.GetStatements.Add (stmt);
+ prop.GetStatements.Add (new CodeMethodReturnStatement (field));
+
+ mainClass.Members.Add (prop);
+ }
+ /******/
+
+ void CheckCompilerErrors (CompilerResults results)
+ {
+ if (results.NativeCompilerReturnValue == 0)
+ return;
+
+ StringWriter writer = new StringWriter();
+ provider.CreateGenerator().GenerateCodeFromCompileUnit (unit, writer, null);
+ throw new CompilationException (parser.InputFile, results.Errors, writer.ToString ());
+ }
+
+ public virtual Type GetCompiledType ()
+ {
+ Type type = CachingCompiler.GetTypeFromCache (parser.InputFile);
+ if (type != null)
+ return type;
+
+ Init ();
+ string lang = parser.Language;
+ CompilationConfiguration config;
+
+ config = CompilationConfiguration.GetInstance (parser.Context);
+ provider = config.GetProvider (lang);
+ if (provider == null)
+ throw new HttpException ("Configuration error. Language not supported: " +
+ lang, 500);
+
+ compiler = provider.CreateCompiler ();
+
+ CreateMethods ();
+ compilerParameters.IncludeDebugInformation = parser.Debug;
+ compilerParameters.CompilerOptions = config.GetCompilerOptions (lang) + " " +
+ parser.CompilerOptions;
+
+ compilerParameters.WarningLevel = config.GetWarningLevel (lang);
+ bool keepFiles = (Environment.GetEnvironmentVariable ("MONO_ASPNET_NODELETE") != null);
+ if (!Directory.Exists (dynamicBase))
+ Directory.CreateDirectory (dynamicBase);
+
+ TempFileCollection tempcoll = new TempFileCollection (config.TempDirectory, keepFiles);
+ compilerParameters.TempFiles = tempcoll;
+ string dllfilename = Path.GetFileName (tempcoll.AddExtension ("dll", true));
+ compilerParameters.OutputAssembly = Path.Combine (dynamicBase, dllfilename);
+
+ CompilerResults results = CachingCompiler.Compile (this);
+ CheckCompilerErrors (results);
+ if (results.CompiledAssembly == null)
+ throw new CompilationException (parser.InputFile, results.Errors,
+ "No assembly returned after compilation!?");
+
+ results.TempFiles.Delete ();
+ return results.CompiledAssembly.GetType (mainClassExpr.Type.BaseType, true);
+ }
+
+ internal CompilerParameters CompilerParameters {
+ get { return compilerParameters; }
+ }
+
+ internal CodeCompileUnit Unit {
+ get { return unit; }
+ }
+
+ internal virtual ICodeCompiler Compiler {
+ get { return compiler; }
+ }
+
+ internal TemplateParser Parser {
+ get { return parser; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/BuildProviderResultFlags.cs b/mcs/class/System.Web/System.Web.Compilation/BuildProviderResultFlags.cs
new file mode 100644
index 00000000000..3cd3ea5723a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/BuildProviderResultFlags.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.Compilation.BuildProviderResultFlags.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System.Resources;
+
+#if NET_2_0
+namespace System.Web.Compilation
+{
+ [Serializable, Flags]
+ public enum BuildProviderResultFlags
+ {
+ Default = 0,
+ ShutdownAppDomainOnChange = 1
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs
new file mode 100644
index 00000000000..2e469984335
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs
@@ -0,0 +1,178 @@
+//
+// System.Web.Compilation.CachingCompiler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+// (c) Copyright 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
+// "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;
+using System.CodeDom.Compiler;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Reflection;
+using System.Web.UI;
+using System.Web.Caching;
+using System.Web.Configuration;
+
+namespace System.Web.Compilation
+{
+ class CachingCompiler
+ {
+ static object compilationLock = new object ();
+ const string cachePrefix = "@@Assembly";
+ const string cacheTypePrefix = "@@@Type";
+
+ public static void InsertType (Type type, string filename)
+ {
+ string [] cacheKeys = new string [] { cachePrefix + filename };
+ CacheDependency dep = new CacheDependency (null, cacheKeys);
+ HttpRuntime.Cache.Insert (cacheTypePrefix + filename, type, dep);
+ }
+
+ public static Type GetTypeFromCache (string filename)
+ {
+ return (Type) HttpRuntime.Cache [cacheTypePrefix + filename];
+ }
+
+ public static CompilerResults Compile (BaseCompiler compiler)
+ {
+ Cache cache = HttpRuntime.Cache;
+ string key = cachePrefix + compiler.Parser.InputFile;
+ CompilerResults results = (CompilerResults) cache [key];
+ if (results != null)
+ return results;
+
+ lock (compilationLock) {
+ results = (CompilerResults) cache [key];
+ if (results != null)
+ return results;
+
+ ICodeCompiler comp = compiler.Compiler;
+ results = comp.CompileAssemblyFromDom (compiler.CompilerParameters, compiler.Unit);
+ string [] deps = (string []) compiler.Parser.Dependencies.ToArray (typeof (string));
+ cache.Insert (key, results, new CacheDependency (deps));
+ }
+
+ return results;
+ }
+
+ public static CompilerResults Compile (WebServiceCompiler compiler)
+ {
+ string key = cachePrefix + compiler.Parser.PhysicalPath;
+ Cache cache = HttpRuntime.Cache;
+ CompilerResults results = (CompilerResults) cache [key];
+ if (results != null)
+ return results;
+
+ lock (compilationLock) {
+ results = (CompilerResults) cache [key];
+ if (results != null)
+ return results;
+
+ SimpleWebHandlerParser parser = compiler.Parser;
+ CompilerParameters options = compiler.CompilerOptions;
+ options.IncludeDebugInformation = parser.Debug;
+ results = compiler.Compiler.CompileAssemblyFromFile (options, compiler.InputFile);
+ string [] deps = (string []) parser.Dependencies.ToArray (typeof (string));
+ cache.Insert (key, results, new CacheDependency (deps));
+ }
+
+ return results;
+ }
+
+ internal static CompilerParameters GetOptions (ICollection assemblies)
+ {
+ CompilerParameters options = new CompilerParameters ();
+ if (assemblies != null) {
+ StringCollection coll = options.ReferencedAssemblies;
+ foreach (string str in assemblies)
+ coll.Add (str);
+ }
+
+ return options;
+ }
+
+ public static CompilerResults Compile (string language, string key, string file,
+ ArrayList assemblies)
+ {
+ Cache cache = HttpRuntime.Cache;
+ CompilerResults results = (CompilerResults) cache [cachePrefix + key];
+ if (results != null)
+ return results;
+
+ lock (compilationLock) {
+ results = (CompilerResults) cache [cachePrefix + key];
+ if (results != null)
+ return results;
+
+ CompilationConfiguration config;
+ config = CompilationConfiguration.GetInstance (HttpContext.Current);
+ CodeDomProvider provider = config.GetProvider (language);
+ if (provider == null)
+ throw new HttpException ("Configuration error. Language not supported: " +
+ language, 500);
+
+ ICodeCompiler compiler = provider.CreateCompiler ();
+ CompilerParameters options = GetOptions (assemblies);
+ results = compiler.CompileAssemblyFromFile (options, file);
+ ArrayList realdeps = new ArrayList (assemblies.Count + 1);
+ realdeps.Add (file);
+ for (int i = assemblies.Count - 1; i >= 0; i--) {
+ string current = (string) assemblies [i];
+ if (Path.IsPathRooted (current))
+ realdeps.Add (current);
+ }
+
+ string [] deps = (string []) realdeps.ToArray (typeof (string));
+ cache.Insert (cachePrefix + key, results, new CacheDependency (deps));
+ }
+
+ return results;
+ }
+
+ public static Type CompileAndGetType (string typename, string language, string key,
+ string file, ArrayList assemblies)
+ {
+ CompilerResults result = CachingCompiler.Compile (language, key, file, assemblies);
+ if (result.NativeCompilerReturnValue != 0) {
+ StreamReader reader = new StreamReader (file);
+ throw new CompilationException (file, result.Errors, reader.ReadToEnd ());
+ }
+
+ Assembly assembly = result.CompiledAssembly;
+ if (assembly == null) {
+ StreamReader reader = new StreamReader (file);
+ throw new CompilationException (file, result.Errors, reader.ReadToEnd ());
+ }
+
+ Type type = assembly.GetType (typename, true);
+ InsertType (type, file);
+ return type;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/ChangeLog b/mcs/class/System.Web/System.Web.Compilation/ChangeLog
new file mode 100644
index 00000000000..f4d6f84550e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/ChangeLog
@@ -0,0 +1,966 @@
+2005-05-03 Lluis Sanchez Gual <lluis@novell.com>
+
+ * WebServiceCompiler.cs: Create the temp directory before
+ creating the web service source code file.
+
+2005-04-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: when checking languages, try to match other aliases
+ too (ie, 'cs' == 'c#').
+
+2005-04-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseCompiler.cs: check that DynamicBase directory exists before
+ creating the TempFileCollection.
+
+2005-04-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: use a stack for non-server tags even before getting
+ to a form. Fixes bug #70274.
+
+2005-04-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspParser.cs: don't error out on ill formed tags if it's not a server
+ tag (ie, allow something like '<table align="left cellpadding="0">' to
+ work, as MS does. Fixes bug #67909.
+
+2005-04-20 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * BaseCompiler.cs: do the bridge of Explicit/Strict attributes from
+ @Page/@Control directives to CodeDOM (VB.NET support)
+
+2005-04-19 Lluis Sanchez Gual <lluis@novell.com>
+
+ * 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 <lluis@novell.com>
+
+ * TemplateControlCompiler.cs: Implemented support for two-way
+ binding.
+
+2005-04-14 Lluis Sanchez Gual <lluis@novell.com>
+
+ * TemplateControlCompiler.cs: Use the new BindingContainerType
+ property to find the type of the binding container.
+
+2005-04-07 Lluis Sanchez Gual <lluis@novell.com>
+
+ * TemplateControlCompiler.cs: Avoid using the GetConverter() trick
+ for primitive types. Parse an empty color string as Color.Empty.
+ Get the converter for a property using its PropertyDescriptor.
+
+2005-04-05 Lluis Sanchez Gual <lluis@novell.com>
+
+ * TemplateControlCompiler.cs: Don't autogenerate IDs for
+ controls inside Content template.
+
+2005-03-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControlCompiler.cs: make typedesc.aspx work again.
+
+2005-02-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ExpressionBuilderContext.cs:
+ * ExpressionBuilder.cs: implemented.
+
+2005-02-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: don't fail on <tbody runat=server>. Fixes bug #71856.
+
+2005-01-28 Lluis Sanchez Gual <lluis@novell.com>
+
+ * TemplateControlCompiler.cs: When generating a property value,
+ check for TypeConverterAttribute in the PropertyInfo, not only in the
+ property type.
+ Implemented code generation using InstanceDescriptor, when the type
+ converter supports conversion to that type.
+
+2005-01-21 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Directive.cs: Added MASTER directive.
+ * AspGenerator.cs: Use UserControlCompiler for compiling master pages.
+ * PageCompiler.cs: Set the master file name when generating the page.
+ * TemplateControlCompiler.cs: When generating the method for a
+ content holder, register the content holder in the base MasterPage.
+ Added method for registering a Content control for a MasterPage.
+ Generate code for Content controls.
+
+2005-01-10 Lluis Sanchez Gual <lluis@novell.com>
+
+ * TemplateControlCompiler.cs: Get the container type from the
+ template (if it was defined using TemplateContainerAttribute.
+
+2004-10-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: correctly process script tags that self-closing.
+ Fixes bug #69657.
+
+2004-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CachingCompiler.cs: when compiling a single .cs file, add the file
+ itself to dependencies. Fixes bug #68788.
+
+2004-09-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ControlBuilder.cs: don't close server tags when we get to a closing
+ tag that is not applied to a server control. Fixes bug #60323.
+
+2004-09-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebServiceCompiler.cs: fix buglet in my last commit.
+
+2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseCompiler.cs:
+ * CachingCompiler.cs:
+ * WebServiceCompiler.cs: correctly cache Type instead of the assembly
+ for ashx/asmx. Otherwise we need to open the file and check for the
+ class name in there. Thanks to Ben for pointing this out.
+
+2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspParser.cs:
+ * AspTokenizer.cs: prevent quotes from being swallowed when we're
+ inside a server tag and they are the next non-whitespace character.
+ Fixes bug #63451.
+
+2004-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CachingCompiler.cs: don't try to watch for changes in system
+ assemblies. Fixes bug #64871.
+
+2004-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: handle builders that need to process inner text
+ with tags.
+
+ * Location.cs: added setters for the properties.
+
+2004-08-02 Duncan Mak <duncan@ximian.com>
+
+ * BuildProviderResultFlags.cs:
+ * IImplicitResourceProvider.cs:
+ * ImplicitResourceKey.cs:
+ * IResourceReader.cs: Added.
+
+2004-07-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: the path for file was treated as virtual, but it's
+ physical. Fixes bug #61524.
+
+2004-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspParser.cs: fixed case-sensitivity issues with #include and its
+ attributes. Closes #61429.
+
+2004-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseCompiler.cs:
+ * WebServiceCompiler.cs: really create the dlls under DynamicBase
+
+2004-06-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControlCompiler.cs: for system colors, use SystemColors class
+ instead of Color. Fixes bug #60249.
+
+2004-06-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseCompiler.cs: try getting the Type from the cache before doing the
+ real work. Remove temporary files right after successful compilation.
+
+ * CachingCompiler.cs: added GetTypeFromCache.
+
+ * UserControlCompiler.cs: nothing interesting.
+
+ * WebServiceCompiler.cs: try getting the Type from the cache before
+ doing anything else. Remove temp files on sucessful compilation.
+
+2004-06-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs:
+ * CachingCompiler.cs: use a different prefix when caching compiler
+ results or Types.
+
+2004-06-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseCompiler.cs: dynamicBase is now protected. Check
+ MONO_ASPNET_NODELETE here.
+
+ * TemplateControlCompiler.cs: if the type is not known but has a
+ TypeConverter, invoke ConvertFromString in the generated code.
+
+ * WebServiceCompiler.cs: it used a hardcoded C# compiler, now it gets
+ the compiler from the configuration. Also handle MONO_ASPNET_NODELETE.
+
+ * CachingCompiler.cs: updated compilation of web services and simple
+ web handlers.
+
+2004-06-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CSCompiler.cs: removed.
+
+ * CachingCompiler.cs: language independent compilation for single files.
+
+2004-06-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseCompiler.cs:
+ * WebServiceCompiler.cs: adapted to the 'new' CachingCompiler.
+ * CachingCompiler.cs: use HttpRuntime.Cache.
+
+2004-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PageCompiler.cs: fixed Trace and add support for Buffer.
+
+2004-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PageCompiler.cs: override CreateConstructor to add assignment for
+ ClientTarget.
+
+2004-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControlCompiler.cs: use CodeDelegateCreateExpression instead
+ of CodeObjectCreateExpression for the render method delegate. Thanks
+ to Jochen Wezel.
+
+2004-05-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseCompiler.cs: use DynamicBase for the output assemblies.
+
+2004-05-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: ObjectTagBuilder do not override HasBody now.
+
+2004-05-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspParser.cs: indent a few lines.
+ * AspTokenizer.cs: added ungetc() used when we read a '/' in an unquoted
+ attribute value. This way we can simulate reading 2 characters ahead
+ (one in ungetc and the other in Peek) and work with values like
+ text/javascript. Fixes bug #57302.
+
+2004-05-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspParser.cs: ignore whitespace after directives. Fixes bug #58057.
+
+2004-04-02 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * TemplateControlCompiler.cs: Fixed build for net_1_0 profile.
+
+2004-03-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * GlobalAsaxCompiler.cs: removed Imports and Assemblies properties.
+
+2004-02-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: error out when <object> server tag is not closed.
+ Ignore any content inside it.
+
+2004-02-10 Jackson Harper <jackson@ximian.com>
+
+ * AspTokenizer.cs: Collect discarded characters that might be used
+ in client side scripts. Patch by Liyu Liu.
+ * AspParser.cs: Add discarded characters. Patch by Liyu Liu.
+
+2004-02-10 Jackson Harper <jackson@ximian.com>
+
+ * BaseCompiler.cs: Use the TempDirectory for compilation. Fixes
+ bug #54117.
+
+2004-01-30 Jackson Harper <jackson@ximian.com>
+
+ * TemplateControlCompiler.cs: Call ToString on the types hashcode,
+ the build method takes strings not ints.
+
+2004-01-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: handle more possible errors in global.asax file.
+
+ * BaseCompiler.cs: added utility methods for creating <object> related
+ properties and fields.
+
+ * GlobalAsaxCompiler.cs: keep around applications and session scope
+ objects builders. Also a list of imports and assemblies added in
+ global.asax.
+
+ * TemplateControlCompiler.cs: use base class methods for <object> stuff.
+
+2004-01-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: use the Cache to store compiled Types. Don't parse
+ pages more than once. Thanks to Eric Lindvall for pointing this out.
+
+2004-01-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControlCompiler.cs: allow handling subproperties for other
+ types than Style and Font. Fixes bug #53217.
+
+2004-01-16 Jackson Harper <jackson@ximian.com>
+
+ * TagAttribute.cs: attributes can be stored as encoded html so we
+ decode them here.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * TemplateControlCompiler.cs: Is a user control is cached and
+ shared use the controls type hashcode for the GUID so it will be
+ the same across instances.
+
+2004-01-13 Jackson Harper <jackson@ximian.com>
+
+ * TemplateControlCompiler.cs: If an item has the partial caching
+ attribute build a PartialCachingControl in the parents __Build method.
+ * BaseCompiler.cs: Add a method for adding class attributes to the
+ class.
+ * UserControlCompiler.cs: If caching is enabled on a user control
+ add the PartialCachingAttribute to it.
+
+2004-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PageCompiler.cs: invoke Request.ValidateInput if required.
+
+2004-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: don't rely on GC to close the files parsed. Fixes bug
+ #52521. Patch by liyul@hotmail.com.
+
+2003-12-25 Jackson Harper <jackson@ximian.com>
+
+ * AspGenerator.cs: Allow scriptlets in javascript. This fixes bug
+ #52522.
+
+2003-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PageCompiler.cs: assign the ErrorPage property if provided.
+
+2003-12-15 Jackson Harper <jackson@ximian.com>
+
+ * PageCompiler.cs: Add Trace and TraceMode to framework initialize
+ method if they are set.
+
+2003-12-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: ignore <tbody> when we're inside a server table and
+ fail when runat="server" is applied to <tbody> with a parse error
+ instead of waiting for a compilation error. Fixes bug #52157.
+
+2003-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: basic checking of ID validity. Throw a
+ ParseException when mixing languages.
+
+2003-11-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PageCompiler.cs: assign LCID, Culture and/or UICulture in
+ FrameworInitialize() if provided in @Page.
+
+ Fixes bug #51511.
+
+2003-11-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControlCompiler.cs: support for expressions of
+ System.Drawing.Size type. Allow getting Color from comma separated
+ numbers, which is not allowed by ColorConverter.
+
+ This makes http://www.codeproject.com/aspnet/asppopup.asp work.
+
+2003-11-13 Jackson Harper <jackson@ximian.com>
+
+ * PageCompiler.cs: Call InitOutputCache when the OutputCache
+ directive is set.
+
+2003-11-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: use fileEncoding from configuration files.
+
+ * PageCompiler.cs: add assign statements for ContentType,
+ ResponseEncoding and CodePage if supplied.
+
+2003-10-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControlCompiler.cs: fix bug #42994. Now we don't generate
+ a return statement for user controls with 'void' return type.
+
+2003-10-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspParser.cs: fixed bug #49627.
+
+2003-10-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseCompiler.cs: now gets the CodeCompiler from configuration files.
+
+2003-10-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Directive.cs: new attribute for @Page directive in 1.1.
+
+2003-10-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspParser.cs:
+ * TagAttributes.cs: allow duplicated runat=server attributes and display
+ error page when duplicated attributes and runat is specified.
+
+2003-10-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspTokenizer.cs: moved token numbers above unicode.
+
+2003-09-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: don't process code render tags inside scripts. Check
+ the language of the script and treat javascript as verbatim input.
+ Fixes bug #48592.
+
+2003-09-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControlCompiler.cs: fixed bug #48212.
+
+2003-09-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebServiceCompiler.cs: remove the temporary files here too.
+
+2003-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: fixed bug #46429.
+
+2003-08-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Directive.cs: support @WebHandler.
+
+2003-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControlCompiler.cs: support string []. Fixes bug #46415.
+
+2003-07-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseCompiler.cs: first look for cached items, then generate the tree.
+ This should speed things up.
+
+ * CachingCompiler.cs: when compiling web services, use the full path of
+ the .asmx file as key when caching.
+
+ * WebServiceCompiler.cs: first look for cached items, then generate
+ the source file.
+
+2003-07-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspParser.cs: more useful error information,
+
+ * BaseCompiler.cs:
+ * CachingCompiler.cs: honor the debug="true" option.
+
+ * TemplateControlCompiler.cs: small fixes for templates.
+
+2003-07-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseCompiler.cs: made Compiler property virtual.
+
+ * CachingCompiler.cs: added support for compiling web services.
+
+ * WebServiceCompiler.cs: implemented.
+
+2003-05-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CachingCompiler.cs: fixed bug #43477.
+
+2003-05-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspParser.cs:
+ * AspTokenizer.cs: fixed bugs #43206 and #43371.
+
+2003-05-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControlCompiler.cs: duh! Generate SupportAutoEvents instead
+ of AutoEventWireup (which is internal). Thanks to Stuart Ballard for
+ reporting.
+
+2003-05-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CompilationException.cs: don't add duplicated lines in the case that
+ mcs reports several errors for the same one.
+
+2003-05-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: fully support including files, ie., treat them just
+ as C treats #includes.
+
+2003-05-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs:
+ * AspParser.cs:
+ * TagType.cs: Added support for server side includes.
+
+2003-05-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CSCompiler.cs: actually add the list of referenced assemblies to the
+ compiler options. Throw a CompilationException if there's an error.
+
+ * CachingCompiler.cs: added a method to compile directly from a source
+ file.
+
+2003-05-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: copy the location before setting the value for the
+ control builders.
+
+ * BaseCompiler.cs: changed parameters for CompilationException.
+
+ * CompilationException.cs: it takes now line numbers and error
+ descriptions from the CompilerErrorCollection.
+
+ * Location.cs: used when a copy of an ILocation is needed.
+
+ * ParseException.cs: implemented new methods to provide line numbers
+ and souce file.
+
+ * TemplateControlCompiler.cs: throw a ParseException where appropiate.
+
+2003-05-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: also support data bind syntax inside tags not
+ processed as controls. Added debugging method.
+
+ * TemplateControlCompiler.cs: reset the number of data binding handlers
+ in the proper place. Small fix when getting the container type.
+
+2003-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControlCompiler.cs: correctly set the TemplateSourceDirectory
+ value.
+
+2003-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: handle code render syntax in tag attributes.
+
+ * AspParser.cs: the constructor now takes a TextReader.
+
+ * TemplateControlCompiler.cs: removed comment.
+
+2003-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControlCompiler.cs: added support for data bound properties.
+
+2003-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspComponentFoundry.cs: simplified it a lot by using Type and Assembly
+ instead of their names.
+
+ * AspElements.cs: removed. No longer needed.
+
+ * AspGenerator.cs: this file is now in charge of interfacing between
+ the parser and the compiler. It manages the creation of the
+ ControlBuilder tree and the compilation of the CodeDOM tree.
+
+ * AspParser.cs: tag handling is simpler now. Instead of a whole bunch
+ of different Types, tags are just and id and a set of attributes.
+ Implement ILocation interface.
+
+ * AspTokenizer.cs: added a few methods to help the parser implementing
+ ILocation.
+
+ * BaseCompiler.cs: handles the portions of the CodeDOM tree that are
+ common to appliaction, page and user control, including the actual
+ compilation and error handling.
+
+ * CSCompiler.cs: compiles C# files using CodeDOM interfaces.
+
+ * CachingCompiler.cs: simplified to use the new interfaces.
+
+ * CompilationException.cs: it's now using CompilationResult to report
+ errors.
+
+ * CompilationResult.cs: Removed file.
+
+ * Directive.cs: to check for the validity of a directive.
+
+ * GlobalAsaxCompiler.cs: simplified a lot, as most of the work is done
+ in BaseCompiler.
+
+ * ILocation.cs: interface used to now the exact place where a parse
+ error happens.
+
+ * PageCompiler.cs: generates a couple of methods that are only used in
+ pages.
+
+ * ParseException.cs: use the ILocation interface.
+
+ * TagAttributes.cs: handles the attributes of the tags parsed.
+
+ * TagType.cs: an enum for the different kinds of tags.
+
+ * TemplateControlCompiler.cs: this is the one that does most of the
+ conversion from teh ControlBuilder tree into a CodeDOM tree.
+
+ * UserControlCompiler.cs: simplified as most of the work is done in
+ its base classes.
+
+ * WebServiceCompiler.cs: dummy.
+
+2003-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspComponentFoundry.cs: added GetComponentType method.
+
+2003-03-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspTokenizer.cs: allow quotes inside server tags that are part of
+ attribute values.
+
+ * CachingCompiler.cs: no more 'FileNotFound' exceptions when the
+ compilation fails.
+
+2003-03-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: generate correct appbase path. It was working with
+ mcs but not with csc.
+
+ * BaseCompiler.cs: quote arguments and removed GetRandomFileName.
+
+ * CachingCompiler.cs: quote source file.
+
+2003-03-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: now the Inherits attribute works as expected for
+ global.asax file.
+
+2003-03-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CompilationException.cs:
+ * ParseException.cs: display the correct line number in error messages.
+
+ * AspElements.cs: added TargetSchema attribute for control. It's
+ ignored.
+
+2003-03-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseCompiler.cs: fixed the hack to work under windows.
+ * CachingCompiler.cs: under windows, try 'mcs.bat' and then 'mcs'.
+
+2003-03-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseCompiler.cs: hacks to work-around our buggy System.Uri.
+
+2003-03-17 George Kodinov <gkodinov@openlinksw.co.uk>
+
+ * BaseCompiler.cs: Removed a FIXME: and added a correct calculation of
+ app's private bin path
+
+2003-03-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs:
+ * BaseCompiler.cs:
+ * CachingCompiler.cs:
+ * CompilationResult.cs:
+ * GlobalAsaxCompiler.cs:
+ * PageCompiler.cs:
+ * UserControlCompiler.cs: recompile the page if dependencies change.
+
+2003-02-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: corrected typo and wrong fix.
+
+2003-02-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: fixed code generation for Table/TableRow/TableCell
+ when used explicitly.
+
+2003-02-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspElements.cs: get the property Type for controls that use
+ ParseChildren with a property name.
+
+ * AspGenerator.cs: generate correct signature for the method that
+ adds controls to the default property in ParseChildren.
+
+2003-02-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: rethrow exceptions that may come from parsing or
+ compilation if a user control.
+
+2003-02-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: throw ParseException on parse
+ error.
+
+ * AspParser.cs: added Line and Column props.
+
+ * CompilationException.cs: derives now from HtmlizedException.
+
+ * CompilationResult.cs: added fileName field. Fixed set_ExitCode.
+
+ * GlobalAsaxCompiler.cs:
+ * PageCompiler.cs:
+ * UserControlCompiler.cs: pass the file name in the CompilationResult.
+
+ * ParseException.cs: new exception.
+
+
+2003-02-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: remove "file://" from the private bin path. Fixes
+ bug #37628.
+
+2003-02-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspParser.cs: the parser fires events when it parses an element.
+
+ * GlobalAsaxCompiler.cs:
+ * PageCompiler.cs:
+ * UserControlCompiler.cs:
+ * AspElements.cs: modified to use the new parser interface.
+
+ * AspGenerator.cs: modified to use the new parser. Merge multiple text
+ strings into one single LiteralControl.
+
+ * AspTokenizer.cs: added Line and Column properties.
+
+2003-01-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspParser.cs: fixed bug #36929.
+
+2003-01-21 Tim Haynes <thaynes@openlinksw.com>
+
+ * AspGenerator.cs:
+ * BaseCompiler.cs:
+ * CachingCompiler.cs: changes to work around spaces and
+ directory-separators in the local filesystem.
+
+2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: make the generated file compile with csc after last
+ change.
+
+2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: removed unused variable. Added support for
+ properties/fields of type string [].
+
+2003-01-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: modified loading of the parent type now that
+ Type.GetType is fixed.
+
+2003-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: cast to Control if the container does not implement
+ INamingContainer.
+
+2003-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: fixed a couple of thinkos related to IsSubclassOf.
+
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspElements.cs: attributes without value lacked a space afterwards.
+
+2003-01-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: functions for columns don't return anything. Fixed
+ typo.
+
+2003-01-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: add data bound controls to code render function.
+
+2003-01-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspComponentFoundry.cs: reworked to allow same prefix for multiple
+ controls. You can register 1 assembly plus any number of user controls
+ under the same prefix.
+
+ * AspGenerator.cs: don't add duplicate 'using' for the same namespace.
+ Hack to allow @Register access to assemblies in other places than bin
+ directory.
+
+2003-01-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspElements.cs: added 'codebehind' attribute for page, control and
+ application. It's ignored by MS, but allowed. Fixed typo.
+
+2003-01-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: fixed EnableSesssionState handling.
+
+2003-01-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: don't generate instance fields for pages/controls
+ when the base class specified in the Inherits attribute already has
+ them. Closes bug #36262.
+
+2002-12-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: generate code like 'control.XXX = value' also for
+ public fields (properties were being handled in that way too).
+
+2002-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: now it uses the current HttpContext when creating
+ user controls. TemplateSourceDirectory is no longer a dummy value.
+
+ * GlobalAsaxCompiler.cs:
+ * PageCompiler.cs:
+ * UserControlCompiler.cs: set the context which will be used to locate
+ the files.
+
+2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: added support for AutoEventWireup attribute in
+ @Page and @Control.
+
+ * CompilationResult.cs:
+ * GlobalAsaxCompiler.cs:
+ * PageCompiler.cs:
+ * UserControlCompiler.cs: store the options.
+
+2002-12-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspElements.cs: new method Tag.GetElements
+ used to parse the inner contents of a tag looking for data binding or
+ code render tags.
+
+ New property HtmlControlTag.ParseChildren allows
+ differentiation of a couple of HtmlControls that has children as
+ properties (namely HtmlTable and HtmlTableRow).
+
+ * AspGenerator.cs: fixed container semantics to
+ match BindingContainer one. Implemented Inherits attribute for page and
+ control.
+
+ Support HtmlControls that has ChildrenAsProperties.
+
+ Generate code for data binding functions that matches the semantic of
+ Container.
+
+ Handle data bound and code render attribute values.
+
+ Set proper value return for TemplateSourceDirectory. Should be relative
+ to appPath.
+
+ * BaseCompiler.cs: moved CompilerOptions and
+ References handling here.
+
+ * CachingCompiler.cs: copy result of compilation.
+
+ * CompilationException.cs: simple ToString () implementation.
+
+ * CompilationResult.cs: implemented CopyFrom and ToString.
+
+ * GlobalAsaxCompiler.cs:
+ * PageCompiler.cs:
+ * UserControlCompiler.cs: removed CompilerOptions as it's now handled
+ in the base class. Get all the types in the generated assembly and
+ look for one that derives from the correct Type.
+
+2002-11-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspElements.cs: added @Application directive.
+
+ * AspGenerator.cs: make it work also with application files. We
+ currently generate an extra private function.
+
+2002-11-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * GlobalAsaxCompiler.cs: compiler for global.asax file. If the file
+ exists, it will be compiled into an HttpApplication derived class
+ (directly or through a user-provided class).
+
+2002-11-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: fixed target file name and generated class name.
+ * BaseCompiler.cs: reference assemblies in PrivateBinPath.
+
+2002-11-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: reworked user control
+ compilation. Provide the options as a Hashtable for use in compilation.
+ Create the user controls in the private bin path of the domain.
+
+ * BaseCompiler.cs: base class for the various compiler types.
+
+ * CachingCompiler.cs: actually executes mcs and do some poor caching
+ (it will use Cache when finished).
+
+ * CompilationException.cs: this exception has enough information to
+ generate a nice error page.
+ * CompilationResult.cs: used in caching.
+
+ * PageCompiler.cs: now derives from BaseCompiler
+
+ * TemplateFactory.cs: no longer needed.
+
+ * UserControlCompiler.cs: new class used when compiling user controls.
+ * WebServiceCompiler.cs: derives from BaseCompiler.
+
+2002-11-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspElements.cs: added ServerComment class.
+ * AspParser.cs: ignore ServerComments tags. Remove server comments when
+ in verbatim mode.
+
+ Fixes #33482.
+
+ * PageCompiler.cs: check if the type is already cached before generating
+ the C# file.
+ * TemplateFactory.cs: if csFile parameter is null, only checks if we
+ already have the page compiled.
+
+2002-11-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: undo one-liner change.
+
+2002-10-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: removed a few hacks no longer needed.
+
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PageCompiler.cs: tracing.
+ * TemplateFactory.cs: cache compiled types and tracing.
+ * WebServiceCompiler.cs: new parameter in GetTypeFromsource,
+
+2002-10-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspComponentFoundry.cs: fixed typo.
+ * TemplateFactory.cs: use csc style options.
+ * AspGenerator.cs: don't use FileDependencies property of base class.
+
+2002-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.Compilation/AspElements.cs:
+ * System.Web.Compilation/AspGenerator.cs:
+ * System.Web.Compilation/AspParser.cs:
+ * System.Web.Compilation/PageCompiler.cs:
+ * System.Web.Compilation/TemplateFactory.cs: we are now able to compile
+ pages and use HttpApplication, HttpRuntime and SimpleWorkerRequest.
+
+2002-09-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspElements.cs: added WebService directive.
+ * WebServiceCompiler.cs: New file.
+
+2002-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PageCompiler.cs: fixed compilation.
+
+2002-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PageCompiler.cs: generate C# file using AspGenerator.
+
+2002-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspComponentFoundry.cs: LookupFoundry now returns bool.
+ * AspGenerator.cs: New file.
+
+2002-08-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspComponentFoundry.cs: New file.
+ * AspElements.cs: renamed Component to Aspcomponent.
+
+2002-08-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspElements.cs:
+ * AspParser.cs:
+ * AspTokenizer.cs:
+ * ChangeLog:
+ * PageCompiler.cs:
+ * TemplateFactory.cs: first steps to move xsp into System.Web.
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/CompilationException.cs b/mcs/class/System.Web/System.Web.Compilation/CompilationException.cs
new file mode 100644
index 00000000000..d312be69804
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/CompilationException.cs
@@ -0,0 +1,118 @@
+//
+// System.Web.Compilation.CompilationException
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.CodeDom.Compiler;
+using System.Text;
+using System.Web;
+
+namespace System.Web.Compilation
+{
+ internal class CompilationException : HtmlizedException
+ {
+ string filename;
+ CompilerErrorCollection errors;
+ string fileText;
+ string errmsg;
+ int [] errorLines;
+
+ public CompilationException (string filename, CompilerErrorCollection errors, string fileText)
+ {
+ this.filename = filename;
+ this.errors = errors;
+ this.fileText = fileText;
+ }
+
+ public override string SourceFile {
+ get {
+ if (errors == null || errors.Count == 0)
+ return filename;
+
+ return errors [0].FileName;
+ }
+ }
+
+ public override string FileName {
+ get { return filename; }
+ }
+
+ public override string Title {
+ get { return "Compilation Error"; }
+ }
+
+ public override string Description {
+ get {
+ return "Error compiling a resource required to service this request. " +
+ "Review your source file and modify it to fix this error.";
+ }
+ }
+
+ public override string ErrorMessage {
+ get {
+ if (errmsg == null && errors != null) {
+ StringBuilder sb = new StringBuilder ();
+ foreach (CompilerError err in errors) {
+ sb.Append (err);
+ sb.Append ("\n");
+ }
+ errmsg = sb.ToString ();
+ }
+
+ return errmsg;
+ }
+ }
+
+ public override string FileText {
+ get { return fileText; }
+ }
+
+ public override int [] ErrorLines {
+ get {
+ if (errorLines == null && errors != null) {
+ ArrayList list = new ArrayList ();
+ foreach (CompilerError err in errors) {
+ if (err.Line != 0 && !list.Contains (err.Line))
+ list.Add (err.Line);
+ }
+ errorLines = (int []) list.ToArray (typeof (int));
+ Array.Sort (errorLines);
+ }
+
+ return errorLines;
+ }
+ }
+
+ public override bool ErrorLinesPaired {
+ get { return false; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/Directive.cs b/mcs/class/System.Web/System.Web.Compilation/Directive.cs
new file mode 100644
index 00000000000..87c887e7b72
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/Directive.cs
@@ -0,0 +1,142 @@
+//
+// System.Web.Compilation.Directive
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.Globalization;
+
+namespace System.Web.Compilation
+{
+ sealed class Directive
+ {
+ static Hashtable directivesHash;
+ static string [] page_atts = { "AspCompat", "AutoEventWireup", "Buffer",
+ "ClassName", "ClientTarget", "CodePage",
+ "CompilerOptions", "ContentType", "Culture", "Debug",
+ "Description", "EnableSessionState", "EnableViewState",
+ "EnableViewStateMac", "ErrorPage", "Explicit",
+ "Inherits", "Language", "LCID", "ResponseEncoding",
+ "Src", "SmartNavigation", "Strict", "Trace",
+ "TraceMode", "Transaction", "UICulture",
+ "WarningLevel", "CodeBehind" , "ValidateRequest" };
+
+ static string [] control_atts = { "AutoEventWireup", "ClassName", "CompilerOptions",
+ "Debug", "Description", "EnableViewState",
+ "Explicit", "Inherits", "Language", "Strict", "Src",
+ "WarningLevel", "CodeBehind", "TargetSchema" };
+
+ static string [] import_atts = { "namespace" };
+ static string [] implements_atts = { "interface" };
+ static string [] assembly_atts = { "name", "src" };
+ static string [] register_atts = { "tagprefix", "tagname", "Namespace", "Src", "Assembly" };
+
+ static string [] outputcache_atts = { "Duration", "Location", "VaryByControl",
+ "VaryByCustom", "VaryByHeader", "VaryByParam" };
+
+ static string [] reference_atts = { "page", "control" };
+
+ static string [] webservice_atts = { "class", "codebehind", "debug", "language" };
+
+ static string [] application_atts = { "description", "inherits", "codebehind" };
+
+ static Directive ()
+ {
+ InitHash ();
+ }
+
+ private static void InitHash ()
+ {
+ CaseInsensitiveHashCodeProvider provider = new CaseInsensitiveHashCodeProvider (CultureInfo.InvariantCulture);
+ CaseInsensitiveComparer comparer = new CaseInsensitiveComparer (CultureInfo.InvariantCulture);
+
+ directivesHash = new Hashtable (provider, comparer);
+
+ // Use Hashtable 'cause is O(1) in Contains (ArrayList is O(n))
+ Hashtable valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in page_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("PAGE", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in control_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("CONTROL", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in import_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("IMPORT", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in implements_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("IMPLEMENTS", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in register_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("REGISTER", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in assembly_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("ASSEMBLY", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in outputcache_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("OUTPUTCACHE", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in reference_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("REFERENCE", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in webservice_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("WEBSERVICE", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ // same attributes as webservice
+ foreach (string att in webservice_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("WEBHANDLER", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in application_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("APPLICATION", valid_attributes);
+
+#if NET_2_0
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in control_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("MASTER", valid_attributes);
+#endif
+ }
+
+ private Directive () { }
+
+ public static bool IsDirective (string id)
+ {
+ return directivesHash.Contains (id);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/ExpressionBuilder.cs b/mcs/class/System.Web/System.Web.Compilation/ExpressionBuilder.cs
new file mode 100644
index 00000000000..d8e0d25e3b7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/ExpressionBuilder.cs
@@ -0,0 +1,57 @@
+//
+// System.Web.Compilation.ExpressionBuilder
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// Copyright (c) 2005 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
+// "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.
+//
+#if NET_2_0
+using System.CodeDom;
+using System.Web.UI;
+
+namespace System.Web.Compilation
+{
+ public abstract class ExpressionBuilder {
+ protected ExpressionBuilder ()
+ {
+ }
+
+ public virtual bool SupportsEvaluate {
+ get { return false; }
+ }
+
+ public virtual object EvaluateExpression (object target, BoundPropertyEntry entry, object parsedData,
+ ExpressionBuilderContext context)
+ {
+ return null;
+ }
+
+ public abstract CodeExpression GetCodeExpression (BoundPropertyEntry entry, object parsedData,
+ ExpressionBuilderContext context);
+ }
+
+}
+#endif // NET_2_0
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/ExpressionBuilderContext.cs b/mcs/class/System.Web/System.Web.Compilation/ExpressionBuilderContext.cs
new file mode 100644
index 00000000000..e095dc9e2e1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/ExpressionBuilderContext.cs
@@ -0,0 +1,61 @@
+//
+// System.Web.Compilation.ExpressionBuilderContext
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// Copyright (c) 2005 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
+// "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.
+//
+#if NET_2_0
+using System.CodeDom;
+using System.Web.UI;
+
+namespace System.Web.Compilation
+{
+ public class ExpressionBuilderContext {
+ TemplateControl tcontrol;
+ string vpath;
+
+ public ExpressionBuilderContext (string virtualPath)
+ {
+ this.vpath = virtualPath;
+ }
+
+ public ExpressionBuilderContext (TemplateControl templateControl)
+ {
+ this.tcontrol = templateControl;
+ }
+
+ public TemplateControl TemplateControl {
+ get { return tcontrol; }
+ }
+
+ public string VirtualPath {
+ get { return vpath; }
+ }
+ }
+
+}
+#endif // NET_2_0
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/GlobalAsaxCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/GlobalAsaxCompiler.cs
new file mode 100644
index 00000000000..0c70ce86c7f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/GlobalAsaxCompiler.cs
@@ -0,0 +1,104 @@
+//
+// System.Web.Compilation.GlobalAsaxCompiler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
+// (c) 2004 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
+// "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;
+using System.Collections;
+using System.Web.UI;
+
+namespace System.Web.Compilation
+{
+ class GlobalAsaxCompiler : BaseCompiler
+ {
+ ApplicationFileParser parser;
+ static ArrayList applicationObjectTags = new ArrayList (1);
+ static ArrayList sessionObjectTags = new ArrayList (1);
+
+ public GlobalAsaxCompiler (ApplicationFileParser parser)
+ : base (parser)
+ {
+ applicationObjectTags.Clear ();
+ sessionObjectTags.Clear ();
+ this.parser = parser;
+ }
+
+ public static Type CompileApplicationType (ApplicationFileParser parser)
+ {
+ AspGenerator generator = new AspGenerator (parser);
+ return generator.GetCompiledType ();
+ }
+
+ protected override void CreateMethods ()
+ {
+ base.CreateMethods ();
+
+ ProcessObjects (parser.RootBuilder);
+ }
+
+ void ProcessObjects (ControlBuilder builder)
+ {
+ if (builder.Children == null)
+ return;
+
+ foreach (object t in builder.Children) {
+ if (!(t is ObjectTagBuilder))
+ continue;
+
+ ObjectTagBuilder tag = (ObjectTagBuilder) t;
+ if (tag.Scope == null) {
+ string fname = CreateFieldForObject (tag.Type, tag.ObjectID);
+ CreatePropertyForObject (tag.Type, tag.ObjectID, fname, true);
+ continue;
+ }
+
+ if (tag.Scope == "session") {
+ sessionObjectTags.Add (tag);
+ CreateApplicationOrSessionPropertyForObject (tag.Type, tag.ObjectID,
+ false, false);
+ } else if (tag.Scope == "application") {
+ applicationObjectTags.Add (tag);
+ CreateFieldForObject (tag.Type, tag.ObjectID);
+ CreateApplicationOrSessionPropertyForObject (tag.Type, tag.ObjectID,
+ true, false);
+ } else {
+ throw new ParseException (tag.location, "Invalid scope: " + tag.Scope);
+ }
+ }
+ }
+
+ internal static ArrayList ApplicationObjects {
+ get { return applicationObjectTags; }
+ }
+
+ internal static ArrayList SessionObjects {
+ get { return sessionObjectTags; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/IImplicitResourceProvider.cs b/mcs/class/System.Web/System.Web.Compilation/IImplicitResourceProvider.cs
new file mode 100644
index 00000000000..3e2c38ff5db
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/IImplicitResourceProvider.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.Compilation.IImplicitResourceProvider.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System.Collections;
+using System.Globalization;
+
+namespace System.Web.Compilation
+{
+ public interface IImplicitResourceProvider
+ {
+ object GetObject (ImplicitResourceKey key, CultureInfo culture);
+ ICollection GetResources (string keyPrefix);
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Compilation/ILocation.cs b/mcs/class/System.Web/System.Web.Compilation/ILocation.cs
new file mode 100644
index 00000000000..f8591d6cddc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/ILocation.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.Compilation.ILocation
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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.
+//
+
+namespace System.Web.Compilation
+{
+ interface ILocation
+ {
+ string Filename { get; }
+ int BeginLine { get; }
+ int EndLine { get; }
+ int BeginColumn { get; }
+ int EndColumn { get; }
+ string PlainText { get; }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/IResourceReader.cs b/mcs/class/System.Web/System.Web.Compilation/IResourceReader.cs
new file mode 100644
index 00000000000..4cdb8b14784
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/IResourceReader.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.Compilation.IResourceProvider.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System.Resources;
+
+#if NET_2_0
+namespace System.Web.Compilation
+{
+ public interface IResourceProvider
+ {
+ IResourceReader ResourceReader { get; }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Compilation/ImplicitResourceKey.cs b/mcs/class/System.Web/System.Web.Compilation/ImplicitResourceKey.cs
new file mode 100644
index 00000000000..ac2bab3c256
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/ImplicitResourceKey.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.Compilation.IImplicitResourceProvider.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.Compilation
+{
+ public class ImplicitResourceKey
+ {
+ public ImplicitResourceKey ()
+ {
+ }
+
+ public string Filter;
+ public string KeyPrefix;
+ public string Property;
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Compilation/Location.cs b/mcs/class/System.Web/System.Web.Compilation/Location.cs
new file mode 100644
index 00000000000..4a57b8055ac
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/Location.cs
@@ -0,0 +1,92 @@
+//
+// System.Web.Compilation.Location
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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.
+//
+
+namespace System.Web.Compilation
+{
+ class Location : ILocation
+ {
+ int beginLine, endLine, beginColumn, endColumn;
+ string fileName, plainText;
+
+ public Location (ILocation location)
+ {
+ Init (location);
+ }
+
+ public void Init (ILocation location)
+ {
+ if (location == null) {
+ beginLine = 0;
+ endLine = 0;
+ beginColumn = 0;
+ endColumn = 0;
+ fileName = null;
+ plainText = null;
+ } else {
+ beginLine = location.BeginLine;
+ endLine = location.EndLine;
+ beginColumn = location.BeginColumn;
+ endColumn = location.EndColumn;
+ fileName = location.Filename;
+ plainText = location.PlainText;
+ }
+ }
+
+ public string Filename {
+ get { return fileName; }
+ }
+
+ public int BeginLine {
+ get { return beginLine; }
+ set { beginLine = value; }
+ }
+
+ public int EndLine {
+ get { return endLine; }
+ set { endLine = value; }
+ }
+
+ public int BeginColumn {
+ get { return beginColumn; }
+ set { beginColumn = value; }
+ }
+
+ public int EndColumn {
+ get { return endColumn; }
+ set { endColumn = value; }
+ }
+
+ public string PlainText {
+ get { return plainText; }
+ set { plainText = value; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs
new file mode 100644
index 00000000000..3211878028d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs
@@ -0,0 +1,207 @@
+//
+// System.Web.Compilation.PageCompiler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.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;
+using System.CodeDom;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using System.Web.UI;
+using System.Web.SessionState;
+using System.Web.Util;
+
+namespace System.Web.Compilation
+{
+ class PageCompiler : TemplateControlCompiler
+ {
+ PageParser pageParser;
+ static CodeTypeReference intRef = new CodeTypeReference (typeof (int));
+
+ public PageCompiler (PageParser pageParser)
+ : base (pageParser)
+ {
+ this.pageParser = pageParser;
+ }
+
+ protected override void CreateConstructor (CodeStatementCollection localVars,
+ CodeStatementCollection trueStmt)
+ {
+ if (pageParser.ClientTarget != null) {
+ CodeExpression prop;
+ prop = new CodePropertyReferenceExpression (thisRef, "ClientTarget");
+ CodeExpression ct = new CodePrimitiveExpression (pageParser.ClientTarget);
+ if (localVars == null)
+ localVars = new CodeStatementCollection ();
+ localVars.Add (new CodeAssignStatement (prop, ct));
+ }
+
+#if NET_2_0
+ if (pageParser.MasterPageFile != null) {
+ CodeExpression prop;
+ prop = new CodePropertyReferenceExpression (thisRef, "MasterPageFile");
+ CodeExpression ct = new CodePrimitiveExpression (pageParser.MasterPageFile);
+ if (localVars == null)
+ localVars = new CodeStatementCollection ();
+ localVars.Add (new CodeAssignStatement (prop, ct));
+ }
+#endif
+
+ base.CreateConstructor (localVars, trueStmt);
+ }
+
+ protected override void AddInterfaces ()
+ {
+ base.AddInterfaces ();
+ if (pageParser.EnableSessionState)
+ mainClass.BaseTypes.Add (new CodeTypeReference (typeof(IRequiresSessionState)));
+
+ if (pageParser.ReadOnlySessionState)
+ mainClass.BaseTypes.Add (new CodeTypeReference (typeof (IReadOnlySessionState)));
+ }
+
+ void CreateGetTypeHashCode ()
+ {
+ CodeMemberMethod method = new CodeMemberMethod ();
+ method.ReturnType = intRef;
+ method.Name = "GetTypeHashCode";
+ method.Attributes = MemberAttributes.Public | MemberAttributes.Override;
+ Random rnd = new Random (pageParser.InputFile.GetHashCode ());
+ method.Statements.Add (new CodeMethodReturnStatement (new CodePrimitiveExpression (rnd.Next ())));
+ mainClass.Members.Add (method);
+ }
+
+ static CodeAssignStatement CreatePropertyAssign (string name, object value)
+ {
+ CodePropertyReferenceExpression prop;
+ prop = new CodePropertyReferenceExpression (thisRef, name);
+ CodePrimitiveExpression prim;
+ prim = new CodePrimitiveExpression (value);
+ return new CodeAssignStatement (prop, prim);
+ }
+
+ protected override void AddStatementsToFrameworkInitialize (CodeMemberMethod method)
+ {
+ string responseEncoding = pageParser.ResponseEncoding;
+ if (responseEncoding != null)
+ method.Statements.Add (CreatePropertyAssign ("ResponseEncoding", responseEncoding));
+
+ int codepage = pageParser.CodePage;
+ if (codepage != -1)
+ method.Statements.Add (CreatePropertyAssign ("CodePage", codepage));
+
+ string contentType = pageParser.ContentType;
+ if (contentType != null)
+ method.Statements.Add (CreatePropertyAssign ("ContentType", contentType));
+
+ if (pageParser.OutputCache) {
+ CodeMethodReferenceExpression init = new CodeMethodReferenceExpression (null,
+ "InitOutputCache");
+ CodeMethodInvokeExpression invoke = new CodeMethodInvokeExpression (init,
+ OutputCacheParams ());
+ method.Statements.Add (invoke);
+ }
+
+ int lcid = pageParser.LCID;
+ if (lcid != -1)
+ method.Statements.Add (CreatePropertyAssign ("LCID", lcid));
+
+ string culture = pageParser.Culture;
+ if (culture != null)
+ method.Statements.Add (CreatePropertyAssign ("Culture", culture));
+
+ culture = pageParser.UICulture;
+ if (culture != null)
+ method.Statements.Add (CreatePropertyAssign ("UICulture", culture));
+
+ string errorPage = pageParser.ErrorPage;
+ if (errorPage != null)
+ method.Statements.Add (CreatePropertyAssign ("ErrorPage", errorPage));
+
+ if (pageParser.HaveTrace) {
+ CodeAssignStatement stmt = new CodeAssignStatement ();
+ stmt.Left = new CodePropertyReferenceExpression (thisRef, "TraceEnabled");
+ stmt.Right = new CodePrimitiveExpression (pageParser.Trace);
+ method.Statements.Add (stmt);
+ }
+
+ if (pageParser.TraceMode != TraceMode.Default) {
+ CodeAssignStatement stmt = new CodeAssignStatement ();
+ CodeTypeReferenceExpression tm = new CodeTypeReferenceExpression ("System.Web.TraceMode");
+ stmt.Left = new CodePropertyReferenceExpression (thisRef, "TraceModeValue");
+ stmt.Right = new CodeFieldReferenceExpression (tm, pageParser.TraceMode.ToString ());
+ method.Statements.Add (stmt);
+ }
+
+ if (pageParser.NotBuffer) {
+ CodeAssignStatement stmt = new CodeAssignStatement ();
+ stmt.Left = new CodePropertyReferenceExpression (thisRef, "Buffer");
+ stmt.Right = new CodePrimitiveExpression (false);
+ method.Statements.Add (stmt);
+ }
+
+#if NET_1_1
+ if (pageParser.ValidateRequest) {
+ CodeMethodInvokeExpression expr = new CodeMethodInvokeExpression ();
+ CodePropertyReferenceExpression prop;
+ prop = new CodePropertyReferenceExpression (thisRef, "Request");
+ expr.Method = new CodeMethodReferenceExpression (prop, "ValidateInput");
+ method.Statements.Add (expr);
+ }
+#endif
+
+ base.AddStatementsToFrameworkInitialize (method);
+ }
+
+ private CodeExpression[] OutputCacheParams ()
+ {
+ return new CodeExpression [] {
+ new CodePrimitiveExpression (pageParser.OutputCacheDuration),
+ new CodePrimitiveExpression (pageParser.OutputCacheVaryByHeader),
+ new CodePrimitiveExpression (pageParser.OutputCacheVaryByCustom),
+ new CodeSnippetExpression (typeof (OutputCacheLocation).ToString () +
+ "." + pageParser.OutputCacheLocation.ToString ()),
+ new CodePrimitiveExpression (pageParser.OutputCacheVaryByParam)
+ };
+ }
+
+ protected override void CreateMethods ()
+ {
+ base.CreateMethods ();
+
+ CreateGetTypeHashCode ();
+ }
+
+ public static Type CompilePageType (PageParser pageParser)
+ {
+ PageCompiler compiler = new PageCompiler (pageParser);
+ return compiler.GetCompiledType ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/ParseException.cs b/mcs/class/System.Web/System.Web.Compilation/ParseException.cs
new file mode 100644
index 00000000000..ac7815ba61d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/ParseException.cs
@@ -0,0 +1,111 @@
+//
+// System.Web.Compilation.ParseException
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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;
+using System.IO;
+
+namespace System.Web.Compilation
+{
+ internal class ParseException : HtmlizedException
+ {
+ ILocation location;
+ string fileText;
+
+ public ParseException (ILocation location, string message)
+ : this (location, message, null)
+ {
+ location = new Location (location);
+ }
+
+
+ public ParseException (ILocation location, string message, Exception inner)
+ : base (message, inner)
+ {
+ this.location = location;
+ }
+
+ public override string Title {
+ get { return "Parser Error"; }
+ }
+
+ public override string Description {
+ get {
+ return "Error parsing a resource required to service this request. " +
+ "Review your source file and modify it to fix this error.";
+ }
+ }
+
+ public override string ErrorMessage {
+ get { return Message; }
+ }
+
+ public override string SourceFile {
+ get { return FileName; }
+ }
+
+ public override string FileName {
+ get {
+ if (location == null)
+ return null;
+
+ return location.Filename;
+ }
+ }
+
+ public override string FileText {
+ get {
+ if (fileText != null)
+ return fileText;
+
+ if (FileName == null)
+ return null;
+
+ //FIXME: encoding
+ TextReader reader = new StreamReader (FileName);
+ fileText = reader.ReadToEnd ();
+ return fileText;
+ }
+ }
+
+ public override int [] ErrorLines {
+ get {
+ if (location == null)
+ return null;
+
+ return new int [] {location.BeginLine, location.EndLine};
+ }
+ }
+
+ public override bool ErrorLinesPaired {
+ get { return true; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/TagAttributes.cs b/mcs/class/System.Web/System.Web.Compilation/TagAttributes.cs
new file mode 100644
index 00000000000..d668646130f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/TagAttributes.cs
@@ -0,0 +1,198 @@
+//
+// System.Web.Compilation.TagAttributes
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.Text;
+
+namespace System.Web.Compilation
+{
+ class TagAttributes
+ {
+ Hashtable atts_hash;
+ Hashtable tmp_hash;
+ ArrayList keys;
+ ArrayList values;
+ bool got_hashed;
+
+ public TagAttributes ()
+ {
+ got_hashed = false;
+ keys = new ArrayList ();
+ values = new ArrayList ();
+ }
+
+ void MakeHash ()
+ {
+ atts_hash = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant,
+ CaseInsensitiveComparer.DefaultInvariant);
+ 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;
+ }
+
+ public bool IsRunAtServer ()
+ {
+ return got_hashed;
+ }
+
+ public void Add (object key, object value)
+ {
+ if (key != null && value != null &&
+ 0 == String.Compare ((string) key, "runat", true)) {
+ if (0 != String.Compare ((string) value, "server", true))
+ throw new HttpException ("runat attribute must have a 'server' value");
+
+ if (got_hashed)
+ return; // ignore duplicate runat="server"
+
+ MakeHash ();
+ }
+
+ if (value != null)
+ value = HttpUtility.HtmlDecode (value.ToString ());
+
+ if (got_hashed) {
+ CheckServerKey (key);
+ if (atts_hash.ContainsKey (key))
+ throw new HttpException ("Tag contains duplicated '" + key +
+ "' attributes.");
+ atts_hash.Add (key, value);
+ } else {
+ keys.Add (key);
+ values.Add (value);
+ }
+ }
+
+ public ICollection Keys
+ {
+ get { return (got_hashed ? atts_hash.Keys : keys); }
+ }
+
+ public ICollection Values
+ {
+ get { return (got_hashed ? atts_hash.Values : values); }
+ }
+
+ private int CaseInsensitiveSearch (string key)
+ {
+ // Hope not to have many attributes when the tag is not a server tag...
+ for (int i = 0; i < keys.Count; i++){
+ if (0 == String.Compare ((string) keys [i], key, true))
+ return i;
+ }
+ return -1;
+ }
+
+ public object this [object key]
+ {
+ get {
+ if (got_hashed)
+ return atts_hash [key];
+
+ int idx = CaseInsensitiveSearch ((string) key);
+ if (idx == -1)
+ return null;
+
+ return values [idx];
+ }
+
+ set {
+ if (got_hashed) {
+ CheckServerKey (key);
+ atts_hash [key] = value;
+ } else {
+ int idx = CaseInsensitiveSearch ((string) key);
+ keys [idx] = value;
+ }
+ }
+ }
+
+ public int Count
+ {
+ get { return (got_hashed ? atts_hash.Count : keys.Count);}
+ }
+
+ public bool IsDataBound (string att)
+ {
+ if (att == null || !got_hashed)
+ return false;
+
+ return (att.StartsWith ("<%#") && att.EndsWith ("%>"));
+ }
+
+ public Hashtable GetDictionary (string key)
+ {
+ if (got_hashed)
+ return atts_hash;
+
+ if (tmp_hash == null)
+ tmp_hash = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant,
+ CaseInsensitiveComparer.DefaultInvariant);
+
+ tmp_hash.Clear ();
+ for (int i = keys.Count - 1; i >= 0; i--)
+ if (key == null || String.Compare (key, (string) keys [i], true) == 0)
+ tmp_hash [keys [i]] = values [i];
+
+ return tmp_hash;
+ }
+
+ public override string ToString ()
+ {
+ StringBuilder result = new StringBuilder ();
+ string value;
+ foreach (string key in Keys){
+ result.Append (key);
+ value = this [key] as string;
+ if (value != null)
+ result.AppendFormat ("=\"{0}\"", value);
+
+ result.Append (' ');
+ }
+
+ if (result.Length > 0 && result [result.Length - 1] == ' ')
+ result.Length--;
+
+ return result.ToString ();
+ }
+
+ void CheckServerKey (object key)
+ {
+ if (key == null || ((string)key).Length == 0)
+ throw new HttpException ("The server tag is not well formed.");
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/TagType.cs b/mcs/class/System.Web/System.Web.Compilation/TagType.cs
new file mode 100644
index 00000000000..af38a4124b3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/TagType.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.Compilation.TagType
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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.
+//
+namespace System.Web.Compilation
+{
+ enum TagType
+ {
+ Text,
+ Tag,
+ Close,
+ SelfClosing,
+ Directive,
+ ServerComment,
+ DataBinding,
+ CodeRender,
+ CodeRenderExpression,
+ Include
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
new file mode 100644
index 00000000000..f1e77470b3a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
@@ -0,0 +1,1208 @@
+//
+// System.Web.Compilation.TemplateControlCompiler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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;
+using System.CodeDom;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Globalization;
+using System.Reflection;
+using System.Text;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel.Design.Serialization;
+#if NET_2_0
+using System.Collections.Specialized;
+using System.Text.RegularExpressions;
+#endif
+
+namespace System.Web.Compilation
+{
+ class TemplateControlCompiler : BaseCompiler
+ {
+ static BindingFlags noCaseFlags = BindingFlags.Public | BindingFlags.NonPublic |
+ BindingFlags.Instance | BindingFlags.IgnoreCase;
+
+ TemplateControlParser parser;
+ int dataBoundAtts;
+ ILocation currentLocation;
+
+ static TypeConverter colorConverter;
+
+ static CodeVariableReferenceExpression ctrlVar = new CodeVariableReferenceExpression ("__ctrl");
+
+#if NET_2_0
+ static Regex bindRegex = new Regex (@"Bind\s*\(""(.*?)""\)\s*%>", RegexOptions.Compiled);
+#endif
+
+ public TemplateControlCompiler (TemplateControlParser parser)
+ : base (parser)
+ {
+ this.parser = parser;
+ }
+
+ void EnsureID (ControlBuilder builder)
+ {
+ if (builder.ID == null || builder.ID.Trim () == "")
+ builder.ID = builder.GetNextID (null);
+ }
+
+ void CreateField (ControlBuilder builder, bool check)
+ {
+ currentLocation = builder.location;
+ if (check && CheckBaseFieldOrProperty (builder.ID, builder.ControlType))
+ return; // The field or property already exists in a base class and is accesible.
+
+ CodeMemberField field;
+ field = new CodeMemberField (builder.ControlType.FullName, builder.ID);
+ field.Attributes = MemberAttributes.Family;
+ mainClass.Members.Add (field);
+ }
+
+ bool CheckBaseFieldOrProperty (string id, Type type)
+ {
+ FieldInfo fld = parser.BaseType.GetField (id, noCaseFlags);
+
+ Type other = null;
+ if (fld == null || fld.IsPrivate) {
+ PropertyInfo prop = parser.BaseType.GetProperty (id, noCaseFlags);
+ if (prop != null) {
+ MethodInfo setm = prop.GetSetMethod (true);
+ if (setm != null)
+ other = prop.PropertyType;
+ }
+ } else {
+ other = fld.FieldType;
+ }
+
+ if (other == null)
+ return false;
+
+ if (!other.IsAssignableFrom (type)) {
+ string msg = String.Format ("The base class includes the field '{0}', but its " +
+ "type '{1}' is not compatible with {2}",
+ id, other, type);
+ throw new ParseException (currentLocation, msg);
+ }
+
+ return true;
+ }
+
+ void AddParsedSubObjectStmt (ControlBuilder builder, CodeExpression expr)
+ {
+ if (!builder.haveParserVariable) {
+ CodeVariableDeclarationStatement p = new CodeVariableDeclarationStatement();
+ p.Name = "__parser";
+ p.Type = new CodeTypeReference (typeof (IParserAccessor));
+ p.InitExpression = new CodeCastExpression (typeof (IParserAccessor), ctrlVar);
+ builder.method.Statements.Add (p);
+ builder.haveParserVariable = true;
+ }
+
+ CodeVariableReferenceExpression var = new CodeVariableReferenceExpression ("__parser");
+ CodeMethodInvokeExpression invoke = new CodeMethodInvokeExpression (var, "AddParsedSubObject");
+ invoke.Parameters.Add (expr);
+ builder.method.Statements.Add (invoke);
+ }
+
+ void InitMethod (ControlBuilder builder, bool isTemplate, bool childrenAsProperties)
+ {
+ string tailname = ((builder is RootBuilder) ? "Tree" : ("_" + builder.ID));
+ CodeMemberMethod method = new CodeMemberMethod ();
+ builder.method = method;
+ method.Name = "__BuildControl" + tailname;
+ method.Attributes = MemberAttributes.Private | MemberAttributes.Final;
+ Type type = builder.ControlType;
+
+ if (builder.HasAspCode) {
+ CodeMemberMethod renderMethod = new CodeMemberMethod ();
+ builder.renderMethod = renderMethod;
+ renderMethod.Name = "__Render" + tailname;
+ renderMethod.Attributes = MemberAttributes.Private | MemberAttributes.Final;
+ CodeParameterDeclarationExpression arg1 = new CodeParameterDeclarationExpression ();
+ arg1.Type = new CodeTypeReference (typeof (HtmlTextWriter));
+ arg1.Name = "__output";
+ CodeParameterDeclarationExpression arg2 = new CodeParameterDeclarationExpression ();
+ arg2.Type = new CodeTypeReference (typeof (Control));
+ arg2.Name = "parameterContainer";
+ renderMethod.Parameters.Add (arg1);
+ renderMethod.Parameters.Add (arg2);
+ mainClass.Members.Add (renderMethod);
+ }
+
+ if (childrenAsProperties || builder.ControlType == null) {
+ string typeString;
+ if (builder.ControlType != null && builder.isProperty &&
+ !typeof (ITemplate).IsAssignableFrom (builder.ControlType))
+ typeString = builder.ControlType.FullName;
+ else
+ typeString = "System.Web.UI.Control";
+
+ method.Parameters.Add (new CodeParameterDeclarationExpression (typeString, "__ctrl"));
+ } else {
+
+ if (typeof (Control).IsAssignableFrom (type))
+ method.ReturnType = new CodeTypeReference (typeof (Control));
+
+ CodeObjectCreateExpression newExpr = new CodeObjectCreateExpression (type);
+
+ object [] atts = type.GetCustomAttributes (typeof (ConstructorNeedsTagAttribute), true);
+ if (atts != null && atts.Length > 0) {
+ ConstructorNeedsTagAttribute att = (ConstructorNeedsTagAttribute) atts [0];
+ if (att.NeedsTag)
+ newExpr.Parameters.Add (new CodePrimitiveExpression (builder.TagName));
+ } else if (builder is DataBindingBuilder) {
+ newExpr.Parameters.Add (new CodePrimitiveExpression (0));
+ newExpr.Parameters.Add (new CodePrimitiveExpression (1));
+ }
+
+ method.Statements.Add (new CodeVariableDeclarationStatement (builder.ControlType, "__ctrl"));
+ CodeAssignStatement assign = new CodeAssignStatement ();
+ assign.Left = ctrlVar;
+ assign.Right = newExpr;
+ method.Statements.Add (assign);
+
+ CodeFieldReferenceExpression builderID = new CodeFieldReferenceExpression ();
+ builderID.TargetObject = thisRef;
+ builderID.FieldName = builder.ID;
+ assign = new CodeAssignStatement ();
+ assign.Left = builderID;
+ assign.Right = ctrlVar;
+ method.Statements.Add (assign);
+ if (typeof (UserControl).IsAssignableFrom (type)) {
+ CodeMethodReferenceExpression mref = new CodeMethodReferenceExpression ();
+ mref.TargetObject = builderID;
+ mref.MethodName = "InitializeAsUserControl";
+ CodeMethodInvokeExpression initAsControl = new CodeMethodInvokeExpression (mref);
+ initAsControl.Parameters.Add (new CodePropertyReferenceExpression (thisRef, "Page"));
+ method.Statements.Add (initAsControl);
+ }
+#if NET_2_0
+ if (typeof (System.Web.UI.WebControls.ContentPlaceHolder).IsAssignableFrom (type)) {
+ CodePropertyReferenceExpression prop = new CodePropertyReferenceExpression (thisRef, "ContentPlaceHolders");
+ CodeMethodInvokeExpression addPlaceholder = new CodeMethodInvokeExpression (prop, "Add");
+ addPlaceholder.Parameters.Add (ctrlVar);
+ method.Statements.Add (addPlaceholder);
+ }
+#endif
+ }
+
+ mainClass.Members.Add (method);
+ }
+
+ void AddLiteralSubObject (ControlBuilder builder, string str)
+ {
+ if (!builder.HasAspCode) {
+ CodeObjectCreateExpression expr;
+ expr = new CodeObjectCreateExpression (typeof (LiteralControl), new CodePrimitiveExpression (str));
+ AddParsedSubObjectStmt (builder, expr);
+ } else {
+ CodeMethodReferenceExpression methodRef = new CodeMethodReferenceExpression ();
+ methodRef.TargetObject = new CodeArgumentReferenceExpression ("__output");
+ methodRef.MethodName = "Write";
+
+ CodeMethodInvokeExpression expr;
+ expr = new CodeMethodInvokeExpression (methodRef, new CodePrimitiveExpression (str));
+ builder.renderMethod.Statements.Add (expr);
+ }
+ }
+
+ string TrimDB (string value)
+ {
+ string str = value.Trim ();
+ str = str.Substring (3);
+ return str.Substring (0, str.Length - 2);
+ }
+
+ string DataBoundProperty (ControlBuilder builder, Type type, string varName, string value)
+ {
+ value = TrimDB (value);
+ CodeMemberMethod method;
+ string dbMethodName = builder.method.Name + "_DB_" + dataBoundAtts++;
+
+ method = CreateDBMethod (dbMethodName, GetContainerType (builder), builder.ControlType);
+
+ CodeVariableReferenceExpression targetExpr = new CodeVariableReferenceExpression ("target");
+
+ // This should be a CodePropertyReferenceExpression for properties... but it works anyway
+ CodeFieldReferenceExpression field = new CodeFieldReferenceExpression (targetExpr, varName);
+
+ CodeExpression expr;
+ if (type == typeof (string)) {
+ CodeMethodInvokeExpression tostring = new CodeMethodInvokeExpression ();
+ CodeTypeReferenceExpression conv = new CodeTypeReferenceExpression (typeof (Convert));
+ tostring.Method = new CodeMethodReferenceExpression (conv, "ToString");
+ tostring.Parameters.Add (new CodeSnippetExpression (value));
+ expr = tostring;
+ } else {
+ CodeSnippetExpression snippet = new CodeSnippetExpression (value);
+ expr = new CodeCastExpression (type, snippet);
+ }
+
+ method.Statements.Add (new CodeAssignStatement (field, expr));
+ mainClass.Members.Add (method);
+ return method.Name;
+ }
+
+ void AddCodeForPropertyOrField (ControlBuilder builder, Type type, string var_name, string att, MemberInfo member, bool isDataBound)
+ {
+ CodeMemberMethod method = builder.method;
+ if (isDataBound) {
+ string dbMethodName = DataBoundProperty (builder, type, var_name, att);
+ AddEventAssign (method, "DataBinding", typeof (EventHandler), dbMethodName);
+ return;
+ }
+
+ CodeAssignStatement assign = new CodeAssignStatement ();
+ assign.Left = new CodePropertyReferenceExpression (ctrlVar, var_name);
+ currentLocation = builder.location;
+ assign.Right = GetExpressionFromString (type, att, member);
+
+ method.Statements.Add (assign);
+ }
+
+ bool IsDataBound (string value)
+ {
+ if (value == null || value == "")
+ return false;
+
+ string str = value.Trim ();
+ return (str.StartsWith ("<%#") && str.EndsWith ("%>"));
+ }
+
+#if NET_2_0
+ void RegisterBindingInfo (ControlBuilder builder, string propName, ref string value)
+ {
+ string str = value.Trim ();
+ str = str.Substring (3).Trim (); // eats "<%#"
+ if (str.StartsWith ("Bind")) {
+ Match match = bindRegex.Match (str);
+ if (match.Success) {
+ string bindingName = match.Groups [1].Value;
+
+ TemplateBuilder templateBuilder = builder.ParentTemplateBuilder;
+ if (templateBuilder == null || templateBuilder.BindingDirection == BindingDirection.OneWay)
+ throw new HttpException ("Bind expression not allowed in this context.");
+
+ string id = builder.attribs ["ID"] as string;
+ if (id == null)
+ throw new HttpException ("Control of type '" + builder.ControlType + "' using two-way binding on property '" + propName + "' must have an ID.");
+
+ templateBuilder.RegisterBoundProperty (builder.ControlType, propName, id, bindingName);
+ value = "<%# Eval" + str.Substring (4);
+ }
+ }
+ }
+#endif
+
+ bool ProcessPropertiesAndFields (ControlBuilder builder, MemberInfo member, string id, string attValue)
+ {
+ int hyphen = id.IndexOf ('-');
+
+ bool isPropertyInfo = (member is PropertyInfo);
+ bool is_processed = false;
+ bool isDataBound = IsDataBound (attValue);
+
+ Type type;
+ if (isPropertyInfo) {
+ type = ((PropertyInfo) member).PropertyType;
+ if (hyphen == -1 && ((PropertyInfo) member).CanWrite == false)
+ return false;
+ } else {
+ type = ((FieldInfo) member).FieldType;
+ }
+
+ if (0 == String.Compare (member.Name, id, true)){
+#if NET_2_0
+ if (isDataBound) RegisterBindingInfo (builder, member.Name, ref attValue);
+#endif
+ AddCodeForPropertyOrField (builder, type, member.Name, attValue, member, isDataBound);
+ return true;
+ }
+
+ if (hyphen == -1)
+ return false;
+
+ string prop_field = id.Replace ("-", ".");
+ string [] parts = prop_field.Split (new char [] {'.'});
+ if (parts.Length != 2 || 0 != String.Compare (member.Name, parts [0], true))
+ return false;
+
+ PropertyInfo [] subprops = type.GetProperties ();
+ foreach (PropertyInfo subprop in subprops) {
+ if (0 != String.Compare (subprop.Name, parts [1], true))
+ continue;
+
+ if (subprop.CanWrite == false)
+ return false;
+
+ bool is_bool = subprop.PropertyType == typeof (bool);
+ if (!is_bool && attValue == null)
+ return false; // Font-Size -> Font-Size="" as html
+
+ string value;
+ if (attValue == null && is_bool)
+ value = "true"; // Font-Bold <=> Font-Bold="true"
+ else
+ value = attValue;
+
+#if NET_2_0
+ if (isDataBound) RegisterBindingInfo (builder, member.Name + "." + subprop.Name, ref attValue);
+#endif
+ AddCodeForPropertyOrField (builder, subprop.PropertyType,
+ member.Name + "." + subprop.Name,
+ value, subprop, isDataBound);
+ is_processed = true;
+ }
+
+ return is_processed;
+ }
+
+ void AddEventAssign (CodeMemberMethod method, string name, Type type, string value)
+ {
+ //"__ctrl.{0} += new {1} (this.{2});"
+ CodeEventReferenceExpression evtID = new CodeEventReferenceExpression (ctrlVar, name);
+
+ CodeDelegateCreateExpression create;
+ create = new CodeDelegateCreateExpression (new CodeTypeReference (type), thisRef, value);
+
+ CodeAttachEventStatement attach = new CodeAttachEventStatement (evtID, create);
+ method.Statements.Add (attach);
+ }
+
+ void CreateAssignStatementsFromAttributes (ControlBuilder builder)
+ {
+ this.dataBoundAtts = 0;
+ IDictionary atts = builder.attribs;
+ if (atts == null || atts.Count == 0)
+ return;
+
+ EventInfo [] ev_info = null;
+ PropertyInfo [] prop_info = null;
+ FieldInfo [] field_info = null;
+ bool is_processed = false;
+ Type type = builder.ControlType;
+
+ foreach (string id in atts.Keys){
+ if (0 == String.Compare (id, "runat", true))
+ continue;
+
+ is_processed = false;
+ string attvalue = atts [id] as string;
+ if (id.Length > 2 && id.Substring (0, 2).ToUpper () == "ON"){
+ if (ev_info == null)
+ ev_info = type.GetEvents ();
+
+ string id_as_event = id.Substring (2);
+ foreach (EventInfo ev in ev_info){
+ if (0 == String.Compare (ev.Name, id_as_event, true)){
+ AddEventAssign (builder.method,
+ ev.Name,
+ ev.EventHandlerType,
+ attvalue);
+
+ is_processed = true;
+ break;
+ }
+ }
+
+ if (is_processed)
+ continue;
+ }
+
+ if (prop_info == null)
+ prop_info = type.GetProperties ();
+
+ foreach (PropertyInfo prop in prop_info) {
+ is_processed = ProcessPropertiesAndFields (builder, prop, id, attvalue);
+ if (is_processed)
+ break;
+ }
+
+ if (is_processed)
+ continue;
+
+ if (field_info == null)
+ field_info = type.GetFields ();
+
+ foreach (FieldInfo field in field_info){
+ is_processed = ProcessPropertiesAndFields (builder, field, id, attvalue);
+ if (is_processed)
+ break;
+ }
+
+ if (is_processed)
+ continue;
+
+ if (!typeof (IAttributeAccessor).IsAssignableFrom (type))
+ throw new ParseException (builder.location, "Unrecognized attribute: " + id);
+
+
+ CodeCastExpression cast = new CodeCastExpression (typeof (IAttributeAccessor), ctrlVar);
+ CodeMethodReferenceExpression methodExpr;
+ methodExpr = new CodeMethodReferenceExpression (cast, "SetAttribute");
+ CodeMethodInvokeExpression expr = new CodeMethodInvokeExpression (methodExpr);
+ expr.Parameters.Add (new CodePrimitiveExpression (id));
+ expr.Parameters.Add (new CodePrimitiveExpression ((string) atts [id]));
+ builder.method.Statements.Add (expr);
+ }
+ }
+
+ void AddRenderControl (ControlBuilder builder)
+ {
+ CodeIndexerExpression indexer = new CodeIndexerExpression ();
+ indexer.TargetObject = new CodePropertyReferenceExpression (
+ new CodeArgumentReferenceExpression ("parameterContainer"),
+ "Controls");
+
+ indexer.Indices.Add (new CodePrimitiveExpression (builder.renderIndex));
+
+ CodeMethodInvokeExpression invoke = new CodeMethodInvokeExpression (indexer, "RenderControl");
+ invoke.Parameters.Add (new CodeArgumentReferenceExpression ("__output"));
+ builder.renderMethod.Statements.Add (invoke);
+ builder.renderIndex++;
+ }
+
+ void AddChildCall (ControlBuilder parent, ControlBuilder child)
+ {
+ CodeMethodReferenceExpression m = new CodeMethodReferenceExpression (thisRef, child.method.Name);
+ CodeMethodInvokeExpression expr = new CodeMethodInvokeExpression (m);
+
+ object [] atts = child.ControlType.GetCustomAttributes (typeof (PartialCachingAttribute), true);
+ if (atts != null && atts.Length > 0) {
+ PartialCachingAttribute pca = (PartialCachingAttribute) atts [0];
+ CodeTypeReferenceExpression cc = new CodeTypeReferenceExpression("System.Web.UI.StaticPartialCachingControl");
+ CodeMethodInvokeExpression build = new CodeMethodInvokeExpression (cc, "BuildCachedControl");
+ build.Parameters.Add (new CodeArgumentReferenceExpression("__ctrl"));
+ build.Parameters.Add (new CodePrimitiveExpression (child.ID));
+#if NET_1_1
+ if (pca.Shared)
+ build.Parameters.Add (new CodePrimitiveExpression (child.ControlType.GetHashCode ().ToString ()));
+ else
+#endif
+ build.Parameters.Add (new CodePrimitiveExpression (Guid.NewGuid ().ToString ()));
+
+ build.Parameters.Add (new CodePrimitiveExpression (pca.Duration));
+ build.Parameters.Add (new CodePrimitiveExpression (pca.VaryByParams));
+ build.Parameters.Add (new CodePrimitiveExpression (pca.VaryByControls));
+ build.Parameters.Add (new CodePrimitiveExpression (pca.VaryByCustom));
+ build.Parameters.Add (new CodeDelegateCreateExpression (
+ new CodeTypeReference (typeof (System.Web.UI.BuildMethod)),
+ thisRef, child.method.Name));
+
+ parent.method.Statements.Add (build);
+ if (parent.HasAspCode)
+ AddRenderControl (parent);
+ return;
+ }
+
+ if (child.isProperty || parent.ChildrenAsProperties) {
+ expr.Parameters.Add (new CodeFieldReferenceExpression (ctrlVar, child.TagName));
+ parent.method.Statements.Add (expr);
+ return;
+ }
+
+ parent.method.Statements.Add (expr);
+ CodeFieldReferenceExpression field = new CodeFieldReferenceExpression (thisRef, child.ID);
+ if (parent.ControlType == null || typeof (IParserAccessor).IsAssignableFrom (parent.ControlType)) {
+ AddParsedSubObjectStmt (parent, field);
+ } else {
+ CodeMethodInvokeExpression invoke = new CodeMethodInvokeExpression (ctrlVar, "Add");
+ invoke.Parameters.Add (field);
+ parent.method.Statements.Add (invoke);
+ }
+
+ if (parent.HasAspCode)
+ AddRenderControl (parent);
+ }
+
+ void AddTemplateInvocation (CodeMemberMethod method, string name, string methodName)
+ {
+ CodePropertyReferenceExpression prop = new CodePropertyReferenceExpression (ctrlVar, name);
+
+ CodeObjectCreateExpression newBuild = new CodeObjectCreateExpression (typeof (BuildTemplateMethod));
+ newBuild.Parameters.Add (new CodeMethodReferenceExpression (thisRef, methodName));
+
+ CodeObjectCreateExpression newCompiled = new CodeObjectCreateExpression (typeof (CompiledTemplateBuilder));
+ newCompiled.Parameters.Add (newBuild);
+
+ CodeAssignStatement assign = new CodeAssignStatement (prop, newCompiled);
+ method.Statements.Add (assign);
+ }
+
+#if NET_2_0
+ void AddBindableTemplateInvocation (CodeMemberMethod method, string name, string methodName, string extractMethodName)
+ {
+ CodePropertyReferenceExpression prop = new CodePropertyReferenceExpression (ctrlVar, name);
+
+ CodeObjectCreateExpression newBuild = new CodeObjectCreateExpression (typeof (BuildTemplateMethod));
+ newBuild.Parameters.Add (new CodeMethodReferenceExpression (thisRef, methodName));
+
+ CodeObjectCreateExpression newExtract = new CodeObjectCreateExpression (typeof (ExtractTemplateValuesMethod));
+ newExtract.Parameters.Add (new CodeMethodReferenceExpression (thisRef, extractMethodName));
+
+ CodeObjectCreateExpression newCompiled = new CodeObjectCreateExpression (typeof (CompiledBindableTemplateBuilder));
+ newCompiled.Parameters.Add (newBuild);
+ newCompiled.Parameters.Add (newExtract);
+
+ CodeAssignStatement assign = new CodeAssignStatement (prop, newCompiled);
+ method.Statements.Add (assign);
+ }
+
+ string CreateExtractValuesMethod (TemplateBuilder builder)
+ {
+ CodeMemberMethod method = new CodeMemberMethod ();
+ method.Name = "__ExtractValues_" + builder.ID;
+ method.Attributes = MemberAttributes.Private | MemberAttributes.Final;
+ method.ReturnType = new CodeTypeReference (typeof(IOrderedDictionary));
+
+ CodeParameterDeclarationExpression arg = new CodeParameterDeclarationExpression ();
+ arg.Type = new CodeTypeReference (typeof (Control));
+ arg.Name = "__container";
+ method.Parameters.Add (arg);
+ mainClass.Members.Add (method);
+
+ CodeObjectCreateExpression newTable = new CodeObjectCreateExpression ();
+ newTable.CreateType = new CodeTypeReference (typeof(OrderedDictionary));
+ method.Statements.Add (new CodeVariableDeclarationStatement (typeof(OrderedDictionary), "__table", newTable));
+ CodeVariableReferenceExpression tableExp = new CodeVariableReferenceExpression ("__table");
+
+ if (builder.Bindings != null) {
+ foreach (TemplateBinding binding in builder.Bindings) {
+ CodeVariableDeclarationStatement dec = new CodeVariableDeclarationStatement (binding.ControlType, binding.ControlId);
+ method.Statements.Add (dec);
+ CodeVariableReferenceExpression cter = new CodeVariableReferenceExpression ("__container");
+ CodeMethodInvokeExpression invoke = new CodeMethodInvokeExpression (cter, "FindControl");
+ invoke.Parameters.Add (new CodePrimitiveExpression (binding.ControlId));
+
+ CodeAssignStatement assign = new CodeAssignStatement ();
+ CodeVariableReferenceExpression control = new CodeVariableReferenceExpression (binding.ControlId);
+ assign.Left = control;
+ assign.Right = new CodeCastExpression (binding.ControlType, invoke);
+ method.Statements.Add (assign);
+
+ CodeConditionStatement sif = new CodeConditionStatement ();
+ sif.Condition = new CodeBinaryOperatorExpression (control, CodeBinaryOperatorType.IdentityInequality, new CodePrimitiveExpression (null));
+
+ assign = new CodeAssignStatement ();
+ assign.Left = new CodeIndexerExpression (tableExp, new CodePrimitiveExpression (binding.FieldName));
+ assign.Right = new CodePropertyReferenceExpression (control, binding.ControlProperty);
+ sif.TrueStatements.Add (assign);
+ method.Statements.Add (sif);
+ }
+ }
+
+ method.Statements.Add (new CodeMethodReturnStatement (tableExp));
+ return method.Name;
+ }
+
+ void AddContentTemplateInvocation (ContentControlBuilder cbuilder, CodeMemberMethod method, string methodName)
+ {
+ CodePropertyReferenceExpression pag = new CodePropertyReferenceExpression (ctrlVar, "Page");
+ CodePropertyReferenceExpression prop = new CodePropertyReferenceExpression (pag, "Master");
+
+ CodeObjectCreateExpression newBuild = new CodeObjectCreateExpression (typeof (BuildTemplateMethod));
+ newBuild.Parameters.Add (new CodeMethodReferenceExpression (thisRef, methodName));
+
+ CodeObjectCreateExpression newCompiled = new CodeObjectCreateExpression (typeof (CompiledTemplateBuilder));
+ newCompiled.Parameters.Add (newBuild);
+
+ CodeMethodInvokeExpression invoke = new CodeMethodInvokeExpression (prop, "AddContentTemplate");
+ invoke.Parameters.Add (new CodePrimitiveExpression (cbuilder.ContentPlaceHolderID));
+ invoke.Parameters.Add (newCompiled);
+
+ method.Statements.Add (invoke);
+ }
+#endif
+
+ void AddCodeRender (ControlBuilder parent, CodeRenderBuilder cr)
+ {
+ if (cr.Code == null || cr.Code.Trim () == "")
+ return;
+
+ if (!cr.IsAssign) {
+ CodeSnippetStatement code = new CodeSnippetStatement (cr.Code);
+ parent.renderMethod.Statements.Add (code);
+ return;
+ }
+
+ CodeMethodInvokeExpression expr = new CodeMethodInvokeExpression ();
+ expr.Method = new CodeMethodReferenceExpression (
+ new CodeArgumentReferenceExpression ("__output"),
+ "Write");
+
+ expr.Parameters.Add (new CodeSnippetExpression (cr.Code));
+ parent.renderMethod.Statements.Add (expr);
+ }
+
+ static Type GetContainerType (ControlBuilder builder)
+ {
+ TemplateBuilder tb = builder as TemplateBuilder;
+ if (tb != null && tb.ContainerType != null)
+ return tb.ContainerType;
+
+ Type type = builder.BindingContainerType;
+
+ PropertyInfo prop = type.GetProperty ("Items", noCaseFlags);
+ if (prop == null)
+ return type;
+
+ Type ptype = prop.PropertyType;
+ if (!typeof (ICollection).IsAssignableFrom (ptype))
+ return type;
+
+ prop = ptype.GetProperty ("Item", noCaseFlags);
+ if (prop == null)
+ return type;
+
+ return prop.PropertyType;
+ }
+
+ CodeMemberMethod CreateDBMethod (string name, Type container, Type target)
+ {
+ CodeMemberMethod method = new CodeMemberMethod ();
+ method.Attributes = MemberAttributes.Public | MemberAttributes.Final;
+ method.Name = name;
+ method.Parameters.Add (new CodeParameterDeclarationExpression (typeof (object), "sender"));
+ method.Parameters.Add (new CodeParameterDeclarationExpression (typeof (EventArgs), "e"));
+
+ CodeTypeReference containerRef = new CodeTypeReference (container);
+ CodeTypeReference targetRef = new CodeTypeReference (target);
+
+ CodeVariableDeclarationStatement decl = new CodeVariableDeclarationStatement();
+ decl.Name = "Container";
+ decl.Type = containerRef;
+ method.Statements.Add (decl);
+
+ decl = new CodeVariableDeclarationStatement();
+ decl.Name = "target";
+ decl.Type = targetRef;
+ method.Statements.Add (decl);
+
+ CodeVariableReferenceExpression targetExpr = new CodeVariableReferenceExpression ("target");
+ CodeAssignStatement assign = new CodeAssignStatement ();
+ assign.Left = targetExpr;
+ assign.Right = new CodeCastExpression (targetRef, new CodeArgumentReferenceExpression ("sender"));
+ method.Statements.Add (assign);
+
+ assign = new CodeAssignStatement ();
+ assign.Left = new CodeVariableReferenceExpression ("Container");
+ assign.Right = new CodeCastExpression (containerRef,
+ new CodePropertyReferenceExpression (targetExpr, "BindingContainer"));
+ method.Statements.Add (assign);
+
+ return method;
+ }
+
+ void AddDataBindingLiteral (ControlBuilder builder, DataBindingBuilder db)
+ {
+ if (db.Code == null || db.Code.Trim () == "")
+ return;
+
+ EnsureID (db);
+ CreateField (db, false);
+
+ string dbMethodName = "__DataBind_" + db.ID;
+ // Add the method that builds the DataBoundLiteralControl
+ InitMethod (db, false, false);
+ CodeMemberMethod method = db.method;
+ AddEventAssign (method, "DataBinding", typeof (EventHandler), dbMethodName);
+ method.Statements.Add (new CodeMethodReturnStatement (ctrlVar));
+
+ // Add the DataBind handler
+ method = CreateDBMethod (dbMethodName, GetContainerType (builder), typeof (DataBoundLiteralControl));
+
+ CodeVariableReferenceExpression targetExpr = new CodeVariableReferenceExpression ("target");
+ CodeMethodInvokeExpression invoke = new CodeMethodInvokeExpression ();
+ invoke.Method = new CodeMethodReferenceExpression (targetExpr, "SetDataBoundString");
+ invoke.Parameters.Add (new CodePrimitiveExpression (0));
+
+ CodeMethodInvokeExpression tostring = new CodeMethodInvokeExpression ();
+ tostring.Method = new CodeMethodReferenceExpression (
+ new CodeTypeReferenceExpression (typeof (Convert)),
+ "ToString");
+ tostring.Parameters.Add (new CodeSnippetExpression (db.Code));
+ invoke.Parameters.Add (tostring);
+ method.Statements.Add (invoke);
+
+ mainClass.Members.Add (method);
+
+ AddChildCall (builder, db);
+ }
+
+ void FlushText (ControlBuilder builder, StringBuilder sb)
+ {
+ if (sb.Length > 0) {
+ AddLiteralSubObject (builder, sb.ToString ());
+ sb.Length = 0;
+ }
+ }
+
+ void CreateControlTree (ControlBuilder builder, bool inTemplate, bool childrenAsProperties)
+ {
+ EnsureID (builder);
+ bool isTemplate = (typeof (TemplateBuilder).IsAssignableFrom (builder.GetType ()));
+ if (!isTemplate && !inTemplate) {
+ CreateField (builder, true);
+ } else if (!isTemplate) {
+ builder.ID = builder.GetNextID (null);
+ CreateField (builder, false);
+ }
+
+ InitMethod (builder, isTemplate, childrenAsProperties);
+ if (!isTemplate || builder.GetType () == typeof (RootBuilder))
+ CreateAssignStatementsFromAttributes (builder);
+
+ if (builder.Children != null && builder.Children.Count > 0) {
+ ArrayList templates = null;
+
+ StringBuilder sb = new StringBuilder ();
+ foreach (object b in builder.Children) {
+
+ if (b is string) {
+ sb.Append ((string) b);
+ continue;
+ }
+
+ FlushText (builder, sb);
+ if (b is ObjectTagBuilder) {
+ ProcessObjectTag ((ObjectTagBuilder) b);
+ continue;
+ }
+
+#if NET_2_0
+ if (b is ContentControlBuilder) {
+ ContentControlBuilder cb = (ContentControlBuilder) b;
+ CreateControlTree (cb, false, true);
+ AddContentTemplateInvocation (cb, builder.method, cb.method.Name);
+ continue;
+ }
+#endif
+
+ if (b is TemplateBuilder) {
+ if (templates == null)
+ templates = new ArrayList ();
+
+ templates.Add (b);
+ continue;
+ }
+
+ if (b is CodeRenderBuilder) {
+ AddCodeRender (builder, (CodeRenderBuilder) b);
+ continue;
+ }
+
+ if (b is DataBindingBuilder) {
+ AddDataBindingLiteral (builder, (DataBindingBuilder) b);
+ continue;
+ }
+
+ if (b is ControlBuilder) {
+ ControlBuilder child = (ControlBuilder) b;
+ CreateControlTree (child, inTemplate, builder.ChildrenAsProperties);
+ AddChildCall (builder, child);
+ continue;
+ }
+
+ throw new Exception ("???");
+ }
+
+ FlushText (builder, sb);
+
+ if (templates != null) {
+ foreach (TemplateBuilder b in templates) {
+ CreateControlTree (b, true, false);
+#if NET_2_0
+ if (b.BindingDirection == BindingDirection.TwoWay) {
+ string extractMethod = CreateExtractValuesMethod (b);
+ AddBindableTemplateInvocation (builder.method, b.TagName, b.method.Name, extractMethod);
+ }
+ else
+#endif
+ AddTemplateInvocation (builder.method, b.TagName, b.method.Name);
+ }
+ }
+
+ }
+
+ if (builder.defaultPropertyBuilder != null) {
+ ControlBuilder b = builder.defaultPropertyBuilder;
+ CreateControlTree (b, false, true);
+ AddChildCall (builder, b);
+ }
+
+ if (builder.HasAspCode) {
+ CodeMethodReferenceExpression m = new CodeMethodReferenceExpression ();
+ m.TargetObject = thisRef;
+ m.MethodName = builder.renderMethod.Name;
+
+ CodeDelegateCreateExpression create = new CodeDelegateCreateExpression ();
+ create.DelegateType = new CodeTypeReference (typeof (RenderMethod));
+ create.TargetObject = thisRef;
+ create.MethodName = builder.renderMethod.Name;
+
+ CodeMethodInvokeExpression invoke = new CodeMethodInvokeExpression ();
+ invoke.Method = new CodeMethodReferenceExpression (ctrlVar, "SetRenderMethodDelegate");
+ invoke.Parameters.Add (create);
+
+ builder.method.Statements.Add (invoke);
+ }
+
+ if (!childrenAsProperties && typeof (Control).IsAssignableFrom (builder.ControlType))
+ builder.method.Statements.Add (new CodeMethodReturnStatement (ctrlVar));
+ }
+
+ protected override void CreateMethods ()
+ {
+ base.CreateMethods ();
+
+ CreateProperties ();
+ CreateControlTree (parser.RootBuilder, false, false);
+ CreateFrameworkInitializeMethod ();
+ }
+
+ void CreateFrameworkInitializeMethod ()
+ {
+ CodeMemberMethod method = new CodeMemberMethod ();
+ method.Name = "FrameworkInitialize";
+ method.Attributes = MemberAttributes.Family | MemberAttributes.Override;
+ AddStatementsToFrameworkInitialize (method);
+ mainClass.Members.Add (method);
+ }
+
+ protected virtual void AddStatementsToFrameworkInitialize (CodeMemberMethod method)
+ {
+ if (!parser.EnableViewState) {
+ CodeAssignStatement stmt = new CodeAssignStatement ();
+ stmt.Left = new CodePropertyReferenceExpression (thisRef, "EnableViewState");
+ stmt.Right = new CodePrimitiveExpression (false);
+ method.Statements.Add (stmt);
+ }
+
+ CodeMethodReferenceExpression methodExpr;
+ methodExpr = new CodeMethodReferenceExpression (thisRef, "__BuildControlTree");
+ CodeMethodInvokeExpression expr = new CodeMethodInvokeExpression (methodExpr, thisRef);
+ method.Statements.Add (new CodeExpressionStatement (expr));
+ }
+
+ protected override void AddApplicationAndSessionObjects ()
+ {
+ foreach (ObjectTagBuilder tag in GlobalAsaxCompiler.ApplicationObjects) {
+ CreateFieldForObject (tag.Type, tag.ObjectID);
+ CreateApplicationOrSessionPropertyForObject (tag.Type, tag.ObjectID, true, false);
+ }
+
+ foreach (ObjectTagBuilder tag in GlobalAsaxCompiler.SessionObjects) {
+ CreateApplicationOrSessionPropertyForObject (tag.Type, tag.ObjectID, false, false);
+ }
+ }
+
+ protected void ProcessObjectTag (ObjectTagBuilder tag)
+ {
+ string fieldName = CreateFieldForObject (tag.Type, tag.ObjectID);
+ CreatePropertyForObject (tag.Type, tag.ObjectID, fieldName, false);
+ }
+
+ void CreateProperties ()
+ {
+ if (!parser.AutoEventWireup) {
+ CreateAutoEventWireup ();
+ } else {
+ CreateAutoHandlers ();
+ }
+
+ CreateApplicationInstance ();
+ CreateTemplateSourceDirectory ();
+ }
+
+ void CreateTemplateSourceDirectory ()
+ {
+ CodeMemberProperty prop = new CodeMemberProperty ();
+ prop.Type = new CodeTypeReference (typeof (string));
+ prop.Name = "TemplateSourceDirectory";
+ prop.Attributes = MemberAttributes.Public | MemberAttributes.Override;
+
+ CodePrimitiveExpression expr = new CodePrimitiveExpression (parser.BaseVirtualDir);
+ prop.GetStatements.Add (new CodeMethodReturnStatement (expr));
+ mainClass.Members.Add (prop);
+ }
+
+ void CreateApplicationInstance ()
+ {
+ CodeMemberProperty prop = new CodeMemberProperty ();
+ Type appType = typeof (HttpApplication);
+ prop.Type = new CodeTypeReference (appType);
+ prop.Name = "ApplicationInstance";
+ prop.Attributes = MemberAttributes.Family | MemberAttributes.Final;
+
+ CodePropertyReferenceExpression propRef = new CodePropertyReferenceExpression (thisRef, "Context");
+
+ propRef = new CodePropertyReferenceExpression (propRef, "ApplicationInstance");
+
+ CodeCastExpression cast = new CodeCastExpression (appType.FullName, propRef);
+ prop.GetStatements.Add (new CodeMethodReturnStatement (cast));
+ mainClass.Members.Add (prop);
+ }
+
+ void CreateAutoHandlers ()
+ {
+ // Create AutoHandlers property
+ CodeMemberProperty prop = new CodeMemberProperty ();
+ prop.Type = new CodeTypeReference (typeof (int));
+ prop.Name = "AutoHandlers";
+ prop.Attributes = MemberAttributes.Family | MemberAttributes.Override;
+
+ CodeMethodReturnStatement ret = new CodeMethodReturnStatement ();
+ CodeFieldReferenceExpression fldRef ;
+ fldRef = new CodeFieldReferenceExpression (mainClassExpr, "__autoHandlers");
+ ret.Expression = fldRef;
+ prop.GetStatements.Add (ret);
+
+ prop.SetStatements.Add (new CodeAssignStatement (fldRef, new CodePropertySetValueReferenceExpression ()));
+
+ mainClass.Members.Add (prop);
+
+ // Add the __autoHandlers field
+ CodeMemberField fld = new CodeMemberField (typeof (int), "__autoHandlers");
+ fld.Attributes = MemberAttributes.Private | MemberAttributes.Static;
+ mainClass.Members.Add (fld);
+ }
+
+ void CreateAutoEventWireup ()
+ {
+ // The getter returns false
+ CodeMemberProperty prop = new CodeMemberProperty ();
+ prop.Type = new CodeTypeReference (typeof (bool));
+ prop.Name = "SupportAutoEvents";
+ prop.Attributes = MemberAttributes.Family | MemberAttributes.Override;
+ prop.GetStatements.Add (new CodeMethodReturnStatement (new CodePrimitiveExpression (false)));
+ mainClass.Members.Add (prop);
+ }
+
+ CodeExpression GetExpressionFromString (Type type, string str, MemberInfo member)
+ {
+ if (type == typeof (string))
+ return new CodePrimitiveExpression (str);
+
+ if (type == typeof (bool)) {
+ if (str == null || str == "" || 0 == String.Compare (str, "true", true))
+ return new CodePrimitiveExpression (true);
+ else if (0 == String.Compare (str, "false", true))
+ return new CodePrimitiveExpression (false);
+ else
+ throw new ParseException (currentLocation,
+ "Value '" + str + "' is not a valid boolean.");
+ }
+
+ if (str == null)
+ return new CodePrimitiveExpression (null);
+
+ if (type.IsPrimitive)
+ return new CodePrimitiveExpression (Convert.ChangeType (str, type, CultureInfo.InvariantCulture));
+
+ if (type == typeof (string [])) {
+ string [] subs = str.Split (',');
+ CodeArrayCreateExpression expr = new CodeArrayCreateExpression ();
+ expr.CreateType = new CodeTypeReference (typeof (string));
+ foreach (string v in subs) {
+ expr.Initializers.Add (new CodePrimitiveExpression (v.Trim ()));
+ }
+
+ return expr;
+ }
+
+ if (type == typeof (Color)){
+ if (colorConverter == null)
+ colorConverter = TypeDescriptor.GetConverter (typeof (Color));
+
+ if (str.Trim().Length == 0) {
+ CodeTypeReferenceExpression ft = new CodeTypeReferenceExpression (typeof (Color));
+ return new CodeFieldReferenceExpression (ft, "Empty");
+ }
+
+ Color c;
+ try {
+ if (str.IndexOf (',') == -1) {
+ c = (Color) colorConverter.ConvertFromString (str);
+ } else {
+ int [] argb = new int [4];
+ argb [0] = 255;
+
+ string [] parts = str.Split (',');
+ int length = parts.Length;
+ if (length < 3)
+ throw new Exception ();
+
+ int basei = (length == 4) ? 0 : 1;
+ for (int i = length - 1; i >= 0; i--) {
+ argb [basei + i] = (int) Byte.Parse (parts [i]);
+ }
+ c = Color.FromArgb (argb [0], argb [1], argb [2], argb [3]);
+ }
+ } catch (Exception e){
+ throw new ParseException (currentLocation,
+ "Color " + str + " is not a valid color.", e);
+ }
+
+ if (c.IsKnownColor){
+ CodeFieldReferenceExpression expr = new CodeFieldReferenceExpression ();
+ if (c.IsSystemColor)
+ type = typeof (SystemColors);
+
+ expr.TargetObject = new CodeTypeReferenceExpression (type);
+ expr.FieldName = c.Name;
+ return expr;
+ } else {
+ CodeMethodReferenceExpression m = new CodeMethodReferenceExpression ();
+ m.TargetObject = new CodeTypeReferenceExpression (type);
+ m.MethodName = "FromArgb";
+ CodeMethodInvokeExpression invoke = new CodeMethodInvokeExpression (m);
+ invoke.Parameters.Add (new CodePrimitiveExpression (c.A));
+ invoke.Parameters.Add (new CodePrimitiveExpression (c.R));
+ invoke.Parameters.Add (new CodePrimitiveExpression (c.G));
+ invoke.Parameters.Add (new CodePrimitiveExpression (c.B));
+ return invoke;
+ }
+ }
+
+ TypeConverter converter = TypeDescriptor.GetProperties (member.DeclaringType) [member.Name].Converter;
+
+ if (converter != null && converter.CanConvertFrom (typeof (string))) {
+ object value = converter.ConvertFrom (str);
+
+ if (converter.CanConvertTo (typeof (InstanceDescriptor))) {
+ InstanceDescriptor idesc = (InstanceDescriptor) converter.ConvertTo (value, typeof(InstanceDescriptor));
+ return GenerateInstance (idesc, true);
+ }
+
+ CodeExpression exp = GenerateObjectInstance (value, false);
+ if (exp != null) return exp;
+
+ CodeMethodReferenceExpression m = new CodeMethodReferenceExpression ();
+ m.TargetObject = new CodeTypeReferenceExpression (typeof (TypeDescriptor));
+ m.MethodName = "GetConverter";
+ CodeMethodInvokeExpression invoke = new CodeMethodInvokeExpression (m);
+ CodeTypeReference tref = new CodeTypeReference (type);
+ invoke.Parameters.Add (new CodeTypeOfExpression (tref));
+
+ invoke = new CodeMethodInvokeExpression (invoke, "ConvertFrom");
+ invoke.Parameters.Add (new CodePrimitiveExpression (str));
+
+ return new CodeCastExpression (tref, invoke);
+ }
+
+ Console.WriteLine ("Unknown type: " + type + " value: " + str);
+
+ return new CodePrimitiveExpression (str);
+ }
+
+ CodeExpression GenerateInstance (InstanceDescriptor idesc, bool throwOnError)
+ {
+ CodeExpression[] parameters = new CodeExpression [idesc.Arguments.Count];
+ int n = 0;
+ foreach (object ob in idesc.Arguments) {
+ CodeExpression exp = GenerateObjectInstance (ob, throwOnError);
+ if (exp == null) return null;
+ parameters [n++] = exp;
+ }
+
+ switch (idesc.MemberInfo.MemberType) {
+ case MemberTypes.Constructor:
+ CodeTypeReference tob = new CodeTypeReference (idesc.MemberInfo.DeclaringType);
+ return new CodeObjectCreateExpression (tob, parameters);
+
+ case MemberTypes.Method:
+ CodeTypeReferenceExpression mt = new CodeTypeReferenceExpression (idesc.MemberInfo.DeclaringType);
+ return new CodeMethodInvokeExpression (mt, idesc.MemberInfo.Name, parameters);
+
+ case MemberTypes.Field:
+ CodeTypeReferenceExpression ft = new CodeTypeReferenceExpression (idesc.MemberInfo.DeclaringType);
+ return new CodeFieldReferenceExpression (ft, idesc.MemberInfo.Name);
+
+ case MemberTypes.Property:
+ CodeTypeReferenceExpression pt = new CodeTypeReferenceExpression (idesc.MemberInfo.DeclaringType);
+ return new CodePropertyReferenceExpression (pt, idesc.MemberInfo.Name);
+ }
+ throw new ParseException (currentLocation, "Invalid instance type.");
+ }
+
+ CodeExpression GenerateObjectInstance (object value, bool throwOnError)
+ {
+ if (value == null)
+ return new CodePrimitiveExpression (null);
+
+ Type t = value.GetType();
+ if (t.IsPrimitive || value is string)
+ return new CodePrimitiveExpression (value);
+
+ if (t.IsArray) {
+ Array ar = (Array) value;
+ CodeExpression[] items = new CodeExpression [ar.Length];
+ for (int n=0; n<ar.Length; n++) {
+ CodeExpression exp = GenerateObjectInstance (ar.GetValue (n), throwOnError);
+ if (exp == null) return null;
+ items [n] = exp;
+ }
+ return new CodeArrayCreateExpression (new CodeTypeReference (t), items);
+ }
+
+ TypeConverter converter = TypeDescriptor.GetConverter (t);
+ if (converter != null && converter.CanConvertTo (typeof (InstanceDescriptor))) {
+ InstanceDescriptor idesc = (InstanceDescriptor) converter.ConvertTo (value, typeof(InstanceDescriptor));
+ return GenerateInstance (idesc, throwOnError);
+ }
+
+ InstanceDescriptor desc = GetDefaultInstanceDescriptor (value);
+ if (desc != null) return GenerateInstance (desc, throwOnError);
+
+ if (throwOnError)
+ throw new ParseException (currentLocation, "Cannot generate an instance for the type: " + t);
+ else
+ return null;
+ }
+
+ InstanceDescriptor GetDefaultInstanceDescriptor (object value)
+ {
+ if (value is System.Web.UI.WebControls.Unit) {
+ System.Web.UI.WebControls.Unit s = (System.Web.UI.WebControls.Unit) value;
+ MethodInfo met = typeof(System.Web.UI.WebControls.Unit).GetMethod ("Parse", new Type[] {typeof(string)});
+ return new InstanceDescriptor (met, new object[] {s.ToString ()});
+ }
+
+ if (value is System.Web.UI.WebControls.FontUnit) {
+ System.Web.UI.WebControls.FontUnit s = (System.Web.UI.WebControls.FontUnit) value;
+ MethodInfo met = typeof(System.Web.UI.WebControls.FontUnit).GetMethod ("Parse", new Type[] {typeof(string)});
+ return new InstanceDescriptor (met, new object[] {s.ToString ()});
+ }
+ return null;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs
new file mode 100644
index 00000000000..80f1191557c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs
@@ -0,0 +1,76 @@
+//
+// System.Web.Compilation.UserControlCompiler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.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;
+using System.CodeDom;
+using System.Web.UI;
+
+namespace System.Web.Compilation
+{
+ class UserControlCompiler : TemplateControlCompiler
+ {
+ UserControlParser parser;
+
+ public UserControlCompiler (UserControlParser parser)
+ : base (parser)
+ {
+ this.parser = parser;
+ }
+
+ public static Type CompileUserControlType (UserControlParser parser)
+ {
+ UserControlCompiler pc = new UserControlCompiler (parser);
+ return pc.GetCompiledType ();
+ }
+
+ protected override void AddClassAttributes ()
+ {
+ if (parser.OutputCache)
+ AddOutputCacheAttribute ();
+ }
+
+ private void AddOutputCacheAttribute ()
+ {
+ CodeAttributeDeclaration cad;
+ cad = new CodeAttributeDeclaration ("System.Web.UI.PartialCachingAttribute");
+ AddPrimitiveAttribute (cad, parser.OutputCacheDuration);
+ AddPrimitiveAttribute (cad, parser.OutputCacheVaryByParam);
+ AddPrimitiveAttribute (cad, parser.OutputCacheVaryByControls);
+ AddPrimitiveAttribute (cad, parser.OutputCacheVaryByCustom);
+ AddPrimitiveAttribute (cad, parser.OutputCacheShared);
+ mainClass.CustomAttributes.Add (cad);
+ }
+
+ private void AddPrimitiveAttribute (CodeAttributeDeclaration cad, object obj)
+ {
+ cad.Arguments.Add (new CodeAttributeArgument (new CodePrimitiveExpression (obj)));
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs
new file mode 100644
index 00000000000..fe927b81187
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs
@@ -0,0 +1,143 @@
+//
+// System.Web.Compilation.WebServiceCompiler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
+// Copyright (c) 2040 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
+// "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;
+using System.CodeDom.Compiler;
+using System.IO;
+using System.Web.Configuration;
+using System.Web.UI;
+using System.Reflection;
+
+namespace System.Web.Compilation
+{
+ class WebServiceCompiler : BaseCompiler
+ {
+ SimpleWebHandlerParser parser;
+ ICodeCompiler compiler;
+ CodeDomProvider provider;
+ CompilerParameters compilerParameters;
+ string inputFile;
+
+ public WebServiceCompiler (SimpleWebHandlerParser wService)
+ : base (null)
+ {
+ this.parser = wService;
+ }
+
+ public static Type CompileIntoType (SimpleWebHandlerParser wService)
+ {
+ WebServiceCompiler wsc = new WebServiceCompiler (wService);
+ return wsc.GetCompiledType ();
+ }
+
+ public override Type GetCompiledType ()
+ {
+ Type type = CachingCompiler.GetTypeFromCache (parser.PhysicalPath);
+ if (type != null)
+ return type;
+
+ if (parser.Program.Trim () == "") {
+ type = parser.GetTypeFromBin (parser.ClassName);
+ CachingCompiler.InsertType (type, parser.PhysicalPath);
+ return type;
+ }
+
+ string lang = parser.Language;
+ CompilationConfiguration config;
+ config = CompilationConfiguration.GetInstance (parser.Context);
+ provider = config.GetProvider (lang);
+ if (provider == null)
+ throw new HttpException ("Configuration error. Language not supported: " +
+ lang, 500);
+
+ compiler = provider.CreateCompiler ();
+
+ compilerParameters = CachingCompiler.GetOptions (parser.Assemblies);
+ compilerParameters.IncludeDebugInformation = parser.Debug;
+ compilerParameters.CompilerOptions = config.GetCompilerOptions (lang);
+ compilerParameters.WarningLevel = config.GetWarningLevel (lang);
+
+ bool keepFiles = (Environment.GetEnvironmentVariable ("MONO_ASPNET_NODELETE") != null);
+
+ TempFileCollection tempcoll;
+ tempcoll = new TempFileCollection (config.TempDirectory, keepFiles);
+ compilerParameters.TempFiles = tempcoll;
+
+ if (!Directory.Exists (dynamicBase))
+ Directory.CreateDirectory (dynamicBase);
+
+ inputFile = tempcoll.AddExtension (provider.FileExtension);
+ Stream st = File.OpenWrite (inputFile);
+ StreamWriter sw = new StreamWriter (st);
+ sw.WriteLine (parser.Program);
+ sw.Close ();
+
+ string dllfilename = Path.GetFileName (tempcoll.AddExtension ("dll", true));
+
+ compilerParameters.OutputAssembly = Path.Combine (dynamicBase, dllfilename);
+
+ CompilerResults results = CachingCompiler.Compile (this);
+ CheckCompilerErrors (results);
+ if (results.CompiledAssembly == null)
+ throw new CompilationException (inputFile, results.Errors,
+ "No assembly returned after compilation!?");
+
+ results.TempFiles.Delete ();
+ type = results.CompiledAssembly.GetType (parser.ClassName, true);
+ CachingCompiler.InsertType (type, parser.PhysicalPath);
+ return type;
+ }
+
+ void CheckCompilerErrors (CompilerResults results)
+ {
+ if (results.NativeCompilerReturnValue == 0)
+ return;
+
+ throw new CompilationException (parser.PhysicalPath, results.Errors, parser.Program);
+ }
+
+ internal new SimpleWebHandlerParser Parser {
+ get { return parser; }
+ }
+
+ internal override ICodeCompiler Compiler {
+ get { return compiler; }
+ }
+
+ internal CompilerParameters CompilerOptions {
+ get { return compilerParameters; }
+ }
+
+ internal string InputFile {
+ get { return inputFile; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/AdapterDictionary.cs b/mcs/class/System.Web/System.Web.Configuration/AdapterDictionary.cs
new file mode 100644
index 00000000000..7273e4410df
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/AdapterDictionary.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.Configuration.AdapterDictionary
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+
+namespace System.Web.Configuration
+{
+ public class AdapterDictionary: Hashtable
+ {
+ public string this [string key] {
+ get { return (string) base [key]; }
+ set { base [key] = value; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/AnonymousIdentificationSection.cs b/mcs/class/System.Web/System.Web.Configuration/AnonymousIdentificationSection.cs
new file mode 100644
index 00000000000..9c94cfcf961
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/AnonymousIdentificationSection.cs
@@ -0,0 +1,128 @@
+//
+// System.Web.Configuration.AnonymousIdentificationSection.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Configuration;
+using System.Web.Security;
+
+namespace System.Web.Configuration
+{
+ public class AnonymousIdentificationSection: InternalSection
+ {
+ static ConfigurationPropertyCollection properties;
+ static ConfigurationProperty enabledProp;
+ static ConfigurationProperty cookieNameProp;
+ static ConfigurationProperty cookieTimeoutProp;
+ static ConfigurationProperty cookiePathProp;
+ static ConfigurationProperty cookieRequireSSLProp;
+ static ConfigurationProperty cookieSlidingExpirationProp;
+ static ConfigurationProperty cookieProtectionProp;
+ static ConfigurationProperty cookilessProp;
+ static ConfigurationProperty domainProp;
+
+ static AnonymousIdentificationSection ()
+ {
+ enabledProp = new ConfigurationProperty ("enabled", typeof(bool), false);
+ cookieNameProp = new NonEmptyStringConfigurationProperty ("cookieName", ".ASPXANONYMOUS", ConfigurationPropertyFlags.None);
+ cookieTimeoutProp = new TimeSpanConfigurationProperty ("cookieTimeout", new TimeSpan (69,10,40,0), TimeSpanSerializedFormat.Minutes, TimeSpanPropertyFlags.AllowInfinite | TimeSpanPropertyFlags.ProhibitZero, ConfigurationPropertyFlags.None);
+ cookiePathProp = new NonEmptyStringConfigurationProperty ("cookiePath", "/", ConfigurationPropertyFlags.None);
+ cookieRequireSSLProp = new ConfigurationProperty ("cookieRequireSSL", typeof(bool), false);
+ cookieSlidingExpirationProp = new ConfigurationProperty ("cookieSlidingExpiration", typeof(bool), true);
+ cookieProtectionProp = new ConfigurationProperty ("cookieProtection", typeof(CookieProtection), CookieProtection.Validation);
+ cookilessProp = new ConfigurationProperty ("cookiless", typeof(HttpCookieMode), HttpCookieMode.UseDeviceProfile);
+ domainProp = new ConfigurationProperty ("domain", typeof(string), null);
+
+ properties = new ConfigurationPropertyCollection ();
+ properties.Add (enabledProp);
+ properties.Add (cookieNameProp);
+ properties.Add (cookieTimeoutProp);
+ properties.Add (cookiePathProp);
+ properties.Add (cookieRequireSSLProp);
+ properties.Add (cookieSlidingExpirationProp);
+ properties.Add (cookieProtectionProp);
+ properties.Add (cookilessProp);
+ properties.Add (domainProp);
+ }
+
+ public HttpCookieMode Cookiless {
+ get { return (HttpCookieMode) base [cookilessProp]; }
+ set { base [cookilessProp] = value; }
+ }
+
+ public string CookieName {
+ get { return (string) base [cookieNameProp]; }
+ set { base [cookieNameProp] = value; }
+ }
+
+ public string CookiePath {
+ get { return (string) base [cookiePathProp]; }
+ set { base [cookiePathProp] = value; }
+ }
+
+ public CookieProtection CookieProtection {
+ get { return (CookieProtection) base [cookieProtectionProp]; }
+ set { base [cookieProtectionProp] = value; }
+ }
+
+ public bool CookieRequireSSL {
+ get { return (bool) base [cookieRequireSSLProp]; }
+ set { base [cookieRequireSSLProp] = value; }
+ }
+
+ public bool CookieSlidingExpiration {
+ get { return (bool) base [cookieSlidingExpirationProp]; }
+ set { base [cookieSlidingExpirationProp] = value; }
+ }
+
+ public TimeSpan CookieTimeout {
+ get { return (TimeSpan) base [cookieTimeoutProp]; }
+ set { base [cookieTimeoutProp] = value; }
+ }
+
+ public string Domain {
+ get { return (string) base [domainProp]; }
+ set { base [domainProp] = value; }
+ }
+
+ public bool Enabled {
+ get { return (bool) base [enabledProp]; }
+ set { base [enabledProp] = value; }
+ }
+
+/* protected override ConfigurationPropertyCollection Properties {
+ get { return properties; }
+ }
+*/
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/AssemblyCollection.cs b/mcs/class/System.Web/System.Web.Configuration/AssemblyCollection.cs
new file mode 100644
index 00000000000..9ed36f83013
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/AssemblyCollection.cs
@@ -0,0 +1,77 @@
+//
+// System.Web.Configuration.AssemblyCollection
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ public class AssemblyCollection: ConfigurationElementCollection
+ {
+ public void Add (AssemblyInfo info)
+ {
+ BaseAdd (info);
+ }
+
+ public void Clear ()
+ {
+ BaseClear ();
+ }
+
+ protected override ConfigurationElement CreateNewElement ()
+ {
+ return new AssemblyInfo ();
+ }
+
+ protected override object GetElementKey (ConfigurationElement element)
+ {
+ return ((AssemblyInfo)element).Assembly;
+ }
+
+ public void Remove (string key)
+ {
+ BaseRemove (key);
+ }
+
+ public void RemoveAt (int index)
+ {
+ BaseRemoveAt (index);
+ }
+
+ public AssemblyInfo this [int n]
+ {
+ get { return (AssemblyInfo) BaseGet (n); }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/AssemblyInfo.cs b/mcs/class/System.Web/System.Web.Configuration/AssemblyInfo.cs
new file mode 100644
index 00000000000..f4d9db26d6a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/AssemblyInfo.cs
@@ -0,0 +1,70 @@
+//
+// System.Web.Configuration.AssemblyCollection
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ public class AssemblyInfo: ConfigurationElement
+ {
+ static ConfigurationPropertyCollection properties;
+ static ConfigurationProperty assemblyProp;
+
+ static AssemblyInfo ()
+ {
+ properties = new ConfigurationPropertyCollection ();
+ assemblyProp = new NonEmptyStringConfigurationProperty ("assembly", null, ConfigurationPropertyFlags.IsKey);
+ properties.Add (assemblyProp);
+ }
+
+ public AssemblyInfo ()
+ {
+ }
+
+ public AssemblyInfo (string assemblyName)
+ {
+ base [assemblyProp] = assemblyName;
+ }
+
+ public string Assembly {
+ get { return (string) base [assemblyProp]; }
+ set { base [assemblyProp] = value; }
+ }
+
+/* protected override ConfigurationPropertyCollection Properties {
+ get { return properties; }
+ }
+*/ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/AuthConfig.cs b/mcs/class/System.Web/System.Web.Configuration/AuthConfig.cs
new file mode 100755
index 00000000000..4016a514d83
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/AuthConfig.cs
@@ -0,0 +1,216 @@
+//
+// System.Web.Configuration.AuthConfig
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.Configuration;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class AuthConfig
+ {
+ AuthenticationMode mode;
+ string cookieName;
+ string cookiePath;
+ string loginUrl;
+ FormsProtectionEnum protection;
+ int timeout;
+ FormsAuthPasswordFormat pwdFormat;
+ Hashtable credentialUsers;
+ bool has_parent;
+#if NET_1_1
+ bool requireSSL;
+ bool slidingExpiration;
+#endif
+
+ internal AuthConfig (object parent)
+ {
+ if (parent is AuthConfig) {
+ has_parent = true;
+ AuthConfig p = (AuthConfig) parent;
+ mode = p.mode;
+ cookieName = p.cookieName;
+ cookiePath = p.cookiePath;
+ loginUrl = p.loginUrl;
+ protection = p.protection;
+ timeout = p.timeout;
+ pwdFormat = p.pwdFormat;
+#if NET_1_1
+ requireSSL = p.requireSSL;
+ slidingExpiration = p.slidingExpiration;
+#endif
+ credentialUsers = new Hashtable (p.CredentialUsers);
+ }
+ }
+
+ internal void SetMode (string m)
+ {
+ if (m == null) {
+ // we default to Forms authentication mode, MS defaults to Windows
+ if (!has_parent)
+ Mode = AuthenticationMode.Forms;
+ return;
+ }
+
+ Mode = (AuthenticationMode) Enum.Parse (typeof (AuthenticationMode), m, true);
+ }
+
+ internal void SetProtection (string prot)
+ {
+ if (prot == null) {
+ if (!has_parent)
+ Protection = FormsProtectionEnum.All;
+ return;
+ }
+
+ Protection = (FormsProtectionEnum) Enum.Parse (typeof (FormsProtectionEnum),
+ prot,
+ true);
+ }
+
+ internal void SetTimeout (string minutes)
+ {
+ if (minutes != null) {
+ Timeout = Int32.Parse (minutes);
+ return;
+ }
+
+ if (!has_parent)
+ Timeout = 30;
+ }
+
+ internal void SetPasswordFormat (string pwdFormat)
+ {
+ if (pwdFormat == null) {
+ if (!has_parent)
+ PasswordFormat = FormsAuthPasswordFormat.Clear;
+ return;
+ }
+
+ PasswordFormat =
+ (FormsAuthPasswordFormat) Enum.Parse (typeof (FormsAuthPasswordFormat),
+ pwdFormat,
+ true);
+ }
+
+ internal AuthenticationMode Mode {
+ get { return mode; }
+ set { mode = value; }
+ }
+
+ internal string CookieName {
+ get {
+ if (cookieName == null)
+ cookieName = ".ASPXAUTH";
+
+ return cookieName;
+ }
+ set {
+ if (value == null)
+ return;
+
+ cookieName = value;
+ }
+ }
+
+ internal string CookiePath {
+ get {
+ if (cookiePath == null)
+ cookiePath = "/";
+
+ return cookiePath;
+ }
+ set {
+ if (value == null)
+ return;
+
+ cookiePath = value;
+ }
+ }
+
+ internal string LoginUrl {
+ get {
+ if (loginUrl == null)
+ loginUrl = "login.aspx";
+
+ return loginUrl;
+ }
+ set {
+ if (value == null)
+ return;
+
+ loginUrl = value;
+ }
+ }
+
+ internal FormsProtectionEnum Protection {
+ get { return protection; }
+ set { protection = value; }
+ }
+
+ internal int Timeout {
+ get { return timeout; }
+ set {
+ if (value <= 0)
+ throw new ArgumentException ("Timeout must be > 0", "value");
+
+ timeout = value;
+ }
+ }
+
+ internal FormsAuthPasswordFormat PasswordFormat {
+ get { return pwdFormat; }
+ set { pwdFormat = value; }
+ }
+
+ internal Hashtable CredentialUsers {
+ get {
+ if (credentialUsers == null)
+ credentialUsers = new Hashtable ();
+
+ return credentialUsers;
+ }
+ }
+
+#if NET_1_1
+ internal bool RequireSSL {
+ get { return requireSSL; }
+ set { requireSSL = value; }
+ }
+
+ internal bool SlidingExpiration {
+ get { return slidingExpiration; }
+ set { slidingExpiration = value; }
+ }
+#endif
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/AuthenticationConfigHandler.cs b/mcs/class/System.Web/System.Web.Configuration/AuthenticationConfigHandler.cs
new file mode 100755
index 00000000000..890a3564408
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/AuthenticationConfigHandler.cs
@@ -0,0 +1,157 @@
+//
+// System.Web.Configuration.AuthenticationSectionHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.Configuration;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class AuthenticationConfigHandler : IConfigurationSectionHandler
+ {
+ public object Create (object parent, object context, XmlNode section)
+ {
+ AuthConfig config = new AuthConfig (parent);
+
+ string mode = AttValue ("mode", section);
+ if (mode != null)
+ config.SetMode (mode);
+
+ if (section.Attributes != null && section.Attributes.Count != 0)
+ ThrowException ("Unrecognized attribute", section);
+
+ XmlNodeList authNodes = section.ChildNodes;
+ foreach (XmlNode child in authNodes) {
+ XmlNodeType ntype = child.NodeType;
+ if (ntype != XmlNodeType.Element)
+ continue;
+
+ if (child.Name == "forms") {
+ config.CookieName = AttValue ("name", child);
+ config.CookiePath = AttValue ("path", child);
+ config.LoginUrl = AttValue ("loginUrl", child);
+ config.SetProtection (AttValue ("protection", child));
+ config.SetTimeout (AttValue ("timeout", child));
+#if NET_1_1
+ string att = AttValue ("requireSSL", child);
+ if (att != null) {
+ if (att == "true") {
+ config.RequireSSL = true;
+ } else if (att == "false") {
+ config.RequireSSL = false;
+ } else {
+ HandlersUtil.ThrowException
+ ("Invalid value for RequireSSL", child);
+ }
+ }
+
+ att = AttValue ("slidingExpiration", child);
+ if (att != null) {
+ if (att == "true") {
+ config.SlidingExpiration = true;
+ } else if (att == "false") {
+ config.SlidingExpiration = false;
+ } else {
+ HandlersUtil.ThrowException
+ ("Invalid value for SlidingExpiration", child);
+ }
+ }
+#endif
+
+ ReadCredentials (child.ChildNodes, config);
+ continue;
+ }
+
+ if (child.Name == "passport") {
+ continue;
+ }
+
+ HandlersUtil.ThrowException ("Unexpected element", child);
+ }
+
+ return config;
+ }
+
+ static void ReadCredentials (XmlNodeList nodes, AuthConfig config)
+ {
+ foreach (XmlNode child in nodes) {
+ XmlNodeType ntype = child.NodeType;
+ if (ntype != XmlNodeType.Element)
+ continue;
+
+ if (child.Name != "credentials")
+ HandlersUtil.ThrowException ("Unexpected element", child);
+
+ config.SetPasswordFormat (AttValue ("passwordFormat", child));
+ ReadUsers (child.ChildNodes, config.CredentialUsers);
+ }
+ }
+
+ static void ReadUsers (XmlNodeList nodes, Hashtable users)
+ {
+ foreach (XmlNode child in nodes) {
+ XmlNodeType ntype = child.NodeType;
+ if (ntype != XmlNodeType.Element)
+ continue;
+
+ if (child.Name != "user")
+ HandlersUtil.ThrowException ("Unexpected element", child);
+
+ string name = AttValue ("name", child, false);
+ string password = AttValue ("password", child);
+ if (users.ContainsKey (name))
+ ThrowException ("User '" + name + "' already added.", child);
+
+ users [name] = password;
+ if (child.HasChildNodes)
+ ThrowException ("Child nodes not allowed here", child.FirstChild);
+ }
+ }
+ // A few methods to save some typing
+ static string AttValue (string name, XmlNode node, bool optional)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, optional);
+ }
+
+ static string AttValue (string name, XmlNode node)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, true);
+ }
+
+ static void ThrowException (string message, XmlNode node)
+ {
+ HandlersUtil.ThrowException (message, node);
+ }
+ //
+
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/AuthenticationMode.cs b/mcs/class/System.Web/System.Web.Configuration/AuthenticationMode.cs
new file mode 100755
index 00000000000..dec72915953
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/AuthenticationMode.cs
@@ -0,0 +1,40 @@
+
+//
+// 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.
+//
+/* System.Web.Configuration
+ * Authors:
+ * Leen Toelen (toelen@hotmail.com)
+ * Copyright (C) 2001 Leen Toelen
+*/
+
+namespace System.Web.Configuration {
+
+ /// <summary>
+ /// Defines the AuthenticationMode for a Web Application.
+ /// </summary>
+ public enum AuthenticationMode{
+ None,
+ Windows,
+ Passport,
+ Forms
+ }
+
+} //namespace System.Web.Configuration
diff --git a/mcs/class/System.Web/System.Web.Configuration/AuthenticationSection.cs b/mcs/class/System.Web/System.Web.Configuration/AuthenticationSection.cs
new file mode 100644
index 00000000000..06765448d79
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/AuthenticationSection.cs
@@ -0,0 +1,81 @@
+//
+// System.Web.Configuration.AuthenticationSection
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ public class AuthenticationSection: ConfigurationSection
+ {
+ static ConfigurationPropertyCollection properties;
+ static ConfigurationProperty formsProp;
+ static ConfigurationProperty passportProp;
+ static ConfigurationProperty modeProp;
+
+ static AuthenticationSection ()
+ {
+ properties = new ConfigurationPropertyCollection ();
+ formsProp = new ConfigurationProperty ("forms", typeof(FormsAuthenticationConfiguration), null);
+ passportProp = new ConfigurationProperty ("passport", typeof(PassportAuthentication), null);
+ modeProp = new ConfigurationProperty ("mode", typeof(AuthenticationMode), null);
+ properties.Add (formsProp);
+ properties.Add (passportProp);
+ properties.Add (modeProp);
+ }
+
+ public AuthenticationSection ()
+ {
+ }
+
+ public FormsAuthenticationConfiguration Forms {
+ get { return (FormsAuthenticationConfiguration) base [formsProp]; }
+ }
+
+ public PassportAuthentication Passport {
+ get { return (PassportAuthentication) base [passportProp]; }
+ }
+
+ public AuthenticationMode Mode {
+ get { return (AuthenticationMode) base [modeProp]; }
+ set { base [modeProp] = value; }
+ }
+
+/*
+ protected override ConfigurationPropertyCollection Properties {
+ get { return properties; }
+ }
+*/
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/AuthorizationConfig.cs b/mcs/class/System.Web/System.Web.Configuration/AuthorizationConfig.cs
new file mode 100644
index 00000000000..5223d72b4e2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/AuthorizationConfig.cs
@@ -0,0 +1,178 @@
+//
+// System.Web.Configuration.AuthorizationConfig
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.Security.Principal;
+using System.Web.UI;
+
+namespace System.Web.Configuration
+{
+ class AuthorizationConfig
+ {
+ AuthorizationConfig parent;
+ ArrayList list;
+
+ internal AuthorizationConfig (object parent)
+ {
+ this.parent = parent as AuthorizationConfig;
+ }
+
+ static string [] SplitAndTrim (string s)
+ {
+ if (s == null || s == "")
+ return null;
+
+ string [] all = s.Split (',');
+ for (int i = 0; i < all.Length; i++)
+ all [i] = all [i].Trim ();
+
+ return all;
+ }
+
+ static bool CheckWildcards (string [] values)
+ {
+ if (values == null)
+ return true;
+
+ foreach (string s in values) {
+ if (s == null || s.Length == 1)
+ continue;
+
+ if (s.IndexOf ('?') != -1 || s.IndexOf ('*') != -1)
+ return false;
+ }
+
+ return true;
+ }
+
+ bool Add (bool allow, string users, string roles, string verbs)
+ {
+ string [] allUsers = SplitAndTrim (users);
+ string [] allRoles = SplitAndTrim (roles);
+ string [] allVerbs = SplitAndTrim (verbs);
+ if (!CheckWildcards (allUsers) || !CheckWildcards (allRoles))
+ return false;
+
+ if (list == null)
+ list = new ArrayList ();
+
+ list.Add (new UserData (allow, allUsers, allRoles, allVerbs));
+ return true;
+ }
+
+ internal bool Allow (string users, string roles, string verbs)
+ {
+ return Add (true, users, roles, verbs);
+ }
+
+ internal bool Deny (string users, string roles, string verbs)
+ {
+ return Add (false, users, roles, verbs);
+ }
+
+ internal bool IsValidUser (IPrincipal user, string verb)
+ {
+ if (user == null)
+ return false;
+
+ if (list == null) {
+ if (parent != null)
+ return parent.IsValidUser (user, verb);
+
+ return true;
+ }
+
+ foreach (UserData data in list) {
+ if (data.Verbs != null && !data.CheckVerb (verb))
+ continue;
+
+ if ((data.Users !=null && data.CheckUser(user.Identity.Name)) ||
+ (data.Roles != null && data.CheckRole(user)))
+ return data.Allow;
+ }
+
+ if (parent != null)
+ return parent.IsValidUser (user, verb);
+
+ return true;
+ }
+
+ struct UserData
+ {
+ public bool Allow;
+ public string [] Users;
+ public string [] Roles;
+ public string [] Verbs;
+
+ public UserData (bool allow, string [] users, string [] roles, string [] verbs)
+ {
+ Allow = allow;
+ Users = users;
+ Roles = roles;
+ Verbs = verbs;
+ }
+
+ public bool CheckUser (string user)
+ {
+ foreach (string u in Users) {
+ if (String.Compare (u, user, true) == 0 ||
+ u == "*" ||
+ (u == "?" && user == ""))
+ return true;
+ }
+
+ return false;
+ }
+
+ public bool CheckRole (IPrincipal user)
+ {
+ foreach (string r in Roles) {
+ if (user.IsInRole (r))
+ return true;
+ }
+
+ return false;
+ }
+
+ public bool CheckVerb (string verb)
+ {
+ foreach (string u in Verbs) {
+ if (String.Compare (u, verb, true) == 0)
+ return true;
+ }
+
+ return false;
+ }
+
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/AuthorizationConfigHandler.cs b/mcs/class/System.Web/System.Web.Configuration/AuthorizationConfigHandler.cs
new file mode 100644
index 00000000000..977da14887a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/AuthorizationConfigHandler.cs
@@ -0,0 +1,95 @@
+//
+// System.Web.Configuration.AuthorizationConfigHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.Configuration;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class AuthorizationConfigHandler : IConfigurationSectionHandler
+ {
+ public object Create (object parent, object context, XmlNode section)
+ {
+ AuthorizationConfig config = new AuthorizationConfig (parent);
+
+ if (section.Attributes != null && section.Attributes.Count != 0)
+ ThrowException ("Unrecognized attribute", section);
+
+ XmlNodeList authNodes = section.ChildNodes;
+ foreach (XmlNode child in authNodes) {
+ XmlNodeType ntype = child.NodeType;
+ if (ntype != XmlNodeType.Element)
+ continue;
+
+ string childName = child.Name;
+ bool allow = (childName == "allow");
+ bool deny = (childName == "deny");
+ if (!allow && !deny)
+ ThrowException ("Element name must be 'allow' or 'deny'.", child);
+
+ string users = AttValue ("users", child);
+ string roles = AttValue ("roles", child);
+ if (users == null && roles == null)
+ ThrowException ("At least 'users' or 'roles' must be present.", child);
+
+ string verbs = AttValue ("verbs", child);
+ if (child.Attributes != null && child.Attributes.Count != 0)
+ ThrowException ("Unrecognized attribute.", child);
+
+ bool added;
+ if (allow)
+ added = config.Allow (users, roles, verbs);
+ else
+ added = config.Deny (users, roles, verbs);
+
+ if (!added)
+ ThrowException ("User and role names cannot contain '?' or '*'.", child);
+ }
+
+ return config;
+ }
+
+ // A few methods to save some typing
+ static string AttValue (string name, XmlNode node)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, true);
+ }
+
+ static void ThrowException (string message, XmlNode node)
+ {
+ HandlersUtil.ThrowException (message, node);
+ }
+ //
+
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/AuthorizationRuleAction.cs b/mcs/class/System.Web/System.Web.Configuration/AuthorizationRuleAction.cs
new file mode 100644
index 00000000000..ff0d8c675e0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/AuthorizationRuleAction.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.Configuration.AuthorizationRuleAction.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System.Resources;
+
+#if NET_2_0
+namespace System.Web.Configuration
+{
+ public enum AuthorizationRuleAction
+ {
+ Allow = 1,
+ Deny = 2,
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/BuildProvider.cs b/mcs/class/System.Web/System.Web.Configuration/BuildProvider.cs
new file mode 100644
index 00000000000..eaa6030dd70
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/BuildProvider.cs
@@ -0,0 +1,90 @@
+//
+// System.Web.Configuration.BuildProvider
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// Copyright (c) 2005 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
+// "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.
+//
+#if NET_2_0
+using System;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ public class BuildProvider : ConfigurationElement {
+ string extension;
+ string type;
+ BuildProviderAppliesTo appliesTo;
+
+ public BuildProvider ()
+ {
+ }
+
+ public BuildProvider (string extension, string type, BuildProviderAppliesTo appliesTo)
+ {
+ this.extension = extension;
+ this.type = type;
+ this.appliesTo = appliesTo;
+ }
+
+ public string Extension {
+ get { return extension; }
+ set { extension = value; }
+ }
+
+ public string Type {
+ get { return type; }
+ set { type = value; }
+ }
+
+ public BuildProviderAppliesTo AppliesTo {
+ get { return appliesTo; }
+ set { appliesTo = value; }
+ }
+
+ protected override ConfigurationPropertyCollection Properties {
+ get {
+ return base.Properties;
+ }
+ }
+
+ public override bool Equals (object provider)
+ {
+ if (!(provider is BuildProvider))
+ return false;
+
+ BuildProvider p = (BuildProvider) provider;
+ return (extension == p.extension && type == p.type && appliesTo == p.appliesTo);
+ }
+
+ public override int GetHashCode ()
+ {
+ return (extension.GetHashCode () ^ (int) appliesTo + type.GetHashCode ());
+ }
+ }
+
+}
+#endif // NET_2_0
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/BuildProviderAppliesTo.cs b/mcs/class/System.Web/System.Web.Configuration/BuildProviderAppliesTo.cs
new file mode 100644
index 00000000000..5c655fdd5ec
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/BuildProviderAppliesTo.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.Configuration.BuildProviderAppliesTo.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System.Resources;
+
+#if NET_2_0
+namespace System.Web.Configuration
+{
+ [Serializable, Flags]
+ public enum BuildProviderAppliesTo
+ {
+ Web = 1,
+ Code = 2,
+ Resources = 4,
+ All = 7,
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/BuildProviderCollection.cs b/mcs/class/System.Web/System.Web.Configuration/BuildProviderCollection.cs
new file mode 100644
index 00000000000..5e5dbfcb119
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/BuildProviderCollection.cs
@@ -0,0 +1,103 @@
+//
+// System.Web.Configuration.BuildProviderCollection
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) Copyright 2005 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
+// "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.
+//
+#if NET_2_0
+using System;
+using System.Collections;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ public sealed class BuildProviderCollection : ConfigurationElementCollection
+ {
+ static ConfigurationPropertyCollection props;
+
+ static BuildProviderCollection ()
+ {
+ //FIXME: add properties
+ props = new ConfigurationPropertyCollection ();
+ }
+
+ public BuildProvider this [int index] {
+ get { return (BuildProvider) BaseGet (index); }
+ set {
+ if (BaseGet (index) != null)
+ BaseRemoveAt (index);
+
+ BaseAdd (index, value);
+ }
+ }
+
+ public new BuildProvider this [string name] {
+ get { return (BuildProvider) BaseGet (name); }
+ }
+
+ protected override ConfigurationPropertyCollection Properties {
+ get { return props; }
+ }
+
+ public void Add (BuildProvider buildProvider)
+ {
+ BaseAdd (buildProvider);
+ }
+
+ public void Clear ()
+ {
+ BaseClear ();
+ }
+
+ public void Remove (string name)
+ {
+ BaseRemove (name);
+ }
+
+ public void RemoveAt (int index)
+ {
+ BaseRemoveAt (index);
+ }
+
+ protected override bool CompareKeys (object key1, object key2)
+ {
+ return (0 == CaseInsensitiveComparer.DefaultInvariant.Compare ((string) key1, (string) key2));
+ }
+
+ protected override ConfigurationElement CreateNewElement ()
+ {
+ return new BuildProvider ();
+ }
+
+ protected override object GetElementKey (ConfigurationElement element)
+ {
+ BuildProvider prov = (BuildProvider) element;
+ return prov.Extension;
+ }
+ }
+}
+#endif // NET_2_0
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/ChangeLog b/mcs/class/System.Web/System.Web.Configuration/ChangeLog
new file mode 100644
index 00000000000..54430bfd29b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/ChangeLog
@@ -0,0 +1,457 @@
+2005-07-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MachineKeyConfigHandler.cs: removed unused code. Use
+ MachineKeyValidation.
+ * MachineKeyValidation.cs: made internal for 1.1 and added AES.
+ * MachineKeyConfig.cs: new property to return 24 bits needed for 3DES.
+ fix typo from last patch ('AutoGenerate'). Made the keys different when
+ both are autogenerated.
+
+2005-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MachineKeyConfigHandler.cs:
+ * MachineKeyConfig.cs: patch from Miguel that moves code from
+ MachineKeyConfigHandler to MachineKeyConfig.
+
+2005-04-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CompilerCollection.cs: added CompareLanguages method.
+
+2005-04-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CompilationConfigurationHandler.cs: ensure TempDirectory is not empty
+ before assigning it. Don't mangle the assembly names provided.
+
+ * CompilationConfiguration.cs: use DynamicBase as the temp directory
+ instead of Path.GetTempPath.
+
+2005-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ModuleItem.cs:
+ * GlobalizationConfigurationHandler.cs:
+ * WebConfigurationSettings.cs:
+ * CustomErrorsConfigHandler.cs:
+ * PagesConfigurationHandler.cs:
+ * WebControlsSectionHandler.cs:
+ * AuthorizationConfigHandler.cs: removed warnings.
+
+2005-03-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CompilerCollection.cs:
+ * CompilationConfigurationHandler.cs:
+ * Compiler.cs:
+ * CompilationSection.cs:
+ * CompilationConfiguration.cs: reverted last patch and/or disable code
+ until the whole config system is migrated to 2.0. Fixes bug #73736.
+
+2005-03-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CodeSubDirectoriesCollection.cs:
+ * ExpressionBuilderCollection.cs:
+ * BuildProviderCollection.cs:
+ * CompilerCollection.cs:
+ * CompilationConfigurationHandler.cs:
+ * ExpressionBuilder.cs:
+ * Compiler.cs:
+ * CompilationSection.cs:
+ * CompilationConfiguration.cs:
+ * CodeSubDirectory.cs: added and implemented
+ most of these files that are used when reading configuration files in
+ NET_2_0.
+
+ * WebCompiler.cs: renamed to Compiler.cs
+
+2004-12-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: correctly detect web.config changes.
+
+2004-11-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HandlerItem.cs: for reusable items, return the same instance always.
+ Fixes bug #69959.
+
+
+2004-11-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * GlobalizationConfigurationHandler.cs: fixed stupid typo (uiculture ->
+ uiCulture). Closes bug #69524.
+
+2004-11-18 Lluis Sanchez Gual <lluis@novell.com>
+
+ * AnonymousIdentificationSection.cs, AuthenticationSection.cs,
+ AssemblyInfo.cs: Initialize property collection.
+ * SiteMapSection.cs, SiteMapHierarchicalDataSourceView.cs,
+ SiteMapDataSource.cs: New file.
+ * SiteMapDataSourceView.cs: Minor fixes.
+
+2004-11-15 Lluis Sanchez Gual <lluis@novell.com>
+
+ * AnonymousIdentificationSection.cs, InternalSection.cs,
+ AuthenticationSection.cs, AssemblyCollection.cs, AssemblyInfo.cs,
+ AdapterDictionary.cs: Implemented.
+ * PassportAuthentication.cs, FormsAuthenticationConfiguration.cs:
+ created classes.
+
+2004-10-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: use CurrentExecutionFilePath instead of
+ FilePath. Fixes bug #67982.
+
+2004-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: fix bug when processing empty location
+ tags. Closes bug #63001.
+
+2004-08-02 Duncan Mak <duncan@ximian.com>
+
+ * AuthorizationRuleAction.cs:
+ * BuildProviderAppliesTo.cs:
+ * CustomErrorsMode.cs:
+ * MachineKeyValidation.cs:
+ * PagesEnableSessionState.cs:
+ * PagesToCountAction.cs:
+ * ProcessModelComAuthenticationLevel.cs:
+ * ProcessModelComImpersonationLevel.cs:
+ * ProcessModelLogLevel.cs;
+ * SerializationMode.cs:
+ * TraceDisplayMode.cs: Added enumerations.
+
+ * IRemoteWebConfigarationHostServer.cs: Added interface.
+
+2004-06-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AuthorizationConfig.cs: really fix bug #60482. Thanks David!
+
+2004-06-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AuthorizationConfig.cs: we must match [verb +] (role|user). Fixes bug
+ #60482.
+
+2004-06-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: allow empty <configSections>.
+
+2004-06-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * GlobalizationConfigurationHandler.cs: if no culture given, use the
+ default one, not the invariant.
+
+2004-06-07 Alon Gazit <along@mainsoft.com>
+
+ * HandlerFactoryConfiguration.cs: using cache to get performance
+ improvement.
+
+
+2004-06-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpCapabilitiesBase.cs: set the useragent of the new
+ HttpBrowserCapabilities object.
+
+2004-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpCapabilitiesBase.cs: ClientTarget takes precedence over UserAgent.
+
+2004-06-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: when the virtual path is not /, don't
+ loop forever trying to read configuration from /. Fixes bug #59480.
+
+2004-05-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * GlobalizationConfiguration.cs: if we have no context, use
+ GetAppConfig instead of GetConfig.
+
+2004-05-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CompilationConfiguration.cs: a null value is ok for TempDirectory.
+
+2004-05-12 Jaroslaw Kowalski <jaak@zd.com.pl>
+
+ * AuthenticationConfigHandler.cs: fixed slidingExpiration and requireSSL
+
+2004-05-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: fixed loading of external files. Closes
+ bug #57244.
+
+2004-05-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: now it defaults to 'web.config' and if
+ not found, 'Web.config'. Don't throw exception if both exists. Thanks
+ to urs and dru for bugging me about this.
+
+2004-04-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: fixed argument exception if the directory
+ we're trying to watch does not exists.
+
+2004-04-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: modify realpath when we reach the
+ virtual root of the application.
+
+2004-04-12 Nick Drochak <ndrochak@gol.com>
+
+ * WebConfigurationSettings.cs: Fix build. Forgot the '?'
+
+2004-04-12 Atsushi Enomoto <atsushi@ximian.com>
+
+ * WebConfigurationSettings.cs : On Windows "Web.config" is "web.config".
+
+2004-04-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: "/" is the virtual root directory of
+ the application. This fixes a bug reported by Vlad that caused
+ configuration error because files were read twice when there's an
+ application different from "/" defined.
+
+2004-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: fixes bug 56267.
+
+2004-03-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: use FileSystemWatcher and really reload
+ configuration when the file is created or modified.
+
+2004-02-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: we were loading web.config from / always!
+ Thanks to Lluis for noticing this.
+
+2004-02-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: fix Web.config search for case
+ insensitive filesystems.
+
+2004-02-04 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * WebConfigurationSettings.cs: Load remoting configuration when reading
+ the web.config file.
+
+2004-01-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AuthConfig.cs:
+ * AuthenticationConfigHandler.cs: added RequireSSL and
+ SlidingExpiration.
+
+ * HandlerFactoryProxy.cs: not public.
+ * HandlerItem.cs: not public.
+
+2004-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: fix location path lookup. Closes bug
+ #53072.
+
+2004-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.Configuration/GlobalizationConfiguration.cs: undo old fix.
+
+ * System.Web.Configuration/PagesConfiguration.cs:
+ * System.Web.Configuration/PagesConfigurationHandler.cs: new files for
+ processing system.web/pages section.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * TraceConfig.cs: New class contains trace configuration data.
+ * TraceConfigurationHandler.cs: New class parses trace
+ configurations.
+
+2004-01-05 Jackson Harper <jackson@ximian.com>
+
+ * HandlerItem.cs: Fix typo so slashes are stripped from paths properly.
+
+2003-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CustomErrorsConfigHandler.cs: handle <system.web><customErrors />..
+
+2003-12-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpCapabilitiesBase.cs: use the new loader.
+
+2003-12-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: also cache parents when building the
+ hierarchy up. Fixes bug #51818.
+
+2003-12-09 Jackson Harper <jackson@ximian.com>
+
+ * GlobalizationConfigurationHander.cs: Make unicode encodings case
+ insensitive.
+
+2003-12-08 Jackson Harper <jackson@ximian.com>
+
+ * GlobalizationConfigurationHandler.cs: Handle creating some the unicode
+ encodings here so we can create ones without BOMs.
+
+2003-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * GlobalizationConfiguration.cs: return null when the configuration is
+ not available.
+
+ * WebConfigurationSettings.cs: handle configuration for System.Web. It
+ replaces the default IConfigurationSystem with itself and handles
+ web.config files oddities.
+
+2003-11-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CompilationConfiguration.cs: don't throw an HttpException.
+ * HttpRuntimeConfig.cs:
+ * HttpRuntimeConfigurationHandler.cs: handle system.web/httpRuntime
+ configuration section.
+
+2003-11-10 Jackson Harper <jackson@ximian.com>
+
+ * CompilationConfigurationHandler.cs: Append .dll to shortened
+ assembly names.
+
+2003-11-08 Jackson Harper <jackson@ximian.com>
+
+ * CompilationConfigurationHandler.cs: Trim extra versioning
+ information off of assembly names. This is a workaround that fixes
+ bug #50355.
+
+2003-11-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * GlobalizationConfiguration.cs: added GetInstance method.
+
+ * GlobalizationConfigurationHandler.cs: warn about unsupported encodings
+ and provide reasonable defaults.
+
+2003-10-17 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * CompilationConfiguration.cs (Init): you have to inherit copying
+ files from the bin folders too.
+
+2003-10-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CompilationConfiguration.cs: use the context passed in. If not, try
+ the current context.
+
+2003-10-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CompilationConfiguration.cs:
+ * CompilationConfigurationHandler.cs:
+ * CompilerCollection.cs:
+ * WebCompiler.cs: new files that process and store
+ system.web/compilation info (compilers + assemblies).
+
+ * HttpHandlersSectionHandler.cs: added option for an attribute to be
+ empty.
+
+2003-10-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebControlsSectionHandler.cs: new file to handle <webControls>
+ configuration.
+
+2003-10-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HandlerItem.cs: make it work for file names without wildcards.
+
+2003-03-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ModuleItem.cs: it's not public.
+ * ModulesConfiguration.cs: it's not public.
+
+2003-02-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AuthenticationConfigHandler.cs: 'name' is optional in <forms>.
+
+2003-02-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HandlerFactoryConfiguration.cs: first search in the mappings of this
+ instance, then in the parent.
+
+2003-02-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * GlobalizationConfiguration.cs: added internal fields to hold the
+ values in the globalization node.
+
+ * GlobalizationConfigurationHandler.cs: handler to load
+ <system.web/globalization> section.
+
+2003-02-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AuthorizationConfigHandler.cs: handler for system.web/authorization
+ section.
+
+ * AuthorizationConfig.cs: keeps record of authorization configuration.
+
+2003-01-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpModulesConfigurationHandler.cs: add a default authentication
+ module at the end of the list.
+
+ * ModuleItem.cs: new constructor.
+
+2002-12-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AuthConfig.cs: LoginUrl defaults to login.aspx.
+
+2002-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AuthConfig.cs:
+ * AuthenticationConfigHandler.cs: handler and helper class for
+ system.web/authentication configuration section.
+
+ * HttpHandlersSectionHandler.cs: check for null in attributes.
+
+ * MachineKeyConfig.cs:
+ * MachineKeyConfigHandler.cs: handler and helper class for
+ system.web/machineKey tag.
+
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpHandlersSectionHandler.cs: more null checks.
+
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpHandlersSectionHandler.cs: made a couple of static methods be
+ part of a class used in other handlers.
+ * HttpModulesConfigurationHandler.cs: handler for modules.
+ * ModuleItem.cs: added IsMatch method.
+ * ModulesConfiguration.cs: made it similar to the handlers class: added Clear, Remove.
+
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpHandlerTypeMapper.cs: removed.
+ * HandlerFactoryConfiguration.cs: readded. I removed it by mistake.
+ * HandlerItem.cs: only load the type if we gotta validate it.
+ Implemented initial IsMatch.
+ * HttpConfigurationContext.cs: New file.
+ * HttpHandlersSectionHandler.cs: validate is optional (default true).
+ Use HttpHandlerTypeMapper.
+
+2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.Configuration/HandlerFactoryConfiguration.cs: removed.
+
+ * System.Web.Configuration/HandlerItem.cs: added validation field.
+
+ * System.Web.Configuration/HttpHandlerTypeMapper.cs: holds mappings
+ between verbs and wilcards and their associated HandlerItem.
+
+ * System.Web.Configuration/HttpHandlersSectionHandler.cs: this one
+ processes system.web/httpHandlers section of machine.config file.
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AuthenticationMode.cs:
+ * ClientTargetSectionHandler.cs:
+ * FormsAuthPasswordFormat.cs:
+ * FormsProtectionEnum.cs:
+ * HttpCapabilitiesBase.cs: fixes base on class status page.
+
+2002-08-05 Patrik Torstensson <ptorsten@hotmail.com>
+
+ * HandlerFactoryConfiguration.cs,
+ HandlerFactoryProxy.cs,
+ HandlerItem.cs : New files to emulate HttpHandler configuration
+
+ * ModuleItem.cs,
+ ModulesConfiguration.cs : New files to emulate HttpModule configuration
+
+2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.Configuration/HttpCapabilitiesBase.cs: New file.
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/ClientTargetSectionHandler.cs b/mcs/class/System.Web/System.Web.Configuration/ClientTargetSectionHandler.cs
new file mode 100644
index 00000000000..a7cf5a71b70
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/ClientTargetSectionHandler.cs
@@ -0,0 +1,65 @@
+
+//
+// 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.
+//
+/* System.Web.Configuration
+ * Authors:
+ * Leen Toelen (toelen@hotmail.com)
+ * Copyright (C) 2001 Leen Toelen
+*/
+using System;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ /// <summary>
+ /// Summary description for ClientTargetSectionHandler.
+ /// </summary>
+ class ClientTargetSectionHandler: NameValueSectionHandler
+ {
+ /// <summary>
+ /// ClientTargetSectionHandler Constructor
+ /// </summary>
+ public ClientTargetSectionHandler(){}
+
+ /// <summary>
+ /// Gets the name of the key in the key-value pair.
+ /// </summary>
+ protected override string KeyAttributeName
+ {
+ get
+ {
+ return "alias";
+ }
+ }
+
+ /// <summary>
+ /// Gets the value for the key in the key-value pair.
+ /// </summary>
+ protected override string ValueAttributeName
+ {
+ get
+ {
+ return "userAgent";
+ }
+ }
+
+ }
+} //namespace System.Web.Configuration
diff --git a/mcs/class/System.Web/System.Web.Configuration/CodeSubDirectoriesCollection.cs b/mcs/class/System.Web/System.Web.Configuration/CodeSubDirectoriesCollection.cs
new file mode 100644
index 00000000000..a0b3176c138
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/CodeSubDirectoriesCollection.cs
@@ -0,0 +1,92 @@
+//
+// System.Web.Configuration.CodeSubDirectoriesCollection
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) Copyright 2005 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
+// "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.
+//
+#if NET_2_0
+using System;
+using System.Collections;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ public sealed class CodeSubDirectoriesCollection : ConfigurationElementCollection
+ {
+ static ConfigurationPropertyCollection props;
+
+ static CodeSubDirectoriesCollection ()
+ {
+ //FIXME: add properties
+ props = new ConfigurationPropertyCollection ();
+ }
+
+ public CodeSubDirectory this [int index] {
+ get { return (CodeSubDirectory) BaseGet (index); }
+ set {
+ if (BaseGet (index) != null)
+ BaseRemoveAt (index);
+
+ BaseAdd (index, value);
+ }
+ }
+
+ protected override ConfigurationElementCollectionType CollectionType {
+ get { return ConfigurationElementCollectionType.AddRemoveClearMap; }
+ }
+
+ protected override string ElementName {
+ get { return "add"; }
+ }
+
+ protected override ConfigurationPropertyCollection Properties {
+ get { return props; }
+ }
+
+ public void Add (CodeSubDirectory codeSubDirectory)
+ {
+ BaseAdd (codeSubDirectory);
+ }
+
+ protected override bool CompareKeys (object key1, object key2)
+ {
+ return (0 == CaseInsensitiveComparer.DefaultInvariant.Compare ((string) key1, (string) key2));
+ }
+
+ protected override ConfigurationElement CreateNewElement ()
+ {
+ return new CodeSubDirectory ();
+ }
+
+ protected override object GetElementKey (ConfigurationElement element)
+ {
+ CodeSubDirectory sd = (CodeSubDirectory) element;
+ return sd.DirectoryName;
+ }
+ }
+}
+#endif // NET_2_0
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/CodeSubDirectory.cs b/mcs/class/System.Web/System.Web.Configuration/CodeSubDirectory.cs
new file mode 100644
index 00000000000..e7ff07c0f53
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/CodeSubDirectory.cs
@@ -0,0 +1,61 @@
+//
+// System.Web.Configuration.CodeSubDirectory
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) Copyright 2005 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
+// "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.
+//
+#if NET_2_0
+using System;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ public sealed class CodeSubDirectory : ConfigurationElement
+ {
+ static ConfigurationPropertyCollection props;
+ string directoryName;
+
+ static CodeSubDirectory ()
+ {
+ props = new ConfigurationPropertyCollection ();
+ ConfigurationPropertyFlags flags = ConfigurationPropertyFlags.IsKey | ConfigurationPropertyFlags.Required;
+ NonEmptyStringFlags strFlags = NonEmptyStringFlags.TrimWhitespace;
+ ConfigurationProperty prop = new NonEmptyStringConfigurationProperty ("directoryName", "", flags, strFlags);
+ props.Add (prop);
+ }
+
+ public string DirectoryName {
+ get { return directoryName; }
+ set { directoryName = value; }
+ }
+
+ protected override ConfigurationPropertyCollection Properties {
+ get { return props; }
+ }
+ }
+}
+#endif // NET_2_0
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/CompilationConfiguration.cs b/mcs/class/System.Web/System.Web.Configuration/CompilationConfiguration.cs
new file mode 100644
index 00000000000..1fb18da769d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/CompilationConfiguration.cs
@@ -0,0 +1,209 @@
+//
+// System.Web.Configuration.CompilationConfiguration
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) Copyright 2003 Ximian, Inc (http://www.ximian.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;
+using System.CodeDom.Compiler;
+using System.Collections;
+using System.Configuration;
+using System.IO;
+using System.Web;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ sealed class CompilationConfiguration
+ {
+ bool debug = false;
+ bool batch = false;
+ int batch_timeout;
+ string default_language = "c#";
+ bool _explicit = true;
+ int max_batch_size = 30;
+ int max_batch_file_size = 3000;
+ int num_recompiles_before_app_restart = 15;
+ bool strict = false;
+ string temp_directory;
+ CompilerCollection compilers;
+ ArrayList assemblies;
+ bool assembliesInBin = false;
+
+ /* Only the config. handler should create instances of this. Use GetInstance (context) */
+ public CompilationConfiguration (object p)
+ {
+ CompilationConfiguration parent = p as CompilationConfiguration;
+ if (parent != null)
+ Init (parent);
+
+ if (compilers == null)
+ compilers = new CompilerCollection ();
+
+ if (assemblies == null)
+ assemblies = new ArrayList ();
+
+ if (temp_directory == null || temp_directory == "")
+ temp_directory = AppDomain.CurrentDomain.SetupInformation.DynamicBase;
+ }
+
+ static public CompilationConfiguration GetInstance (HttpContext context)
+ {
+ CompilationConfiguration config;
+ if (context == null)
+ context = HttpContext.Context;
+
+ config = context.GetConfig ("system.web/compilation") as CompilationConfiguration;
+
+ if (config == null)
+ throw new Exception ("Configuration error.");
+
+ return config;
+ }
+
+ public CodeDomProvider GetProvider (string language)
+ {
+ Compiler compiler = Compilers [language];
+ if (compiler == null)
+ return null;
+
+ if (compiler.Provider != null)
+ return compiler.Provider;
+
+ Type t = Type.GetType (compiler.Type);
+ compiler.Provider = Activator.CreateInstance (t) as CodeDomProvider;
+ return compiler.Provider;
+ }
+
+ public string GetCompilerOptions (string language)
+ {
+ Compiler compiler = Compilers [language];
+ if (compiler == null)
+ return null;
+
+ return compiler.CompilerOptions;
+ }
+
+ public int GetWarningLevel (string language)
+ {
+ Compiler compiler = Compilers [language];
+ if (compiler == null)
+ return 0;
+
+ return compiler.WarningLevel;
+ }
+
+ void Init (CompilationConfiguration parent)
+ {
+ debug = parent.debug;
+ batch = parent.batch;
+ batch_timeout = parent.batch_timeout;
+ default_language = parent.default_language;
+ _explicit = parent._explicit;
+ max_batch_size = parent.max_batch_size;
+ max_batch_file_size = parent.max_batch_file_size;
+ num_recompiles_before_app_restart = parent.num_recompiles_before_app_restart;
+ strict = parent.strict;
+ temp_directory = parent.temp_directory;
+ compilers = new CompilerCollection (parent.compilers);
+ ArrayList p = parent.assemblies;
+ assembliesInBin = parent.assembliesInBin;
+ ICollection coll = (p == null) ? (ICollection) new object [0] : p;
+ assemblies = new ArrayList (coll);
+ }
+
+ public bool Debug {
+ get { return debug; }
+ set { debug = value; }
+ }
+
+ public bool Batch {
+ get { return batch; }
+ set { batch = value; }
+ }
+
+ public int BatchTimeout {
+ get { return batch_timeout; }
+ set { batch_timeout = value; }
+ }
+
+ public string DefaultLanguage {
+ get { return default_language; }
+ set { default_language = value; }
+ }
+
+ public bool Explicit {
+ get { return _explicit; }
+ set { _explicit = value; }
+ }
+
+ public int MaxBatchSize {
+ get { return max_batch_size; }
+ set { max_batch_size = value; }
+ }
+
+ public int MaxBatchFileSize {
+ get { return max_batch_file_size; }
+ set { max_batch_file_size = value; }
+ }
+
+ public int NumRecompilesBeforeAppRestart {
+ get { return num_recompiles_before_app_restart; }
+ set { num_recompiles_before_app_restart = value; }
+ }
+
+ public bool Strict {
+ get { return strict; }
+ set { strict = value; }
+ }
+
+ public string TempDirectory {
+ get { return temp_directory; }
+ set {
+ if (value != null && !Directory.Exists (value))
+ throw new ArgumentException ("Directory does not exist");
+
+ Console.WriteLine ("Dos: '{0}'\n{1}", value, Environment.StackTrace);
+ temp_directory = value;
+ }
+ }
+
+ public CompilerCollection Compilers {
+ get { return compilers; }
+ }
+
+ public ArrayList Assemblies {
+ get { return assemblies; }
+ }
+
+ public bool AssembliesInBin {
+ get { return assembliesInBin; }
+ set { assembliesInBin = value; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/CompilationConfigurationHandler.cs b/mcs/class/System.Web/System.Web.Configuration/CompilationConfigurationHandler.cs
new file mode 100644
index 00000000000..889c70ce6e6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/CompilationConfigurationHandler.cs
@@ -0,0 +1,196 @@
+//
+// System.Web.Configuration.CompilationConfigurationHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.Configuration;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class CompilationConfigurationHandler : IConfigurationSectionHandler
+ {
+ public object Create (object parent, object context, XmlNode section)
+ {
+ CompilationConfiguration config = new CompilationConfiguration (parent);
+
+ string tmp = AttValue ("tempDirectory", section, true);
+ if (tmp != null && tmp != "")
+ config.TempDirectory = tmp;
+ config.DefaultLanguage = AttValue ("defaultLanguage", section);
+ if (config.DefaultLanguage == null)
+ config.DefaultLanguage = "c#";
+
+ config.Debug = AttBoolValue ("debug", section, false);
+ config.Batch = AttBoolValue ("batch", section, false);
+ config.Explicit = AttBoolValue ("explicit", section, true);
+ config.Strict = AttBoolValue ("strict", section, false);
+ config.BatchTimeout = AttUIntValue ("batchTimeout", section, 0);
+ config.MaxBatchSize = AttUIntValue ("maxBatchSize", section, 0);
+ config.MaxBatchFileSize = AttUIntValue ("maxBatchFileSize", section, 0);
+ config.NumRecompilesBeforeAppRestart =
+ AttUIntValue ("numRecompilesBeforeAppRestart", section, 15);
+
+ if (section.Attributes != null && section.Attributes.Count != 0)
+ ThrowException ("Unrecognized attribute.", section);
+
+ XmlNodeList authNodes = section.ChildNodes;
+ foreach (XmlNode child in authNodes) {
+ XmlNodeType ntype = child.NodeType;
+ if (ntype != XmlNodeType.Element)
+ continue;
+
+ if (child.Name == "compilers") {
+ ReadCompilers (child.ChildNodes, config);
+ continue;
+ }
+
+ if (child.Name == "assemblies") {
+ ReadAssemblies (child.ChildNodes, config);
+ continue;
+ }
+
+ ThrowException ("Unexpected element", child);
+ }
+
+ return config;
+ }
+
+ static void ReadCompilers (XmlNodeList nodes, CompilationConfiguration config)
+ {
+ foreach (XmlNode child in nodes) {
+ XmlNodeType ntype = child.NodeType;
+ if (ntype != XmlNodeType.Element)
+ continue;
+
+ if (child.Name != "compiler")
+ ThrowException ("Unexpected element", child);
+
+ Compiler compiler = new Compiler ();
+ compiler.Language = AttValue ("language", child);
+ compiler.Extension = AttValue ("extension", child);
+ compiler.Type = AttValue ("type", child);
+ compiler.CompilerOptions = AttValue ("compilerOptions", child, true, true);
+ compiler.WarningLevel = AttUIntValue ("warningLevel", child, 0);
+ config.Compilers [compiler.Language] = compiler;
+ }
+ }
+
+ static void ReadAssemblies (XmlNodeList nodes, CompilationConfiguration config)
+ {
+ ArrayList assemblies = config.Assemblies;
+
+ foreach (XmlNode child in nodes) {
+ XmlNodeType ntype = child.NodeType;
+ if (ntype != XmlNodeType.Element)
+ continue;
+
+ if (child.Name == "clear") {
+ assemblies.Clear ();
+ config.AssembliesInBin = false;
+ continue;
+ }
+
+ string aname = AttValue ("assembly", child);
+ if (child.Name == "add") {
+ if (aname == "*") {
+ config.AssembliesInBin = true;
+ continue;
+ }
+
+ if (!assemblies.Contains (aname))
+ assemblies.Add (aname);
+
+ continue;
+ }
+
+ if (child.Name == "remove") {
+ if (aname == "*") {
+ config.AssembliesInBin = false;
+ continue;
+ }
+ assemblies.Remove (aname);
+ continue;
+ }
+
+ ThrowException ("Unexpected element " + child.Name, child);
+ }
+ }
+
+ static string AttValue (string name, XmlNode node, bool optional)
+ {
+ return AttValue (name, node, optional, false);
+ }
+
+ static string AttValue (string name, XmlNode node, bool optional, bool allowEmpty)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, optional, allowEmpty);
+ }
+
+ static bool AttBoolValue (string name, XmlNode node, bool _default)
+ {
+ string v = AttValue (name, node, true);
+ if (v == null)
+ return _default;
+
+ bool result = (v == "true");
+ if (!result && v != "false")
+ ThrowException ("Invalid boolean value in " + name, node);
+
+ return result;
+ }
+
+ static int AttUIntValue (string name, XmlNode node, int _default)
+ {
+ string v = AttValue (name, node, true);
+ if (v == null)
+ return _default;
+
+ int result = 0;
+ try {
+ result = (int) UInt32.Parse (v);
+ } catch {
+ ThrowException ("Invalid number in " + name, node);
+ }
+
+ return result;
+ }
+
+ static string AttValue (string name, XmlNode node)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, true);
+ }
+
+ static void ThrowException (string message, XmlNode node)
+ {
+ HandlersUtil.ThrowException (message, node);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/CompilationSection.cs b/mcs/class/System.Web/System.Web.Configuration/CompilationSection.cs
new file mode 100644
index 00000000000..5ee0d91195f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/CompilationSection.cs
@@ -0,0 +1,189 @@
+//
+// System.Web.Configuration.CompilationSection
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) Copyright 2005 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
+// "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.
+//
+#if NET_2_0
+using System;
+using System.Configuration;
+using System.ComponentModel;
+
+namespace System.Web.Configuration
+{
+ public sealed class CompilationSection : InternalSection
+ {
+ static ConfigurationPropertyCollection props;
+ static ConfigurationProperty compilers;
+ static ConfigurationProperty tempDirectory;
+ static ConfigurationProperty debug;
+ static ConfigurationProperty strict;
+ static ConfigurationProperty _explicit;
+ static ConfigurationProperty batch;
+ static ConfigurationProperty batchTimeout;
+ static ConfigurationProperty maxBatchSize;
+ static ConfigurationProperty maxBatchGeneratedFileSize;
+ static ConfigurationProperty numRecompilesBeforeAppRestart;
+ static ConfigurationProperty defaultLanguage;
+ static ConfigurationProperty assemblies;
+ static ConfigurationProperty buildProviders;
+ static ConfigurationProperty expressionBuilders;
+ static ConfigurationProperty urlLinePragmas;
+ static ConfigurationProperty codeSubDirectories;
+
+ static CompilationSection ()
+ {
+ props = new ConfigurationPropertyCollection ();
+ Type strType = typeof (string);
+ TypeConverter strTypeConv = new StringConverter ();
+ Type boolType = typeof (bool);
+ TypeConverter boolTypeConv = new BooleanConverter ();
+ Type intType = typeof (int);
+ TypeConverter intTypeConv = new Int32Converter ();
+
+ assemblies = new ConfigurationProperty ("assemblies", typeof (AssemblyCollection), 0);
+ props.Add (assemblies);
+ batch = new ConfigurationProperty ("batch", boolType, true, boolTypeConv, null, 0);
+ props.Add (batch);
+ buildProviders = new ConfigurationProperty ("buidProviders", typeof (BuildProviderCollection), 0);
+ props.Add (buildProviders);
+ batchTimeout = new ConfigurationProperty ("batchTimeout", typeof (TimeSpan), new TimeSpan (0, 15, 0),
+ new TimeSpanConverter (), null, 0);
+ props.Add (batchTimeout);
+ codeSubDirectories = new ConfigurationProperty ("codeSubDirectories", typeof (CodeSubDirectoriesCollection), 0);
+ props.Add (codeSubDirectories);
+ //compilers = new ConfigurationProperty ("compilers", typeof (CompilerCollection), 0);
+ //props.Add (compilers);
+ debug = new ConfigurationProperty ("debug", boolType, false, boolTypeConv, null, 0);
+ props.Add (debug);
+ defaultLanguage = new ConfigurationProperty ("defaultLanguage", strType, "c#", strTypeConv, null, 0);
+ props.Add (defaultLanguage);
+ expressionBuilders = new ConfigurationProperty ("expressionBuilders", typeof (ExpressionBuilderCollection), 0);
+ props.Add (expressionBuilders);
+ _explicit = new ConfigurationProperty ("explicit", boolType, true, boolTypeConv, null, 0);
+ props.Add (_explicit);
+ maxBatchSize = new ConfigurationProperty ("maxBatchSize", intType, 1000, intTypeConv, null, 0);
+ props.Add (maxBatchSize);
+ maxBatchGeneratedFileSize = new ConfigurationProperty ("maxBatchGeneratedFileSize", intType, 3000, intTypeConv, null, 0);
+ props.Add (maxBatchGeneratedFileSize);
+ numRecompilesBeforeAppRestart = new ConfigurationProperty ("numRecompilesBeforeAppRestart", intType, 15, intTypeConv, null, 0);
+ props.Add (numRecompilesBeforeAppRestart);
+ strict = new ConfigurationProperty ("strict", boolType, false, boolTypeConv, null, 0);
+ props.Add (strict);
+ tempDirectory = new ConfigurationProperty ("tempDirectory", strType, "", strTypeConv, null, 0);
+ props.Add (tempDirectory);
+ urlLinePragmas = new ConfigurationProperty ("urlLinePragmas", boolType, false, boolTypeConv, null, 0);
+ props.Add (urlLinePragmas);
+ }
+
+ public CompilationSection ()
+ {
+ }
+
+ public AssemblyCollection Assemblies {
+ get { return (AssemblyCollection) this [assemblies]; }
+ }
+
+ public bool Batch {
+ get { return (bool) this [batch]; }
+ set { this [batch] = value; }
+ }
+
+ public TimeSpan BatchTimeout {
+ get { return (TimeSpan) this [batchTimeout]; }
+ set { this [batchTimeout] = value; }
+ }
+
+ public BuildProviderCollection BuildProviders {
+ get { return (BuildProviderCollection) this [buildProviders]; }
+ }
+
+ public CodeSubDirectoriesCollection CodeSubDirectories {
+ get { return (CodeSubDirectoriesCollection) this [codeSubDirectories]; }
+ }
+
+ /*
+ public CompilerCollection Compilers {
+ get { return (CompilerCollection) this [compilers]; }
+ }
+ */
+
+ public bool Debug {
+ get { return (bool) this [debug]; }
+ set { this [debug] = value; }
+ }
+
+ public string DefaultLanguage {
+ get { return (string) this [defaultLanguage]; }
+ set { this [defaultLanguage] = value; }
+ }
+
+ public bool Explicit {
+ get { return (bool) this [_explicit]; }
+ set { this [_explicit] = value; }
+ }
+
+ public ExpressionBuilderCollection ExpressionBuilders {
+ get { return (ExpressionBuilderCollection) this [expressionBuilders]; }
+ }
+
+ public int MaxBatchGeneratedFileSize {
+ get { return (int) this [maxBatchGeneratedFileSize]; }
+ set { this [maxBatchGeneratedFileSize] = value; }
+ }
+
+ public int MaxBatchSize {
+ get { return (int) this [maxBatchSize]; }
+ set { this [maxBatchSize] = value; }
+ }
+
+ public int NumRecompilesBeforeAppRestart {
+ get { return (int) this [numRecompilesBeforeAppRestart]; }
+ set { this [numRecompilesBeforeAppRestart] = value; }
+ }
+
+ public bool Strict {
+ get { return (bool) this [strict]; }
+ set { this [strict] = value; }
+ }
+
+ public string TempDirectory {
+ get { return (string) this [tempDirectory]; }
+ set { this [tempDirectory] = value; }
+ }
+
+ public bool UrlLinePragmas {
+ get { return (bool) this [urlLinePragmas]; }
+ set { this [urlLinePragmas] = value; }
+ }
+
+ protected override ConfigurationPropertyCollection Properties {
+ get { return props; }
+ }
+ }
+}
+#endif // NET_2_0
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/Compiler.cs b/mcs/class/System.Web/System.Web.Configuration/Compiler.cs
new file mode 100644
index 00000000000..7b3b10dcb65
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/Compiler.cs
@@ -0,0 +1,116 @@
+//
+// System.Web.Configuration.Compiler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2005 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
+// "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;
+using System.CodeDom.Compiler;
+using System.Collections;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ class Compiler
+ {
+ public string Language;
+ public string Extension;
+ public string Type;
+ public int WarningLevel;
+ public string CompilerOptions;
+ public CodeDomProvider Provider;
+
+ public override string ToString ()
+ {
+ return "Language: " + Language + "\n" +
+ "Extension: " + Extension + "\n" +
+ "Type: " + Type + "\n" +
+ "WarningLevel: " + WarningLevel + "\n" +
+ "CompilerOptions: " + CompilerOptions + "\n";
+ }
+ }
+#if false
+ public sealed class Compiler : ConfigurationElement
+ {
+ static ConfigurationPropertyCollection props;
+ static ConfigurationProperty compilerOptions;
+ static ConfigurationProperty extension;
+ static ConfigurationProperty language;
+ static ConfigurationProperty type;
+ static ConfigurationProperty warningLevel;
+
+ CodeDomProvider provider;
+
+ static Compiler ()
+ {
+ Type strType = typeof (string);
+ compilerOptions = new ConfigurationProperty ("compilerOptions", strType, "", 0);
+ extension = new ConfigurationProperty ("extension", strType, "", 0);
+ language = new ConfigurationProperty ("language", strType, "", 0);
+ ConfigurationPropertyFlags flags = ConfigurationPropertyFlags.Required | ConfigurationPropertyFlags.IsKey;
+ type = new ConfigurationProperty ("type", strType, "", flags);
+ warningLevel = new ConfigurationProperty ("warningLevel", typeof (int), 0, 0);
+
+ props = new ConfigurationPropertyCollection ();
+ props.Add (compilerOptions);
+ props.Add (extension);
+ props.Add (language);
+ props.Add (type);
+ props.Add (warningLevel);
+ }
+
+ public string CompilerOptions {
+ get { return (string) this [compilerOptions]; }
+ }
+
+ public string Extension {
+ get { return (string) this [extension]; }
+ }
+
+ public string Language {
+ get { return (string) this [language]; }
+ }
+
+ public string Type {
+ get { return (string) this [type]; }
+ }
+
+ internal CodeDomProvider Provider {
+ get { return provider; }
+ set { provider = value; }
+ }
+
+ public int WarningLevel {
+ get { return (int) this [warningLevel]; }
+ }
+
+ protected override ConfigurationPropertyCollection Properties {
+ get { return props; }
+ }
+ }
+#endif
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/CompilerCollection.cs b/mcs/class/System.Web/System.Web.Configuration/CompilerCollection.cs
new file mode 100644
index 00000000000..e1085c647bf
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/CompilerCollection.cs
@@ -0,0 +1,140 @@
+//
+// System.Web.Configuration.CompilerCollection
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003,2005 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
+// "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;
+using System.Collections;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ sealed class CompilerCollection
+ {
+ Hashtable compilers;
+
+ public CompilerCollection () : this (null) {}
+
+ public CompilerCollection (CompilerCollection parent)
+ {
+ compilers = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant,
+ CaseInsensitiveComparer.DefaultInvariant);
+
+ if (parent != null && parent.compilers != null) {
+ foreach (DictionaryEntry entry in parent.compilers)
+ compilers [entry.Key] = entry.Value;
+ }
+ }
+
+ public Compiler this [string language] {
+ get { return compilers [language] as Compiler; }
+ set {
+ compilers [language] = value;
+ string [] langs = language.Split (';');
+ foreach (string s in langs) {
+ string x = s.Trim ();
+ if (x != "")
+ compilers [x] = value;
+ }
+ }
+ }
+
+ public bool CompareLanguages (string lang1, string lang2)
+ {
+ return (this [lang1] == this [lang2]);
+ }
+ }
+#if false
+ public sealed class CompilerCollection : ConfigurationElementCollection
+ {
+ static ConfigurationPropertyCollection props;
+
+ static CompilerCollection ()
+ {
+ //FIXME: add properties
+ props = new ConfigurationPropertyCollection ();
+ }
+
+ public string [] AllKeys {
+ get { return BaseGetAllKeys (); }
+ }
+
+ public Compiler this [int index] {
+ get { return (Compiler) BaseGet (index); }
+ }
+
+ public new Compiler this [string language] {
+ get { return (Compiler) BaseGet (language); }
+ }
+
+ protected override ConfigurationElementCollectionType CollectionType {
+ get { return ConfigurationElementCollectionType.AddRemoveClearMap; }
+ }
+
+ protected override string ElementName {
+ get { return "compiler"; }
+ }
+
+ protected override ConfigurationPropertyCollection Properties {
+ get { return props; }
+ }
+
+ public Compiler Get (int index)
+ {
+ return (Compiler) BaseGet (index);
+ }
+
+ public Compiler Get (string language)
+ {
+ return (Compiler) BaseGet (language);
+ }
+
+ public string GetKey (int index)
+ {
+ return BaseGetKey (index);
+ }
+
+ protected override bool CompareKeys (object key1, object key2)
+ {
+ return (0 == CaseInsensitiveComparer.DefaultInvariant.Compare ((string) key1, (string) key2));
+ }
+
+ protected override ConfigurationElement CreateNewElement ()
+ {
+ return new Compiler ();
+ }
+
+ protected override object GetElementKey (ConfigurationElement element)
+ {
+ Compiler c = (Compiler) element;
+ return c.Language;
+ }
+ }
+#endif
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/CustomErrorsConfigHandler.cs b/mcs/class/System.Web/System.Web.Configuration/CustomErrorsConfigHandler.cs
new file mode 100644
index 00000000000..8398df05ca5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/CustomErrorsConfigHandler.cs
@@ -0,0 +1,183 @@
+//
+// System.Web.Configuration.CustomErrorsConfigHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 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
+// "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;
+using System.Collections;
+using System.Configuration;
+using System.IO;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ enum CustomErrorMode
+ {
+ RemoteOnly,
+ On,
+ Off
+ }
+
+ class CustomErrorsConfig
+ {
+ string defaultRedirect;
+ CustomErrorMode mode;
+ Hashtable redirects;
+ string configFilePath;
+
+ public CustomErrorsConfig (object parent, object context)
+ {
+ if (parent != null) {
+ CustomErrorsConfig p = (CustomErrorsConfig) parent;
+ mode = p.mode;
+ defaultRedirect = p.defaultRedirect;
+ if (p.redirects != null && p.redirects.Count > 0) {
+ redirects = new Hashtable ();
+ foreach (DictionaryEntry entry in p.redirects)
+ redirects [entry.Key] = entry.Value;
+ }
+ }
+
+ configFilePath = Path.GetDirectoryName ((string) context);
+ }
+
+ public string DefaultRedirect {
+ get { return defaultRedirect; }
+ set { defaultRedirect = value; }
+ }
+
+ public CustomErrorMode Mode {
+ get { return mode; }
+ set { mode = value; }
+ }
+
+ public string ConfigFilePath {
+ get { return configFilePath; }
+ }
+
+ public string this [int statusCode] {
+ get {
+ if (redirects == null)
+ return null;
+
+ return (string) redirects [statusCode];
+ }
+
+ set {
+ if (redirects == null)
+ redirects = new Hashtable ();
+
+ // Overrides any previous setting for statusCode even in the same file
+ redirects [statusCode] = value;
+ }
+ }
+ }
+
+ class CustomErrorsConfigHandler : IConfigurationSectionHandler
+ {
+ public object Create (object parent, object context, XmlNode section)
+ {
+ CustomErrorsConfig config = new CustomErrorsConfig (parent, context);
+
+ string defaultRedirect = AttValue ("defaultRedirect", section);
+ if (defaultRedirect != null)
+ config.DefaultRedirect = defaultRedirect;
+
+ string mode = AttValue ("mode", section);
+ if (mode != null) {
+ switch (mode) {
+ case "On":
+ config.Mode = CustomErrorMode.On;
+ break;
+ case "Off":
+ config.Mode = CustomErrorMode.Off;
+ break;
+ case "RemoteOnly":
+ config.Mode = CustomErrorMode.RemoteOnly;
+ break;
+ default:
+ ThrowException ("Invalid value for 'mode': " + mode, section);
+ break;
+ }
+ }
+
+ if (section.Attributes != null && section.Attributes.Count != 0)
+ ThrowException ("Unrecognized attribute", section);
+
+ if (!section.HasChildNodes)
+ return config;
+
+ XmlNodeList children = section.ChildNodes;
+ foreach (XmlNode child in children) {
+ XmlNodeType ntype = child.NodeType;
+ if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)
+ continue;
+
+ if (ntype != XmlNodeType.Element)
+ ThrowException ("Only elements allowed", child);
+
+ if (child.Name != "error")
+ ThrowException ("Unrecognized node: " + child.Name, child);
+
+ string statusCode = AttValue ("statusCode", child, false, false);
+ string redirect = AttValue ("redirect", child, false, false);
+ int code = 0;
+ try {
+ code = Int32.Parse (statusCode);
+ } catch {
+ ThrowException ("Unable to parse 'statusCode': " + statusCode, child);
+ }
+
+ if (code < 100 || code >= 1000)
+ ThrowException ("Invalid value for 'statusCode': " + code, child);
+
+ config [code] = redirect;
+ }
+
+ return config;
+ }
+
+ // To save some typing...
+ static string AttValue (string name, XmlNode node, bool optional, bool allowEmpty)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, optional, allowEmpty);
+ }
+
+ static string AttValue (string name, XmlNode node)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, true);
+ }
+
+ static void ThrowException (string message, XmlNode node)
+ {
+ HandlersUtil.ThrowException (message, node);
+ }
+ //
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/CustomErrorsMode.cs b/mcs/class/System.Web/System.Web.Configuration/CustomErrorsMode.cs
new file mode 100644
index 00000000000..3fd8d419230
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/CustomErrorsMode.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.Configuration.CustomErrorsMode.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System.Resources;
+
+#if NET_2_0
+namespace System.Web.Configuration
+{
+ public enum CustomErrorsMode
+ {
+ On = 1,
+ Off = 2,
+ RemoteOnly = 3,
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/ExpressionBuilder.cs b/mcs/class/System.Web/System.Web.Configuration/ExpressionBuilder.cs
new file mode 100644
index 00000000000..24e64b07752
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/ExpressionBuilder.cs
@@ -0,0 +1,71 @@
+//
+// System.Web.Configuration.ExpressionBuilder
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2005 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
+// "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.
+//
+#if NET_2_0
+using System;
+using System.Collections;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ public sealed class ExpressionBuilder : ConfigurationElement
+ {
+ static ConfigurationPropertyCollection props;
+ static ConfigurationProperty expressionPrefix;
+ static ConfigurationProperty type;
+
+ static ExpressionBuilder ()
+ {
+ ConfigurationPropertyFlags flags = ConfigurationPropertyFlags.Required | ConfigurationPropertyFlags.IsKey;
+ type = new NonEmptyStringConfigurationProperty ("type", "", flags);
+ flags = ConfigurationPropertyFlags.Required;
+ expressionPrefix = new NonEmptyStringConfigurationProperty ("expressionPrefix", "", flags);
+
+ props = new ConfigurationPropertyCollection ();
+ props.Add (type);
+ props.Add (expressionPrefix);
+ }
+
+ public string ExpressionPrefix {
+ get { return (string) this [expressionPrefix]; }
+ set { this [expressionPrefix] = value; }
+ }
+
+ public string Type {
+ get { return (string) this [type]; }
+ set { this [type] = value; }
+ }
+
+ protected override ConfigurationPropertyCollection Properties {
+ get { return props; }
+ }
+ }
+}
+#endif // NET_2_0
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/ExpressionBuilderCollection.cs b/mcs/class/System.Web/System.Web.Configuration/ExpressionBuilderCollection.cs
new file mode 100644
index 00000000000..c8137450ba0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/ExpressionBuilderCollection.cs
@@ -0,0 +1,105 @@
+//
+// System.Web.Configuration.ExpressionBuilderCollection
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) Copyright 2005 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
+// "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.
+//
+#if NET_2_0
+using System;
+using System.Collections;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ public sealed class ExpressionBuilderCollection : ConfigurationElementCollection
+ {
+ static ConfigurationPropertyCollection props;
+
+ static ExpressionBuilderCollection ()
+ {
+ props = new ConfigurationPropertyCollection ();
+ ConfigurationPropertyFlags flags = ConfigurationPropertyFlags.DefaultCollection;
+ ConfigurationProperty prop = new ConfigurationProperty (null, typeof (ExpressionBuilderCollection), null, flags);
+ props.Add (prop);
+ }
+
+ public ExpressionBuilder this [int index] {
+ get { return (ExpressionBuilder) BaseGet (index); }
+ set {
+ if (BaseGet (index) != null)
+ BaseRemoveAt (index);
+
+ BaseAdd (index, value);
+ }
+ }
+
+ public new ExpressionBuilder this [string name] {
+ get { return (ExpressionBuilder) BaseGet (name); }
+ }
+
+ protected override ConfigurationPropertyCollection Properties {
+ get { return props; }
+ }
+
+ public void Add (ExpressionBuilder buildProvider)
+ {
+ BaseAdd (buildProvider);
+ }
+
+ public void Clear ()
+ {
+ BaseClear ();
+ }
+
+ public void Remove (string name)
+ {
+ BaseRemove (name);
+ }
+
+ public void RemoveAt (int index)
+ {
+ BaseRemoveAt (index);
+ }
+
+ protected override bool CompareKeys (object key1, object key2)
+ {
+ return (0 == CaseInsensitiveComparer.DefaultInvariant.Compare ((string) key1, (string) key2));
+ }
+
+ protected override ConfigurationElement CreateNewElement ()
+ {
+ return new ExpressionBuilder ();
+ }
+
+ protected override object GetElementKey (ConfigurationElement element)
+ {
+ ExpressionBuilder eb = (ExpressionBuilder) element;
+ return eb.ExpressionPrefix;
+ }
+ }
+}
+#endif // NET_2_0
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/FormsAuthPasswordFormat.cs b/mcs/class/System.Web/System.Web.Configuration/FormsAuthPasswordFormat.cs
new file mode 100755
index 00000000000..1ef62e8237e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/FormsAuthPasswordFormat.cs
@@ -0,0 +1,39 @@
+
+//
+// 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.
+//
+/* System.Web.Configuration
+ * Authors:
+ * Leen Toelen (toelen@hotmail.com)
+ * Copyright (C) 2001 Leen Toelen
+*/
+
+namespace System.Web.Configuration {
+
+ /// <summary>
+ /// Defines the password encryption format.
+ /// </summary>
+ public enum FormsAuthPasswordFormat{
+ Clear,
+ SHA1,
+ MD5
+ }
+
+} //namespace System.Web.Configuration
diff --git a/mcs/class/System.Web/System.Web.Configuration/FormsAuthenticationConfiguration.cs b/mcs/class/System.Web/System.Web.Configuration/FormsAuthenticationConfiguration.cs
new file mode 100644
index 00000000000..9e121376f89
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/FormsAuthenticationConfiguration.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.Configuration.FormsAuthenticationConfiguration
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ public class FormsAuthenticationConfiguration: ConfigurationElement
+ {
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/FormsProtectionEnum.cs b/mcs/class/System.Web/System.Web.Configuration/FormsProtectionEnum.cs
new file mode 100755
index 00000000000..ddb73bf7665
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/FormsProtectionEnum.cs
@@ -0,0 +1,40 @@
+
+//
+// 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.
+//
+/* System.Web.Configuration
+ * Authors:
+ * Leen Toelen (toelen@hotmail.com)
+ * Copyright (C) 2001 Leen Toelen
+*/
+
+namespace System.Web.Configuration {
+
+ /// <summary>
+ /// Defines the method used for securing web forms.
+ /// </summary>
+ public enum FormsProtectionEnum{
+ All,
+ None,
+ Encryption,
+ Validation
+ }
+
+} //namespace System.Web.Configuration
diff --git a/mcs/class/System.Web/System.Web.Configuration/GlobalizationConfiguration.cs b/mcs/class/System.Web/System.Web.Configuration/GlobalizationConfiguration.cs
new file mode 100644
index 00000000000..d8997da29f9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/GlobalizationConfiguration.cs
@@ -0,0 +1,76 @@
+//
+// System.Web.Configuration.GlobalizationConfiguration
+//
+// Authors:
+// Patrik Torstensson (ptorsten@hotmail.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2003 Ximian, Inc. (http://www.ximian.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.Globalization;
+using System.Text;
+
+namespace System.Web.Configuration
+{
+ class GlobalizationConfiguration
+ {
+ internal Encoding RequestEncoding;
+ internal Encoding ResponseEncoding;
+ internal Encoding FileEncoding;
+ internal CultureInfo Culture;
+ internal CultureInfo UICulture;
+
+ internal GlobalizationConfiguration (object p)
+ {
+ if (!(p is GlobalizationConfiguration))
+ return;
+
+ GlobalizationConfiguration parent = (GlobalizationConfiguration) p;
+ RequestEncoding = parent.RequestEncoding;
+ ResponseEncoding = parent.ResponseEncoding;
+ FileEncoding = parent.FileEncoding;
+ Culture = parent.Culture;
+ UICulture = parent.UICulture;
+ }
+
+ static public GlobalizationConfiguration GetInstance (HttpContext context)
+ {
+ GlobalizationConfiguration config;
+ try {
+ if (context == null)
+ config = HttpContext.GetAppConfig ("system.web/globalization")
+ as GlobalizationConfiguration;
+ else
+ config = context.GetConfig ("system.web/globalization")
+ as GlobalizationConfiguration;
+ } catch {
+ return null;
+ }
+ return config;
+ }
+
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/GlobalizationConfigurationHandler.cs b/mcs/class/System.Web/System.Web.Configuration/GlobalizationConfigurationHandler.cs
new file mode 100644
index 00000000000..8fef7b6f307
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/GlobalizationConfigurationHandler.cs
@@ -0,0 +1,163 @@
+//
+// System.Web.Configuration.GlobalizationConfigurationHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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.Configuration;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class GlobalizationConfigurationHandler : IConfigurationSectionHandler
+ {
+ static bool encoding_warning;
+ static bool culture_warning;
+
+ public object Create (object parent, object configContext, XmlNode section)
+ {
+ GlobalizationConfiguration config = new GlobalizationConfiguration (parent);
+
+ if (section.HasChildNodes)
+ ThrowException ("No child nodes allowed here.", section);
+
+ string attvalue = AttValue ("requestEncoding", section, true);
+ if (attvalue == null)
+ config.RequestEncoding = Encoding.Default;
+ else
+ config.RequestEncoding = GetEncoding (section, "requestEncoding", attvalue);
+
+ attvalue = AttValue ("responseEncoding", section, true);
+ if (attvalue == null)
+ config.ResponseEncoding = Encoding.Default;
+ else
+ config.ResponseEncoding = GetEncoding (section, "responseEncoding", attvalue);
+
+ attvalue = AttValue ("fileEncoding", section, true);
+ if (attvalue == null)
+ config.FileEncoding = Encoding.Default;
+ else
+ config.FileEncoding = GetEncoding (section, "fileEncoding", attvalue);
+
+ attvalue = AttValue ("culture", section, true);
+ if (attvalue != null)
+ config.Culture = GetCulture (section, "culture", attvalue);
+
+ attvalue = AttValue ("uiCulture", section, true);
+ if (attvalue != null)
+ config.UICulture = GetCulture (section, "uiCulture", attvalue);
+
+ if (section.Attributes == null || section.Attributes.Count != 0)
+ ThrowException ("Unknown attribute(s).", section);
+
+ return config;
+ }
+
+ static Encoding GetEncoding (XmlNode section, string att, string enc)
+ {
+ Encoding encoding = null;
+ try {
+ switch (enc.ToLower ()) {
+ case "utf-16le":
+ case "utf-16":
+ case "ucs-2":
+ case "unicode":
+ case "iso-10646-ucs-2":
+ encoding = new UnicodeEncoding (false, true);
+ break;
+ case "utf-16be":
+ case "unicodefffe":
+ encoding = new UnicodeEncoding (true, true);
+ break;
+ case "utf-8":
+ case "unicode-1-1-utf-8":
+ case "unicode-2-0-utf-8":
+ case "x-unicode-1-1-utf-8":
+ case "x-unicode-2-0-utf-8":
+ encoding = new UTF8Encoding (false, false);
+ break;
+ default:
+ encoding = Encoding.GetEncoding (enc);
+ break;
+ }
+ } catch {
+ EncodingFailed (section, att, enc);
+ encoding = new UTF8Encoding (false, false);
+ }
+
+ return encoding;
+ }
+
+ static CultureInfo GetCulture (XmlNode section, string att, string cul)
+ {
+ CultureInfo culture = null;
+ try {
+ culture = new CultureInfo (cul);
+ } catch {
+ CultureFailed (section, att, cul);
+ culture = new CultureInfo (0x007f); // Invariant
+ }
+
+ return culture;
+ }
+
+ static void EncodingFailed (XmlNode section, string att, string enc)
+ {
+ if (encoding_warning)
+ return;
+
+ encoding_warning = true;
+ Console.WriteLine ("Encoding {1} cannot be loaded. Perhaps your runtime \n" +
+ "don't have ICU support?\n{0}=\"{1}\"\n", att, enc);
+ }
+
+ static void CultureFailed (XmlNode section, string att, string cul)
+ {
+ if (culture_warning)
+ return;
+
+ culture_warning = true;
+ Console.WriteLine ("Culture {1} cannot be loaded. Perhaps your runtime \n" +
+ "don't have ICU support?\n{0}=\"{1}\"\n", att, cul);
+ }
+
+ // A few methods to save some typing
+ static string AttValue (string name, XmlNode node, bool optional)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, optional);
+ }
+
+ static void ThrowException (string message, XmlNode node)
+ {
+ HandlersUtil.ThrowException (message, node);
+ }
+ //
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryConfiguration.cs b/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryConfiguration.cs
new file mode 100644
index 00000000000..68a80c8019d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryConfiguration.cs
@@ -0,0 +1,122 @@
+//
+// System.Web.Configuration.HandlerFactoryConfiguration
+//
+// Authors:
+// Patrik Torstensson (ptorsten@hotmail.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.Collections;
+
+namespace System.Web.Configuration
+{
+ class HandlerFactoryConfiguration
+ {
+ ArrayList mappings;
+ Hashtable _cache;
+ int ownIndex;
+
+ public HandlerFactoryConfiguration () : this (null)
+ {
+ }
+
+ public HandlerFactoryConfiguration (HandlerFactoryConfiguration parent)
+ {
+ if (parent != null)
+ mappings = new ArrayList (parent.mappings);
+ else
+ mappings = new ArrayList ();
+
+ _cache = Hashtable.Synchronized(new Hashtable());
+ ownIndex = mappings.Count;
+ }
+
+ public void Add (HandlerItem mapping)
+ {
+ mappings.Add (mapping);
+ }
+
+ public HandlerItem Remove (string verb, string path)
+ {
+ int i = GetIndex (verb, path);
+ if (i == -1)
+ return null;
+
+ HandlerItem item = (HandlerItem) mappings [i];
+ mappings.RemoveAt (i);
+ if (_cache.ContainsKey(verb+"+"+path))
+ _cache.Remove(verb+"+"+path);
+ return item;
+ }
+
+ public void Clear ()
+ {
+ mappings.Clear ();
+ _cache.Clear();
+ }
+
+ public HandlerItem FindHandler (string verb, string path)
+ {
+ int i = GetIndex (verb, path);
+ if (i == -1)
+ return null;
+
+ return (HandlerItem) mappings [i];
+ }
+
+ int GetIndex (string verb, string path)
+ {
+ string cahceKey = verb+"+"+path;
+ object answer = _cache[cahceKey];
+ if (answer != null)
+ return (int)answer;
+ int end = mappings.Count;
+
+ for (int i = ownIndex; i < end; i++) {
+ HandlerItem item = (HandlerItem) mappings [i];
+ if (item.IsMatch (verb, path))
+ {
+ _cache[cahceKey] = i;
+ return i;
+ }
+ }
+
+ // parent mappings
+ end = ownIndex;
+ for (int i = 0; i < end; i++) {
+ HandlerItem item = (HandlerItem) mappings [i];
+ if (item.IsMatch (verb, path))
+ {
+ _cache[cahceKey] = i;
+ return i;
+ }
+ }
+ _cache[cahceKey] = -1;
+ return -1;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryProxy.cs b/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryProxy.cs
new file mode 100644
index 00000000000..2d07aed8e49
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryProxy.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.Configuration.HandlerFactoryProxy
+//
+// Author:
+// Patrik Torstensson (ptorsten@hotmail.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;
+
+namespace System.Web.Configuration {
+ [MonoTODO]
+ class HandlerFactoryProxy {
+ public HandlerFactoryProxy() {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Configuration/HandlerItem.cs b/mcs/class/System.Web/System.Web.Configuration/HandlerItem.cs
new file mode 100644
index 00000000000..3980842b3e5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/HandlerItem.cs
@@ -0,0 +1,165 @@
+//
+// System.Web.Configuration.HandlerItem
+//
+// Authors:
+// Patrik Torstensson (ptorsten@hotmail.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.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;
+using System.Collections;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading;
+
+namespace System.Web.Configuration
+{
+ class HandlerItem
+ {
+ private Type _type;
+ private string _typeName;
+ private string _path;
+ private string _requestType;
+ private Regex requestRegex;
+ private Regex pathRegex;
+ static Hashtable regexCache;
+ object instance;
+ bool validated;
+
+ public HandlerItem (string requestType, string path, string type, bool validate)
+ {
+ _typeName = type;
+ _path = path;
+ _requestType = requestType.Replace (" ", "");
+ requestRegex = GetRegex (_requestType);
+ pathRegex = GetRegex (_path);
+ if (validate)
+ DoValidation ();
+ }
+
+ public object GetInstance ()
+ {
+ object obj = Interlocked.CompareExchange (ref instance, null, null);
+ if (obj != null)
+ return obj;
+
+ DoValidation ();
+ obj = HttpRuntime.CreateInternalObject (_type);
+ IHttpHandler hnd = obj as IHttpHandler;
+ if (hnd != null && hnd.IsReusable)
+ Interlocked.CompareExchange (ref instance, hnd, null);
+
+ return obj;
+ }
+
+ public Type Type
+ {
+ get {
+ DoValidation ();
+ return _type;
+ }
+ }
+
+ public bool IsMatch (string type, string path)
+ {
+ return (MatchVerb (type) && MatchPath (path));
+ }
+
+ bool MatchVerb (string verb)
+ {
+ return requestRegex.IsMatch (verb);
+ }
+
+ bool MatchPath (string path)
+ {
+ if (pathRegex.IsMatch (path))
+ return true;
+
+ int slash = path.LastIndexOf ('/');
+ if (slash != -1 && path.Length > slash + 1)
+ return pathRegex.IsMatch (path.Substring (slash + 1));
+
+ return false;
+ }
+
+ void DoValidation ()
+ {
+ if (validated)
+ return;
+
+ lock (this) {
+ Type t = Type.GetType (_typeName, true);
+ _type = t;
+ validated = true;
+ }
+
+ if (typeof (IHttpHandler).IsAssignableFrom (_type))
+ return;
+
+ if (typeof (IHttpHandlerFactory).IsAssignableFrom (_type))
+ return;
+
+ throw new HttpException (HttpRuntime.FormatResourceString ("type_not_factory_or_handler"));
+ }
+
+ static string ToRegexPattern (string dosPattern)
+ {
+ string result = dosPattern.Replace (".", "\\.");
+ result = result.Replace ("*", ".*");
+ result = result.Replace ('?', '.');
+ return result;
+ }
+
+ static Regex GetRegex (string verb)
+ {
+ EnsureCache ();
+ if (regexCache.ContainsKey (verb))
+ return (Regex) regexCache [verb];
+
+ StringBuilder result = new StringBuilder ("\\A");
+ string [] expressions = verb.Split (',');
+ int end = expressions.Length;
+ for (int i = 0; i < end; i++) {
+ string regex = ToRegexPattern (expressions [i]);
+ if (i + 1 < end) {
+ result.AppendFormat ("{0}\\z|\\A", regex);
+ } else {
+ result.AppendFormat ("({0})\\z", regex);
+ }
+ }
+
+ Regex r = new Regex (result.ToString ());
+ regexCache [verb] = r;
+ return r;
+ }
+
+ static void EnsureCache ()
+ {
+ if (regexCache == null)
+ regexCache = new Hashtable ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/HttpCapabilitiesBase.cs b/mcs/class/System.Web/System.Web.Configuration/HttpCapabilitiesBase.cs
new file mode 100644
index 00000000000..0d09e4f3401
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/HttpCapabilitiesBase.cs
@@ -0,0 +1,66 @@
+//
+// System.Web.Configuration.HttpCapabilitiesBase
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+// (C) 2003,2004 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
+// "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.
+//
+
+namespace System.Web.Configuration
+{
+ using System;
+ using System.Collections;
+ using System.Web;
+
+ public class HttpCapabilitiesBase
+ {
+ Hashtable capabilities;
+
+ public HttpCapabilitiesBase () { }
+
+ public virtual string this [string key] {
+ get { return capabilities [key] as string; }
+ }
+
+ public static HttpCapabilitiesBase GetConfigCapabilities (string configKey, HttpRequest request)
+ {
+ string ua = request.ClientTarget;
+ if (ua == null)
+ ua = request.UserAgent;
+
+ HttpBrowserCapabilities bcap = new HttpBrowserCapabilities ();
+ bcap.useragent = ua;
+ bcap.capabilities = CapabilitiesLoader.GetCapabilities (ua);
+ bcap.Init ();
+ return bcap;
+ }
+
+ protected virtual void Init ()
+ {
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/HttpConfigurationContext.cs b/mcs/class/System.Web/System.Web.Configuration/HttpConfigurationContext.cs
new file mode 100644
index 00000000000..3c26d2a5067
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/HttpConfigurationContext.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.Configuration.HttpConfigurationContext
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.
+//
+
+namespace System.Web.Configuration
+{
+ public class HttpConfigurationContext
+ {
+ private string virtualPath;
+
+ internal HttpConfigurationContext (string virtualPath)
+ {
+ this.virtualPath = virtualPath;
+ }
+
+ public string VirtualPath
+ {
+ get {
+ return virtualPath;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/HttpHandlersSectionHandler.cs b/mcs/class/System.Web/System.Web.Configuration/HttpHandlersSectionHandler.cs
new file mode 100644
index 00000000000..82aa62e3b07
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/HttpHandlersSectionHandler.cs
@@ -0,0 +1,158 @@
+//
+// System.Web.Configuration.HttpHandlersSectionHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.Collections;
+using System.Configuration;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class HttpHandlersSectionHandler : IConfigurationSectionHandler
+ {
+ public virtual object Create (object parent, object configContext, XmlNode section)
+ {
+ HandlerFactoryConfiguration mapper;
+
+ if (parent is HandlerFactoryConfiguration)
+ mapper = new HandlerFactoryConfiguration ((HandlerFactoryConfiguration) parent);
+ else
+ mapper = new HandlerFactoryConfiguration ();
+
+ if (section.Attributes != null && section.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", section);
+
+ XmlNodeList httpHandlers = section.ChildNodes;
+ foreach (XmlNode child in httpHandlers) {
+ XmlNodeType ntype = child.NodeType;
+ if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)
+ continue;
+
+ if (ntype != XmlNodeType.Element)
+ HandlersUtil.ThrowException ("Only elements allowed", child);
+
+ string name = child.Name;
+ if (name == "clear") {
+ if (child.Attributes != null && child.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", child);
+
+ mapper.Clear ();
+ continue;
+ }
+
+ string verb = HandlersUtil.ExtractAttributeValue ("verb", child);
+ string path = HandlersUtil.ExtractAttributeValue ("path", child);
+ string validateStr = HandlersUtil.ExtractAttributeValue ("validate", child, true);
+ bool validate;
+ if (validateStr == null) {
+ validate = true;
+ } else {
+ validate = validateStr == "true";
+ if (!validate && validateStr != "false")
+ HandlersUtil.ThrowException (
+ "Invalid value for validate attribute.", child);
+ }
+
+ if (name == "add") {
+ string type = HandlersUtil.ExtractAttributeValue ("type", child);
+ if (child.Attributes != null && child.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", child);
+
+ HandlerItem item = new HandlerItem (verb, path, type, validate);
+ mapper.Add (item);
+ continue;
+ }
+
+ if (name == "remove") {
+ if (child.Attributes != null && child.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", child);
+
+ if (validate && mapper.Remove (verb, path) == null)
+ HandlersUtil.ThrowException ("There's no mapping to remove", child);
+
+ continue;
+ }
+ HandlersUtil.ThrowException ("Unexpected element", child);
+ }
+
+ return mapper;
+ }
+ }
+
+ internal class HandlersUtil
+ {
+ private HandlersUtil ()
+ {
+ }
+
+ static internal string ExtractAttributeValue (string attKey, XmlNode node)
+ {
+ return ExtractAttributeValue (attKey, node, false);
+ }
+
+ static internal string ExtractAttributeValue (string attKey, XmlNode node, bool optional)
+ {
+ return ExtractAttributeValue (attKey, node, optional, false);
+ }
+
+ static internal string ExtractAttributeValue (string attKey, XmlNode node, bool optional,
+ bool allowEmpty)
+ {
+ if (node.Attributes == null) {
+ if (optional)
+ return null;
+
+ ThrowException ("Required attribute not found: " + attKey, node);
+ }
+
+ XmlNode att = node.Attributes.RemoveNamedItem (attKey);
+ if (att == null) {
+ if (optional)
+ return null;
+ ThrowException ("Required attribute not found: " + attKey, node);
+ }
+
+ string value = att.Value;
+ if (!allowEmpty && value == String.Empty) {
+ string opt = optional ? "Optional" : "Required";
+ ThrowException (opt + " attribute is empty: " + attKey, node);
+ }
+
+ return value;
+ }
+
+ static internal void ThrowException (string msg, XmlNode node)
+ {
+ if (node != null && node.Name != String.Empty)
+ msg = msg + " (node name: " + node.Name + ") ";
+ throw new ConfigurationException (msg, node);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/HttpModulesConfigurationHandler.cs b/mcs/class/System.Web/System.Web.Configuration/HttpModulesConfigurationHandler.cs
new file mode 100644
index 00000000000..a26aca2afc0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/HttpModulesConfigurationHandler.cs
@@ -0,0 +1,102 @@
+//
+// System.Web.Configuration.HttpModulesConfigurationHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.Configuration;
+using System.Xml;
+using System.Web.Security;
+
+namespace System.Web.Configuration
+{
+ class HttpModulesConfigurationHandler : IConfigurationSectionHandler
+ {
+ public virtual object Create (object parent, object configContext, XmlNode section)
+ {
+ ModulesConfiguration mapper;
+
+ if (parent is ModulesConfiguration)
+ mapper = new ModulesConfiguration ((ModulesConfiguration) parent);
+ else
+ mapper = new ModulesConfiguration ();
+
+ if (section.Attributes != null && section.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", section);
+
+ XmlNodeList httpModules = section.ChildNodes;
+
+ foreach (XmlNode child in httpModules) {
+ XmlNodeType ntype = child.NodeType;
+ if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)
+ continue;
+
+ if (ntype != XmlNodeType.Element)
+ HandlersUtil.ThrowException ("Only elements allowed", child);
+
+ string name = child.Name;
+ if (name == "clear") {
+ if (child.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", child);
+
+ mapper.Clear ();
+ continue;
+ }
+
+ string nameAtt = HandlersUtil.ExtractAttributeValue ("name", child);
+ if (name == "add") {
+ string type = HandlersUtil.ExtractAttributeValue ("type", child);
+ if (child.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", child);
+
+ // FIXME: gotta remove this. Just here to make it work with my local config
+ if (type.StartsWith ("System.Web.Mobile"))
+ continue;
+
+ ModuleItem item = new ModuleItem (nameAtt, type);
+ mapper.Add (item);
+ continue;
+ }
+
+ if (name == "remove") {
+ if (child.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", child);
+
+ if (mapper.Remove (nameAtt) == null)
+ HandlersUtil.ThrowException ("Module not loaded", child);
+ continue;
+ }
+
+ HandlersUtil.ThrowException ("Unrecognized element", child);
+ }
+
+ mapper.Add (new ModuleItem ("DefaultAuthentication", typeof (DefaultAuthenticationModule)));
+ return mapper;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/HttpRuntimeConfig.cs b/mcs/class/System.Web/System.Web.Configuration/HttpRuntimeConfig.cs
new file mode 100644
index 00000000000..08681092f09
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/HttpRuntimeConfig.cs
@@ -0,0 +1,96 @@
+//
+// System.Web.Configuration.HttpRuntimeConfig
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 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
+// "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;
+using System.CodeDom.Compiler;
+using System.Collections;
+using System.Configuration;
+using System.IO;
+using System.Web;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ sealed class HttpRuntimeConfig
+ {
+ public int ExecutionTimeout = 90; // seconds
+ public int MaxRequestLength = 4096; // KB
+ public int RequestLengthDiskThreshold = 256; // KB
+ public bool UseFullyQualifiedRedirectUrl = false;
+ public int MinFreeThreads = 8;
+ public int MinLocalRequestFreeThreads = 4;
+ public int AppRequestQueueLimit = 100;
+ public bool EnableKernelOutputCache = true;
+ public bool EnableVersionHeader = true;
+ public bool RequireRootSaveAsPath = true;
+ public int IdleTimeout = 20; // minutes
+ public bool Enable = true;
+ public string VersionHeader;
+
+ /* Only the config. handler should create instances of this. Use GetInstance (context) */
+ public HttpRuntimeConfig (object p)
+ {
+ HttpRuntimeConfig parent = p as HttpRuntimeConfig;
+ if (parent != null)
+ Init (parent);
+ }
+
+ static public HttpRuntimeConfig GetInstance (HttpContext context)
+ {
+ HttpRuntimeConfig config;
+ if (context == null)
+ context = HttpContext.Context;
+
+ config = context.GetConfig ("system.web/httpRuntime") as HttpRuntimeConfig;
+
+ if (config == null)
+ throw new Exception ("Configuration error.");
+
+ return config;
+ }
+
+ void Init (HttpRuntimeConfig parent)
+ {
+ ExecutionTimeout = parent.ExecutionTimeout;
+ MaxRequestLength = parent.MaxRequestLength;
+ RequestLengthDiskThreshold = parent.RequestLengthDiskThreshold;
+ UseFullyQualifiedRedirectUrl = parent.UseFullyQualifiedRedirectUrl;
+ MinFreeThreads = parent.MinFreeThreads;
+ MinLocalRequestFreeThreads = parent.MinLocalRequestFreeThreads;
+ AppRequestQueueLimit = parent.AppRequestQueueLimit;
+ EnableKernelOutputCache = parent.EnableKernelOutputCache;
+ EnableVersionHeader = parent.EnableVersionHeader;
+ RequireRootSaveAsPath = parent.RequireRootSaveAsPath;
+ IdleTimeout = parent.IdleTimeout;
+ Enable = parent.Enable;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/HttpRuntimeConfigurationHandler.cs b/mcs/class/System.Web/System.Web.Configuration/HttpRuntimeConfigurationHandler.cs
new file mode 100644
index 00000000000..cdd9fc322c5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/HttpRuntimeConfigurationHandler.cs
@@ -0,0 +1,108 @@
+//
+// System.Web.Configuration.HttpRuntimeConfigurationHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 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
+// "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;
+using System.Collections;
+using System.Configuration;
+using System.Security.Cryptography;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class HttpRuntimeConfigurationHandler : IConfigurationSectionHandler
+ {
+ public object Create (object parent, object context, XmlNode section)
+ {
+ if (section.HasChildNodes)
+ ThrowException ("Child nodes not allowed here", section.FirstChild);
+
+ HttpRuntimeConfig config = new HttpRuntimeConfig (parent);
+
+ config.ExecutionTimeout = AttUIntValue (section, "executionTimeout", 90);
+ config.MaxRequestLength = AttUIntValue (section, "maxRequestLength", 4096);
+ config.RequestLengthDiskThreshold = AttUIntValue (section, "requestLengthDiskThreshold", 256);
+ config.UseFullyQualifiedRedirectUrl = AttBoolValue (section, "useFullyQualifiedRedirectUrl", false);
+ config.MinFreeThreads = AttUIntValue (section, "minFresThreads", 8);
+ config.MinLocalRequestFreeThreads = AttUIntValue (section, "minLocalRequestFreeThreads", 4);
+ config.AppRequestQueueLimit = AttUIntValue (section, "appRequestQueueLimit", 100);
+ config.EnableKernelOutputCache = AttBoolValue (section, "requestLengthDiskThreshold", true);
+ config.EnableVersionHeader = AttBoolValue (section, "requestLengthDiskThreshold", true);
+ config.RequireRootSaveAsPath = AttBoolValue (section, "requestLengthDiskThreshold", true);
+ config.IdleTimeout = AttUIntValue (section, "requestLengthDiskThreshold", 20);
+ config.Enable = AttBoolValue (section, "requestLengthDiskThreshold", true);
+ config.VersionHeader = AttValue (section, "versionHeader");
+
+ return config;
+ }
+
+ //
+ static bool AttBoolValue (XmlNode node, string name, bool _default)
+ {
+ string v = AttValue (node, name);
+ if (v == null)
+ return _default;
+
+ bool result = (v == "true");
+ if (!result && v != "false")
+ ThrowException ("Invalid boolean value in " + name, node);
+
+ return result;
+ }
+
+ static int AttUIntValue (XmlNode node, string name, int _default)
+ {
+ string v = AttValue (node, name);
+ if (v == null)
+ return _default;
+
+ int result = 0;
+ try {
+ result = (int) UInt32.Parse (v);
+ } catch {
+ ThrowException ("Invalid number in " + name, node);
+ }
+
+ return result;
+ }
+
+
+ static string AttValue (XmlNode node, string name)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, true);
+ }
+
+ static void ThrowException (string message, XmlNode node)
+ {
+ HandlersUtil.ThrowException (message, node);
+ }
+ //
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/IRemoteWebConfigurationHostServer.cs b/mcs/class/System.Web/System.Web.Configuration/IRemoteWebConfigurationHostServer.cs
new file mode 100644
index 00000000000..77cfb0325db
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/IRemoteWebConfigurationHostServer.cs
@@ -0,0 +1,49 @@
+//
+// System.Web.Configuration.IRemoteWebConfigurationHostServer.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System.Resources;
+
+#if NET_2_0
+namespace System.Web.Configuration
+{
+ public interface IRemoteWebConfigurationHostServer
+ {
+ string DoEncryptOrDecrypt (
+ bool do_encrypt, string xml_string, string protection_provider_name,
+ string protection_provider_type, string [] params_keys, string [] param_values);
+
+ byte [] GetData (string filename, out long readTime);
+
+ void GetFileDetails (string name, out bool exists, out long size, out long create_data, out long last_write_date);
+
+ string GetFilePaths (string path, string site);
+
+ void WriteData (string file_name, byte [] data, ref long read_time);
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/InternalSection.cs b/mcs/class/System.Web/System.Web.Configuration/InternalSection.cs
new file mode 100644
index 00000000000..9bed4bef525
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/InternalSection.cs
@@ -0,0 +1,54 @@
+//
+// System.Web.Configuration.InternalSection.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ public class InternalSection: ConfigurationSection
+ {
+ [MonoTODO]
+ protected virtual object GetRuntimeConfig ()
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ protected override object GetRuntimeObject ()
+ {
+ return this;
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/MachineKeyConfig.cs b/mcs/class/System.Web/System.Web.Configuration/MachineKeyConfig.cs
new file mode 100644
index 00000000000..791453bbf7e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/MachineKeyConfig.cs
@@ -0,0 +1,159 @@
+//
+// System.Web.Configuration.MachineKeyConfig
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+// Copyright (c) 2005 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
+// "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;
+using System.Collections;
+using System.Configuration;
+using System.Xml;
+using System.Security.Cryptography;
+
+namespace System.Web.Configuration
+{
+ class MachineKeyConfig
+ {
+ static MachineKeyConfig machine_key;
+ byte [] validation_key;
+ bool isolate_validation;
+ byte [] decryption_key;
+ byte [] decryption_key_192bits;
+ bool isolate_decryption; // For us, this is always true by now.
+ MachineKeyValidation validation_type;
+
+ static byte [] autogenerated;
+ static byte [] autogenerated_decrypt;
+
+ static MachineKeyConfig ()
+ {
+ autogenerated = new byte [64];
+ RNGCryptoServiceProvider cp = new RNGCryptoServiceProvider ();
+ cp.GetBytes (autogenerated);
+ autogenerated_decrypt = new byte [64];
+ cp.GetBytes (autogenerated_decrypt);
+ }
+
+ internal MachineKeyConfig (object parent)
+ {
+ if (parent is MachineKeyConfig) {
+ MachineKeyConfig p = (MachineKeyConfig) parent;
+ validation_key = p.validation_key;
+ decryption_key = p.decryption_key;
+ validation_type = p.validation_type;
+ }
+ }
+
+ static byte ToHexValue (char c, bool high)
+ {
+ byte v;
+ if (c >= '0' && c <= '9')
+ v = (byte) (c - '0');
+ else if (c >= 'a' && c <= 'f')
+ v = (byte) (c - 'a' + 10);
+ else if (c >= 'A' && c <= 'F')
+ v = (byte) (c - 'A' + 10);
+ else
+ throw new ArgumentException ("Invalid hex character");
+
+ if (high)
+ v <<= 4;
+
+ return v;
+ }
+
+ internal static byte [] GetBytes (string key, int len)
+ {
+ byte [] result = new byte [len / 2];
+ for (int i = 0; i < len; i += 2)
+ result [i / 2] = (byte) (ToHexValue (key [i], true) + ToHexValue (key [i + 1], false));
+
+ return result;
+ }
+
+ static byte [] MakeKey (string key, bool decryption, out bool isolate)
+ {
+ if (key == null || key.StartsWith ("AutoGenerate")){
+ isolate = key.IndexOf ("IsolateApps") != 1;
+
+ // Same key for validation and decryption when both are autogenerated.
+ return (decryption) ? autogenerated_decrypt : autogenerated;
+ }
+
+ isolate = false;
+
+ int len = key.Length;
+ if (len < 40 || len > 128 || (len % 2) == 1)
+ throw new ArgumentException ("Invalid key length");
+
+ return GetBytes (key, len);
+ }
+
+ internal void SetValidationKey (string n)
+ {
+ validation_key = MakeKey (n, false, out isolate_validation);
+ }
+
+ internal byte [] ValidationKey {
+ get { return validation_key; }
+ }
+
+ internal void SetDecryptionKey (string n)
+ {
+ decryption_key = MakeKey (n, true, out isolate_decryption);
+ decryption_key_192bits = new byte [24];
+ int count = 24;
+ if (decryption_key.Length < 24)
+ count = decryption_key.Length;
+ Buffer.BlockCopy (decryption_key, 0, decryption_key_192bits, 0, count);
+ }
+
+ internal byte [] DecryptionKey {
+ get { return decryption_key; }
+ }
+
+ internal byte [] DecryptionKey192Bits {
+ get { return decryption_key_192bits; }
+ }
+
+ internal MachineKeyValidation ValidationType {
+ get {
+ return validation_type;
+ }
+ set {
+ validation_type = value;
+ }
+ }
+
+ internal static MachineKeyConfig MachineKey {
+ get { return machine_key; }
+ set { machine_key = value; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/MachineKeyConfigHandler.cs b/mcs/class/System.Web/System.Web.Configuration/MachineKeyConfigHandler.cs
new file mode 100644
index 00000000000..e3237bf3ceb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/MachineKeyConfigHandler.cs
@@ -0,0 +1,93 @@
+//
+// System.Web.Configuration.MachineKeyConfigHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.Configuration;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class MachineKeyConfigHandler : IConfigurationSectionHandler
+ {
+ public object Create (object parent, object context, XmlNode section)
+ {
+ if (section.HasChildNodes)
+ ThrowException ("Child nodes not allowed here", section.FirstChild);
+
+ MachineKeyConfig config = new MachineKeyConfig (parent);
+
+ try {
+ config.SetValidationKey (AttValue ("validationKey", section));
+ } catch (ArgumentException e) {
+ ThrowException (e.Message, section);
+ }
+
+ try {
+ config.SetDecryptionKey (AttValue ("decryptionKey", section));
+ } catch (ArgumentException e) {
+ ThrowException (e.Message, section);
+ }
+
+ string validation = AttValue ("validation", section);
+ MachineKeyValidation valid = 0;
+ if (validation == "SHA1")
+ valid = MachineKeyValidation.SHA1;
+ else if (validation == "MD5")
+ valid = MachineKeyValidation.MD5;
+ else if (validation == "TripleDES")
+ valid = MachineKeyValidation.TripleDES;
+ else
+ ThrowException ("Invalid 'validation' value", section);
+
+ config.ValidationType = valid;
+
+ if (section.Attributes != null && section.Attributes.Count != 0)
+ ThrowException ("Unrecognized attribute", section);
+
+ MachineKeyConfig.MachineKey = config;
+ return config;
+ }
+
+ // A few methods to save some typing
+ static string AttValue (string name, XmlNode node)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, true);
+ }
+
+ static void ThrowException (string message, XmlNode node)
+ {
+ HandlersUtil.ThrowException (message, node);
+ }
+ //
+
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/MachineKeyValidation.cs b/mcs/class/System.Web/System.Web.Configuration/MachineKeyValidation.cs
new file mode 100644
index 00000000000..a7b75150edb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/MachineKeyValidation.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.Configuration.MachineKeyValidation.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System.Resources;
+
+namespace System.Web.Configuration
+{
+#if NET_2_0
+ public
+#else
+ internal
+#endif
+ enum MachineKeyValidation
+ {
+ MD5 = 0,
+ SHA1 = 1,
+ TripleDES = 2,
+ AES = 3
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/ModuleItem.cs b/mcs/class/System.Web/System.Web.Configuration/ModuleItem.cs
new file mode 100644
index 00000000000..ce797469297
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/ModuleItem.cs
@@ -0,0 +1,71 @@
+//
+// System.Web.Configuration.ModuleItem
+//
+// Author:
+// Patrik Torstensson (ptorsten@hotmail.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;
+
+namespace System.Web.Configuration {
+ class ModuleItem {
+ private Type _type;
+ private string _name;
+
+ public ModuleItem(string name, string type) {
+ _name = name;
+
+ _type = Type.GetType (type, true);
+ if (!typeof(IHttpModule).IsAssignableFrom(_type))
+ throw new HttpException(HttpRuntime.FormatResourceString("type_not_module"));
+ }
+
+ public ModuleItem(string name, Type type) {
+ _name = name;
+ _type = type;
+ if (!typeof(IHttpModule).IsAssignableFrom(_type))
+ throw new HttpException(HttpRuntime.FormatResourceString("type_not_module"));
+ }
+
+ public IHttpModule Create() {
+ return (IHttpModule) HttpRuntime.CreateInternalObject(_type);
+ }
+
+ public Type Type {
+ get {
+ return _type;
+ }
+ }
+
+ public bool IsMatch (string name)
+ {
+ return (_type.Name == name || _type.FullName == name);
+ }
+
+ public string ModuleName {
+ get {
+ return _name;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Configuration/ModulesConfiguration.cs b/mcs/class/System.Web/System.Web.Configuration/ModulesConfiguration.cs
new file mode 100644
index 00000000000..0a820c861c0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/ModulesConfiguration.cs
@@ -0,0 +1,96 @@
+//
+// System.Web.Configuration.ModulesConfiguration
+//
+// Authors:
+// Patrik Torstensson (ptorsten@hotmail.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.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;
+using System.Collections;
+
+namespace System.Web.Configuration
+{
+ class ModulesConfiguration
+ {
+ ArrayList modules;
+
+ public ModulesConfiguration () : this (null)
+ {
+ }
+
+ public ModulesConfiguration (ModulesConfiguration parent)
+ {
+ if (parent != null)
+ modules = new ArrayList (parent.modules);
+ else
+ modules = new ArrayList ();
+ }
+
+ public void Add (ModuleItem item)
+ {
+ modules.Add (item);
+ }
+
+ public ModuleItem Remove (string name)
+ {
+ int i = GetIndex (name);
+ if (i == -1)
+ return null;
+
+ ModuleItem item = (ModuleItem) modules [i];
+ modules.RemoveAt (i);
+ return item;
+ }
+
+ public void Clear ()
+ {
+ modules.Clear ();
+ }
+
+ public HttpModuleCollection CreateCollection ()
+ {
+ HttpModuleCollection items = new HttpModuleCollection ();
+ foreach (ModuleItem item in modules)
+ items.AddModule (item.ModuleName, item.Create ());
+
+ return items;
+ }
+
+ int GetIndex (string name)
+ {
+ int end = modules.Count;
+
+ for (int i = 0; i < end; i++) {
+ ModuleItem item = (ModuleItem) modules [i];
+ if (item.IsMatch (name))
+ return i;
+ }
+
+ return -1;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/PagesConfiguration.cs b/mcs/class/System.Web/System.Web.Configuration/PagesConfiguration.cs
new file mode 100644
index 00000000000..69396021d96
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/PagesConfiguration.cs
@@ -0,0 +1,81 @@
+//
+// System.Web.Configuration.PagesConfiguration
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2003 Ximian, Inc. (http://www.ximian.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.Globalization;
+using System.Text;
+
+namespace System.Web.Configuration
+{
+ class PagesConfiguration
+ {
+ internal bool Buffer = true;
+ internal string EnableSessionState = "true";
+ internal bool EnableViewState = true;
+ internal bool EnableViewStateMac = false;
+ internal bool SmartNavigation = false;
+ internal bool AutoEventWireup = true;
+ internal bool ValidateRequest = true;
+ internal string PageBaseType = "System.Web.UI.Page";
+ internal string UserControlBaseType = "System.Web.UI.UserControl";
+
+ internal PagesConfiguration (object p)
+ {
+ if (!(p is PagesConfiguration))
+ return;
+
+ PagesConfiguration parent = (PagesConfiguration) p;
+ Buffer = parent.Buffer;
+ EnableSessionState = parent.EnableSessionState;
+ EnableViewState = parent.EnableViewState;
+ EnableViewStateMac = parent.EnableViewStateMac;
+ SmartNavigation = parent.SmartNavigation;
+ AutoEventWireup = parent.AutoEventWireup;
+ ValidateRequest = parent.ValidateRequest;
+ PageBaseType = parent.PageBaseType;
+ UserControlBaseType = parent.UserControlBaseType;
+ }
+
+ static public PagesConfiguration GetInstance (HttpContext context)
+ {
+ PagesConfiguration config;
+ if (context == null)
+ context = HttpContext.Context;
+
+ try {
+ config = context.GetConfig ("system.web/pages") as PagesConfiguration;
+ } catch {
+ return null;
+ }
+ return config;
+ }
+
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/PagesConfigurationHandler.cs b/mcs/class/System.Web/System.Web.Configuration/PagesConfigurationHandler.cs
new file mode 100644
index 00000000000..08878c9a9e3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/PagesConfigurationHandler.cs
@@ -0,0 +1,120 @@
+//
+// System.Web.Configuration.PagesConfigurationHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2004 Novell, Inc (http://www.novel.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.Configuration;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class PagesConfigurationHandler : IConfigurationSectionHandler
+ {
+ public object Create (object parent, object configContext, XmlNode section)
+ {
+ PagesConfiguration config = new PagesConfiguration (parent);
+
+ if (section.HasChildNodes)
+ HandlersUtil.ThrowException ("No child nodes allowed here.", section);
+
+ string attvalue = AttValue ("buffer", section);
+ if (attvalue != null)
+ config.Buffer = GetBool ("buffer", attvalue, section);
+
+ attvalue = AttValue ("enableSessionState", section);
+ if (attvalue != null) {
+ if (attvalue != "true" && attvalue != "false" && attvalue != "ReadOnly")
+ HandlersUtil.ThrowException ("Invalid value for 'enableSessionState'", section);
+
+ config.EnableSessionState = attvalue;
+ }
+
+ attvalue = AttValue ("enableViewState", section);
+ if (attvalue != null)
+ config.EnableViewState = GetBool ("enableViewState", attvalue, section);
+
+ attvalue = AttValue ("enableViewStateMac", section);
+ if (attvalue != null)
+ config.EnableViewStateMac = GetBool ("enableViewStateMac", attvalue, section);
+
+ attvalue = AttValue ("smartNavigation", section);
+ if (attvalue != null)
+ config.SmartNavigation = GetBool ("smartNavigation", attvalue, section);
+
+ attvalue = AttValue ("autoEventWireup", section);
+ if (attvalue != null)
+ config.AutoEventWireup = GetBool ("autoEventWireup", attvalue, section);
+
+ attvalue = AttValue ("validateRequest", section);
+ if (attvalue != null)
+ config.ValidateRequest = GetBool ("validateRequest", attvalue, section);
+
+ attvalue = AttValue ("pageBaseType", section);
+ if (attvalue != null) {
+ string v = attvalue.Trim ();
+ if (v.Length == 0)
+ HandlersUtil.ThrowException ("pageBaseType is empty.", section);
+
+ config.PageBaseType = v;
+ }
+
+ attvalue = AttValue ("userControlBaseType", section);
+ if (attvalue != null) {
+ string v = attvalue.Trim ();
+ if (v.Length == 0)
+ HandlersUtil.ThrowException ("userControlBaseType is empty.", section);
+
+ config.UserControlBaseType = v;
+ }
+
+ if (section.Attributes == null || section.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unknown attribute(s).", section);
+
+ return config;
+ }
+
+ static bool GetBool (string name, string value, XmlNode section)
+ {
+ if (value == "true")
+ return true;
+
+ if (value != "false")
+ HandlersUtil.ThrowException ("Invalid boolean value for '" + name + "'", section);
+
+ return false;
+ }
+
+ // A few methods to save some typing
+ static string AttValue (string name, XmlNode node)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, true);
+ }
+ //
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/PagesEnableSessionState.cs b/mcs/class/System.Web/System.Web.Configuration/PagesEnableSessionState.cs
new file mode 100644
index 00000000000..4379e8051ff
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/PagesEnableSessionState.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.Configuration.PagesEnableSessionState.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System.Resources;
+
+#if NET_2_0
+namespace System.Web.Configuration
+{
+ public enum PagesEnableSessionState
+ {
+ False = 0,
+ ReadOnly = 1,
+ True = 2
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/PagesToCountAction.cs b/mcs/class/System.Web/System.Web.Configuration/PagesToCountAction.cs
new file mode 100644
index 00000000000..eb42de35dd6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/PagesToCountAction.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.Configuration.PagesToCountAction.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System.Resources;
+
+#if NET_2_0
+namespace System.Web.Configuration
+{
+ public enum PagesToCountAction
+ {
+ Include = 1,
+ Exclude = 2,
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/PassportAuthentication.cs b/mcs/class/System.Web/System.Web.Configuration/PassportAuthentication.cs
new file mode 100644
index 00000000000..e4c8738bada
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/PassportAuthentication.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.Configuration.PassportAuthentication
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ public sealed class PassportAuthentication: ConfigurationElement
+ {
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/ProcessModelComAuthenticationLevel.cs b/mcs/class/System.Web/System.Web.Configuration/ProcessModelComAuthenticationLevel.cs
new file mode 100644
index 00000000000..937b0c9bf54
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/ProcessModelComAuthenticationLevel.cs
@@ -0,0 +1,45 @@
+//
+// System.Web.Configuration.ProcessModelComAuthenticationLevel.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System.Resources;
+
+#if NET_2_0
+namespace System.Web.Configuration
+{
+ public enum ProcessModelComAuthenticationLevel
+ {
+ Call = 1,
+ Connect = 2,
+ Default = 3,
+ None = 4,
+ Pkt = 5,
+ PktIntegrity = 6,
+ PktPrivacy = 7
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/ProcessModelComImpersonationLevel.cs b/mcs/class/System.Web/System.Web.Configuration/ProcessModelComImpersonationLevel.cs
new file mode 100644
index 00000000000..a84607ea193
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/ProcessModelComImpersonationLevel.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.Configuration.ProcessModelComImpersonationLevel.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System.Resources;
+
+#if NET_2_0
+namespace System.Web.Configuration
+{
+ public enum ProcessModelComImpersonationLevel
+ {
+ Anonymous = 1,
+ Default = 2,
+ Delegate = 3,
+ Identify = 4,
+ Impersonate = 5
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/ProcessModelLogLevel.cs b/mcs/class/System.Web/System.Web.Configuration/ProcessModelLogLevel.cs
new file mode 100644
index 00000000000..94edfe9046d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/ProcessModelLogLevel.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.Configuration.ProcessModelLogLevel.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System.Resources;
+
+#if NET_2_0
+namespace System.Web.Configuration
+{
+ public enum ProcessModelLogLevel
+ {
+ All = 1,
+ Errors = 2,
+ None = 3
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/SerializationMode.cs b/mcs/class/System.Web/System.Web.Configuration/SerializationMode.cs
new file mode 100644
index 00000000000..2942dd9d65c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/SerializationMode.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.Configuration.SerializationMode.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System.Resources;
+
+#if NET_2_0
+namespace System.Web.Configuration
+{
+ public enum SerializationMode
+ {
+ String = 0,
+ Xml = 1,
+ Binary = 2,
+ ProviderSpecific = 3
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/SiteMapSection.cs b/mcs/class/System.Web/System.Web.Configuration/SiteMapSection.cs
new file mode 100644
index 00000000000..121bd214ae1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/SiteMapSection.cs
@@ -0,0 +1,80 @@
+//
+// System.Web.Configuration.SiteMapSection.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Configuration;
+using System.Web.Security;
+
+namespace System.Web.Configuration
+{
+ public class SiteMapSection: InternalSection
+ {
+ static ConfigurationPropertyCollection properties;
+ static ConfigurationProperty enabledProp;
+ static ConfigurationProperty defaultProviderProp;
+ static ConfigurationProperty providersProp;
+
+ static SiteMapSection ()
+ {
+ properties = new ConfigurationPropertyCollection ();
+ enabledProp = new ConfigurationProperty ("enabled", typeof(bool), false);
+ defaultProviderProp = new ConfigurationProperty ("defaultProvider", typeof(string), null);
+ providersProp = new ConfigurationProperty ("providers", typeof(ProviderSettingsCollection), null);
+
+ properties.Add (enabledProp);
+ properties.Add (defaultProviderProp);
+ properties.Add (providersProp);
+ }
+
+
+ public string DefaultProvider {
+ get { return (string) base [defaultProviderProp]; }
+ set { base [defaultProviderProp] = value; }
+ }
+
+ public bool Enabled {
+ get { return (bool) base [enabledProp]; }
+ set { base [enabledProp] = value; }
+ }
+
+ public ProviderSettingsCollection Providers {
+ get { return (ProviderSettingsCollection) base [providersProp]; }
+ set { base [providersProp] = value; }
+ }
+
+ protected override ConfigurationPropertyCollection Properties {
+ get { return properties; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/TraceConfig.cs b/mcs/class/System.Web/System.Web.Configuration/TraceConfig.cs
new file mode 100644
index 00000000000..8cee4d76921
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/TraceConfig.cs
@@ -0,0 +1,75 @@
+//
+// System.Web.Configuration.TraceConfig
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2004 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
+// "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;
+using System.Web;
+
+namespace System.Web.Configuration {
+
+ internal class TraceConfig {
+
+ private bool enabled;
+ private bool local_only;
+ private bool page_output;
+ private int request_limit;
+ private TraceMode trace_mode;
+
+ public TraceConfig ()
+ {
+ request_limit = 10;
+ }
+
+ public bool Enabled {
+ get { return enabled; }
+ set { enabled = value; }
+ }
+
+ public bool LocalOnly {
+ get { return local_only; }
+ set { local_only = value; }
+ }
+
+ public bool PageOutput {
+ get { return page_output; }
+ set { page_output = value; }
+ }
+
+ public int RequestLimit {
+ get { return request_limit; }
+ set { request_limit = value; }
+ }
+
+ public TraceMode TraceMode {
+ get { return trace_mode; }
+ set { trace_mode = value; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/TraceConfigurationHandler.cs b/mcs/class/System.Web/System.Web.Configuration/TraceConfigurationHandler.cs
new file mode 100644
index 00000000000..cea8c663e60
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/TraceConfigurationHandler.cs
@@ -0,0 +1,110 @@
+//
+// System.Web.Configuation.TraceConfigurationHandler
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2004 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
+// "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;
+using System.Web;
+using System.Xml;
+using System.Configuration;
+
+namespace System.Web.Configuration {
+
+ internal class TraceConfigurationHandler : IConfigurationSectionHandler {
+
+ public object Create (object parent, object context, XmlNode section)
+ {
+ TraceConfig config = new TraceConfig ();
+
+ string enabled_str = AttValue ("enabled", section);
+ if (enabled_str != null) {
+ try {
+ config.Enabled = Boolean.Parse (enabled_str);
+ } catch {
+ ThrowException ("The 'enabled' attribute is case sensitive" +
+ " and must be set to 'true' or 'false'.", section);
+ }
+ }
+
+ string local_str = AttValue ("localOnly", section);
+ if (local_str != null) {
+ try {
+ config.LocalOnly = Boolean.Parse (local_str);
+ } catch {
+ ThrowException ("The 'localOnly' attribute is case sensitive" +
+ " and must be set to 'true' or 'false'.", section);
+ }
+ }
+
+ string page_str = AttValue ("pageOutput", section);
+ if (page_str != null) {
+ try {
+ config.PageOutput = Boolean.Parse (page_str);
+ } catch {
+ ThrowException ("The 'pageOutput' attribute is case sensitive" +
+ " and must be set to 'true' or 'false'.", section);
+ }
+ }
+
+ string limit_str = AttValue ("requestLimit", section);
+ if (limit_str != null) {
+ try {
+ config.RequestLimit = Int32.Parse (limit_str);
+ } catch {
+ ThrowException ("The 'requestLimit' attribute must be an integer value.",
+ section);
+ }
+ }
+
+ string trace_str = AttValue ("traceMode", section);
+ if (trace_str != null) {
+ try {
+ config.TraceMode = (TraceMode) Enum.Parse (typeof (TraceMode), trace_str);
+ } catch {
+ ThrowException ("The 'traceMode' attribute is case sensitive and must be" +
+ " one of the following values: SortByTime, SortByCategory.",
+ section);
+ }
+ }
+
+ return config;
+ }
+
+ // A few methods to save some typing
+ static string AttValue (string name, XmlNode node)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, true);
+ }
+
+ static void ThrowException (string message, XmlNode node)
+ {
+ HandlersUtil.ThrowException (message, node);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/TraceDisplayMode.cs b/mcs/class/System.Web/System.Web.Configuration/TraceDisplayMode.cs
new file mode 100644
index 00000000000..5d8e9b5e300
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/TraceDisplayMode.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.Configuration.TraceDisplayMode.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System.Resources;
+
+#if NET_2_0
+namespace System.Web.Configuration
+{
+ public enum TraceDisplayMode
+ {
+ SortByTime = 1,
+ SortByCategory = 2
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs b/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs
new file mode 100644
index 00000000000..a7fe0060fb7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs
@@ -0,0 +1,944 @@
+//
+// System.Configuration.WebConfigurationSettings.cs
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2003,2004 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
+// "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;
+using System.Configuration;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Runtime.Remoting;
+using System.Web.Util;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class WebConfigurationSettings
+ {
+ static IConfigurationSystem oldConfig;
+ static WebDefaultConfig config;
+ static string machineConfigPath;
+ const BindingFlags privStatic = BindingFlags.NonPublic | BindingFlags.Static;
+
+ private WebConfigurationSettings ()
+ {
+ }
+
+ public static void Init ()
+ {
+ lock (typeof (WebConfigurationSettings)) {
+ if (config != null)
+ return;
+
+ WebDefaultConfig settings = WebDefaultConfig.GetInstance ();
+ Type t = typeof (ConfigurationSettings);
+ MethodInfo changeConfig = t.GetMethod ("ChangeConfigurationSystem",
+ privStatic);
+
+ if (changeConfig == null)
+ throw new ConfigurationException ("Cannot find method CCS");
+
+ object [] args = new object [] {settings};
+ oldConfig = (IConfigurationSystem) changeConfig.Invoke (null, args);
+ config = settings;
+ }
+ }
+
+ public static void Init (HttpContext context)
+ {
+ Init ();
+ config.Init (context);
+ }
+
+ public static object GetConfig (string sectionName)
+ {
+ return config.GetConfig (sectionName);
+ }
+
+ public static object GetConfig (string sectionName, HttpContext context)
+ {
+ return config.GetConfig (sectionName, context);
+ }
+
+ public static string MachineConfigPath {
+ get {
+ lock (typeof (WebConfigurationSettings)) {
+ if (machineConfigPath != null)
+ return machineConfigPath;
+
+ if (config == null)
+ Init ();
+
+ Type t = oldConfig.GetType ();
+ MethodInfo getMC = t.GetMethod ("GetMachineConfigPath",
+ privStatic);
+
+ if (getMC == null)
+ throw new ConfigurationException ("Cannot find method GMC");
+
+ machineConfigPath = (string) getMC.Invoke (null, null);
+ return machineConfigPath;
+ }
+ }
+ }
+ }
+
+ //
+ // class WebDefaultConfig: read configuration from machine.config file and application
+ // config file if available.
+ //
+ class WebDefaultConfig : IConfigurationSystem
+ {
+ static WebDefaultConfig instance;
+ Hashtable fileToConfig;
+ HttpContext firstContext;
+ bool initCalled;
+
+ static WebDefaultConfig ()
+ {
+ instance = new WebDefaultConfig ();
+ }
+
+ private WebDefaultConfig ()
+ {
+ fileToConfig = new Hashtable ();
+ }
+
+ public static WebDefaultConfig GetInstance ()
+ {
+ return instance;
+ }
+
+ public object GetConfig (string sectionName)
+ {
+ HttpContext current = HttpContext.Current;
+ if (current == null)
+ current = firstContext;
+ return GetConfig (sectionName, current);
+ }
+
+ public object GetConfig (string sectionName, HttpContext context)
+ {
+ if (context == null)
+ return null;
+
+ ConfigurationData config = GetConfigFromFileName (context.Request.CurrentExecutionFilePath, context);
+ if (config == null)
+ return null;
+
+ return config.GetConfig (sectionName, context);
+ }
+
+ ConfigurationData GetConfigFromFileName (string filepath, HttpContext context)
+ {
+ if (filepath == "")
+ return (ConfigurationData) fileToConfig [WebConfigurationSettings.MachineConfigPath];
+
+ string dir = UrlUtils.GetDirectory (filepath);
+ if (HttpRuntime.AppDomainAppVirtualPath.Length > dir.Length)
+ return (ConfigurationData) fileToConfig [WebConfigurationSettings.MachineConfigPath];
+
+ ConfigurationData data = (ConfigurationData) fileToConfig [dir];
+ if (data != null)
+ return data;
+
+ string realpath = context.Request.MapPath (dir);
+ string lower = Path.Combine (realpath, "web.config");
+ bool isLower = File.Exists (lower);
+ string wcfile = null;
+ if (!isLower) {
+ string upper = Path.Combine (realpath, "Web.config");
+ bool isUpper = File.Exists (upper);
+ if (isUpper)
+ wcfile = upper;
+ } else {
+ wcfile = lower;
+ }
+
+ string tempDir = dir;
+ if (tempDir == HttpRuntime.AppDomainAppVirtualPath ||
+ tempDir + "/" == HttpRuntime.AppDomainAppVirtualPath) {
+ tempDir = "";
+ realpath = HttpRuntime.AppDomainAppPath;
+ }
+
+ ConfigurationData parent = GetConfigFromFileName (tempDir, context);
+ if (wcfile == null) {
+ data = new ConfigurationData (parent, null, realpath);
+ data.DirName = dir;
+ fileToConfig [dir] = data;
+ }
+
+ if (data == null) {
+ data = new ConfigurationData (parent, wcfile);
+ data.DirName = dir;
+ data.LoadFromFile (wcfile);
+ fileToConfig [dir] = data;
+ RemotingConfiguration.Configure (wcfile);
+ }
+
+ return data;
+ }
+
+ public void Init ()
+ {
+ // nothing. We need a context.
+ }
+
+ public void Init (HttpContext context)
+ {
+ if (initCalled)
+ return;
+
+ lock (this) {
+ if (initCalled)
+ return;
+
+ firstContext = context;
+ ConfigurationData data = new ConfigurationData ();
+ if (!data.LoadFromFile (WebConfigurationSettings.MachineConfigPath))
+ throw new ConfigurationException ("Cannot find " + WebConfigurationSettings.MachineConfigPath);
+
+ fileToConfig [WebConfigurationSettings.MachineConfigPath] = data;
+ initCalled = true;
+ }
+ }
+ }
+
+ class FileWatcherCache
+ {
+ Hashtable cacheTable;
+ string path;
+ string filename;
+ FileSystemWatcher watcher;
+ ConfigurationData data;
+
+ public FileWatcherCache (ConfigurationData data)
+ {
+ this.data = data;
+ cacheTable = new Hashtable ();
+ this.path = Path.GetDirectoryName (data.FileName);
+ this.filename = Path.GetFileName (data.FileName);
+ if (!Directory.Exists (path))
+ return;
+
+ watcher = new FileSystemWatcher (this.path, this.filename);
+ FileSystemEventHandler handler = new FileSystemEventHandler (SetChanged);
+ watcher.Created += handler;
+ watcher.Changed += handler;
+ watcher.Deleted += handler;
+ watcher.EnableRaisingEvents = true;
+ }
+
+ void SetChanged (object o, FileSystemEventArgs args)
+ {
+ lock (data) {
+ cacheTable.Clear ();
+ data.Reset ();
+ if (args.ChangeType == WatcherChangeTypes.Created)
+ RemotingConfiguration.Configure (args.FullPath);
+
+ if (args.ChangeType != WatcherChangeTypes.Deleted)
+ data.LoadFromFile (args.FullPath);
+ }
+ }
+
+ public object this [string key] {
+ get {
+ lock (data)
+ return cacheTable [key];
+ }
+
+ set {
+ lock (data)
+ cacheTable [key] = value;
+ }
+ }
+
+ public void Close ()
+ {
+ if (watcher != null)
+ watcher.EnableRaisingEvents = false;
+ }
+ }
+
+ enum AllowDefinition
+ {
+ Everywhere,
+ MachineOnly,
+ MachineToApplication
+ }
+
+ class SectionData
+ {
+ public readonly string SectionName;
+ public readonly string TypeName;
+ public readonly bool AllowLocation;
+ public readonly AllowDefinition AllowDefinition;
+ public string FileName;
+
+ public SectionData (string sectionName, string typeName,
+ bool allowLocation, AllowDefinition allowDefinition)
+ {
+ SectionName = sectionName;
+ TypeName = typeName;
+ AllowLocation = allowLocation;
+ AllowDefinition = allowDefinition;
+ }
+ }
+
+ class ConfigurationData
+ {
+ ConfigurationData parent;
+ Hashtable factories;
+ Hashtable pending;
+ Hashtable locations;
+ string fileName;
+ string dirname;
+ static object removedMark = new object ();
+ static object groupMark = new object ();
+ static object emptyMark = new object ();
+ FileWatcherCache fileCache;
+ static char [] forbiddenPathChars = new char [] {
+ ';', '?', ':', '@', '&', '=', '+',
+ '$', ',','\\', '*', '\"', '<', '>'
+ };
+
+ static string forbiddenStr = "';', '?', ':', '@', '&', '=', '+', '$', ',', '\\', '*', '\"', '<', '>'";
+
+ internal FileWatcherCache FileCache {
+ get {
+ lock (this) {
+ if (fileCache != null)
+ return fileCache;
+
+ fileCache = new FileWatcherCache (this);
+ }
+
+ return fileCache;
+ }
+ }
+
+ internal string FileName {
+ get { return fileName; }
+ }
+
+ internal ConfigurationData Parent {
+ get { return parent; }
+ }
+
+ internal string DirName {
+ get { return dirname; }
+ set { dirname = value; }
+ }
+
+ internal void Reset ()
+ {
+ factories.Clear ();
+ if (pending != null)
+ pending.Clear ();
+
+ if (locations != null)
+ locations.Clear ();
+ }
+
+ public ConfigurationData () : this (null, null)
+ {
+ }
+
+ public ConfigurationData (ConfigurationData parent, string filename)
+ {
+ this.parent = (parent == this) ? null : parent;
+ this.fileName = filename;
+ factories = new Hashtable ();
+ }
+
+ public ConfigurationData (ConfigurationData parent, string filename, string realdir)
+ {
+ this.parent = (parent == this) ? null : parent;
+ if (filename == null) {
+ this.fileName = Path.Combine (realdir, "*.config");
+ } else {
+ this.fileName = filename;
+ }
+ factories = new Hashtable ();
+ }
+
+ public bool LoadFromFile (string fileName)
+ {
+ this.fileName = fileName;
+ if (fileName == null || !File.Exists (fileName))
+ return false;
+
+ XmlTextReader reader = null;
+
+ try {
+ FileStream fs = new FileStream (fileName, FileMode.Open, FileAccess.Read);
+ reader = new XmlTextReader (fs);
+ InitRead (reader);
+ ReadConfig (reader, false);
+ } catch (ConfigurationException) {
+ throw;
+ } catch (Exception e) {
+ throw new ConfigurationException ("Error reading " + fileName, e);
+ } finally {
+ if (reader != null)
+ reader.Close();
+ }
+
+ return true;
+ }
+
+ public void LoadFromReader (XmlTextReader reader, string fakeFileName, bool isLocation)
+ {
+ fileName = fakeFileName;
+ MoveToNextElement (reader);
+ ReadConfig (reader, isLocation);
+ }
+
+ object GetHandler (string sectionName)
+ {
+ lock (factories) {
+ object o = factories [sectionName];
+ if (o == null || o == removedMark) {
+ if (parent != null)
+ return parent.GetHandler (sectionName);
+
+ return null;
+ }
+
+ if (o is IConfigurationSectionHandler)
+ return (IConfigurationSectionHandler) o;
+
+ o = CreateNewHandler (sectionName, (SectionData) o);
+ factories [sectionName] = o;
+ return o;
+ }
+ }
+
+ object CreateNewHandler (string sectionName, SectionData section)
+ {
+ Type t = Type.GetType (section.TypeName);
+ if (t == null)
+ throw new ConfigurationException ("Cannot get Type for " + section.TypeName);
+
+ Type iconfig = typeof (IConfigurationSectionHandler);
+ if (!iconfig.IsAssignableFrom (t))
+ throw new ConfigurationException (sectionName + " does not implement " + iconfig);
+
+ object o = Activator.CreateInstance (t, true);
+ if (o == null)
+ throw new ConfigurationException ("Cannot get instance for " + t);
+
+ return o;
+ }
+
+ XmlDocument GetInnerDoc (XmlDocument doc, int i, string [] sectionPath)
+ {
+ if (++i >= sectionPath.Length)
+ return doc;
+
+ if (doc.DocumentElement == null)
+ return null;
+
+ XmlNode node = doc.DocumentElement.FirstChild;
+ while (node != null) {
+ if (node.Name == sectionPath [i]) {
+ ConfigXmlDocument result = new ConfigXmlDocument ();
+ result.Load (new StringReader (node.OuterXml));
+ return GetInnerDoc (result, i, sectionPath);
+ }
+ node = node.NextSibling;
+ }
+
+ return null;
+ }
+
+ XmlDocument GetDocumentForSection (string sectionName)
+ {
+ ConfigXmlDocument doc = new ConfigXmlDocument ();
+ if (pending == null)
+ return doc;
+
+ string [] sectionPath = sectionName.Split ('/');
+ string outerxml = pending [sectionPath [0]] as string;
+ if (outerxml == null)
+ return doc;
+
+ StringReader reader = new StringReader (outerxml);
+ XmlTextReader rd = new XmlTextReader (reader);
+ rd.MoveToContent ();
+ doc.LoadSingleElement (fileName, rd);
+
+ return GetInnerDoc (doc, 0, sectionPath);
+ }
+
+ object GetConfigInternal (string sectionName, HttpContext context, bool useLoc)
+ {
+ object handler = GetHandler (sectionName);
+ IConfigurationSectionHandler iconf = handler as IConfigurationSectionHandler;
+ if (iconf == null)
+ return handler;
+
+ object parentConfig = null;
+ if (parent != null) {
+ if (useLoc)
+ parentConfig = parent.GetConfig (sectionName, context);
+ else
+ parentConfig = parent.GetConfigOptLocation (sectionName, context, false);
+ }
+
+ XmlDocument doc = GetDocumentForSection (sectionName);
+ if (doc == null || doc.DocumentElement == null)
+ return parentConfig;
+
+ return iconf.Create (parentConfig, fileName, doc.DocumentElement);
+ }
+
+ public object GetConfig (string sectionName, HttpContext context)
+ {
+ if (locations != null && dirname != null) {
+ string reduced = UrlUtils.MakeRelative (context.Request.CurrentExecutionFilePath, dirname);
+ string [] parts = reduced.Split ('/');
+ Location location = null;
+
+ string target = null;
+ for (int i = 0; i < parts.Length; i++) {
+ if (target == null)
+ target = parts [i];
+ else
+ target = target + "/" + parts [i];
+
+ if (locations.ContainsKey (target)) {
+ location = locations [target] as Location;
+ } else if (locations.ContainsKey (target + "/*")) {
+ location = locations [target + "/*"] as Location;
+ }
+ }
+
+ if (location == null) {
+ location = locations ["*"] as Location;
+ }
+
+ if (location != null && location.Config != null) {
+ object o = location.Config.GetConfigOptLocation (sectionName, context, false);
+ if (o != null) {
+ return o;
+ }
+ }
+ }
+
+ return GetConfigOptLocation (sectionName, context, true);
+ }
+
+ object GetConfigOptLocation (string sectionName, HttpContext context, bool useLoc)
+ {
+ object config = this.FileCache [sectionName];
+ if (config == emptyMark)
+ return null;
+
+ if (config != null)
+ return config;
+
+ lock (this) {
+ config = GetConfigInternal (sectionName, context, useLoc);
+ this.FileCache [sectionName] = (config == null) ? emptyMark : config;
+ }
+
+ return config;
+ }
+
+ private object LookForFactory (string key)
+ {
+ object o = factories [key];
+ if (o != null)
+ return o;
+
+ if (parent != null)
+ return parent.LookForFactory (key);
+
+ return null;
+ }
+
+ private void InitRead (XmlTextReader reader)
+ {
+ reader.MoveToContent ();
+ if (reader.NodeType != XmlNodeType.Element || reader.Name != "configuration")
+ ThrowException ("Configuration file does not have a valid root element", reader);
+
+ if (reader.HasAttributes)
+ ThrowException ("Unrecognized attribute in root element", reader);
+
+ MoveToNextElement (reader);
+ }
+
+ internal void MoveToNextElement (XmlTextReader reader)
+ {
+ while (reader.Read ()) {
+ XmlNodeType ntype = reader.NodeType;
+ if (ntype == XmlNodeType.Element)
+ return;
+
+ if (ntype != XmlNodeType.Whitespace &&
+ ntype != XmlNodeType.Comment &&
+ ntype != XmlNodeType.SignificantWhitespace &&
+ ntype != XmlNodeType.EndElement)
+ ThrowException ("Unrecognized element", reader);
+ }
+ }
+
+ private void ReadSection (XmlTextReader reader, string sectionName)
+ {
+ string attName;
+ string nameValue = null;
+ string typeValue = null;
+ string allowLoc = null, allowDef = null;
+ bool allowLocation = true;
+ AllowDefinition allowDefinition = AllowDefinition.Everywhere;
+
+ while (reader.MoveToNextAttribute ()) {
+ attName = reader.Name;
+ if (attName == null)
+ continue;
+
+ if (attName == "allowLocation") {
+ if (allowLoc != null)
+ ThrowException ("Duplicated allowLocation attribute.", reader);
+
+ allowLoc = reader.Value;
+ allowLocation = (allowLoc == "true");
+ if (!allowLocation && allowLoc != "false")
+ ThrowException ("Invalid attribute value", reader);
+
+ continue;
+ }
+
+ if (attName == "allowDefinition") {
+ if (allowDef != null)
+ ThrowException ("Duplicated allowDefinition attribute.", reader);
+
+ allowDef = reader.Value;
+ try {
+ allowDefinition = (AllowDefinition) Enum.Parse (
+ typeof (AllowDefinition), allowDef);
+ } catch {
+ ThrowException ("Invalid attribute value", reader);
+ }
+
+ continue;
+ }
+
+ if (attName == "type") {
+ if (typeValue != null)
+ ThrowException ("Duplicated type attribute.", reader);
+ typeValue = reader.Value;
+ continue;
+ }
+
+ if (attName == "name") {
+ if (nameValue != null)
+ ThrowException ("Duplicated name attribute.", reader);
+
+ nameValue = reader.Value;
+ if (nameValue == "location")
+ ThrowException ("location is a reserved section name", reader);
+ continue;
+ }
+
+ ThrowException ("Unrecognized attribute.", reader);
+ }
+
+ if (nameValue == null || typeValue == null)
+ ThrowException ("Required attribute missing", reader);
+
+ if (sectionName != null)
+ nameValue = sectionName + '/' + nameValue;
+
+ reader.MoveToElement();
+ object o = LookForFactory (nameValue);
+ if (o != null && o != removedMark)
+ ThrowException ("Already have a factory for " + nameValue, reader);
+
+ SectionData section = new SectionData (nameValue, typeValue, allowLocation, allowDefinition);
+ section.FileName = fileName;
+ factories [nameValue] = section;
+ MoveToNextElement (reader);
+ }
+
+ private void ReadRemoveSection (XmlTextReader reader, string sectionName)
+ {
+ if (!reader.MoveToNextAttribute () || reader.Name != "name")
+ ThrowException ("Unrecognized attribute.", reader);
+
+ string removeValue = reader.Value;
+ if (removeValue == null || removeValue.Length == 0)
+ ThrowException ("Empty name to remove", reader);
+
+ reader.MoveToElement ();
+
+ if (sectionName != null)
+ removeValue = sectionName + '/' + removeValue;
+
+ object o = LookForFactory (removeValue);
+ if (o != null && o == removedMark)
+ ThrowException ("No factory for " + removeValue, reader);
+
+ factories [removeValue] = removedMark;
+ MoveToNextElement (reader);
+ }
+
+ private void ReadSectionGroup (XmlTextReader reader, string configSection)
+ {
+ if (!reader.MoveToNextAttribute ())
+ ThrowException ("sectionGroup must have a 'name' attribute.", reader);
+
+ if (reader.Name != "name")
+ ThrowException ("Unrecognized attribute.", reader);
+
+ if (reader.MoveToNextAttribute ())
+ ThrowException ("Unrecognized attribute.", reader);
+
+ string value = reader.Value;
+ if (value == "location")
+ ThrowException ("location is a reserved section name", reader);
+
+ if (configSection != null)
+ value = configSection + '/' + value;
+
+ object o = LookForFactory (value);
+ if (o != null && o != removedMark && o != groupMark)
+ ThrowException ("Already have a factory for " + value, reader);
+
+ factories [value] = groupMark;
+ MoveToNextElement (reader);
+ ReadSections (reader, value);
+ }
+
+ private void ReadSections (XmlTextReader reader, string configSection)
+ {
+ int depth = reader.Depth;
+ while (reader.Depth == depth) {
+ string name = reader.Name;
+ if (name == "section") {
+ ReadSection (reader, configSection);
+ continue;
+ }
+
+ if (name == "remove") {
+ ReadRemoveSection (reader, configSection);
+ continue;
+ }
+
+ if (name == "clear") {
+ if (reader.HasAttributes)
+ ThrowException ("Unrecognized attribute.", reader);
+
+ factories.Clear ();
+ MoveToNextElement (reader);
+ continue;
+ }
+
+ if (name == "sectionGroup") {
+ ReadSectionGroup (reader, configSection);
+ continue;
+ }
+
+ ThrowException ("Unrecognized element: " + reader.Name, reader);
+ }
+ }
+
+ void StoreLocation (string name, XmlTextReader reader)
+ {
+ string path = null;
+ bool haveAllow = false;
+ bool allowOverride = true;
+ string att = null;
+
+ while (reader.MoveToNextAttribute ()) {
+ att = reader.Name;
+
+ if (att == "path") {
+ if (path != null)
+ ThrowException ("Duplicate path attribute", reader);
+
+ path = reader.Value;
+ if (path.StartsWith ("."))
+ ThrowException ("Path cannot begin with '.'", reader);
+
+ if (path.IndexOfAny (forbiddenPathChars) != -1)
+ ThrowException ("Path cannot contain " + forbiddenStr, reader);
+
+ continue;
+ }
+
+ if (att == "allowOverride") {
+ if (haveAllow)
+ ThrowException ("Duplicate allowOverride attribute", reader);
+
+ haveAllow = true;
+ allowOverride = (reader.Value == "true");
+ if (!allowOverride && reader.Value != "false")
+ ThrowException ("allowOverride must be either true or false", reader);
+ continue;
+ }
+
+ ThrowException ("Unrecognized attribute.", reader);
+ }
+
+ if (att == null)
+ return; // empty location tag
+
+ Location loc = new Location (this, path, allowOverride);
+ if (locations == null)
+ locations = new Hashtable ();
+ else if (locations.ContainsKey (loc.Path))
+ ThrowException ("Duplicated location path: " + loc.Path, reader);
+
+ reader.MoveToElement ();
+ loc.LoadFromString (reader.ReadInnerXml ());
+ locations [loc.Path] = loc;
+ if (!loc.AllowOverride) {
+ XmlTextReader inner = loc.GetReader ();
+ if (inner != null) {
+ MoveToNextElement (inner);
+ ReadConfig (loc.GetReader (), true);
+ }
+ }
+
+ loc.XmlStr = null;
+ }
+
+ void StorePending (string name, XmlTextReader reader)
+ {
+ if (pending == null)
+ pending = new Hashtable ();
+
+ if (pending.ContainsKey (name))
+ ThrowException ("Sections can only appear once: " + name, reader);
+
+ pending [name] = reader.ReadOuterXml ();
+ }
+
+ void ReadConfig (XmlTextReader reader, bool isLocation)
+ {
+ int depth = reader.Depth;
+ while (!reader.EOF && reader.Depth == depth) {
+ string name = reader.Name;
+
+ if (name == "configSections") {
+ if (isLocation)
+ ThrowException ("<configSections> inside <location>", reader);
+
+ if (reader.HasAttributes)
+ ThrowException ("Unrecognized attribute in <configSections>.", reader);
+
+ MoveToNextElement (reader);
+ if (reader.Depth > depth)
+ ReadSections (reader, null);
+ } else if (name == "location") {
+ if (isLocation)
+ ThrowException ("<location> inside <location>", reader);
+
+ StoreLocation (name, reader);
+ MoveToNextElement (reader);
+ } else if (name != null && name != ""){
+ StorePending (name, reader);
+ MoveToNextElement (reader);
+ } else {
+ MoveToNextElement (reader);
+ }
+ }
+ }
+
+ void ThrowException (string text, XmlTextReader reader)
+ {
+ throw new ConfigurationException (text, fileName, reader.LineNumber);
+ }
+ }
+
+ class Location
+ {
+ string path;
+ bool allowOverride;
+ ConfigurationData parent;
+ ConfigurationData thisOne;
+ string xmlstr;
+
+ public Location (ConfigurationData parent, string path, bool allowOverride)
+ {
+ this.parent = parent;
+ this.allowOverride = allowOverride;
+ this.path = (path == null || path == "") ? "*" : path;
+ }
+
+ public bool AllowOverride {
+ get { return (path != "*" || allowOverride); }
+ }
+
+ public string Path {
+ get { return path; }
+ }
+
+ public string XmlStr {
+ set { xmlstr = value; }
+ }
+
+ public void LoadFromString (string str)
+ {
+ if (str == null)
+ throw new ArgumentNullException ("str");
+
+ if (thisOne != null)
+ throw new InvalidOperationException ();
+
+ this.xmlstr = str.Trim ();
+ if (xmlstr == "")
+ return;
+
+ XmlTextReader reader = new XmlTextReader (new StringReader (str));
+ thisOne = new ConfigurationData (parent, parent.FileName);
+ thisOne.LoadFromReader (reader, parent.FileName, true);
+ }
+
+ public XmlTextReader GetReader ()
+ {
+ if (xmlstr == "")
+ return null;
+
+ XmlTextReader reader = new XmlTextReader (new StringReader (xmlstr));
+ return reader;
+ }
+
+ public ConfigurationData Config {
+ get { return thisOne; }
+ }
+ }
+}
+
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/WebControlsSectionHandler.cs b/mcs/class/System.Web/System.Web.Configuration/WebControlsSectionHandler.cs
new file mode 100644
index 00000000000..33fb18a6d7e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/WebControlsSectionHandler.cs
@@ -0,0 +1,136 @@
+//
+// System.Web.Configuration.WebControlsSectionHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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;
+using System.Configuration;
+using System.IO;
+using System.Web;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class WebControlsConfig
+ {
+ static WebControlsConfig instance;
+ string scriptsVDir;
+ string configFilePath;
+
+ public WebControlsConfig (WebControlsConfig parent, object context)
+ {
+ configFilePath = context as string;
+ if (parent == null)
+ return;
+
+ scriptsVDir = parent.scriptsVDir;
+ if (scriptsVDir != null)
+ configFilePath = parent.configFilePath;
+ }
+
+ public void SetClientScriptsLocation (string location, out string error)
+ {
+ error = null;
+ if (location == null || location.Length == 0) {
+ error = "empty or null value for clientScriptsLocation";
+ return;
+ }
+
+ if (location [0] != '/')
+ location = "/" + location;
+
+ string [] splitted = location.Split ('/');
+ int end = splitted.Length;
+ for (int i = 0; i < end; i++)
+ splitted [i] = HttpUtility.UrlEncode (splitted [i]);
+
+ scriptsVDir = String.Join ("/", splitted);
+ }
+
+ public string ScriptsPhysicalDirectory {
+ get { return Path.Combine (Path.GetDirectoryName (configFilePath), "web_scripts"); }
+ }
+
+ public string ScriptsVirtualDirectory {
+ get { return scriptsVDir; }
+ set { scriptsVDir = value; }
+ }
+
+ static public WebControlsConfig Instance {
+ get {
+ //TODO: use HttpContext to get the configuration
+ if (instance != null)
+ return instance;
+
+ lock (typeof (WebControlsConfig)) {
+ if (instance != null)
+ return instance;
+
+ instance = (WebControlsConfig) ConfigurationSettings.GetConfig ("system.web/webControls");
+ }
+
+ return instance;
+ }
+ }
+ }
+
+ class WebControlsSectionHandler : IConfigurationSectionHandler
+ {
+ public object Create (object parent, object context, XmlNode section)
+ {
+ WebControlsConfig config = new WebControlsConfig (parent as WebControlsConfig, context);
+
+ if (section.Attributes == null && section.Attributes.Count == 0)
+ ThrowException ("Lack of clientScriptsLocation attribute", section);
+
+ string clientLocation = AttValue ("clientScriptsLocation", section, false);
+ if (section.Attributes != null && section.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", section);
+
+ string error;
+ config.SetClientScriptsLocation (clientLocation, out error);
+ if (error != null)
+ HandlersUtil.ThrowException (error, section);
+
+ return config;
+ }
+
+ // To save some typing...
+ static string AttValue (string name, XmlNode node, bool optional)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, optional);
+ }
+
+ static void ThrowException (string message, XmlNode node)
+ {
+ HandlersUtil.ThrowException (message, node);
+ }
+ //
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs b/mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs
new file mode 100644
index 00000000000..c7170931b4c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs
@@ -0,0 +1,96 @@
+//
+// System.Web.Handlers.AssemblyResourceLoader
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.Web;
+using System.Web.UI;
+using System.Reflection;
+using System.IO;
+
+namespace System.Web.Handlers {
+ [MonoTODO ("Should we cache stuff?")]
+ #if NET_2_0
+ public
+ #else
+ internal // since this is in the .config file, we need to support it, since we dont have versoned support.
+ #endif
+ class AssemblyResourceLoader : IHttpHandler {
+
+ internal static string GetResourceUrl (Type type, string resourceName)
+ {
+ string aname = type.Assembly == typeof(AssemblyResourceLoader).Assembly ? "s" : HttpUtility.UrlEncode (type.Assembly.GetName ().FullName);
+ return "WebResource.axd?a="
+ + aname
+ + "&r="
+ + HttpUtility.UrlEncode (resourceName);
+ }
+
+
+ [MonoTODO ("Substitution not implemented")]
+ void System.Web.IHttpHandler.ProcessRequest (HttpContext context)
+ {
+#if NET_2_0
+ string resourceName = context.Request.QueryString ["r"];
+ string asmName = context.Request.QueryString ["a"];
+ Assembly assembly;
+
+ if (asmName == null || asmName == "s") assembly = GetType().Assembly;
+ else assembly = Assembly.Load (asmName);
+
+ bool found = false;
+ foreach (WebResourceAttribute wra in assembly.GetCustomAttributes (typeof (WebResourceAttribute), false)) {
+ if (wra.WebResource == resourceName) {
+ context.Response.ContentType = wra.ContentType;
+
+ if (wra.PerformSubstitution)
+ throw new NotImplementedException ("Substitution not implemented");
+
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ return;
+
+ Stream s = assembly.GetManifestResourceStream (resourceName);
+
+ byte [] buf = new byte [1024];
+ Stream output = context.Response.OutputStream;
+ int c;
+ do {
+ c = s.Read (buf, 0, 1024);
+ output.Write (buf, 0, c);
+ } while (c > 0);
+#endif
+ }
+
+ bool System.Web.IHttpHandler.IsReusable { get { return true; } }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Handlers/ChangeLog b/mcs/class/System.Web/System.Web.Handlers/ChangeLog
new file mode 100644
index 00000000000..eb1b06f0fbc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Handlers/ChangeLog
@@ -0,0 +1,46 @@
+2004-11-18 Lluis Sanchez Gual <lluis@novell.com>
+
+ * AssemblyResourceLoader.cs: Use a special name when encoding a resource
+ from the System.Web assembly.
+
+2004-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TraceHandler.cs: error code is 403 and the message different when
+ trace is enabled but not for remote clients.
+
+2004-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TraceHandler.cs: check that trace is enabled or throw.
+
+2004-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TraceHandler.cs: Added protected missing members and attributes.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * TraceHandler.cs: Obey localOnly attribute.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * TraceHandler.cs: Implement.
+
+2003-11-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AssemblyResourceLoader.cs: fixed compilation under MS. Ben already
+ filed a bug report.
+
+2003-11-04 Jackson Harper <jackson@ximian.com>
+
+ * AssemblyResourceLoader.cs: No method body for v1. This fixes the
+ build.
+
+2003-11-04 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * AssemblyResourceLoader.cs: New file. New v2 handler.
+
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ChangeLog: New file.
+ * TraceHandler.cs: stubbed out. This should generate the trace page
+ when tracing is enabled.
+
diff --git a/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs b/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs
new file mode 100644
index 00000000000..23e35288f80
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs
@@ -0,0 +1,186 @@
+//
+// System.Web.Handlers.TraceHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+// (C) 2004 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
+// "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.Collections;
+using System.Data;
+using System.Web;
+using System.Web.Util;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace System.Web.Handlers
+{
+#if NET_2_0
+ [Serializable]
+#endif
+ class TraceNotAvailableException : HttpException
+ {
+ bool notLocal;
+
+ public TraceNotAvailableException (bool notLocal) :
+ base (notLocal ? 403 : 500, "Trace Error")
+ {
+ this.notLocal = notLocal;
+ }
+
+ internal override string Description {
+ get {
+ if (notLocal)
+ return "Trace is not enabled for remote clients.";
+
+ return "Trace.axd is not enabled in the configuration file for this application.";
+ }
+ }
+ }
+
+ public class TraceHandler : IHttpHandler
+ {
+ void IHttpHandler.ProcessRequest (HttpContext context)
+ {
+ TraceManager manager = HttpRuntime.TraceManager;
+
+ if (!manager.Enabled || manager.LocalOnly && !context.Request.IsLocal)
+ throw new TraceNotAvailableException (manager.Enabled);
+
+ HtmlTextWriter output = new HtmlTextWriter (context.Response.Output);
+
+ if (context.Request.QueryString ["clear"] != null)
+ manager.Clear ();
+
+ string id_str = context.Request.QueryString ["id"];
+ int id = -1;
+ if (id_str != null)
+ id = Int32.Parse (id_str);
+
+ if (id > 0 && id <= manager.ItemCount) {
+ RenderItem (manager, output, id);
+ } else {
+ string dir = context.Server.MapPath (UrlUtils.GetDirectory (context.Request.FilePath));
+ RenderMenu (manager, output, dir);
+ }
+
+ }
+
+ bool IHttpHandler.IsReusable
+ {
+ get {
+ return false;
+ }
+ }
+
+ private void RenderMenu (TraceManager manager, HtmlTextWriter output, string dir)
+ {
+
+ output.RenderBeginTag (HtmlTextWriterTag.Html);
+
+ output.RenderBeginTag (HtmlTextWriterTag.Head);
+ TraceData.RenderStyleSheet (output);
+ output.RenderEndTag ();
+
+ RenderHeader (output, dir);
+
+ output.RenderBeginTag (HtmlTextWriterTag.Body);
+ output.AddAttribute ("class", "tracecontent");
+ output.RenderBeginTag (HtmlTextWriterTag.Span);
+
+ Table table = TraceData.CreateTable ();
+
+ table.Rows.Add (TraceData.AltRow ("Requests to the Application"));
+ table.Rows.Add (TraceData.SubHeadRow ("No", "Time of Request",
+ "File", "Status Code", "Verb", "&nbsp;"));
+
+ if (manager.TraceData != null) {
+ for (int i=0; i<manager.ItemCount; i++) {
+ int item = i + 1;
+ TraceData d = manager.TraceData [i];
+ TraceData.RenderAltRow (table, i, item.ToString (), d.RequestTime.ToString (),
+ d.RequestPath, d.StatusCode.ToString (), d.RequestType,
+ "<a href=\"Trace.axd?id=" + item + "\" class=\"tinylink\">" +
+ "<b><nobr>View Details</a>");
+ }
+ table.RenderControl (output);
+ }
+
+ output.RenderEndTag ();
+ output.RenderEndTag ();
+
+ output.RenderEndTag ();
+ }
+
+ private void RenderHeader (HtmlTextWriter output, string dir)
+ {
+ Table table = TraceData.CreateTable ();
+ TableRow row1 = new TableRow ();
+ TableRow row2 = new TableRow ();
+ TableCell cell1 = new TableCell ();
+ TableCell cell2 = new TableCell ();
+ TableCell cell3 = new TableCell ();
+ TableCell cell4 = new TableCell ();
+
+ cell1.Text = "<h1>Application Trace</h1>";
+ cell2.Text = "[ <a href=\"Trace.axd?clear=1\" class=\"link\">clear current trace</a> ]";
+
+ cell2.HorizontalAlign = HorizontalAlign.Right;
+ cell2.VerticalAlign = VerticalAlign.Bottom;
+
+ row1.Cells.Add (cell1);
+ row1.Cells.Add (cell2);
+
+ cell3.Text = "<h2><h2><p>"; // ummm, WTF?
+ cell4.Text = "<b>Physical Directory:</b>" + dir;
+
+ row2.Cells.Add (cell3);
+ row2.Cells.Add (cell4);
+
+ table.Rows.Add (row1);
+ table.Rows.Add (row2);
+
+ table.RenderControl (output);
+ }
+
+ private void RenderItem (TraceManager manager, HtmlTextWriter output, int item)
+ {
+ manager.TraceData [item - 1].Render (output);
+ }
+
+ [MonoTODO ("Appears in class status, but...")]
+ protected void ShowDetails (DataSet data)
+ {
+ }
+
+ [MonoTODO ("Appears in class status, but...")]
+ protected void ShowRequests (ArrayList list)
+ {
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Hosting/AppDomainFactory.cs b/mcs/class/System.Web/System.Web.Hosting/AppDomainFactory.cs
new file mode 100644
index 00000000000..252d4460266
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/AppDomainFactory.cs
@@ -0,0 +1,156 @@
+//
+// System.Web.Hosting.AppDomainFactory.cs
+//
+// Authors:
+// Bob Smith <bob@thestuff.net>
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) Bob Smith
+// (c) Copyright 2002 Ximian, Inc. (http://www.ximian.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;
+using System.Collections;
+using System.IO;
+using System.Security;
+using System.Security.Policy;
+using System.Text;
+
+namespace System.Web.Hosting
+{
+ public sealed class AppDomainFactory : IAppDomainFactory
+ {
+ static int nDomain = 0;
+ static string [] domainData = { ".appDomain",
+ ".appId",
+ ".appPath",
+ ".appVPath",
+ ".appName",
+ ".domainId"
+ };
+
+ public object Create (string module,
+ string typeName,
+ string appId,
+ string appPath,
+ string strUrlOfAppOrigin,
+ int iZone)
+ {
+ appPath = Path.GetFullPath (appPath);
+ if (appPath [appPath.Length - 1] == '\\')
+ appPath += '\\';
+
+ StringBuilder sb = new StringBuilder (appId);
+ sb.Append ('-');
+ lock (domainData){
+ sb.Append (nDomain.ToString ());
+ nDomain++;
+ }
+
+ sb.Append ('-' + DateTime.Now.ToString ());
+ string domainId = sb.ToString ();
+ sb = null;
+
+ int slash = appId.IndexOf ('/');
+ string vPath;
+ if (slash == -1)
+ vPath = "/";
+ else
+ vPath = appId.Substring (slash + 1);
+
+ string appName = (appId.GetHashCode () + appPath.GetHashCode ()).ToString ("x");
+ AppDomainSetup domainSetup = new AppDomainSetup ();
+
+ PopulateDomainBindings (domainId,
+ appId,
+ appName,
+ appPath,
+ vPath,
+ domainSetup,
+ null);
+
+ // May be adding more assemblies and such to Evidence?
+ AppDomain domain = AppDomain.CreateDomain (domainId,
+ AppDomain.CurrentDomain.Evidence,
+ domainSetup);
+
+ string [] settings = new string [6];
+ settings [0] = "*";
+ settings [1] = appId;
+ settings [2] = appPath;
+ settings [3] = vPath;
+ settings [4] = appName;
+ settings [5] = domainId;
+ for (int i = 0; i < 6; i++)
+ domain.SetData (domainData [i], settings [i]);
+
+ object o = null;
+ try {
+ o = domain.CreateInstance (module, typeName);
+ } catch {
+ AppDomain.Unload (domain);
+ o = null;
+ }
+
+ return o;
+ }
+
+ internal static void PopulateDomainBindings (string domainId,
+ string appId,
+ string appName,
+ string appPath,
+ string appVPath,
+ AppDomainSetup setup,
+ IDictionary dict)
+ {
+ setup.PrivateBinPath = "bin";
+ setup.PrivateBinPathProbe = "*";
+ setup.ShadowCopyFiles = "true";
+
+ //HACK: we should use Uri (appBase).ToString () once Uri works fine.
+ string uri = "file://" + appPath;
+ if (Path.DirectorySeparatorChar != '/')
+ uri = uri.Replace (Path.DirectorySeparatorChar, '/');
+
+ setup.ApplicationBase = uri;
+ setup.ApplicationName = appName;
+ string temp = Path.GetTempPath ();
+ setup.DynamicBase = Path.Combine (temp, Environment.UserName + "-temp-aspnet");
+ string webConfigName = Path.Combine (appPath, "Web.config");
+ if (File.Exists (webConfigName))
+ setup.ConfigurationFile = webConfigName;
+ else
+ setup.ConfigurationFile = Path.Combine (appPath, "web.config");
+
+ if (dict != null) {
+ dict.Add (domainData [0], "*");
+ dict.Add (domainData [1], appId);
+ dict.Add (domainData [2], appPath);
+ dict.Add (domainData [3], appVPath);
+ dict.Add (domainData [4], appName);
+ dict.Add (domainData [5], domainId);
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs b/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs
new file mode 100644
index 00000000000..25dab77ee24
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs
@@ -0,0 +1,103 @@
+//
+// System.Web.Hosting.ApplicationHost
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// (class signature from Bob Smith <bob@thestuff.net> (C) )
+// Gonzalo Paniagua Javier (gonzalo@ximian.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;
+using System.Collections;
+using System.IO;
+using System.Runtime.Remoting;
+using System.Web.Util;
+
+namespace System.Web.Hosting
+{
+ public sealed class ApplicationHost
+ {
+ internal class ConfigInitHelper : MarshalByRefObject
+ {
+ internal void InitConfig ()
+ {
+ }
+ }
+
+ private ApplicationHost ()
+ {
+ }
+
+ public static object CreateApplicationHost (Type hostType,
+ string virtualDir,
+ string physicalDir)
+ {
+ if (hostType == null)
+ throw new ArgumentException ("hostType");
+
+ if (virtualDir == null || virtualDir.Length == 0)
+ throw new ArgumentException ("virtualDir");
+
+ if (physicalDir == null || physicalDir.Length == 0)
+ throw new ArgumentException ("physicalDir");
+
+ if (physicalDir [physicalDir.Length - 1] != Path.DirectorySeparatorChar)
+ physicalDir += Path.DirectorySeparatorChar;
+
+ int nowInt = DateTime.Now.ToString ().GetHashCode ();
+ string nowHash = nowInt.ToString ("x");
+ nowInt += physicalDir.GetHashCode ();
+ string sum = nowInt.ToString ("x");
+ Hashtable hTable = new Hashtable ();
+ AppDomainSetup domainSetup = new AppDomainSetup();
+
+ AppDomainFactory.PopulateDomainBindings (nowHash,
+ sum,
+ sum,
+ physicalDir,
+ virtualDir,
+ domainSetup,
+ hTable);
+
+ AppDomain domain = AppDomain.CreateDomain (nowHash, null, domainSetup);
+ foreach (string key in hTable.Keys)
+ domain.SetData (key, (string) hTable [key]);
+
+ domain.SetData (".hostingVirtualPath", virtualDir);
+ domain.SetData (".hostingInstallDir", ICalls.GetMachineInstallDirectory ());
+ InitConfigInNewAppDomain (domain);
+ ObjectHandle o = domain.CreateInstance (hostType.Assembly.FullName,
+ hostType.FullName);
+ return o.Unwrap();
+ }
+
+ private static void InitConfigInNewAppDomain (AppDomain appDomain)
+ {
+ Type t = typeof (ConfigInitHelper);
+ ObjectHandle o = appDomain.CreateInstance (t.Assembly.FullName, t.FullName);
+ ConfigInitHelper helper = (ConfigInitHelper) o.Unwrap();
+ helper.InitConfig ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Hosting/ChangeLog b/mcs/class/System.Web/System.Web.Hosting/ChangeLog
new file mode 100644
index 00000000000..0d874317392
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/ChangeLog
@@ -0,0 +1,132 @@
+2004-08-03 Atsushi Enomoto <atsushi@ximian.com>
+
+ * IApplicationHost.cs : missing namespace import.
+
+2004-08-02 Duncan Mak <duncan@ximian.com>
+
+ * IApplicationHost.cs (MapPath): Add [In] attribute.
+
+ * IAppManagerAppDomainFactory.cs:
+ * IProcessHostSupportFunction.cs: signature fixes.
+
+2004-08-02 Duncan Mak <duncan@ximian.com>
+
+ * IApplicationHost.cs:
+ * IHttpWorkerRequestHandler.cs:
+ * IProcessHost.cs:
+ * IProcessHostFactoryHelper.cs:
+ * IProcessHostSupportFunction.cs:
+ * IProcessPingCallback.cs:
+ * IQueueHost.cs:
+ * IRegisteredObject.cs: Added interfaces.
+
+2004-06-18 Gert Driesen <drieseng@users.sourceforge.net>
+
+ * IAppDomainFactory.cs: added missing marshalling attributes
+ * IISAPIRuntime.cs: added missing marshalling attributes
+
+2004-05-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AppDomainFactory.cs: set the Dynamic base for the AppDomain.
+
+2004-03-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleWorkerRequest.cs: patch from Aleksey Demakov that fixes
+ MapPath when the virtual directory is the root virtual directory.
+
+2004-01-14 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * IISAPIRuntime.cs: Fixed wrong attribute
+
+2004-01-11 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * SimpleWorkerRequest.cs: Added missing attribute
+ * IISAPIRuntime.cs: Added attributes, fixed signature
+ * IAppDomainFactory.cs: Added attributes, fixed signature
+
+2003-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ApplicationHost.cs: set hostingInstallDir.
+ * SimpleWorkerRequest.cs: implemented a couple of properties.
+
+2003-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleWorkerRequest.cs: fixed GetFilePathTranslated and added a
+ paranoid condition to ExtractPathInfo.
+
+2003-06-25 Eric Lindvall <eric@5stops.com>
+
+ * SimpleWorkerRequest.cs:
+ -adds PATH_INFO support
+ - updates GetFilePathTranslated() to make use of Path.Combine()
+ - gets rid of the null check in GetPathInfo() (we're setting
+ _PathInfo to String.Empty now)
+ - fixed CreatePath() so that it doesn't return String.Empty if
+ the _AppVirtualPath is not "/" (to match MS runtime -- does
+ anyone know why it was returning String.Empty?)
+
+2003-03-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AppDomainFactory.cs: hacks to work-around our buggy System.Uri.
+
+2003-03-17 George Kodinov <gkodinov@openlinksw.co.uk>
+
+ * AppDomainFactory.cs: place the correct full path for Web.config when
+ in Application host
+
+2003-02-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AppDomainFactory.cs: Web.config takes precedence over web.config.
+
+ * ApplicationHost.cs: removed hacks to work around an old bug.
+
+2003-02-04 Tim Haynes <thaynes@openlinksw.com>
+
+ * SimpleWorkerRequest.cs: changed the initialised values of
+ _App{Install,Virtual}Path variables
+
+2002-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.Hosting/SimpleWorkerRequest.cs: we are now able to compile
+ pages and use HttpApplication, HttpRuntime and SimpleWorkerRequest.
+
+2002-09-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ApplicationHost.cs:
+ * SimpleWorkerRequest.cs: workaround for bug #31245.
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ApplicationHost.cs: little fixes.
+
+2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ApplicationHost.cs: use Assembly instead of Module.
+
+2002-08-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AppDomainFactory.cs: implemented.
+ * ApplicationHost.cs: implemented.
+ * SimpleWorkerRequest.cs: a few little fixes and reformatted. It's now
+ fully implemented.
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AppDomainFactory.cs:
+ * IAppDomainFactory.cs:
+ * IISAPIRuntime.cs:
+ * ISAPIRuntime.cs: make them compile.
+
+2002-04-10 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * ApplicationHost.cs: Test implementation to support testing.
+ * SimpleWorkerRequest.cs: Rewrite and a almost full implementation.
+
+2001-08-30 Bob Smith <bob@thestuff.net>
+
+ * AppDomainFactory.cs: Stubbed.
+ * ApplicationHost.cs: Stubbed.
+ * IAppDomainFactory.cs: Stubbed.
+ * IISAPIRuntime.cs: Stubbed.
+ * ISAPIRuntime.cs: Implemented.
+ * SimpleWorkerRequest.cs: Implemented.
diff --git a/mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs b/mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs
new file mode 100644
index 00000000000..fa4a9621a96
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs
@@ -0,0 +1,49 @@
+//
+// System.Web.Hosting.IAppDomainFactory.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Runtime.InteropServices;
+
+namespace System.Web.Hosting
+{
+ [Guid ("e6e21054-a7dc-4378-877d-b7f4a2d7e8ba")]
+ [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IAppDomainFactory
+ {
+ [return: MarshalAs (UnmanagedType.Interface)]
+ object Create ([In, MarshalAs(UnmanagedType.BStr)] string module,
+ [In, MarshalAs(UnmanagedType.BStr)] string typeName,
+ [In, MarshalAs(UnmanagedType.BStr)] string appId,
+ [In, MarshalAs(UnmanagedType.BStr)] string appPath,
+ [In, MarshalAs(UnmanagedType.BStr)] string strUrlOfAppOrigin,
+ [In, MarshalAs(UnmanagedType.I4)] int iZone);
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Hosting/IAppManagerAppDomainFactory.cs b/mcs/class/System.Web/System.Web.Hosting/IAppManagerAppDomainFactory.cs
new file mode 100644
index 00000000000..198298ed6a3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/IAppManagerAppDomainFactory.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.Hosting.IAppManagerAppDomainFactory.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System.Runtime.InteropServices;
+
+namespace System.Web.Hosting
+{
+ public interface IAppManagerAppDomainFactory
+ {
+ object Create ([In] string s, [In] string app_id);
+ void Stop ();
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Hosting/IApplicationHost.cs b/mcs/class/System.Web/System.Web.Hosting/IApplicationHost.cs
new file mode 100644
index 00000000000..357db17d3a7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/IApplicationHost.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.Hosting.IApplicationHost.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+#if NET_2_0
+namespace System.Web.Hosting
+{
+ public interface IApplicationHost
+ {
+ IntPtr GetConfigToken ();
+ string GetPhysicalPath ();
+ string GetSiteName ();
+ string GetVirtualPath ();
+ bool IsHostProcessMultiInstance ();
+ string MapPath ([In] string s);
+ void MessageReceived ();
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Hosting/IHttpWorkerRequestHandler.cs b/mcs/class/System.Web/System.Web.Hosting/IHttpWorkerRequestHandler.cs
new file mode 100644
index 00000000000..c75ccb2a2af
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/IHttpWorkerRequestHandler.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.Hosting.IHttpWorkerRequestHandler.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using System.Web;
+
+#if NET_2_0
+namespace System.Web.Hosting
+{
+ public interface IHttpWorkerRequestHandler
+ {
+ void ProcessRequest (HttpWorkerRequest worker_request);
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Hosting/IISAPIRuntime.cs b/mcs/class/System.Web/System.Web.Hosting/IISAPIRuntime.cs
new file mode 100644
index 00000000000..fc69298fe08
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/IISAPIRuntime.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.Hosting.IISAPIRuntime.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Runtime.InteropServices;
+
+namespace System.Web.Hosting
+{
+ [Guid ("c4918956-485b-3503-bd10-9083e3f6b66c")]
+ [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IISAPIRuntime
+ {
+ void DoGCCollect ();
+ [return: MarshalAs (UnmanagedType.I4)]
+ int ProcessRequest ([In] IntPtr ecb, [In, MarshalAs(UnmanagedType.I4)] int useProcessModel);
+ void StartProcessing ();
+ void StopProcessing ();
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Hosting/IProcessHost.cs b/mcs/class/System.Web/System.Web.Hosting/IProcessHost.cs
new file mode 100644
index 00000000000..3803b2af725
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/IProcessHost.cs
@@ -0,0 +1,74 @@
+//
+// System.Web.Hosting.IProcessHost.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System.Runtime.InteropServices;
+
+#if NET_2_0
+namespace System.Web.Hosting
+{
+ public interface IProcessHost
+ {
+ bool IsIdle ();
+
+ void Ping (IProcessPingCallback callback);
+
+ void ShutdownAll ();
+
+ void ShutdownApplication ([In] string app_id);
+
+ void StartAppDomainProtocolQueue (
+ [In] string app_id,
+ [In] string protocol_id,
+ IQueueHost queue_host);
+
+ void StartProcessProtocolQueue (
+ [In] string protocol_id,
+ IQueueHost queue_host);
+
+ void StopAppDomainProtocol (
+ [In] string app_id,
+ [In] string protocol_id,
+ bool immediate);
+
+ void StopAppDomainProtocolQueue (
+ [In] string app_id,
+ [In] string protocol_id,
+ int queue_id,
+ bool immediate);
+
+ void StopProcessProtocol (
+ [In] string protocol_id,
+ bool immediate);
+
+ void StopProcessProtocolQueue (
+ [In] string protocol_id,
+ int queue_id,
+ bool immediate);
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Hosting/IProcessHostFactoryHelper.cs b/mcs/class/System.Web/System.Web.Hosting/IProcessHostFactoryHelper.cs
new file mode 100644
index 00000000000..0c9b3012cea
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/IProcessHostFactoryHelper.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.Hosting.IProcessHostFactoryHelper.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System.Runtime.InteropServices;
+
+#if NET_2_0
+namespace System.Web.Hosting
+{
+ public interface IProcessHostFactoryHelper
+ {
+ object GetProcessHost (IProcessHostSupportFunctions host);
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Hosting/IProcessHostSupportFunction.cs b/mcs/class/System.Web/System.Web.Hosting/IProcessHostSupportFunction.cs
new file mode 100644
index 00000000000..77cc307dd88
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/IProcessHostSupportFunction.cs
@@ -0,0 +1,57 @@
+//
+// System.Web.Hosting.IProcessHostSupportFunctions.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+#if NET_2_0
+namespace System.Web.Hosting
+{
+ public interface IProcessHostSupportFunctions
+ {
+ void GetApplicationProperties (
+ [In] string app_id,
+ out string virtual_path,
+ out string physical_path,
+ out string site_name);
+
+ IntPtr GetConfigToken ([In] string s);
+
+ string GetProcessID ();
+
+ bool IsHostProcessMultiInstance ();
+
+ void MapPath (
+ [In] string app_id,
+ [In] string virtual_path,
+ out string physical_path);
+
+ void MessageReceived ();
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Hosting/IProcessPingCallback.cs b/mcs/class/System.Web/System.Web.Hosting/IProcessPingCallback.cs
new file mode 100644
index 00000000000..63acbf6b2a7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/IProcessPingCallback.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.Hosting.IProcessPingCallback.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+#if NET_2_0
+namespace System.Web.Hosting
+{
+ public interface IProcessPingCallback
+ {
+ void Respond ();
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Hosting/IQueueHost.cs b/mcs/class/System.Web/System.Web.Hosting/IQueueHost.cs
new file mode 100644
index 00000000000..c5e60ec087b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/IQueueHost.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.Hosting.IQueueHost.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+#if NET_2_0
+namespace System.Web.Hosting
+{
+ public interface IQueueHost
+ {
+ void GetQueueData (
+ [In, Out] byte [] buffer,
+ ref int buffer_size);
+
+ int GetQueueDataLength ();
+
+ int GetQueueId ();
+
+ void QueueStarted ();
+
+ void QueueStopped (int hr);
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Hosting/IRegisteredObject.cs b/mcs/class/System.Web/System.Web.Hosting/IRegisteredObject.cs
new file mode 100644
index 00000000000..14daca7541f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/IRegisteredObject.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.Hosting.IRegisteredObject.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+#if NET_2_0
+namespace System.Web.Hosting
+{
+ public interface IRegisteredObject
+ {
+ void Stop (bool immediate);
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Hosting/ISAPIRuntime.cs b/mcs/class/System.Web/System.Web.Hosting/ISAPIRuntime.cs
new file mode 100644
index 00000000000..44dc266eed8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/ISAPIRuntime.cs
@@ -0,0 +1,69 @@
+//
+// System.Web.Hosting.ISAPIRuntime.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) Bob Smith
+// (c) 2002 Ximian, Inc. (http://www.ximian.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;
+
+namespace System.Web.Hosting
+{
+ public sealed class ISAPIRuntime : IISAPIRuntime
+ {
+ [MonoTODO]
+ public ISAPIRuntime ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void DoGCCollect ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int ProcessRequest (IntPtr ecb, int iWRType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void StartProcessing ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void StopProcessing ()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs b/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs
new file mode 100644
index 00000000000..942a5f50a21
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs
@@ -0,0 +1,328 @@
+//
+// System.Web.Hosting.SimpleWorkerRequest.cs
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// (class signature from Bob Smith <bob@thestuff.net> (C) )
+// Gonzalo Paniagua Javier (gonzalo@ximian.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;
+using System.IO;
+using System.Text;
+using System.Runtime.InteropServices;
+using System.Web.Util;
+
+namespace System.Web.Hosting
+{
+ [MonoTODO("Implement security demands on the path usage functions (and review)")]
+ [ComVisible (false)]
+ public class SimpleWorkerRequest : HttpWorkerRequest
+ {
+ private string _Page;
+ private string _Query;
+ private string _PathInfo = String.Empty;
+ private string _AppVirtualPath;
+ private string _AppPhysicalPath;
+ private string _AppInstallPath;
+ private TextWriter _Output;
+ private bool _HasInstallInfo;
+
+ private SimpleWorkerRequest ()
+ {
+ }
+
+ public SimpleWorkerRequest (string Page, string Query, TextWriter Output)
+ {
+ _Page = Page;
+
+ _Query = Query;
+ AppDomain current = AppDomain.CurrentDomain;
+ object o = current.GetData (".appPath");
+ if (o == null)
+ throw new HttpException ("Cannot get .appPath");
+ _AppPhysicalPath = o.ToString ();
+
+ o = current.GetData (".hostingVirtualPath");
+ if (o == null)
+ throw new HttpException ("Cannot get .hostingVirtualPath");
+ _AppVirtualPath = o.ToString ();
+
+ o = current.GetData (".hostingInstallDir");
+ if (o == null)
+ throw new HttpException ("Cannot get .hostingInstallDir");
+ _AppInstallPath = o.ToString ();
+ _Output = Output;
+
+ if (_AppPhysicalPath == null)
+ throw new HttpException ("Invalid app domain");
+
+ _HasInstallInfo = true;
+
+ ExtractPagePathInfo();
+ }
+
+ public SimpleWorkerRequest (string AppVirtualPath,
+ string AppPhysicalPath,
+ string Page,
+ string Query,
+ TextWriter Output)
+ {
+ if (AppDomain.CurrentDomain.GetData (".appPath") == null)
+ throw new HttpException ("Invalid app domain");
+
+ _Page = Page;
+ _Query = Query;
+ _AppVirtualPath = AppVirtualPath;
+ _AppPhysicalPath = CheckAndAddSlash (AppPhysicalPath);
+ _Output = Output;
+ _HasInstallInfo = false;
+
+ ExtractPagePathInfo();
+ }
+
+ [MonoTODO("Implement security")]
+ public override string MachineInstallDirectory
+ {
+ get {
+ if (_HasInstallInfo)
+ return _AppInstallPath;
+
+ return ICalls.GetMachineInstallDirectory ();
+ }
+ }
+
+ public override string MachineConfigPath
+ {
+ get { return ICalls.GetMachineConfigPath (); }
+ }
+
+ public override void EndOfRequest ()
+ {
+ }
+
+ public override void FlushResponse (bool finalFlush)
+ {
+ }
+
+ public override string GetAppPath ()
+ {
+ return _AppVirtualPath;
+ }
+
+ public override string GetAppPathTranslated ()
+ {
+ return _AppPhysicalPath;
+ }
+
+ public override string GetFilePath ()
+ {
+ return CreatePath (false);
+ }
+
+ public override string GetFilePathTranslated ()
+ {
+ string page = _Page;
+
+ if (Path.DirectorySeparatorChar != '/')
+ page = _Page.Replace ('/', Path.DirectorySeparatorChar);
+
+ if (page [0] == Path.DirectorySeparatorChar)
+ page = page.Substring (1);
+
+ return (Path.Combine (_AppPhysicalPath, page));
+ }
+
+ public override string GetHttpVerbName ()
+ {
+ return "GET";
+ }
+
+ public override string GetHttpVersion ()
+ {
+ return "HTTP/1.0";
+ }
+
+ public override string GetLocalAddress ()
+ {
+ return "127.0.0.1";
+ }
+
+ public override int GetLocalPort ()
+ {
+ return 80;
+ }
+
+ public override string GetPathInfo ()
+ {
+ return _PathInfo;
+ }
+
+ public override string GetQueryString ()
+ {
+ return _Query;
+ }
+
+ public override string GetRawUrl ()
+ {
+ string path = CreatePath (true);
+ if (null != _Query && _Query.Length > 0)
+ return path + "?" + _Query;
+
+ return path;
+ }
+
+ public override string GetRemoteAddress()
+ {
+ return "127.0.0.1";
+ }
+
+ public override int GetRemotePort()
+ {
+ return 0;
+ }
+
+ public override string GetServerVariable(string name)
+ {
+ return String.Empty;
+ }
+
+ public override string GetUriPath()
+ {
+ return CreatePath (true);
+ }
+
+ public override IntPtr GetUserToken()
+ {
+ return IntPtr.Zero;
+ }
+
+ public override string MapPath (string path)
+ {
+ string sPath = _AppPhysicalPath.Substring (0, _AppPhysicalPath.Length - 1);
+ if (path != null && path.Length > 0 && path [0] != '/')
+ return sPath;
+
+ char sep = Path.DirectorySeparatorChar;
+ if (path.StartsWith(_AppVirtualPath)) {
+ if (sep == '/')
+ return sPath + path.Substring (_AppVirtualPath.Length);
+ else
+ return sPath + path.Substring (_AppVirtualPath.Length).Replace ('/', sep);
+ }
+
+ return null;
+ }
+
+ public override void SendKnownResponseHeader (int index, string value)
+ {
+ }
+
+ public override void SendResponseFromFile (IntPtr handle, long offset, long length)
+ {
+ }
+
+ public override void SendResponseFromFile (string filename, long offset, long length)
+ {
+ }
+
+ public override void SendResponseFromMemory (byte [] data, int length)
+ {
+ _Output.Write (Encoding.Default.GetChars (data, 0, length));
+ }
+
+ public override void SendStatus(int statusCode, string statusDescription)
+ {
+ }
+
+ public override void SendUnknownResponseHeader(string name, string value)
+ {
+ }
+
+ // Create's a path string
+ private string CheckAndAddSlash(string sPath)
+ {
+ if (null == sPath)
+ return null;
+
+ if (!sPath.EndsWith ("" + Path.DirectorySeparatorChar))
+ return sPath + Path.DirectorySeparatorChar;
+
+ return sPath;
+ }
+
+ // Create's a path string
+ private string CreatePath (bool bIncludePathInfo)
+ {
+ string sPath = Path.Combine (_AppVirtualPath, _Page);
+
+ if (bIncludePathInfo)
+ {
+ sPath += _PathInfo;
+ }
+
+ return sPath;
+ }
+
+ // "The extra path information, as given by the client. In
+ // other words, scripts can be accessed by their virtual
+ // pathname, followed by extra information at the end of this
+ // path. The extra information is sent as PATH_INFO."
+ private void ExtractPagePathInfo ()
+ {
+ if (_Page == null || _Page == String.Empty)
+ return;
+
+ string FullPath = GetFilePathTranslated ();
+ int PathInfoLength = 0;
+ string LastFile = String.Empty;
+
+ while (PathInfoLength < _Page.Length) {
+ if (LastFile.Length > 0) {
+ // increase it by the length of the file plus
+ // a "/"
+ //
+ PathInfoLength += LastFile.Length + 1;
+ }
+
+ if (File.Exists (FullPath) == true)
+ break;
+
+ if (Directory.Exists (FullPath) == true) {
+ PathInfoLength -= (LastFile.Length + 1);
+ break;
+ }
+
+ LastFile = Path.GetFileName (FullPath);
+ FullPath = Path.GetDirectoryName (FullPath);
+ }
+
+ if (PathInfoLength <= 0 || PathInfoLength > _Page.Length)
+ return;
+
+ _PathInfo = _Page.Substring (_Page.Length - PathInfoLength);
+ _Page = _Page.Substring (0, _Page.Length - PathInfoLength);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Mail/Base64AttachmentEncoder.cs b/mcs/class/System.Web/System.Web.Mail/Base64AttachmentEncoder.cs
new file mode 100644
index 00000000000..83a2288dea0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/Base64AttachmentEncoder.cs
@@ -0,0 +1,105 @@
+//
+// System.Web.Mail.Base64AttachmentEncoder.cs
+//
+// Author(s):
+// Per Arneng <pt99par@student.bth.se>
+//
+//
+
+//
+// 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;
+using System.IO;
+using System.Text;
+using System.Security.Cryptography;
+
+namespace System.Web.Mail {
+
+ // a class that handles Base64 encoding for attachments
+ internal class Base64AttachmentEncoder : IAttachmentEncoder {
+
+ // reads bytes from a stream and writes the encoded
+ // as base64 encoded characters. ( 60 chars on each row)
+ public void EncodeStream( Stream ins , Stream outs ) {
+
+ if( ( ins == null ) || ( outs == null ) )
+ throw new ArgumentNullException( "The input and output streams may not " +
+ "be null.");
+
+ ICryptoTransform base64 = new ToBase64Transform();
+
+ // the buffers
+ byte[] plainText = new byte[ base64.InputBlockSize ];
+ byte[] cipherText = new byte[ base64.OutputBlockSize ];
+
+ int readLength = 0;
+ int count = 0;
+ byte[] newln = new byte[] { 13 , 10 }; //CR LF with mail
+
+ // read through the stream until there
+ // are no more bytes left
+ while( true ) {
+
+ // read some bytes
+ readLength = ins.Read( plainText , 0 , plainText.Length );
+
+ // break when there is no more data
+ if( readLength < 1 ) break;
+
+ // transfrom and write the blocks. If the block size
+ // is less than the InputBlockSize then write the final block
+ if( readLength == plainText.Length ) {
+
+ base64.TransformBlock( plainText , 0 ,
+ plainText.Length ,
+ cipherText , 0 );
+
+ // write the data
+ outs.Write( cipherText , 0 , cipherText.Length );
+
+
+ // do this to output lines that
+ // are 60 chars long
+ count += cipherText.Length;
+ if( count == 60 ) {
+ outs.Write( newln , 0 , newln.Length );
+ count = 0;
+ }
+
+ } else {
+
+ // convert the final blocks of bytes and write them
+ cipherText = base64.TransformFinalBlock( plainText , 0 , readLength );
+ outs.Write( cipherText , 0 , cipherText.Length );
+
+ }
+
+ }
+
+ outs.Write( newln , 0 , newln.Length );
+ }
+
+
+ }
+
+
+
+}
diff --git a/mcs/class/System.Web/System.Web.Mail/ChangeLog b/mcs/class/System.Web/System.Web.Mail/ChangeLog
new file mode 100644
index 00000000000..a70ee15ed3d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/ChangeLog
@@ -0,0 +1,101 @@
+2005-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SmtpClient.cs:
+ * SmtpStream.cs: removed warnings.
+
+2005-01-28 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Base64AttachmentEncoder.cs: Fixed warning.
+
+2004-10-27 Sanjay Gupta <gsanjay@novell.com>
+
+ * SmtpClient.cs: Fix for bug 68829.
+
+2004-08-27 Sanjay Gupta <gsanjay@novell.com>
+
+ * MailMessageWrapper.cs: Added a comment to add Date header.
+ * SmtpClient.cs: Updated functionality to add RelatedBodyPart to
+ MIME message.
+
+2004-08-26 Sanjay Gupta <gsanjay@novell.com>
+
+ * SmtpClient.cs: Added functionality to add RelatedBodyPart to
+ MIME message.
+
+2004-08-25 Sanjay Gupta <gsanjay@novell.com>
+
+ * MailMessageWrapper.cs: Added NET_2_0 property and another missing
+ property from NET_1_1.
+ * RelatedBodyPart.cs: Error detection and handling.
+ * SmtpClient.cs: Upgraded for NET_1_1 and WIP for NET_2_0.
+
+2004-08-18 Sanjay Gupta <gsanjay@novell.com>
+
+ * MailEncoding.cs:
+ * MailFormat.cs:
+ * MailPriority.cs: Added NET_2_0 attribute.
+
+2004-08-18 Sanjay Gupta <gsanjay@novell.com>
+
+ * MailMessage.cs: Added new property RelatedBodyParts.
+ * RelatedBodyPart.cs: Added new file.
+
+2004-08-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SmtpClient.cs: multipart mails default body format is now the same as
+ the one used for single part mails instead of being forced to
+ "text/plain".
+
+2004-02-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MailMessage.cs: patch by John Luke that initialized the fields in
+ the message and makes Fields return the same as in MS.NET. Fixes bug
+ #54908.
+
+2003-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MailMessage.cs: added Fields property.
+
+2003-11-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MailMessageWrapper.cs: fixed typo that made all messages be sent as
+ html, even when the body is marked as text. Path by Mohammad DAMT.
+ Closes bug #51177.
+
+2003-07-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MailAddress.cs: return null instead of exception when the address is
+ empty.
+
+ * MailAddressCollection.cs: ignore null addresses.
+ * SmtpMail.cs: add the exception we get as inner exception so we know
+ where the error is.
+
+ Fixes bug #45746.
+
+2003-03-24 Per Arneng <pt99par@student.bth.se>
+ * MailUtil: Added for some functions that didnt fit in other classes
+
+2003-03-06 Per Arneng <pt99par@student.bth.se>
+ * MailMessageWrapper: Added to get at more advanced mail message
+
+2003-02-23 Per Arneng <pt99par@student.bth.se>
+
+ * SmtpMail.cs: Send method now implemented (needs testing)
+ * SmtpClient.cs: Added to make Send work (internal class)
+ * SmtpException.cs: Added to make Send work (internal class)
+ * SmtpStream.cs: Added to make Send work (internal class)
+ * SmtpResponse.cs: Added to make Send work (internal class)
+
+2002-11-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SmtpMail.cs: i don't wanna see that warning :-).
+
+2002-04-26 Lawrence Pit <loz@cable.a2000.nl>
+
+ * MailAttachment.cs: Implemented
+ * MailEncoding.cs: Implemented
+ * MailFormat.cs: Implemented
+ * MailMessage.cs: Implemented
+ * MailPriority.cs: Implemented
+ * SmtpMail.cs: Stubbed
diff --git a/mcs/class/System.Web/System.Web.Mail/IAttachmentEncoder.cs b/mcs/class/System.Web/System.Web.Mail/IAttachmentEncoder.cs
new file mode 100644
index 00000000000..11e680712a0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/IAttachmentEncoder.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.Mail.IAttachmentEncoder.cs
+//
+// Author(s):
+// Per Arneng <pt99par@student.bth.se>
+//
+//
+
+//
+// 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;
+using System.IO;
+
+namespace System.Web.Mail {
+
+ // An interface for attachment encoders ex Base64, UUEncode
+ interface IAttachmentEncoder {
+ void EncodeStream( Stream ins , Stream outs );
+ }
+
+}
diff --git a/mcs/class/System.Web/System.Web.Mail/MailAddress.cs b/mcs/class/System.Web/System.Web.Mail/MailAddress.cs
new file mode 100644
index 00000000000..7d872a77f95
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/MailAddress.cs
@@ -0,0 +1,135 @@
+//
+// System.Web.Mail.MailAddress.cs
+//
+// Author(s):
+// Per Arneng <pt99par@student.bth.se>
+//
+//
+
+//
+// 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;
+using System.Text;
+
+namespace System.Web.Mail {
+
+ // Reperesents a mail address
+ internal class MailAddress {
+
+ protected string user;
+ protected string host;
+ protected string name;
+
+ public string User {
+ get { return user; }
+ set { user = value; }
+ }
+
+ public string Host {
+ get { return host; }
+ set { host = value; }
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public string Address {
+ get { return String.Format( "{0}@{1}" , user , host ); }
+ set {
+
+ string[] parts = value.Split( new char[] { '@' } );
+
+ if( parts.Length != 2 )
+ throw new FormatException( "Invalid e-mail address: '" + value + "'.");
+
+ user = parts[ 0 ];
+ host = parts[ 1 ];
+ }
+ }
+
+ public static MailAddress Parse( string str ) {
+ if (str == null || str.Trim () == "")
+ return null;
+
+ MailAddress addr = new MailAddress();
+ string address = null;
+ string nameString = null;
+ string[] parts = str.Split( new char[] { ' ' } );
+
+ // find the address: xxx@xx.xxx
+ // and put to gether all the parts
+ // before the address as nameString
+ foreach( string part in parts ) {
+
+ if( part.IndexOf( '@' ) > 0 ) {
+ address = part;
+ break;
+ }
+
+ nameString = nameString + part + " ";
+ }
+
+ if( address == null )
+ throw new FormatException( "Invalid e-mail address: '" + str + "'.");
+
+ address = address.Trim( new char[] { '<' , '>' , '(' , ')' } );
+
+ addr.Address = address;
+
+ if( nameString != null ) {
+ addr.Name = nameString.Trim( new char[] { ' ' , '"' } );
+ addr.Name = ( addr.Name.Length == 0 ? null : addr.Name );
+ }
+
+
+ return addr;
+ }
+
+
+ public override string ToString() {
+
+ string retString = "";
+
+ if( name == null ) {
+
+ retString = String.Format( "<{0}>" , this.Address );
+
+ } else {
+
+ string personName = this.Name;
+
+ if( MailUtil.NeedEncoding( personName ) ) {
+ personName = String.Format( "=?{0}?B?{1}?=",
+ Encoding.Default.BodyName ,
+ MailUtil.Base64Encode( personName ) ) ;
+ }
+
+ retString = String.Format( "\"{0}\" <{1}>" , personName , this.Address);
+
+ }
+
+ return retString;
+ }
+ }
+
+}
diff --git a/mcs/class/System.Web/System.Web.Mail/MailAddressCollection.cs b/mcs/class/System.Web/System.Web.Mail/MailAddressCollection.cs
new file mode 100644
index 00000000000..ceac38f4adb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/MailAddressCollection.cs
@@ -0,0 +1,89 @@
+//
+// System.Web.Mail.MailAddressCollection.cs
+//
+// Author(s):
+// Per Arneng <pt99par@student.bth.se>
+//
+//
+
+//
+// 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;
+using System.Text;
+using System.Collections;
+
+namespace System.Web.Mail {
+
+ // represents a collection of MailAddress objects
+ internal class MailAddressCollection : IEnumerable {
+
+ protected ArrayList data = new ArrayList();
+
+ public MailAddress this[ int index ] {
+ get { return this.Get( index ); }
+ }
+
+ public int Count { get { return data.Count; } }
+
+ public void Add( MailAddress addr ) { data.Add( addr ); }
+ public MailAddress Get( int index ) { return (MailAddress)data[ index ]; }
+
+ public IEnumerator GetEnumerator() {
+ return data.GetEnumerator();
+ }
+
+
+ public override string ToString() {
+
+ StringBuilder builder = new StringBuilder();
+ for( int i = 0; i <data.Count ; i++ ) {
+ MailAddress addr = this.Get( i );
+
+ builder.Append( addr );
+
+ if( i != ( data.Count - 1 ) ) builder.Append( ",\r\n " );
+ }
+
+ return builder.ToString();
+ }
+
+ public static MailAddressCollection Parse( string str ) {
+
+ if( str == null ) throw new ArgumentNullException("Null is not allowed as an address string");
+
+ MailAddressCollection list = new MailAddressCollection();
+
+ string[] parts = str.Split( new char[] { ',' , ';' } );
+
+ foreach( string part in parts ) {
+ MailAddress add = MailAddress.Parse (part);
+ if (add == null)
+ continue;
+
+ list.Add (add);
+ }
+
+ return list;
+ }
+
+ }
+
+}
diff --git a/mcs/class/System.Web/System.Web.Mail/MailAttachment.cs b/mcs/class/System.Web/System.Web.Mail/MailAttachment.cs
new file mode 100644
index 00000000000..6232f124011
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/MailAttachment.cs
@@ -0,0 +1,67 @@
+//
+// System.Web.Mail.MailAttachment.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+// Per Arneng (pt99par@student.bth.se)
+//
+
+//
+// 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.
+//
+
+namespace System.Web.Mail
+{
+ public class MailAttachment
+ {
+ private string filename;
+ private MailEncoding encoding;
+
+ public MailAttachment (string filename) :
+ this (filename, MailEncoding.Base64)
+ {
+ }
+
+ public MailAttachment (string filename, MailEncoding encoding)
+ {
+ this.filename = filename;
+ this.encoding = encoding;
+ try {
+ System.IO.File.OpenRead (filename).Close ();
+ } catch (Exception) {
+ throw new System.Web.HttpException ("Cannot find file: '" +
+ filename + "'." );
+ }
+ }
+
+ // Properties
+ public string Filename
+ {
+ get { return filename; }
+ }
+
+ public MailEncoding Encoding
+ {
+ get { return encoding; }
+ }
+
+ }
+
+} //namespace System.Web.Mail
diff --git a/mcs/class/System.Web/System.Web.Mail/MailEncoding.cs b/mcs/class/System.Web/System.Web.Mail/MailEncoding.cs
new file mode 100644
index 00000000000..161a31823a9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/MailEncoding.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.Mail.MailEncoding.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+//
+// 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.
+//
+
+namespace System.Web.Mail
+{
+
+ /// <summary>
+ /// </summary>
+#if NET_2_0
+ [Serializable]
+#endif
+ public enum MailEncoding
+ {
+
+ /// <summary>
+ /// </summary>
+ UUEncode = 0,
+
+ /// <summary>
+ /// </summary>
+ Base64 = 1
+
+ }
+
+} //namespace System.Web.Mail
diff --git a/mcs/class/System.Web/System.Web.Mail/MailFormat.cs b/mcs/class/System.Web/System.Web.Mail/MailFormat.cs
new file mode 100644
index 00000000000..35a13d363bd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/MailFormat.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.Mail.MailFormat.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+//
+// 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.
+//
+
+namespace System.Web.Mail
+{
+
+ /// <summary>
+ /// </summary>
+#if NET_2_0
+ [Serializable]
+#endif
+ public enum MailFormat
+ {
+
+ /// <summary>
+ /// </summary>
+ Text = 0,
+
+ /// <summary>
+ /// </summary>
+ Html = 1
+
+ }
+
+} //namespace System.Web.Mail
diff --git a/mcs/class/System.Web/System.Web.Mail/MailHeader.cs b/mcs/class/System.Web/System.Web.Mail/MailHeader.cs
new file mode 100644
index 00000000000..975f83d64d0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/MailHeader.cs
@@ -0,0 +1,113 @@
+//
+// System.Web.Mail.MailHeader.cs
+//
+// Author(s):
+// Per Arneng <pt99par@student.bth.se>
+//
+//
+
+//
+// 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;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.Mail {
+
+ // This class represents the header of a mail with
+ // all the header fields.
+ internal class MailHeader {
+
+ protected NameValueCollection data = new NameValueCollection();
+
+ public string To {
+ get { return data[ "To" ]; }
+ set { data[ "To" ] = value; }
+ }
+
+ public string From {
+ get { return data[ "From" ]; }
+ set { data[ "From" ] = value; }
+ }
+
+ public string Cc {
+ get { return data[ "Cc" ]; }
+ set { data[ "Cc" ] = value; }
+ }
+
+ public string Bcc {
+ get { return data[ "Bcc" ]; }
+ set { data[ "Bcc" ] = value; }
+ }
+
+ public string Subject {
+ get { return data[ "Subject" ]; }
+ set { data[ "Subject" ] = value; }
+ }
+
+ public string Importance {
+ get { return data[ "Importance" ]; }
+ set { data[ "Importance" ] = value; }
+ }
+
+ public string Priority {
+ get { return data[ "Priority" ]; }
+ set { data[ "Priority" ] = value; }
+ }
+
+ public string MimeVersion {
+ get { return data[ "Mime-Version" ]; }
+ set { data[ "Mime-Version" ] = value; }
+ }
+
+ public string ContentType {
+ get { return data[ "Content-Type" ]; }
+ set { data[ "Content-Type" ] = value; }
+ }
+
+ public string ContentTransferEncoding{
+ get { return data[ "Content-Transfer-Encoding" ]; }
+ set { data[ "Content-Transfer-Encoding" ] = value; }
+ }
+
+ public string ContentDisposition {
+ get { return data[ "Content-Disposition" ]; }
+ set { data[ "Content-Disposition" ] = value; }
+ }
+
+ public string ContentBase {
+ get { return data[ "Content-Base" ]; }
+ set { data[ "Content-Base" ] = value; }
+ }
+
+ public string ContentLocation {
+ get { return data[ "Content-Location" ]; }
+ set { data[ "Content-Location" ] = value; }
+ }
+
+
+ public NameValueCollection Data {
+ get { return data; }
+ }
+
+ }
+
+}
diff --git a/mcs/class/System.Web/System.Web.Mail/MailMessage.cs b/mcs/class/System.Web/System.Web.Mail/MailMessage.cs
new file mode 100644
index 00000000000..cd0eb98f335
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/MailMessage.cs
@@ -0,0 +1,156 @@
+//
+// System.Web.Mail.MailMessage.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+// Per Arneng (pt99par@student.bth.se)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (c)2004 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
+// "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;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.Mail
+{
+ /// <remarks>
+ /// </remarks>
+ public class MailMessage
+ {
+ private ArrayList attachments;
+ private string bcc;
+ private string body = "";
+ private Encoding bodyEncoding;
+ private MailFormat bodyFormat;
+ private string cc;
+ private string from;
+ private ListDictionary headers;
+ private MailPriority priority;
+ private string subject = "";
+ private string to;
+ private string urlContentBase;
+ private string urlContentLocation;
+
+ // Constructor
+ public MailMessage ()
+ {
+ attachments = new ArrayList (8);
+ headers = new ListDictionary ();
+ bodyEncoding = Encoding.Default;
+#if NET_1_1
+ fields = new Hashtable ();
+#endif
+#if NET_2_0
+ bodyParts = new ArrayList (2);
+#endif
+ }
+
+ // Properties
+ public IList Attachments {
+ get { return (IList) attachments; }
+ }
+
+ public string Bcc {
+ get { return bcc; }
+ set { bcc = value; }
+ }
+
+ public string Body {
+ get { return body; }
+ set { body = value; }
+ }
+
+ public Encoding BodyEncoding {
+ get { return bodyEncoding; }
+ set { bodyEncoding = value; }
+ }
+
+ public MailFormat BodyFormat {
+ get { return bodyFormat; }
+ set { bodyFormat = value; }
+ }
+
+ public string Cc {
+ get { return cc; }
+ set { cc = value; }
+ }
+
+ public string From {
+ get { return from; }
+ set { from = value; }
+ }
+
+ public IDictionary Headers {
+ get { return (IDictionary) headers; }
+ }
+
+ public MailPriority Priority {
+ get { return priority; }
+ set { priority = value; }
+ }
+
+ public string Subject {
+ get { return subject; }
+ set { subject = value; }
+ }
+
+ public string To {
+ get { return to; }
+ set { to = value; }
+ }
+
+ public string UrlContentBase {
+ get { return urlContentBase; }
+ set { urlContentBase = value; }
+ }
+
+ public string UrlContentLocation {
+ get { return urlContentLocation; }
+ set { urlContentLocation = value; }
+ }
+
+#if NET_1_1
+ private Hashtable fields;
+
+ public IDictionary Fields {
+ get {
+ return (IDictionary) fields;
+ }
+ }
+#endif
+
+#if NET_2_0
+ private ArrayList bodyParts;
+
+ public IList RelatedBodyParts {
+ get { return (IList) bodyParts; }
+ }
+#endif
+
+ }
+
+} //namespace System.Web.Mail
diff --git a/mcs/class/System.Web/System.Web.Mail/MailMessageWrapper.cs b/mcs/class/System.Web/System.Web.Mail/MailMessageWrapper.cs
new file mode 100644
index 00000000000..f50ec10c7bd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/MailMessageWrapper.cs
@@ -0,0 +1,257 @@
+//
+// System.Web.Mail.MailMessageWrapper.cs
+//
+// Author(s):
+// Per Arneng <pt99par@student.bth.se>
+// Sanjay Gupta <gsanjay@novell.com>
+//
+// (C) 2004, 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
+// "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;
+using System.Collections;
+using System.Text;
+
+namespace System.Web.Mail {
+
+ // wraps a MailMessage to make an easier
+ // interface to work with collections of
+ // addresses instead of a single string
+ internal class MailMessageWrapper {
+
+ private MailAddressCollection bcc = new MailAddressCollection();
+ private MailAddressCollection cc = new MailAddressCollection();
+ private MailAddress from;
+ private MailAddressCollection to = new MailAddressCollection();
+ private MailHeader header = new MailHeader();
+ private MailMessage message;
+ private string body;
+
+ // Constructor
+ public MailMessageWrapper( MailMessage message )
+ {
+ this.message = message;
+
+ if( message.From != null ) {
+ from = MailAddress.Parse( message.From );
+ header.From = from.ToString();
+ }
+
+ if( message.To != null ) {
+ to = MailAddressCollection.Parse( message.To );
+ header.To = to.ToString();
+ }
+
+ if( message.Cc != null ) {
+ cc = MailAddressCollection.Parse( message.Cc );
+ header.Cc = cc.ToString();
+ }
+
+ if( message.Bcc != null ) {
+ bcc = MailAddressCollection.Parse( message.Bcc );
+ header.Bcc = bcc.ToString();
+ }
+
+ // set the subject
+ if( message.Subject != null ) {
+
+ // encode the subject if it needs encoding
+ if( MailUtil.NeedEncoding( message.Subject ) ) {
+
+ byte[] subjectBytes = message.BodyEncoding.GetBytes( message.Subject );
+ // encode the subject with Base64
+ header.Subject = String.Format( "=?{0}?B?{1}?=" ,
+ message.BodyEncoding.BodyName ,
+ Convert.ToBase64String( subjectBytes ) );
+ } else {
+
+ header.Subject = message.Subject;
+
+ }
+ }
+
+ // convert single '.' on a line with ".." to not
+ // confuse the smtp server since the DATA command
+ // is terminated with a '.' on a single line.
+ // this is also according to the smtp specs.
+ if( message.Body != null ) {
+ body = message.Body.Replace( "\n.\n" , "\n..\n" );
+ body = body.Replace( "\r\n.\r\n" , "\r\n..\r\n" );
+ }
+
+
+ // set the Contet-Base header
+ if( message.UrlContentBase != null )
+ header.ContentBase = message.UrlContentBase;
+
+ // set the Contet-Location header
+ if( message.UrlContentLocation != null )
+ header.ContentLocation = message.UrlContentLocation;
+
+
+ // set the content type
+ switch( message.BodyFormat ) {
+
+ case MailFormat.Html:
+ header.ContentType =
+ String.Format( "text/html; charset=\"{0}\"" , message.BodyEncoding.BodyName );
+ break;
+
+ case MailFormat.Text:
+ header.ContentType =
+ String.Format( "text/plain; charset=\"{0}\"" , message.BodyEncoding.BodyName );
+ break;
+
+ default:
+ header.ContentType =
+ String.Format( "text/html; charset=\"{0}\"" , message.BodyEncoding.BodyName );
+ break;
+ }
+
+
+ // set the priority as in the same way as .NET sdk does
+ switch( message.Priority ) {
+
+ case MailPriority.High:
+ header.Importance = "high";
+ break;
+
+ case MailPriority.Low:
+ header.Importance = "low";
+ break;
+
+ case MailPriority.Normal:
+ header.Importance = "normal";
+ break;
+
+ default:
+ header.Importance = "normal";
+ break;
+
+ }
+
+ // .NET sdk allways sets this to normal
+ header.Priority = "normal";
+
+
+ // Set the mime version
+ header.MimeVersion = "1.0";
+
+ // Set the transfer encoding
+ if( message.BodyEncoding is ASCIIEncoding ) {
+ header.ContentTransferEncoding = "7bit";
+ } else {
+ header.ContentTransferEncoding = "8bit";
+ }
+
+ // Add Date header, we were missing earlier 27/08/04
+ // RFC822 requires date to be in format Fri, 27 Aug 2004 20:13:20 +0530
+ //DateTime.Now gives in format 8/27/2004 8:13:00 PM
+ // Need to explore further dateTime formats available or do we need
+ // to write a function to convert.
+ //header.Data.Add ("Date", DateTime.Now.ToString());
+
+ // Add the custom headers
+ foreach( string key in message.Headers.Keys )
+ header.Data[ key ] = (string)this.message.Headers[ key ];
+ }
+
+ // Properties
+ public IList Attachments {
+ get { return message.Attachments; }
+ }
+
+ public MailAddressCollection Bcc {
+ get { return bcc; }
+ }
+
+ public string Body {
+ get { return body; }
+ set { body = value; }
+ }
+
+ public Encoding BodyEncoding {
+ get { return message.BodyEncoding; }
+ set { message.BodyEncoding = value; }
+ }
+
+ public MailFormat BodyFormat {
+ get { return message.BodyFormat; }
+ set { message.BodyFormat = value; }
+ }
+
+ public MailAddressCollection Cc {
+ get { return cc; }
+ }
+
+ public MailAddress From {
+ get { return from; }
+ }
+
+ public MailHeader Header {
+ get { return header; }
+ }
+
+ public MailPriority Priority {
+ get { return message.Priority; }
+ set { message.Priority = value; }
+ }
+
+ public string Subject {
+ get { return message.Subject; }
+ set { message.Subject = value; }
+ }
+
+ public MailAddressCollection To {
+ get { return to; }
+ }
+
+ public string UrlContentBase {
+ get { return message.UrlContentBase; }
+
+ }
+
+ public string UrlContentLocation {
+ get { return message.UrlContentLocation; }
+ }
+
+#if NET_1_1
+ public MailHeader Fields {
+ get {
+ MailHeader bodyHeaders = new MailHeader();
+ // Add Fields to MailHeader Object
+ foreach( string key in message.Fields.Keys )
+ bodyHeaders.Data[ key ] = (string)this.message.Fields[ key ];
+
+ return bodyHeaders;
+ }
+
+ }
+#endif
+
+#if NET_2_0
+ public IList RelatedBodyParts {
+ get { return message.RelatedBodyParts; }
+ }
+#endif
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Mail/MailPriority.cs b/mcs/class/System.Web/System.Web.Mail/MailPriority.cs
new file mode 100644
index 00000000000..5c0bf83ed2a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/MailPriority.cs
@@ -0,0 +1,54 @@
+//
+// System.Web.Mail.MailPriority.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+//
+// 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.
+//
+
+namespace System.Web.Mail
+{
+
+ /// <summary>
+ /// </summary>
+#if NET_2_0
+ [Serializable]
+#endif
+ public enum MailPriority
+ {
+
+ /// <summary>
+ /// </summary>
+ Normal = 0,
+
+ /// <summary>
+ /// </summary>
+ Low = 1,
+
+ /// <summary>
+ /// </summary>
+ High = 2
+
+ }
+
+} //namespace System.Web.Mail
diff --git a/mcs/class/System.Web/System.Web.Mail/MailUtil.cs b/mcs/class/System.Web/System.Web.Mail/MailUtil.cs
new file mode 100644
index 00000000000..6f9b25dc0d0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/MailUtil.cs
@@ -0,0 +1,88 @@
+//
+// System.Web.Mail.MailUtil.cs
+//
+// Author(s):
+// Per Arneng <pt99par@student.bth.se>
+//
+//
+
+//
+// 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;
+using System.Text;
+
+namespace System.Web.Mail {
+
+ // This class contains some utillity functions
+ // that doesnt fit in other classes and to keep
+ // high cohesion on the other classes.
+ internal class MailUtil {
+
+ // determines if a string needs to
+ // be encoded for transfering over
+ // the smtp protocol without risking
+ // that it would be changed.
+ public static bool NeedEncoding( string str ) {
+
+ foreach( char chr in str ) {
+
+ int ch = (int)chr;
+
+ if( ! ( (ch > 61) && (ch < 127) || (ch>31) && (ch<61) ) ) {
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ // Encodes a string to base4
+ public static string Base64Encode( string str ) {
+ return Convert.ToBase64String( Encoding.Default.GetBytes( str ) );
+ }
+
+ // Generate a unique boundary
+ public static string GenerateBoundary() {
+ StringBuilder boundary = new StringBuilder("__MONO__Boundary");
+
+ boundary.Append("__");
+
+ DateTime now = DateTime.Now;
+ boundary.Append(now.Year);
+ boundary.Append(now.Month);
+ boundary.Append(now.Day);
+ boundary.Append(now.Hour);
+ boundary.Append(now.Minute);
+ boundary.Append(now.Second);
+ boundary.Append(now.Millisecond);
+
+ boundary.Append("__");
+ boundary.Append((new Random()).Next());
+ boundary.Append("__");
+
+ return boundary.ToString();
+ }
+
+ }
+
+
+}
diff --git a/mcs/class/System.Web/System.Web.Mail/RelatedBodyPart.cs b/mcs/class/System.Web/System.Web.Mail/RelatedBodyPart.cs
new file mode 100644
index 00000000000..dc6851cb02c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/RelatedBodyPart.cs
@@ -0,0 +1,72 @@
+//
+// System.Web.Mail.RelatedBodyPart.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System.Web;
+namespace System.Web.Mail
+{
+ public class RelatedBodyPart
+ {
+ private string id;
+ private string fileName;
+
+ public RelatedBodyPart (string id, string fileName)
+ {
+ this.id = id;
+ if (FileExists (fileName))
+ this.fileName = fileName;
+ else
+ throw new HttpException(500, "Invalid related body part");
+ }
+
+ public string Name {
+ get { return id; }
+ set { id = value; }
+ }
+
+ public string Path {
+ get { return fileName; }
+ set { fileName = value; }
+ }
+
+ private bool FileExists (string fileName)
+ {
+ //I am handling local files only . Not sure how URL's
+ //need to be handled.
+ try {
+ System.IO.File.OpenRead (fileName).Close ();
+ return true;
+ } catch (Exception) {
+ return false;
+ }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Mail/SmtpClient.cs b/mcs/class/System.Web/System.Web.Mail/SmtpClient.cs
new file mode 100644
index 00000000000..e4740125819
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/SmtpClient.cs
@@ -0,0 +1,291 @@
+//
+// System.Web.Mail.SmtpClient.cs
+//
+// Author(s):
+// Per Arneng <pt99par@student.bth.se>
+// Sanjay Gupta <gsanjay@novell.com>
+// (C) 2004, 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
+// "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;
+using System.Net;
+using System.IO;
+using System.Text;
+using System.Collections;
+using System.Net.Sockets;
+
+namespace System.Web.Mail {
+
+ /// represents a conntection to a smtp server
+ internal class SmtpClient {
+
+ private string server;
+ private TcpClient tcpConnection;
+ private SmtpStream smtp;
+
+ //Initialise the variables and connect
+ public SmtpClient( string server ) {
+
+ this.server = server;
+ Connect();
+ }
+
+ // make the actual connection
+ // and HELO handshaking
+ private void Connect() {
+ tcpConnection = new TcpClient( server , 25 );
+
+ Stream stream = tcpConnection.GetStream();
+ smtp = new SmtpStream( stream );
+
+ // read the server greeting
+ smtp.ReadResponse();
+ smtp.CheckForStatusCode( 220 );
+
+ // write the HELO command to the server
+ smtp.WriteHelo( Dns.GetHostName() );
+
+ }
+
+ public void Send( MailMessageWrapper msg ) {
+
+ if( msg.From == null ) {
+ throw new SmtpException( "From property must be set." );
+ }
+
+ if( msg.To == null ) {
+ if( msg.To.Count < 1 ) throw new SmtpException( "Atleast one recipient must be set." );
+ }
+
+
+ // start with a reset incase old data
+ // is present at the server in this session
+ smtp.WriteRset();
+
+ // write the mail from command
+ smtp.WriteMailFrom( msg.From.Address );
+
+ // write the rcpt to command for the To addresses
+ foreach( MailAddress addr in msg.To ) {
+ smtp.WriteRcptTo( addr.Address );
+ }
+
+ // write the rcpt to command for the Cc addresses
+ foreach( MailAddress addr in msg.Cc ) {
+ smtp.WriteRcptTo( addr.Address );
+ }
+
+ // write the rcpt to command for the Bcc addresses
+ foreach( MailAddress addr in msg.Bcc ) {
+ smtp.WriteRcptTo( addr.Address );
+ }
+
+ // write the data command and then
+ // send the email
+ smtp.WriteData();
+
+ if( msg.Attachments.Count == 0 ) {
+#if NET_2_0
+ //The message might be multipart, if RelatedBodyParts are present
+ if (msg.RelatedBodyParts.Count != 0)
+ SendMultipartMail (msg);
+ else
+#endif
+ SendSinglepartMail( msg );
+ } else {
+
+ SendMultipartMail( msg );
+
+ }
+
+ // write the data end tag "."
+ smtp.WriteDataEndTag();
+
+ }
+
+ // sends a single part mail to the server
+ private void SendSinglepartMail( MailMessageWrapper msg ) {
+
+ // write the header
+ smtp.WriteHeader( msg.Header );
+
+ // send the mail body
+ smtp.WriteBytes( msg.BodyEncoding.GetBytes( msg.Body ) );
+
+ }
+
+ // sends a multipart mail to the server
+ private void SendMultipartMail( MailMessageWrapper msg ) {
+
+ // generate the boundary between attachments
+ string boundary = MailUtil.GenerateBoundary();
+
+ // set the Content-Type header to multipart/mixed
+ string bodyContentType = msg.Header.ContentType;
+
+#if NET_2_0
+ if (msg.RelatedBodyParts.Count != 0)
+ msg.Header.ContentType = String.Format( "multipart/related;\r\n boundary={0}" , boundary );
+ else
+#endif
+ msg.Header.ContentType =
+ String.Format( "multipart/mixed;\r\n boundary={0}" , boundary );
+
+ // write the header
+ smtp.WriteHeader( msg.Header );
+
+ // write the first part text part
+ // before the attachments
+ smtp.WriteBoundary( boundary );
+
+ MailHeader partHeader = new MailHeader();
+ partHeader.ContentType = bodyContentType;
+
+#if NET_1_1
+ // Add all the custom headers to body part as specified in
+ //Fields property of MailMessageWrapper
+
+ //Remove fields specific for authenticating to SMTP server.
+ //Need to incorporate AUTH command in SmtpStream to handle
+ //Authorization info. Its a temporary fix for Bug no 68829.
+ //Will dig some more on SMTP AUTH command, and then implement
+ //Authorization. - Sanjay
+
+ if (msg.Fields.Data ["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] != null)
+ msg.Fields.Data.Remove ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate");
+ if (msg.Fields.Data ["http://schemas.microsoft.com/cdo/configuration/sendusername"] != null)
+ msg.Fields.Data.Remove ("http://schemas.microsoft.com/cdo/configuration/sendusername");
+ if (msg.Fields.Data ["http://schemas.microsoft.com/cdo/configuration/sendpassword"] != null)
+ msg.Fields.Data.Remove ("http://schemas.microsoft.com/cdo/configuration/sendpassword");
+ partHeader.Data.Add (msg.Fields.Data);
+#endif
+
+ smtp.WriteHeader( partHeader );
+
+ // FIXME: probably need to use QP or Base64 on everything higher
+ // then 8-bit .. like utf-16
+ smtp.WriteBytes( msg.BodyEncoding.GetBytes( msg.Body ) );
+
+ smtp.WriteBoundary( boundary );
+
+#if NET_2_0
+ for (int i = 0; i < msg.RelatedBodyParts.Count; i++) {
+ RelatedBodyPart rbp = (RelatedBodyPart) msg.RelatedBodyParts [i];
+ FileInfo file = new FileInfo (rbp.Path);
+ MailHeader header = new MailHeader ();
+ header.ContentLocation = rbp.Path;
+ header.ContentType = String.Format (MimeTypes.GetMimeType (file.Name) + "; name=\"{0}\"",file.Name);
+ //If content id and ContentLocation both are present
+ //in mime header of a mail, than RelatedBodyPart of mail
+ //doesnt show up in a machine other than from which mail
+ //was sent, and hence only one of them is inserted in
+ //header. Need to check how the things go when another
+ //body part refers the content with the content id specified
+ /*if (rbp.Name != null)
+ header.Data.Add ("Content-ID", "<"+rbp.Name+">");*/
+
+ header.ContentTransferEncoding = "Base64";
+ header.ContentDisposition = String.Format( "inline; filename=\"{0}\"" , file.Name );
+
+ smtp.WriteHeader (header);
+ FileStream rbpStream = new FileStream (file.FullName, FileMode.Open);
+ IAttachmentEncoder rbpEncoder = new Base64AttachmentEncoder ();
+ rbpEncoder.EncodeStream (rbpStream, smtp.Stream);
+ rbpStream.Close();
+ smtp.WriteLine( "" );
+
+ if (i < (msg.RelatedBodyParts.Count - 1)) {
+ smtp.WriteBoundary (boundary);
+ } else {
+ if (msg.Attachments.Count == 0)
+ smtp.WriteFinalBoundary (boundary);
+ else
+ smtp.WriteBoundary (boundary);
+
+ }
+ }
+#endif
+ // now start to write the attachments
+
+ for( int i=0; i< msg.Attachments.Count ; i++ ) {
+ MailAttachment a = (MailAttachment)msg.Attachments[ i ];
+
+ FileInfo fileInfo = new FileInfo( a.Filename );
+
+ MailHeader aHeader = new MailHeader();
+
+ aHeader.ContentType =
+ String.Format (MimeTypes.GetMimeType (fileInfo.Name) + "; name=\"{0}\"",fileInfo.Name);
+
+ aHeader.ContentDisposition =
+ String.Format( "attachment; filename=\"{0}\"" , fileInfo.Name );
+
+ aHeader.ContentTransferEncoding = a.Encoding.ToString();
+
+ smtp.WriteHeader( aHeader );
+
+ // perform the actual writing of the file.
+ // read from the file stream and write to the tcp stream
+ FileStream ins = new FileStream( fileInfo.FullName , FileMode.Open );
+
+ // create an apropriate encoder
+ IAttachmentEncoder encoder;
+ if( a.Encoding == MailEncoding.UUEncode ) {
+ encoder = new UUAttachmentEncoder( 644 , fileInfo.Name );
+ } else {
+ encoder = new Base64AttachmentEncoder();
+ }
+
+ encoder.EncodeStream( ins , smtp.Stream );
+
+ ins.Close();
+
+
+ smtp.WriteLine( "" );
+
+ // if it is the last attachment write
+ // the final boundary otherwise write
+ // a normal one.
+ if( i < (msg.Attachments.Count - 1) ) {
+ smtp.WriteBoundary( boundary );
+ } else {
+ smtp.WriteFinalBoundary( boundary );
+ }
+
+ }
+
+ }
+
+ // send quit command and
+ // closes the connection
+ public void Close() {
+
+ smtp.WriteQuit();
+ tcpConnection.Close();
+
+ }
+
+
+ }
+
+}
diff --git a/mcs/class/System.Web/System.Web.Mail/SmtpException.cs b/mcs/class/System.Web/System.Web.Mail/SmtpException.cs
new file mode 100644
index 00000000000..5ff7fda1bb7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/SmtpException.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.Mail.SmtpException.cs
+//
+// Author(s):
+// Per Arneng <pt99par@student.bth.se>
+//
+//
+
+//
+// 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.IO;
+
+namespace System.Web.Mail {
+
+ // an exception thrown when an smtp exception occurs
+ internal class SmtpException : IOException {
+ public SmtpException( string message ) : base( message ) {}
+ }
+
+}
diff --git a/mcs/class/System.Web/System.Web.Mail/SmtpMail.cs b/mcs/class/System.Web/System.Web.Mail/SmtpMail.cs
new file mode 100644
index 00000000000..6bb50ceffd8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/SmtpMail.cs
@@ -0,0 +1,108 @@
+//
+// System.Web.Mail.SmtpMail.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+// Per Arneng (pt99par@student.bth.se) (SmtpMail.Send)
+//
+
+//
+// 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;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using System.IO;
+using System.Reflection;
+
+namespace System.Web.Mail
+{
+ /// <remarks>
+ /// </remarks>
+ public class SmtpMail
+ {
+ private static string smtpServer = "localhost";
+
+ // Constructor
+ private SmtpMail ()
+ {
+ /* empty */
+ }
+
+ // Properties
+ public static string SmtpServer {
+ get { return smtpServer; }
+ set { smtpServer = value; }
+ }
+
+
+ public static void Send (MailMessage message)
+ {
+
+ try {
+
+ // wrap the MailMessage in a MailMessage wrapper for easier
+ // access to properties and to add some functionality
+ MailMessageWrapper messageWrapper = new MailMessageWrapper( message );
+
+ SmtpClient smtp = new SmtpClient (smtpServer);
+
+ smtp.Send (messageWrapper);
+
+ smtp.Close ();
+
+ } catch (SmtpException ex) {
+ // LAMESPEC:
+ // .NET sdk throws HttpException
+ // for some reason so to be compatible
+ // we have to do it to :(
+ throw new HttpException (ex.Message, ex);
+
+ } catch (IOException ex) {
+
+ throw new HttpException (ex.Message, ex);
+
+ } catch (FormatException ex) {
+
+ throw new HttpException (ex.Message, ex);
+
+ } catch (SocketException ex) {
+
+ throw new HttpException (ex.Message, ex);
+
+ }
+
+ }
+
+ public static void Send (string from, string to, string subject, string messageText)
+ {
+ MailMessage message = new MailMessage ();
+ message.From = from;
+ message.To = to;
+ message.Subject = subject;
+ message.Body = messageText;
+ Send (message);
+ }
+
+ }
+
+} //namespace System.Web.Mail
diff --git a/mcs/class/System.Web/System.Web.Mail/SmtpResponse.cs b/mcs/class/System.Web/System.Web.Mail/SmtpResponse.cs
new file mode 100644
index 00000000000..b70fc34edea
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/SmtpResponse.cs
@@ -0,0 +1,86 @@
+//
+// System.Web.Mail.SmtpResponse.cs
+//
+// Author(s):
+// Per Arneng <pt99par@student.bth.se>
+//
+//
+
+//
+// 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;
+
+namespace System.Web.Mail {
+
+ /// this class represents the response from the smtp server
+ internal class SmtpResponse {
+
+ private string rawResponse;
+ private int statusCode;
+ private string[] parts;
+
+ /// use the Parse method to create instances
+ protected SmtpResponse() {}
+
+ /// the smtp status code FIXME: change to Enumeration?
+ public int StatusCode {
+ get { return statusCode; }
+ set { statusCode = value; }
+ }
+
+ /// the response as it was recieved
+ public string RawResponse {
+ get { return rawResponse; }
+ set { rawResponse = value; }
+ }
+
+ /// the response as parts where ; was used as delimiter
+ public string[] Parts {
+ get { return parts; }
+ set { parts = value; }
+ }
+
+ /// parses a new response object from a response string
+ public static SmtpResponse Parse( string line ) {
+ SmtpResponse response = new SmtpResponse();
+
+ if( line.Length < 4 )
+ throw new SmtpException( "Response is to short " +
+ line.Length + ".");
+
+ if( ( line[ 3 ] != ' ' ) && ( line[ 3 ] != '-' ) )
+ throw new SmtpException( "Response format is wrong.(" +
+ line + ")" );
+
+ // parse the response code
+ response.StatusCode = Int32.Parse( line.Substring( 0 , 3 ) );
+
+ // set the rawsponse
+ response.RawResponse = line;
+
+ // set the response parts
+ response.Parts = line.Substring( 0 , 3 ).Split( ';' );
+
+ return response;
+ }
+ }
+
+}
diff --git a/mcs/class/System.Web/System.Web.Mail/SmtpStream.cs b/mcs/class/System.Web/System.Web.Mail/SmtpStream.cs
new file mode 100644
index 00000000000..3228bbb56aa
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/SmtpStream.cs
@@ -0,0 +1,208 @@
+//
+// System.Web.Mail.SmtpStream.cs
+//
+// Author(s):
+// Per Arneng <pt99par@student.bth.se>
+//
+//
+
+//
+// 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;
+using System.IO;
+using System.Collections;
+using System.Text;
+using System.Security.Cryptography;
+
+namespace System.Web.Mail {
+
+ internal class SmtpStream {
+
+ protected Stream stream;
+ protected Encoding encoding;
+ protected SmtpResponse lastResponse;
+ protected string command = "";
+
+ public SmtpStream( Stream stream ) {
+ this.stream = stream;
+ encoding = new ASCIIEncoding();
+ }
+
+ public Stream Stream {
+ get { return stream; }
+ }
+
+ public SmtpResponse LastResponse {
+ get { return lastResponse; }
+ }
+
+ public void WriteRset() {
+ command = "RSET";
+ WriteLine( command );
+ ReadResponse();
+ CheckForStatusCode( 250 );
+
+ }
+
+ public void WriteHelo( string hostName ) {
+ command = "HELO " + hostName;
+ WriteLine( command );
+ ReadResponse();
+ CheckForStatusCode( 250 );
+
+ }
+
+ public void WriteMailFrom( string from ) {
+ command = "MAIL FROM: <" + from + ">";
+ WriteLine( command );
+ ReadResponse();
+ CheckForStatusCode( 250 );
+
+ }
+
+ public void WriteRcptTo( string to ) {
+ command = "RCPT TO: <" + to + ">";
+ WriteLine( command );
+ ReadResponse();
+ CheckForStatusCode( 250 );
+
+ }
+
+
+ public void WriteData() {
+ command = "DATA";
+ WriteLine( command );
+ ReadResponse();
+ CheckForStatusCode( 354 );
+
+ }
+
+ public void WriteQuit() {
+ command = "QUIT";
+ WriteLine( command );
+ ReadResponse();
+ CheckForStatusCode( 221 );
+
+ }
+
+ public void WriteBoundary( string boundary ) {
+
+ WriteLine( "\r\n--{0}" , boundary );
+
+ }
+
+ public void WriteFinalBoundary( string boundary ) {
+
+ WriteLine( "\r\n--{0}--" , boundary );
+
+ }
+
+ // single dot by itself
+ public void WriteDataEndTag() {
+ command = "\r\n.";
+ WriteLine( command );
+ ReadResponse();
+ CheckForStatusCode( 250 );
+
+ }
+
+
+ public void WriteHeader( MailHeader header ) {
+ // write the headers
+ foreach( string key in header.Data.AllKeys )
+ WriteLine( "{0}: {1}" , key , header.Data[ key ] );
+
+ // write the header end tag
+ WriteLine( "" );
+ }
+
+ public void CheckForStatusCode( int statusCode ) {
+
+ if( LastResponse.StatusCode != statusCode ) {
+
+ string msg = "" +
+ "Server reponse: '" + lastResponse.RawResponse + "';" +
+ "Status code: '" + lastResponse.StatusCode + "';" +
+ "Expected status code: '" + statusCode + "';" +
+ "Last command: '" + command + "'";
+
+ throw new SmtpException( msg );
+
+ }
+ }
+
+
+ // write buffer's bytes to the stream
+ public void WriteBytes( byte[] buffer ) {
+ stream.Write( buffer , 0 , buffer.Length );
+ }
+
+ // writes a formatted line to the server
+ public void WriteLine( string format , params object[] args ) {
+ WriteLine( String.Format( format , args ) );
+ }
+
+ // writes a line to the server
+ public void WriteLine( string line ) {
+ byte[] buffer = encoding.GetBytes( line + "\r\n" );
+
+ stream.Write( buffer , 0 , buffer.Length );
+
+ #if DEBUG
+ DebugPrint( line );
+ #endif
+ }
+
+ // read a line from the server
+ public void ReadResponse( ) {
+ string line = null;
+
+ byte[] buffer = new byte[ 4096 ];
+
+ int readLength = stream.Read( buffer , 0 , buffer.Length );
+
+ if( readLength > 0 ) {
+
+ line = encoding.GetString( buffer , 0 , readLength );
+
+ line = line.TrimEnd( new Char[] { '\r' , '\n' , ' ' } );
+
+ }
+
+ // parse the line to the lastResponse object
+ lastResponse = SmtpResponse.Parse( line );
+
+ #if DEBUG
+ DebugPrint( line );
+ #endif
+ }
+
+ #if DEBUG
+ /// debug printing
+ private void DebugPrint( string line ) {
+ Console.WriteLine( "smtp: {0}" , line );
+ }
+ #endif
+
+ }
+
+
+}
diff --git a/mcs/class/System.Web/System.Web.Mail/ToUUEncodingTransform.cs b/mcs/class/System.Web/System.Web.Mail/ToUUEncodingTransform.cs
new file mode 100644
index 00000000000..a440a5734e1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/ToUUEncodingTransform.cs
@@ -0,0 +1,133 @@
+//
+// System.Web.Mail.ToUUEncodingTransform.cs
+//
+// Author(s):
+// Per Arneng <pt99par@student.bth.se>
+//
+//
+
+//
+// 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;
+using System.Security.Cryptography;
+
+namespace System.Web.Mail {
+
+ // This class transforms blocks of plaintext to UU encoding
+ internal class ToUUEncodingTransform : ICryptoTransform {
+
+ public int InputBlockSize { get { return 45; } }
+ public int OutputBlockSize { get { return 61; } }
+
+ public bool CanTransformMultipleBlocks { get { return true; } }
+ public bool CanReuseTransform { get { return true; } }
+
+ // transforms a block of bytes to UU encoding
+ public int TransformBlock( byte[] inputBuffer,
+ int inputOffset,
+ int inputCount,
+ byte[] outputBuffer,
+ int outputOffset
+ ) {
+
+ // write the line length length+0x20
+ outputBuffer[ 0 ] = (byte)'M';
+
+ // transform the block 3bytes at a time
+ for( int i=0;i<15;i++ ) {
+
+ TransformTriplet( inputBuffer , inputOffset + i * 3 , 3,
+ outputBuffer , outputOffset + i * 4 + 1);
+
+ }
+
+
+ return OutputBlockSize;
+ }
+
+ // make a final uu transformations
+ public byte[] TransformFinalBlock(byte[] inputBuffer,
+ int inputOffset,
+ int inputCount
+ ) {
+
+ // calculate how many 4-byte blocks there are
+ int tripletBlocks = inputCount / 3 + 1;
+
+ // create a new buffer and copy the input data into that
+ byte[] buffer = new byte[ tripletBlocks * 3 ];
+ Buffer.BlockCopy( inputBuffer,inputOffset, buffer,0,inputCount);
+
+ // create the outpur buffer and set the first byte
+ // to the length+0x20
+ byte[] outputBuffer = new byte[ tripletBlocks * 4 + 1 ];
+ outputBuffer[ 0 ] = (byte)(inputCount+0x20);
+
+ // transform the block 3bytes at a time
+ for( int i =0 ; i < tripletBlocks ; i++ ) {
+ TransformTriplet( inputBuffer , inputOffset + i * 3 , 3,
+ outputBuffer , i * 4 + 1);
+ }
+
+
+
+ return outputBuffer;
+
+ }
+
+ // transforms a 3byte buffer to a 4byte uuencoded buffer
+ protected int TransformTriplet( byte[] inputBuffer,
+ int inputOffset,
+ int inputCount,
+ byte[] outputBuffer,
+ int outputOffset
+ ) {
+
+ byte a = inputBuffer[ inputOffset + 0 ];
+ byte b = inputBuffer[ inputOffset + 1 ];
+ byte c = inputBuffer[ inputOffset + 2 ];
+
+ outputBuffer[ outputOffset + 0 ] =
+ (byte)(0x20 + (( a >> 2 ) & 0x3F));
+
+ outputBuffer[ outputOffset + 1 ] =
+ (byte)(0x20 + (((a << 4) | ((b >> 4) & 0xF)) & 0x3F));
+
+ outputBuffer[ outputOffset + 2 ] =
+ (byte)(0x20 + (((b << 2) | ((c >> 6) & 0x3)) & 0x3F));
+
+ outputBuffer[ outputOffset + 3 ] =
+ (byte)(0x20 + (( c ) & 0x3F));
+
+ // tanslate all 0x20 to 0x60 according to specs
+ for( int i = 0; i < 4; i++ ) {
+ if( outputBuffer[ outputOffset + i ] == 0x20 ) {
+ outputBuffer[ outputOffset + i ] = 0x60;
+ }
+ }
+
+ return 4;
+ }
+
+ public void Dispose() {}
+ }
+
+}
diff --git a/mcs/class/System.Web/System.Web.Mail/UUAttachmentEncoder.cs b/mcs/class/System.Web/System.Web.Mail/UUAttachmentEncoder.cs
new file mode 100644
index 00000000000..ee70fc75725
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/UUAttachmentEncoder.cs
@@ -0,0 +1,97 @@
+//
+// System.Web.Mail.UUAttachmentEncoder.cs
+//
+// Author(s):
+// Per Arneng <pt99par@student.bth.se>
+//
+//
+
+//
+// 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;
+using System.IO;
+using System.Text;
+
+namespace System.Web.Mail {
+
+ // a class that handles UU encoding for attachments
+ internal class UUAttachmentEncoder : IAttachmentEncoder {
+
+ protected byte[] beginTag;
+ protected byte[] endTag;
+ protected byte[] endl;
+
+ public UUAttachmentEncoder( int mode , string fileName ) {
+ string endlstr = "\r\n";
+
+ beginTag =
+ Encoding.ASCII.GetBytes( "begin " + mode + " " + fileName + endlstr);
+
+ endTag =
+ Encoding.ASCII.GetBytes( "`" + endlstr + "end" + endlstr );
+
+ endl = Encoding.ASCII.GetBytes( endlstr );
+ }
+
+ // uu encodes a stream in to another stream
+ public void EncodeStream( Stream ins , Stream outs ) {
+
+ // write the start tag
+ outs.Write( beginTag , 0 , beginTag.Length );
+
+ // create the uu transfom and the buffers
+ ToUUEncodingTransform tr = new ToUUEncodingTransform();
+ byte[] input = new byte[ tr.InputBlockSize ];
+ byte[] output = new byte[ tr.OutputBlockSize ];
+
+ while( true ) {
+
+ // read from the stream until no more data is available
+ int check = ins.Read( input , 0 , input.Length );
+ if( check < 1 ) break;
+
+ // if the read length is not InputBlockSize
+ // write a the final block
+ if( check == tr.InputBlockSize ) {
+ tr.TransformBlock( input , 0 , check , output , 0 );
+ outs.Write( output , 0 , output.Length );
+ outs.Write( endl , 0 , endl.Length );
+ } else {
+ byte[] finalBlock = tr.TransformFinalBlock( input , 0 , check );
+ outs.Write( finalBlock , 0 , finalBlock.Length );
+ outs.Write( endl , 0 , endl.Length );
+ break;
+ }
+
+ }
+
+ // write the end tag.
+ outs.Write( endTag , 0 , endTag.Length );
+ }
+
+
+
+
+
+
+ }
+
+}
diff --git a/mcs/class/System.Web/System.Web.Management/ChangeLog b/mcs/class/System.Web/System.Web.Management/ChangeLog
new file mode 100644
index 00000000000..3421810ee26
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Management/ChangeLog
@@ -0,0 +1,25 @@
+2004-08-02 Duncan Mak <duncan@ximian.com>
+
+ * RuleFiringRecord.cs:
+ * WebApplicationInformation:
+ * WebEventFormatter: Signature fixes, hide the constructor.
+
+ * IRegiisUtility.cs: Fixed name.
+
+ * EventNotificationType.cs:
+ * SessionStateType.cs:
+ * SqlFeatures.cs: Added missing attributes.
+
+2004-08-02 Duncan Mak <duncan@ximian.com>
+
+ * EventNotificationType.cs:
+ * SessionStateType.cs:
+ * SqlFeatures.cs: Added enumerations.
+
+ * IRegissUtility.cs:
+ * IRegisterCreateITypeLib.cs: Added interfaces.
+
+ * RuleFiringRecord.cs:
+ * WebApplicationInformation.cs:
+ * WebBaseEvent.cs:
+ * WebEventFormatter.cs: Stubbed out classes. \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.Management/EventNotificationType.cs b/mcs/class/System.Web/System.Web.Management/EventNotificationType.cs
new file mode 100644
index 00000000000..0e248a12923
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Management/EventNotificationType.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.Management.EventNotificationType.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+#if NET_2_0
+namespace System.Web.Management
+{
+ [Serializable]
+ public enum EventNotificationType
+ {
+ Regular = 0,
+ Urgent = 1,
+ Flush = 2,
+ Unbuffered = 3
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Management/IRegiisUtility.cs b/mcs/class/System.Web/System.Web.Management/IRegiisUtility.cs
new file mode 100644
index 00000000000..051f5b33d12
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Management/IRegiisUtility.cs
@@ -0,0 +1,62 @@
+//
+// System.Web.Management.IRegiisUtility.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+#if NET_2_0
+namespace System.Web.Management
+{
+ public interface IRegiisUtility
+ {
+ void ProtectedConfigAction (
+ long actionToPerform,
+ [In] string first_argument,
+ [In] string second_argument,
+ [In] string provider_name,
+ [In] string app_path,
+ [In] string csp_or_location,
+ int key_size,
+ out string exception);
+
+ void RegisterAsnetMmcAssembly (
+ int do_reg,
+ [In] string assembly_name,
+ [In] string binary_directory,
+ out string exception);
+
+ void RegisterSystemWebAssembly (int do_reg, out string exception);
+
+ void ToggleWebAdminToolConfigs (
+ [In] string site,
+ [In] int [] settings,
+ int size,
+ out string exception);
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Management/IRegisterCreateITypeLib.cs b/mcs/class/System.Web/System.Web.Management/IRegisterCreateITypeLib.cs
new file mode 100644
index 00000000000..4bb44b08a02
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Management/IRegisterCreateITypeLib.cs
@@ -0,0 +1,58 @@
+//
+// System.Web.Management.IRegisterCreateITypeLib.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+#if NET_2_0
+namespace System.Web.Management
+{
+ public interface IRegisterCreateITypeLib
+ {
+ void CreateTypeInfo ();
+
+ void SaveAllChanges ();
+
+ void SetDocString ();
+
+ void SetGuid ();
+
+ void SetHelpContext ();
+
+ void SetHelpFileName ();
+
+ void SetLcid ();
+
+ void SetLibFlags ();
+
+ void SetName ();
+
+ void SetVersion ();
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Management/IWebEventCustomEvaluator.cs b/mcs/class/System.Web/System.Web.Management/IWebEventCustomEvaluator.cs
new file mode 100644
index 00000000000..47c619393b5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Management/IWebEventCustomEvaluator.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.Management.IWebEventCustomEvaluator.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+#if NET_2_0
+namespace System.Web.Management
+{
+ public interface IWebEventCustomEvaluator
+ {
+ bool CanFire (WebBaseEvent raised_event, RuleFiringRecord record);
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Management/RuleFiringRecord.cs b/mcs/class/System.Web/System.Web.Management/RuleFiringRecord.cs
new file mode 100644
index 00000000000..f8627fd8a8d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Management/RuleFiringRecord.cs
@@ -0,0 +1,54 @@
+//
+// System.Web.Management.RuleFiringRecord.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+using System;
+using System.Web;
+
+namespace System.Web.Management
+{
+ public class RuleFiringRecord
+ {
+ internal RuleFiringRecord ()
+ {
+ }
+
+ public DateTime LastFired {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public int TimesRaised {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Management/SessionStateType.cs b/mcs/class/System.Web/System.Web.Management/SessionStateType.cs
new file mode 100644
index 00000000000..d0cf520a44f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Management/SessionStateType.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.Management.SessionStateType.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.Management
+{
+ [Serializable]
+ public enum SessionStateType
+ {
+ Temporary = 0,
+ Persisted = 1,
+ Custom = 2,
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Management/SqlFeatures.cs b/mcs/class/System.Web/System.Web.Management/SqlFeatures.cs
new file mode 100644
index 00000000000..a1df23ffd56
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Management/SqlFeatures.cs
@@ -0,0 +1,45 @@
+//
+// System.Web.Management.SqlFeatures.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.Management
+{
+ [Flags, Serializable]
+ public enum SqlFeatures
+ {
+ None = 0,
+ Membership = 1,
+ Profile = 2,
+ RoleManager = 4,
+ SiteCounters = 8,
+ Personalization = 16,
+ SqlWebEventProvider = 32,
+ All = 1073741887
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Management/WebApplicationInformation.cs b/mcs/class/System.Web/System.Web.Management/WebApplicationInformation.cs
new file mode 100644
index 00000000000..7243b6bb683
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Management/WebApplicationInformation.cs
@@ -0,0 +1,84 @@
+//
+// System.Web.Management.WebApplicationInformation.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+#if NET_2_0
+
+using System;
+using System.Web;
+
+namespace System.Web.Management
+{
+ public class WebApplicationInformation
+ {
+ string application_domain, application_path, application_virtual_path, machine_name, trust_level;
+
+ internal WebApplicationInformation ()
+ {
+ }
+
+ public string ApplicationDomain {
+ get {
+ return application_domain;
+ }
+ }
+
+ public string ApplicationPath {
+ get {
+ return application_path;
+ }
+ }
+
+ public string ApplicationVirtualPath {
+ get {
+ return application_virtual_path;
+ }
+ }
+
+ public string MachineName {
+ get {
+ return machine_name;
+ }
+ }
+
+ public string TrustLevel {
+ get {
+ return trust_level;
+ }
+ }
+
+ public void FormatToString (WebEventFormatter formatter)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Management/WebBaseEvent.cs b/mcs/class/System.Web/System.Web.Management/WebBaseEvent.cs
new file mode 100644
index 00000000000..d27e9462904
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Management/WebBaseEvent.cs
@@ -0,0 +1,136 @@
+//
+// System.Web.Management.WebBaseEvent.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+using System;
+
+namespace System.Web.Management
+{
+ public class WebBaseEvent
+ {
+ string message;
+ object event_source;
+ int event_code, event_detail_code;
+
+ public WebBaseEvent (string message, object event_source, int event_code)
+ {
+ this.message = message;
+ this.event_source = event_source;
+ this.event_code = event_code;
+ }
+
+ public WebBaseEvent (string message, object event_source, int event_code, int event_detail_code)
+ {
+ this.message = message;
+ this.event_source = event_source;
+ this.event_code = event_code;
+ this.event_detail_code = event_detail_code;
+ }
+
+ public static WebApplicationInformation ApplicationInformation {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public int EventCode {
+ get {
+ return event_code;
+ }
+ }
+
+ public int EventDetailCode {
+ get {
+ return event_detail_code;
+ }
+ }
+
+ public Guid EventId {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public long EventSequence {
+ get {
+
+ throw new NotImplementedException ();
+ }
+ }
+
+ public object EventSource {
+ get {
+ return event_source;
+ }
+ }
+
+ public DateTime EventTime {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public DateTime EventTimeUtc {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public string Message {
+ get {
+ return message;
+ }
+ }
+
+ public virtual void FormatCustomEventDetails (WebEventFormatter formatter)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual void Raise ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static void Raise (WebBaseEvent event_raised)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string ToString (bool include_app_info, bool include_custom_event_details)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Management/WebEventFormatter.cs b/mcs/class/System.Web/System.Web.Management/WebEventFormatter.cs
new file mode 100644
index 00000000000..30b4c1234ac
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Management/WebEventFormatter.cs
@@ -0,0 +1,67 @@
+//
+// System.Web.Management.WebEventFormatter.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.Management
+{
+ public class WebEventFormatter
+ {
+ int indentation_level, tab_size;
+
+ internal WebEventFormatter ()
+ {
+ }
+
+ public int IndentationLevel {
+
+ get { return indentation_level; }
+
+ set { indentation_level = value; }
+
+ }
+
+ public int TabSize {
+
+ get { return tab_size; }
+
+ set { tab_size = value; }
+
+ }
+
+ public void AppendLine (string s)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Profile/ChangeLog b/mcs/class/System.Web/System.Web.Profile/ChangeLog
new file mode 100644
index 00000000000..a0abb82c47a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Profile/ChangeLog
@@ -0,0 +1,3 @@
+2004-08-02 Duncan Mak <duncan@ximian.com>
+
+ * ProfileAuthenticationOption.cs: Added enumeration. \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.Profile/ProfileAuthenticationOption.cs b/mcs/class/System.Web/System.Web.Profile/ProfileAuthenticationOption.cs
new file mode 100644
index 00000000000..b2bdbe006ac
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Profile/ProfileAuthenticationOption.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.Profile.ProfileAuthenticationOption.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.Profile
+{
+ public enum ProfileAuthenticationOption
+ {
+ Anonymous = 1,
+ Authenticated = 2,
+ All = 3
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.Security/.cvsignore b/mcs/class/System.Web/System.Web.Security/.cvsignore
new file mode 100644
index 00000000000..6cf78161dc9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/.cvsignore
@@ -0,0 +1 @@
+semantic.cache
diff --git a/mcs/class/System.Web/System.Web.Security/AccessMembershipProvider.cs b/mcs/class/System.Web/System.Web.Security/AccessMembershipProvider.cs
new file mode 100644
index 00000000000..ec65c4235b1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/AccessMembershipProvider.cs
@@ -0,0 +1,174 @@
+//
+// System.Web.Security.AccessMembershipProvider
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.Security {
+ public class AccessMembershipProvider : MembershipProvider {
+
+ [MonoTODO]
+ public override bool ChangePassword (string username, string oldPwd, string newPwd)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool ChangePasswordQuestionAndAnswer (string username, string password, string newPwdQuestion, string newPwdAnswer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override MembershipUser CreateUser (string username, string password, string email, string pwdQuestion, string pwdAnswer, bool isApproved, out MembershipCreateStatus status)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool DeleteUser (string username, bool deleteAllRelatedData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual string GeneratePassword ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override MembershipUserCollection FindUsersByEmail (string emailToMatch, int pageIndex, int pageSize, out int totalRecords)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override MembershipUserCollection FindUsersByName (string nameToMatch, int pageIndex, int pageSize, out int totalRecords)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override MembershipUserCollection GetAllUsers (int pageIndex, int pageSize, out int totalRecords)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetNumberOfUsersOnline ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string GetPassword (string username, string answer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override MembershipUser GetUser (string username, bool userIsOnline)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string GetUserNameByEmail (string email)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void Initialize (string name, NameValueCollection config)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ResetPassword (string username, string answer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void UpdateUser (MembershipUser user)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool ValidateUser (string username, string password)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ApplicationName {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual string Description {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override bool EnablePasswordReset {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override bool EnablePasswordRetrieval {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual MembershipPasswordFormat PasswordFormat {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override bool RequiresQuestionAndAnswer {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual bool RequiresUniqueEmail {
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/AccessRoleProvider.cs b/mcs/class/System.Web/System.Web.Security/AccessRoleProvider.cs
new file mode 100644
index 00000000000..68c42182536
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/AccessRoleProvider.cs
@@ -0,0 +1,118 @@
+//
+// System.Web.Security.AccessRoleProvider
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.Security {
+ public class AccessRoleProvider: RoleProvider {
+
+ [MonoTODO]
+ public override void AddUsersToRoles (string [] usernames, string [] rolenames)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void CreateRole (string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void DeleteRole (string rolename, bool throwOnPopulatedRole)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void FindUsersInRole (string roleName, string usernameToMatch)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string [] GetAllRoles ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string [] GetRolesForUser (string username)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string [] GetUsersInRole (string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void Initialize (string name, NameValueCollection config)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsUserInRole (string username, string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void RemoveUsersFromRoles (string [] usernames, string [] rolenames)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool RoleExists (string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ApplicationName {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual string Description {
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/ActiveDirectoryMembershipProvider.cs b/mcs/class/System.Web/System.Web.Security/ActiveDirectoryMembershipProvider.cs
new file mode 100644
index 00000000000..3e91ccd9fbf
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/ActiveDirectoryMembershipProvider.cs
@@ -0,0 +1,174 @@
+//
+// System.Web.Security.ActiveDirectoryMembershipProvider
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.Security {
+ public class ActiveDirectoryMembershipProvider : MembershipProvider {
+
+ [MonoTODO]
+ public override bool ChangePassword (string username, string oldPwd, string newPwd)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool ChangePasswordQuestionAndAnswer (string username, string password, string newPwdQuestion, string newPwdAnswer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override MembershipUser CreateUser (string username, string password, string email, string pwdQuestion, string pwdAnswer, bool isApproved, out MembershipCreateStatus status)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool DeleteUser (string username, bool deleteAllRelatedData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual string GeneratePassword ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override MembershipUserCollection FindUsersByEmail (string emailToMatch, int pageIndex, int pageSize, out int totalRecords)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override MembershipUserCollection FindUsersByName (string nameToMatch, int pageIndex, int pageSize, out int totalRecords)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override MembershipUserCollection GetAllUsers (int pageIndex, int pageSize, out int totalRecords)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetNumberOfUsersOnline ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string GetPassword (string username, string answer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override MembershipUser GetUser (string username, bool userIsOnline)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string GetUserNameByEmail (string email)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void Initialize (string name, NameValueCollection config)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ResetPassword (string username, string answer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void UpdateUser (MembershipUser user)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool ValidateUser (string username, string password)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ApplicationName {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual string Description {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override bool EnablePasswordReset {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override bool EnablePasswordRetrieval {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual MembershipPasswordFormat PasswordFormat {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override bool RequiresQuestionAndAnswer {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual bool RequiresUniqueEmail {
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/AnonymousIdentificationEventArgs.cs b/mcs/class/System.Web/System.Web.Security/AnonymousIdentificationEventArgs.cs
new file mode 100644
index 00000000000..726303ba6ce
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/AnonymousIdentificationEventArgs.cs
@@ -0,0 +1,52 @@
+//
+// System.Web.Security.AnonymousIdentificationEventArgs
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+namespace System.Web.Security {
+ public sealed class AnonymousIdentificationEventArgs : EventArgs {
+ public AnonymousIdentificationEventArgs (HttpContext context)
+ {
+ this.context = context;
+ }
+
+ HttpContext context;
+ public HttpContext Context {
+ get { return context; }
+ }
+
+ string anonymousId;
+ public string AnonymousId {
+ get { return anonymousId; }
+ set { anonymousId = value; }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/AnonymousIdentificationEventHandler.cs b/mcs/class/System.Web/System.Web.Security/AnonymousIdentificationEventHandler.cs
new file mode 100644
index 00000000000..0af2ab7e460
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/AnonymousIdentificationEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.Security.AnonymousIdentificationEventHandler
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+namespace System.Web.Security {
+ public delegate void AnonymousIdentificationEventHandler (object sender, AnonymousIdentificationEventArgs e);
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/AnonymousIdentificationModule.cs b/mcs/class/System.Web/System.Web.Security/AnonymousIdentificationModule.cs
new file mode 100644
index 00000000000..16645fb906f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/AnonymousIdentificationModule.cs
@@ -0,0 +1,61 @@
+//
+// System.Web.Security.AnonymousIdentificationModule
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.Security {
+ public sealed class AnonymousIdentificationModule : IHttpModule {
+ public event AnonymousIdentificationEventHandler OnCreate;
+ public event EventHandler OnRemove;
+
+
+ [MonoTODO]
+ public void Dispose ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Init (HttpApplication app)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool Enabled {
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/ChangeLog b/mcs/class/System.Web/System.Web.Security/ChangeLog
new file mode 100644
index 00000000000..2b9b7b28567
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/ChangeLog
@@ -0,0 +1,228 @@
+2005-07-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs: the init_vector must be the same accross
+ restarts, otherwise the cookie does not work even when a decryption
+ key is provided. Initialize it to the bytes of the cookie name. Fixes
+ bug #75635.
+
+2005-07-25 Eyal Alaluf <eyala@mainsoft.com>
+
+ * FormsAuthenticationModule.cs: Check for null config
+
+2005-07-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs: my previous patch missed a "small" detail: it
+ didn't include the verification key when computing/checking the
+ validation hash. Now this is really a MAC or HMAC or...
+
+2005-07-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs:
+ * FormsAuthenticationTicket.cs: added support for validation and
+ encryption of the auth. cookie and improved serialization of the ticket.
+
+2005-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs:
+ * PassportAuthenticationModule.cs:
+ * WindowsAuthenticationModule.cs: removed warnings.
+
+2005-03-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthenticationModule.cs: fix for bug 73545, which caused
+ authentication not to work when the cookie was not persistent.
+ Patch by Ilya Kharmatsky (Mainsoft).
+
+2005-02-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs: make the string to be stored in a config.
+ file uppercase... See bug #72557.
+
+2005-02-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs: fixed typo when getting the hash for the
+ password in SHA1 and MD5. Thanks to Tadas Dailyda.
+ Lock on a static object instead of typeof(FormsAuthentication).
+
+2004-11-18 Lluis Sanchez Gual <lluis@novell.com>
+
+ * RoleProvider.cs, Roles.cs, SqlRoleProvider.cs, RoleProviderCollection.cs,
+ AccessRoleProvider.cs: IRoleProvider has been renamed to ProviderBase.
+ * IMembershipProvider.cs: Deleted.
+ * MembershipProvider.cs, AccessMembershipProvider.cs, MembershipUser.cs,
+ Membership.cs, ADMembershipProvider.cs, SqlMembershipProvider.cs
+ MembershipProviderCollection.cs: MembershipProvider has been deleted
+ and replaced by the abstract class MembershipProvider.
+ * MembershipProviderCollection.cs: Minor fixes.
+ * ADMembershipProvider.cs: Renamed to ActiveDirectoryMembershipProvider.cs.
+
+2004-11-15 Lluis Sanchez Gual <lluis@novell.com>
+
+ * RoleProviderCollection.cs, MembershipProviderCollection.cs:
+ Fixed warnings.
+
+2004-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs: patch by Jim Pease to fix the date on renewal.
+
+2004-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthenticationModule.cs: don't renew expired cookies. Only renew
+ the cookie if SlidingExpiration is set. Thanks to Jim Pease.
+
+2004-08-03 Sanjay Gupta <gsanjay@novell.com>
+
+ * MembershipSortOptions.cs:
+ * MembershipPasswordFormat.cs:
+ * MembershipOnlineStatus.cs:
+ * MembershipCreateStatus.cs:
+ * CookieProtection.cs: minor modifications.
+
+2004-06-12 Pedro Martínez Juliá <yoros@wanadoo.es>
+
+ * FormsAuthentication.cs: Undo last change.
+
+2004-06-12 Pedro Martínez Juliá <yoros@wanadoo.es>
+
+ * FormsAuthentication.cs: go to loginUrl from web.config settings
+ before try with the default ones.
+
+2004-06-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultAuthenticationModule.cs: set the IPrincipal for this thread
+ once we have a user. Fixes bug #59683.
+
+2004-04-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthenticationModule.cs: re-read configuration files if needed
+ when determining if forms auth. is used.
+
+2004-01-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs: added RequireSSL and SlidingExpiration.
+
+2004-01-11 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * PassportIdentity.cs: Added v 1.1 members
+
+2003-11-25 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * AccessMembershipProvider.cs: New v2 file
+ * AccessRoleProvider.cs: New v2 file
+ * ADMembershipProvider.cs: New v2 file
+ * AnonymousIdentificationEventArgs.cs: New v2 file
+ * AnonymousIdentificationEventHandler.cs: New v2 file
+ * AnonymousIdentificationModule.cs: New v2 file
+ * CookieProtection.cs: New v2 file
+ * IMembershipProvider.cs: New v2 file
+ * IRoleProvider.cs: New v2 file
+ * Membership.cs: New v2 file
+ * MembershipCreateStatus.cs: New v2 file
+ * MembershipCreateUserException.cs: New v2 file
+ * MembershipOnlineStatus.cs: New v2 file
+ * MembershipPasswordException.cs: New v2 file
+ * MembershipPasswordFormat.cs: New v2 file
+ * MembershipProviderCollection.cs: New v2 file
+ * MembershipSortOptions.cs: New v2 file
+ * MembershipUser.cs: New v2 file
+ * MembershipUserCollection.cs: New v2 file
+ * RoleManagerEventArgs.cs: New v2 file
+ * RoleManagerEventHandler.cs: New v2 file
+ * RoleManagerModule.cs: New v2 file
+ * RolePrincipal.cs: New v2 file
+ * RoleProviderCollection.cs: New v2 file
+ * Roles.cs: New v2 file
+ * SqlMembershipProvider.cs: New v2 file
+ * SqlRoleProvider.cs: New v2 file
+
+2003-11-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs: encoding updates.
+
+2003-10-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthenticationModule.cs: fixed for applications other than /.
+
+2003-08-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlAuthorizationModule.cs: fixed description for status code.
+
+2003-07-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthenticationModule.cs: really renew the ticket. Thanks to
+ Jens Thiel <Jens@Thiel.DE>.
+
+2003-02-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlAuthorizationModule.cs: tell the application not to run any other
+ step apart from EndRequest.
+
+2003-02-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs: implemented RedirectFromLoginPage and
+ GetRedirectUrl.
+
+ * FormsAuthenticationModule.cs: redirect to the login page when a 401
+ error happens.
+
+ * UrlAuthorizationModule.cs: check for valid user or render error page.
+
+2003-01-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultAuthenticationModule.cs: implemented. It just create a default
+ unauthenticated user when no one else provided one.
+
+ * FormsAuthenticationModule.cs: removed debug output.
+
+2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthenticationModule.cs: remove debug lines.
+
+2002-12-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs: return a null ticket when an exception is
+ thrown creating it. Implemented RenewTicketIfOld.
+
+ * FormsAuthenticationModule.cs: implemented event handlers for
+ AuthenticateRequest and EndRequest.
+
+ * FormsAuthenticationTicket.cs: implemented SetDates and Clone methods.
+
+2002-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs: implemented GetAuthCookie, SetAuthCookie,
+ SignOut, FormsCookieName and FormsCookiePath.
+
+2002-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs: implemented Authenticate, unencrypted Encrypt
+ and Decrypt, HashPasswordForStoringInConfigFile and Initialize.
+
+ * FormsAuthenticationTicket.cs: set cookiePath to the default when no
+ other provided.
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultAuthenticationEventHandler.cs:
+ * DefaultAuthenticationModule.cs:
+ * FileAuthorizationModule.cs:
+ * FormsAuthentication.cs:
+ * FormsAuthenticationEventArgs.cs:
+ * FormsAuthenticationEventHandler.cs:
+ * FormsAuthenticationModule.cs:
+ * FormsAuthenticationTicket.cs:
+ * FormsIdentity.cs:
+ * PassportAuthenticationEventArgs.cs:
+ * PassportAuthenticationEventHandler.cs:
+ * PassportAuthenticationModule.cs:
+ * PassportIdentity.cs:
+ * UrlAuthorizationModule.cs:
+ * WindowsAuthenticationEventArgs.cs:
+ * WindowsAuthenticationEventHandler.cs:
+ * WindowsAuthenticationModule.cs: new files. Some of them implemented,
+ some others stubbed out.
+
+2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultAuthenticationEventArgs.cs: added file.
+
diff --git a/mcs/class/System.Web/System.Web.Security/CookieProtection.cs b/mcs/class/System.Web/System.Web.Security/CookieProtection.cs
new file mode 100644
index 00000000000..b1f343045ed
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/CookieProtection.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.Security.CookieProtection
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+namespace System.Web.Security {
+ public enum CookieProtection {
+ None = 0,
+ Validation = 1,
+ Encryption = 2,
+ All = 3
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventArgs.cs b/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventArgs.cs
new file mode 100644
index 00000000000..650ddbf7447
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.Security.DefaultAuthenticationEventArgs
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.
+//
+
+namespace System.Web.Security {
+ using System;
+ using System.Web;
+
+public sealed class DefaultAuthenticationEventArgs : EventArgs
+{
+ private HttpContext _context;
+
+ public DefaultAuthenticationEventArgs (HttpContext context)
+ {
+ if (context == null)
+ throw new ArgumentNullException ("context");
+
+ _context = context;
+ }
+
+ public HttpContext Context
+ {
+ get { return _context; }
+ }
+}
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventHandler.cs b/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventHandler.cs
new file mode 100644
index 00000000000..c7982c7a482
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.Security.DefaultAuthenticationEventHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.
+//
+
+namespace System.Web.Security
+{
+ public delegate void DefaultAuthenticationEventHandler (object sender,
+ DefaultAuthenticationEventArgs e);
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationModule.cs b/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationModule.cs
new file mode 100644
index 00000000000..7efccce9771
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationModule.cs
@@ -0,0 +1,66 @@
+//
+// System.Web.Security.DefaultAuthenticationModule
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.Web;
+using System.Security.Principal;
+
+namespace System.Web.Security
+{
+ public sealed class DefaultAuthenticationModule : IHttpModule
+ {
+ static GenericIdentity defaultIdentity = new GenericIdentity ("", "");
+
+ public event DefaultAuthenticationEventHandler Authenticate;
+
+ public void Dispose ()
+ {
+ }
+
+ public void Init (HttpApplication app)
+ {
+ app.DefaultAuthentication += new EventHandler (OnDefaultAuthentication);
+ }
+
+ void OnDefaultAuthentication (object sender, EventArgs args)
+ {
+ HttpApplication app = (HttpApplication) sender;
+ HttpContext context = app.Context;
+
+ if (context.User == null && Authenticate != null)
+ Authenticate (this, new DefaultAuthenticationEventArgs (context));
+
+ if (context.User == null)
+ context.User = new GenericPrincipal (defaultIdentity, new string [0]);
+
+ app.SetPrincipal (context.User);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/FileAuthorizationModule.cs b/mcs/class/System.Web/System.Web.Security/FileAuthorizationModule.cs
new file mode 100644
index 00000000000..90357401165
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/FileAuthorizationModule.cs
@@ -0,0 +1,48 @@
+//
+// System.Web.Security.FileAuthorizationModule
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.Web;
+
+namespace System.Web.Security
+{
+ public sealed class FileAuthorizationModule : IHttpModule
+ {
+ public void Dispose ()
+ {
+ }
+
+ [MonoTODO]
+ public void Init (HttpApplication app)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs b/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs
new file mode 100644
index 00000000000..0bb04b34e17
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs
@@ -0,0 +1,463 @@
+//
+// System.Web.Security.FormsAuthentication
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
+// Copyright (c) 2005 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
+// "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;
+using System.Collections;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+using System.Web;
+using System.Web.Configuration;
+using System.Web.Util;
+
+namespace System.Web.Security
+{
+ public sealed class FormsAuthentication
+ {
+ const int MD5_hash_size = 16;
+ const int SHA1_hash_size = 20;
+
+ static string authConfigPath = "system.web/authentication";
+ static bool initialized;
+ static string cookieName;
+ static string cookiePath;
+ static int timeout;
+ static FormsProtectionEnum protection;
+ static object locker = new object ();
+ static byte [] init_vector; // initialization vector used for 3DES
+#if NET_1_1
+ static bool requireSSL;
+ static bool slidingExpiration;
+#endif
+
+ // same names and order used in xsp
+ static string [] indexFiles = { "index.aspx",
+ "Default.aspx",
+ "default.aspx",
+ "index.html",
+ "index.htm" };
+
+ public static bool Authenticate (string name, string password)
+ {
+ if (name == null || password == null)
+ return false;
+
+ Initialize ();
+ HttpContext context = HttpContext.Current;
+ if (context == null)
+ throw new HttpException ("Context is null!");
+
+ AuthConfig config = context.GetConfig (authConfigPath) as AuthConfig;
+ Hashtable users = config.CredentialUsers;
+ string stored = users [name] as string;
+ if (stored == null)
+ return false;
+
+ switch (config.PasswordFormat) {
+ case FormsAuthPasswordFormat.Clear:
+ /* Do nothing */
+ break;
+ case FormsAuthPasswordFormat.MD5:
+ password = HashPasswordForStoringInConfigFile (password, "MD5");
+ break;
+ case FormsAuthPasswordFormat.SHA1:
+ password = HashPasswordForStoringInConfigFile (password, "SHA1");
+ break;
+ }
+
+ return (password == stored);
+ }
+
+ static FormsAuthenticationTicket Decrypt2 (byte [] bytes)
+ {
+ if (protection == FormsProtectionEnum.None)
+ return FormsAuthenticationTicket.FromByteArray (bytes);
+
+ MachineKeyConfig config = HttpContext.GetAppConfig ("system.web/machineKey") as MachineKeyConfig;
+ bool all = (protection == FormsProtectionEnum.All);
+
+ byte [] result = bytes;
+ if (all || protection == FormsProtectionEnum.Encryption) {
+ ICryptoTransform decryptor;
+ decryptor = new TripleDESCryptoServiceProvider().CreateDecryptor (config.DecryptionKey192Bits, init_vector);
+ result = decryptor.TransformFinalBlock (bytes, 0, bytes.Length);
+ bytes = null;
+ }
+
+ if (all || protection == FormsProtectionEnum.Validation) {
+ int count;
+
+ if (config.ValidationType == MachineKeyValidation.MD5)
+ count = MD5_hash_size;
+ else
+ count = SHA1_hash_size; // 3DES and SHA1
+
+ byte [] vk = config.ValidationKey;
+ byte [] mix = new byte [result.Length - count + vk.Length];
+ Buffer.BlockCopy (result, 0, mix, 0, result.Length - count);
+ Buffer.BlockCopy (vk, 0, mix, result.Length - count, vk.Length);
+
+ byte [] hash = null;
+ switch (config.ValidationType) {
+ case MachineKeyValidation.MD5:
+ hash = MD5.Create ().ComputeHash (mix);
+ break;
+ // From MS docs: "When 3DES is specified, forms authentication defaults to SHA1"
+ case MachineKeyValidation.TripleDES:
+ case MachineKeyValidation.SHA1:
+ hash = SHA1.Create ().ComputeHash (mix);
+ break;
+ }
+
+ if (result.Length < count)
+ throw new ArgumentException ("Error validating ticket (length).", "encryptedTicket");
+
+ int i, k;
+ for (i = result.Length - count, k = 0; k < count; i++, k++) {
+ if (result [i] != hash [k])
+ throw new ArgumentException ("Error validating ticket.", "encryptedTicket");
+ }
+ }
+
+ return FormsAuthenticationTicket.FromByteArray (result);
+ }
+
+ public static FormsAuthenticationTicket Decrypt (string encryptedTicket)
+ {
+ if (encryptedTicket == null || encryptedTicket == String.Empty)
+ throw new ArgumentException ("Invalid encrypted ticket", "encryptedTicket");
+
+ Initialize ();
+
+ FormsAuthenticationTicket ticket;
+ byte [] bytes = MachineKeyConfig.GetBytes (encryptedTicket, encryptedTicket.Length);
+ try {
+ ticket = Decrypt2 (bytes);
+ } catch (Exception) {
+ ticket = null;
+ }
+
+ return ticket;
+ }
+
+ public static string Encrypt (FormsAuthenticationTicket ticket)
+ {
+ if (ticket == null)
+ throw new ArgumentNullException ("ticket");
+
+ Initialize ();
+ byte [] ticket_bytes = ticket.ToByteArray ();
+ if (protection == FormsProtectionEnum.None)
+ return GetHexString (ticket_bytes);
+
+ byte [] result = ticket_bytes;
+ MachineKeyConfig config = HttpContext.GetAppConfig ("system.web/machineKey") as MachineKeyConfig;
+ bool all = (protection == FormsProtectionEnum.All);
+ if (all || protection == FormsProtectionEnum.Validation) {
+ byte [] valid_bytes = null;
+ byte [] vk = config.ValidationKey;
+ byte [] mix = new byte [ticket_bytes.Length + vk.Length];
+ Buffer.BlockCopy (ticket_bytes, 0, mix, 0, ticket_bytes.Length);
+ Buffer.BlockCopy (vk, 0, mix, result.Length, vk.Length);
+
+ switch (config.ValidationType) {
+ case MachineKeyValidation.MD5:
+ valid_bytes = MD5.Create ().ComputeHash (mix);
+ break;
+ // From MS docs: "When 3DES is specified, forms authentication defaults to SHA1"
+ case MachineKeyValidation.TripleDES:
+ case MachineKeyValidation.SHA1:
+ valid_bytes = SHA1.Create ().ComputeHash (mix);
+ break;
+ }
+
+ int tlen = ticket_bytes.Length;
+ int vlen = valid_bytes.Length;
+ result = new byte [tlen + vlen];
+ Buffer.BlockCopy (ticket_bytes, 0, result, 0, tlen);
+ Buffer.BlockCopy (valid_bytes, 0, result, tlen, vlen);
+ }
+
+ if (all || protection == FormsProtectionEnum.Encryption) {
+ ICryptoTransform encryptor;
+ encryptor = new TripleDESCryptoServiceProvider().CreateEncryptor (config.DecryptionKey192Bits, init_vector);
+ result = encryptor.TransformFinalBlock (result, 0, result.Length);
+ }
+
+ return GetHexString (result);
+ }
+
+ public static HttpCookie GetAuthCookie (string userName, bool createPersistentCookie)
+ {
+ return GetAuthCookie (userName, createPersistentCookie, null);
+ }
+
+ public static HttpCookie GetAuthCookie (string userName, bool createPersistentCookie, string strCookiePath)
+ {
+ Initialize ();
+
+ if (userName == null)
+ userName = String.Empty;
+
+ if (strCookiePath == null || strCookiePath.Length == 0)
+ strCookiePath = cookiePath;
+
+ DateTime now = DateTime.Now;
+ DateTime then;
+ if (createPersistentCookie)
+ then = now.AddYears (50);
+ else
+ then = now.AddMinutes (timeout);
+
+ FormsAuthenticationTicket ticket = new FormsAuthenticationTicket (1,
+ userName,
+ now,
+ then,
+ createPersistentCookie,
+ String.Empty,
+ cookiePath);
+
+ if (!createPersistentCookie)
+ then = DateTime.MinValue;
+
+ return new HttpCookie (cookieName, Encrypt (ticket), strCookiePath, then);
+ }
+
+ public static string GetRedirectUrl (string userName, bool createPersistentCookie)
+ {
+ if (userName == null)
+ return null;
+
+ Initialize ();
+ HttpRequest request = HttpContext.Current.Request;
+ string returnUrl = request ["RETURNURL"];
+ if (returnUrl != null)
+ return returnUrl;
+
+ returnUrl = request.ApplicationPath;
+ string apppath = request.PhysicalApplicationPath;
+ bool found = false;
+
+ foreach (string indexFile in indexFiles) {
+ string filePath = Path.Combine (apppath, indexFile);
+ if (File.Exists (filePath)) {
+ returnUrl = UrlUtils.Combine (returnUrl, indexFile);
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ returnUrl = UrlUtils.Combine (returnUrl, "index.aspx");
+
+ return returnUrl;
+ }
+
+ static string GetHexString (string str)
+ {
+ return GetHexString (Encoding.UTF8.GetBytes (str));
+ }
+
+ static string GetHexString (byte [] bytes)
+ {
+ StringBuilder result = new StringBuilder (bytes.Length * 2);
+ foreach (byte b in bytes)
+ result.AppendFormat ("{0:X2}", (int) b);
+
+ return result.ToString ();
+ }
+
+ public static string HashPasswordForStoringInConfigFile (string password, string passwordFormat)
+ {
+ if (password == null)
+ throw new ArgumentNullException ("password");
+
+ if (passwordFormat == null)
+ throw new ArgumentNullException ("passwordFormat");
+
+ byte [] bytes;
+ if (String.Compare (passwordFormat, "MD5", true) == 0) {
+ bytes = MD5.Create ().ComputeHash (Encoding.UTF8.GetBytes (password));
+ } else if (String.Compare (passwordFormat, "SHA1", true) == 0) {
+ bytes = SHA1.Create ().ComputeHash (Encoding.UTF8.GetBytes (password));
+ } else {
+ throw new ArgumentException ("The format must be either MD5 or SHA1", "passwordFormat");
+ }
+
+ return GetHexString (bytes);
+ }
+
+ public static void Initialize ()
+ {
+ if (initialized)
+ return;
+
+ lock (locker) {
+ if (initialized)
+ return;
+
+ HttpContext context = HttpContext.Current;
+ if (context == null)
+ throw new HttpException ("Context is null!");
+
+ AuthConfig authConfig = context.GetConfig (authConfigPath) as AuthConfig;
+ if (authConfig != null) {
+ cookieName = authConfig.CookieName;
+ timeout = authConfig.Timeout;
+ cookiePath = authConfig.CookiePath;
+ protection = authConfig.Protection;
+#if NET_1_1
+ requireSSL = authConfig.RequireSSL;
+ slidingExpiration = authConfig.SlidingExpiration;
+#endif
+ } else {
+ cookieName = ".MONOAUTH";
+ timeout = 30;
+ cookiePath = "/";
+ protection = FormsProtectionEnum.All;
+#if NET_1_1
+ slidingExpiration = true;
+#endif
+ }
+
+ // IV is 8 bytes long for 3DES
+ init_vector = new byte [8];
+ int len = cookieName.Length;
+ for (int i = 0; i < 8; i++) {
+ if (i >= len)
+ break;
+
+ init_vector [i] = (byte) cookieName [i];
+ }
+
+ initialized = true;
+ }
+ }
+
+ public static void RedirectFromLoginPage (string userName, bool createPersistentCookie)
+ {
+ RedirectFromLoginPage (userName, createPersistentCookie, null);
+ }
+
+ public static void RedirectFromLoginPage (string userName, bool createPersistentCookie, string strCookiePath)
+ {
+ if (userName == null)
+ return;
+
+ Initialize ();
+ SetAuthCookie (userName, createPersistentCookie, strCookiePath);
+ HttpResponse resp = HttpContext.Current.Response;
+ resp.Redirect (GetRedirectUrl (userName, createPersistentCookie), false);
+ }
+
+ public static FormsAuthenticationTicket RenewTicketIfOld (FormsAuthenticationTicket tOld)
+ {
+ if (tOld == null)
+ return null;
+
+ DateTime now = DateTime.Now;
+ TimeSpan toIssue = now - tOld.IssueDate;
+ TimeSpan toExpiration = tOld.Expiration - now;
+ if (toExpiration > toIssue)
+ return tOld;
+
+ FormsAuthenticationTicket tNew = tOld.Clone ();
+ tNew.SetDates (now, now + (tOld.Expiration - tOld.IssueDate));
+ return tNew;
+ }
+
+ public static void SetAuthCookie (string userName, bool createPersistentCookie)
+ {
+ Initialize ();
+ SetAuthCookie (userName, createPersistentCookie, cookiePath);
+ }
+
+ public static void SetAuthCookie (string userName, bool createPersistentCookie, string strCookiePath)
+ {
+ HttpContext context = HttpContext.Current;
+ if (context == null)
+ throw new HttpException ("Context is null!");
+
+ HttpResponse response = context.Response;
+ if (response == null)
+ throw new HttpException ("Response is null!");
+
+ response.Cookies.Add (GetAuthCookie (userName, createPersistentCookie, strCookiePath));
+ }
+
+ public static void SignOut ()
+ {
+ Initialize ();
+
+ HttpContext context = HttpContext.Current;
+ if (context == null)
+ throw new HttpException ("Context is null!");
+
+ HttpResponse response = context.Response;
+ if (response == null)
+ throw new HttpException ("Response is null!");
+
+ response.Cookies.MakeCookieExpire (cookieName, cookiePath);
+ }
+
+ public static string FormsCookieName
+ {
+ get {
+ Initialize ();
+ return cookieName;
+ }
+ }
+
+ public static string FormsCookiePath
+ {
+ get {
+ Initialize ();
+ return cookiePath;
+ }
+ }
+#if NET_1_1
+ public static bool RequireSSL {
+ get {
+ Initialize ();
+ return requireSSL;
+ }
+ }
+
+ public static bool SlidingExpiration {
+ get {
+ Initialize ();
+ return slidingExpiration;
+ }
+ }
+#endif
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventArgs.cs b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventArgs.cs
new file mode 100644
index 00000000000..3474e18f241
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventArgs.cs
@@ -0,0 +1,66 @@
+//
+// System.Web.Security.FormsAuthenticationEventArgs
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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;
+using System.Security.Principal;
+using System.Web;
+
+namespace System.Web.Security
+{
+ public sealed class FormsAuthenticationEventArgs : EventArgs
+ {
+ IPrincipal user;
+ HttpContext context;
+
+ public FormsAuthenticationEventArgs (HttpContext context)
+ {
+ this.context = context;
+ }
+
+ public HttpContext Context
+ {
+ get {
+ return context;
+ }
+ }
+
+ public IPrincipal User
+ {
+ get {
+ return user;
+ }
+
+ set {
+ user = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventHandler.cs b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventHandler.cs
new file mode 100644
index 00000000000..710aa55ad1b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventHandler.cs
@@ -0,0 +1,35 @@
+//
+// System.Web.Security.FormsAuthenticationEventHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.
+//
+
+namespace System.Web.Security
+{
+ public delegate void FormsAuthenticationEventHandler (object sender, FormsAuthenticationEventArgs e);
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs
new file mode 100644
index 00000000000..5cfa8c2901d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs
@@ -0,0 +1,121 @@
+//
+// System.Web.Security.FormsAuthenticationModule
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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;
+using System.Security.Principal;
+using System.Text;
+using System.Web;
+using System.Web.Configuration;
+using System.Web.Util;
+
+namespace System.Web.Security
+{
+ public sealed class FormsAuthenticationModule : IHttpModule
+ {
+ public void Dispose ()
+ {
+ }
+
+ public void Init (HttpApplication app)
+ {
+ app.AuthenticateRequest += new EventHandler (OnAuthenticateRequest);
+ app.EndRequest += new EventHandler (OnEndRequest);
+ }
+
+ void OnAuthenticateRequest (object sender, EventArgs args)
+ {
+ HttpApplication app = (HttpApplication) sender;
+ HttpContext context = app.Context;
+ AuthConfig config = (AuthConfig) context.GetConfig ("system.web/authentication");
+ if (config.Mode != AuthenticationMode.Forms) {
+ return;
+ }
+
+ string cookieName = config.CookieName;
+ string cookiePath = config.CookiePath;
+ string loginPage = config.LoginUrl;
+
+ string reqPath = context.Request.PhysicalPath;
+ string loginPath = context.Request.MapPath (loginPage);
+ context.SkipAuthorization = (reqPath == loginPath);
+
+ FormsAuthenticationEventArgs formArgs = new FormsAuthenticationEventArgs (context);
+ if (Authenticate != null)
+ Authenticate (this, formArgs);
+
+ bool contextUserNull = (context.User == null);
+ if (formArgs.User != null || !contextUserNull) {
+ if (contextUserNull)
+ context.User = formArgs.User;
+ return;
+ }
+
+ HttpCookie cookie = context.Request.Cookies [cookieName];
+ if (cookie == null || (cookie.Expires != DateTime.MinValue && cookie.Expires < DateTime.Now))
+ return;
+
+ FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt (cookie.Value);
+ if (ticket == null || (ticket.IsPersistent && ticket.Expired))
+ return;
+
+ if (config.SlidingExpiration)
+ ticket = FormsAuthentication.RenewTicketIfOld (ticket);
+
+ context.User = new GenericPrincipal (new FormsIdentity (ticket), new string [0]);
+
+ cookie.Value = FormsAuthentication.Encrypt (ticket);
+ cookie.Path = cookiePath;
+ if (ticket.IsPersistent)
+ cookie.Expires = ticket.Expiration;
+
+ context.Response.Cookies.Add (cookie);
+ }
+
+ void OnEndRequest (object sender, EventArgs args)
+ {
+ HttpApplication app = (HttpApplication) sender;
+ HttpContext context = app.Context;
+ if (context.Response.StatusCode != 401 || context.Request.QueryString ["ReturnUrl"] != null)
+ return;
+
+ AuthConfig config = (AuthConfig) context.GetConfig ("system.web/authentication");
+ if (config.Mode != AuthenticationMode.Forms)
+ return;
+
+ StringBuilder login = new StringBuilder ();
+ login.Append (UrlUtils.Combine (context.Request.ApplicationPath, config.LoginUrl));
+ login.AppendFormat ("?ReturnUrl={0}", HttpUtility.UrlEncode (context.Request.RawUrl));
+ context.Response.Redirect (login.ToString ());
+ }
+
+ public event FormsAuthenticationEventHandler Authenticate;
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/FormsAuthenticationTicket.cs b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationTicket.cs
new file mode 100644
index 00000000000..cb108d98c40
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationTicket.cs
@@ -0,0 +1,208 @@
+//
+// System.Web.Security.FormsAuthenticationTicket
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+// Copyright (c) 2005 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
+// "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;
+using System.IO;
+
+namespace System.Web.Security
+{
+ [Serializable]
+ public sealed class FormsAuthenticationTicket
+ {
+ int version;
+ bool persistent;
+ DateTime issue_date;
+ DateTime expiration;
+ string name;
+ string cookie_path;
+ string user_data;
+
+ /*
+ internal void ToStr ()
+ {
+ Console.WriteLine ("version: {0}", version);
+ Console.WriteLine ("persistent: {0}", persistent);
+ Console.WriteLine ("issue_date: {0}", issue_date);
+ Console.WriteLine ("expiration: {0}", expiration);
+ Console.WriteLine ("name: {0}", name);
+ Console.WriteLine ("cookie_path: {0}", cookie_path);
+ Console.WriteLine ("user_data: {0}", user_data);
+ }
+ */
+
+ internal byte [] ToByteArray ()
+ {
+ MemoryStream ms = new MemoryStream ();
+ BinaryWriter writer = new BinaryWriter (ms);
+ writer.Write (version);
+ writer.Write (persistent);
+ writer.Write (issue_date.Ticks);
+ writer.Write (expiration.Ticks);
+ writer.Write (name != null);
+ if (name != null)
+ writer.Write (name);
+
+ writer.Write (cookie_path != null);
+ if (cookie_path != null)
+ writer.Write (cookie_path);
+
+ writer.Write (user_data != null);
+ if (user_data != null)
+ writer.Write (user_data);
+
+ writer.Flush ();
+ return ms.ToArray ();
+ }
+
+ internal static FormsAuthenticationTicket FromByteArray (byte [] bytes)
+ {
+ MemoryStream ms = new MemoryStream (bytes);
+ BinaryReader reader = new BinaryReader (ms);
+ FormsAuthenticationTicket ticket = new FormsAuthenticationTicket ();
+ ticket.version = reader.ReadInt32 ();
+ ticket.persistent = reader.ReadBoolean ();
+ ticket.issue_date = new DateTime (reader.ReadInt64 ());
+ ticket.expiration = new DateTime (reader.ReadInt64 ());
+ if (reader.ReadBoolean ())
+ ticket.name = reader.ReadString ();
+
+ if (reader.ReadBoolean ())
+ ticket.cookie_path = reader.ReadString ();
+
+ if (reader.ReadBoolean ())
+ ticket.user_data = reader.ReadString ();
+
+ return ticket;
+ }
+
+ private FormsAuthenticationTicket ()
+ {
+ }
+
+ public FormsAuthenticationTicket (int version,
+ string name,
+ DateTime issueDate,
+ DateTime expiration,
+ bool isPersistent,
+ string userData)
+ {
+ this.version = version;
+ this.name = name;
+ this.issue_date = issueDate;
+ this.expiration = expiration;
+ this.persistent = isPersistent;
+ this.user_data = userData;
+ this.cookie_path = "/";
+ }
+
+ public FormsAuthenticationTicket (int version,
+ string name,
+ DateTime issueDate,
+ DateTime expiration,
+ bool isPersistent,
+ string userData,
+ string cookiePath)
+ {
+ this.version = version;
+ this.name = name;
+ this.issue_date = issueDate;
+ this.expiration = expiration;
+ this.persistent = isPersistent;
+ this.user_data = userData;
+ this.cookie_path = cookiePath;
+ }
+
+ public FormsAuthenticationTicket (string name, bool isPersistent, int timeout)
+ {
+ this.version = 1;
+ this.name = name;
+ this.issue_date = DateTime.Now;
+ this.persistent = isPersistent;
+ if (persistent)
+ expiration = issue_date.AddYears (50);
+ else
+ expiration = issue_date.AddMinutes ((double) timeout);
+
+ this.user_data = "";
+ this.cookie_path = "/";
+ }
+
+ internal void SetDates (DateTime issue_date, DateTime expiration)
+ {
+ this.issue_date = issue_date;
+ this.expiration = expiration;
+ }
+
+ internal FormsAuthenticationTicket Clone ()
+ {
+ return new FormsAuthenticationTicket (version,
+ name,
+ issue_date,
+ expiration,
+ persistent,
+ user_data,
+ cookie_path);
+ }
+
+ public string CookiePath {
+ get { return cookie_path; }
+ }
+
+ public DateTime Expiration {
+ get { return expiration; }
+ }
+
+ public bool Expired {
+ get { return DateTime.Now > expiration; }
+ }
+
+ public bool IsPersistent {
+ get { return persistent; }
+ }
+
+ public DateTime IssueDate {
+ get { return issue_date; }
+ }
+
+ public string Name {
+ get { return name; }
+ }
+
+ public string UserData {
+ get { return user_data; }
+ }
+
+ public int Version {
+ get { return version; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/FormsIdentity.cs b/mcs/class/System.Web/System.Web.Security/FormsIdentity.cs
new file mode 100644
index 00000000000..43e2846ae23
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/FormsIdentity.cs
@@ -0,0 +1,75 @@
+//
+// System.Web.Security.FormsIdentity
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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;
+using System.Security.Principal;
+
+namespace System.Web.Security
+{
+ [Serializable]
+ public sealed class FormsIdentity : IIdentity
+ {
+ FormsAuthenticationTicket ticket;
+
+ public FormsIdentity (FormsAuthenticationTicket ticket)
+ {
+ this.ticket = ticket;
+ }
+
+ public string AuthenticationType
+ {
+ get {
+ return "Forms";
+ }
+ }
+
+ public bool IsAuthenticated
+ {
+ get {
+ return true;
+ }
+ }
+
+ public string Name
+ {
+ get {
+ return ticket.Name;
+ }
+ }
+
+ public FormsAuthenticationTicket Ticket
+ {
+ get {
+ return ticket;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/Membership.cs b/mcs/class/System.Web/System.Web.Security/Membership.cs
new file mode 100644
index 00000000000..c272ef26890
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/Membership.cs
@@ -0,0 +1,162 @@
+//
+// System.Web.Security.Membership
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.Security {
+ public sealed class Membership {
+
+ private Membership () {}
+
+ public static MembershipUser CreateUser (string username, string password)
+ {
+ return CreateUser (username, password, null);
+ }
+
+ public static MembershipUser CreateUser (string username, string password, string email)
+ {
+ MembershipCreateStatus status;
+ MembershipUser usr = CreateUser (username, password, email, null, null, true, out status);
+ if (usr == null)
+ throw new MembershipCreateUserException (status);
+
+ return usr;
+ }
+
+ public static MembershipUser CreateUser (string username, string password, string email, string pwdQuestion, string pwdAnswer, bool isApproved, out MembershipCreateStatus status)
+ {
+ return Provider.CreateUser (username, password, email, pwdQuestion, pwdAnswer, isApproved, out status);
+ }
+
+ public static bool DeleteUser (string username)
+ {
+ return Provider.DeleteUser (username, true);
+ }
+
+ public static bool DeleteUser (string username, bool deleteAllRelatedData)
+ {
+ return Provider.DeleteUser (username, deleteAllRelatedData);
+ }
+
+ [MonoTODO]
+ public static string GeneratePassword (int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static MembershipUserCollection GetAllUsers ()
+ {
+ int total;
+ return GetAllUsers (1, int.MaxValue, out total);
+ }
+
+ public static MembershipUserCollection GetAllUsers (int pageIndex, int pageSize, out int totalRecords)
+ {
+ return Provider.GetAllUsers (pageIndex, pageSize, out totalRecords);
+ }
+
+ public static int GetNumberOfUsersOnline ()
+ {
+ return Provider.GetNumberOfUsersOnline ();
+ }
+
+ public static MembershipUser GetUser ()
+ {
+ return GetUser (HttpContext.Current.User.Identity.Name, true);
+ }
+
+ public static MembershipUser GetUser (bool userIsOnline)
+ {
+ return GetUser (HttpContext.Current.User.Identity.Name, userIsOnline);
+ }
+
+ public static MembershipUser GetUser (string username)
+ {
+ return GetUser (username, false);
+ }
+
+ public static MembershipUser GetUser (string username, bool userIsOnline)
+ {
+ return Provider.GetUser (username, userIsOnline);
+ }
+
+ public static string GetUserNameByEmail (string email)
+ {
+ return Provider.GetUserNameByEmail (email);
+ }
+
+ public static void UpdateUser (MembershipUser user)
+ {
+ Provider.UpdateUser (user);
+ }
+
+ public static bool ValidateUser (string username, string password)
+ {
+ return Provider.ValidateUser (username, password);
+ }
+
+ public static string ApplicationName {
+ get { return Provider.ApplicationName; }
+ set { Provider.ApplicationName = value; }
+ }
+
+ public static bool EnablePasswordReset {
+ get { return Provider.EnablePasswordReset; }
+ }
+
+ public static bool EnablePasswordRetrieval {
+ get { return Provider.EnablePasswordRetrieval; }
+ }
+
+ public static bool RequiresQuestionAndAnswer {
+ get { return Provider.RequiresQuestionAndAnswer; }
+ }
+
+ [MonoTODO]
+ public static MembershipProvider Provider {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static MembershipProviderCollection Providers {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static int UserIsOnlineTimeWindow {
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/MembershipCreateStatus.cs b/mcs/class/System.Web/System.Web.Security/MembershipCreateStatus.cs
new file mode 100644
index 00000000000..e2fecc94edd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/MembershipCreateStatus.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.Security.MembershipCreateStatus
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+namespace System.Web.Security {
+ public enum MembershipCreateStatus {
+ Success = 0,
+ UserNotFound = 1,
+ InvalidPassword = 2,
+ InvalidQuestion = 3,
+ InvalidAnswer = 4,
+ InvalidEmail = 5,
+ DuplicateUsername = 6,
+ DuplicateEmail = 7,
+ UserRejected = 8,
+ ProviderError = 9
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/MembershipCreateUserException.cs b/mcs/class/System.Web/System.Web.Security/MembershipCreateUserException.cs
new file mode 100644
index 00000000000..d2fc4ec0558
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/MembershipCreateUserException.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.Security.MembershipCreateUserException
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+namespace System.Web.Security {
+ [MonoTODO ("make strings for the messages")]
+ public class MembershipCreateUserException : HttpException {
+ public MembershipCreateUserException (MembershipCreateStatus statusCode) : base (statusCode.ToString ())
+ {
+ this.statusCode = statusCode;
+ }
+
+ MembershipCreateStatus statusCode;
+ public MembershipCreateStatus StatusCode {
+ get { return statusCode; }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/MembershipOnlineStatus.cs b/mcs/class/System.Web/System.Web.Security/MembershipOnlineStatus.cs
new file mode 100644
index 00000000000..8467cc2c374
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/MembershipOnlineStatus.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.Security.MembershipOnlineStatus
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+namespace System.Web.Security {
+ public enum MembershipOnlineStatus {
+ All = 0,
+ Online = 1,
+ Offline = 2
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/MembershipPasswordException.cs b/mcs/class/System.Web/System.Web.Security/MembershipPasswordException.cs
new file mode 100644
index 00000000000..767a46a9594
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/MembershipPasswordException.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.Security.MembershipPasswordException
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+namespace System.Web.Security {
+ public class MembershipPasswordException : HttpException {
+ public MembershipPasswordException () : base () {}
+ public MembershipPasswordException (string message) : base (message) {}
+ public MembershipPasswordException (string message, Exception innerException) : base (message, innerException) {}
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/MembershipPasswordFormat.cs b/mcs/class/System.Web/System.Web.Security/MembershipPasswordFormat.cs
new file mode 100644
index 00000000000..af501fd133f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/MembershipPasswordFormat.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.Security.MembershipPasswordFormat
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+namespace System.Web.Security {
+ public enum MembershipPasswordFormat {
+ Clear = 0,
+ Hashed = 1,
+ Encrypted = 2
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/MembershipProvider.cs b/mcs/class/System.Web/System.Web.Security/MembershipProvider.cs
new file mode 100644
index 00000000000..80a92d44586
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/MembershipProvider.cs
@@ -0,0 +1,64 @@
+//
+// System.Web.Security.IMembershipProvider
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Configuration.Provider;
+
+namespace System.Web.Security
+{
+ public abstract class MembershipProvider : ProviderBase
+ {
+ protected MembershipProvider ()
+ {
+ }
+
+ public abstract bool ChangePassword (string name, string oldPwd, string newPwd);
+ public abstract bool ChangePasswordQuestionAndAnswer (string name, string password, string newPwdQuestion, string newPwdAnswer);
+ public abstract MembershipUser CreateUser (string username, string password, string email, string pwdQuestion, string pwdAnswer, bool isApproved, out MembershipCreateStatus status);
+ public abstract bool DeleteUser (string name, bool deleteAllRelatedData);
+ public abstract MembershipUserCollection FindUsersByEmail (string emailToMatch, int pageIndex, int pageSize, out int totalRecords);
+ public abstract MembershipUserCollection FindUsersByName (string nameToMatch, int pageIndex, int pageSize, out int totalRecords);
+ public abstract MembershipUserCollection GetAllUsers (int pageIndex, int pageSize, out int totalRecords);
+ public abstract int GetNumberOfUsersOnline ();
+ public abstract string GetPassword (string name, string answer);
+ public abstract MembershipUser GetUser (string name, bool userIsOnline);
+ public abstract string GetUserNameByEmail (string email);
+ public abstract string ResetPassword (string name, string answer);
+ public abstract void UpdateUser (MembershipUser user);
+ public abstract bool ValidateUser (string name, string password);
+ public abstract string ApplicationName { get; set; }
+ public abstract bool EnablePasswordReset { get; }
+ public abstract bool EnablePasswordRetrieval { get; }
+ public abstract bool RequiresQuestionAndAnswer { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/MembershipProviderCollection.cs b/mcs/class/System.Web/System.Web.Security/MembershipProviderCollection.cs
new file mode 100644
index 00000000000..28748fe6e69
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/MembershipProviderCollection.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.Security.MembershipProviderCollection
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Configuration.Provider;
+
+namespace System.Web.Security {
+ public class MembershipProviderCollection : ProviderCollection {
+ public override void Add (ProviderBase provider)
+ {
+ if (provider is MembershipProvider)
+ base.Add (provider);
+ else
+ throw new HttpException ();
+ }
+
+ public new MembershipProvider this [string name] {
+ get { return (MembershipProvider) base [name]; }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/MembershipSortOptions.cs b/mcs/class/System.Web/System.Web.Security/MembershipSortOptions.cs
new file mode 100644
index 00000000000..c170f51fbbf
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/MembershipSortOptions.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.Security.MembershipSortOptions
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+namespace System.Web.Security {
+ public enum MembershipSortOptions {
+ UserName = 0,
+ CreationDate = 1,
+ LastActivityDate = 2,
+ LastLoginDate = 3,
+ LastPasswordChangeDate = 4,
+ Email = 5
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/MembershipUser.cs b/mcs/class/System.Web/System.Web.Security/MembershipUser.cs
new file mode 100644
index 00000000000..e2d3a93feea
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/MembershipUser.cs
@@ -0,0 +1,162 @@
+//
+// System.Web.Security.MembershipUser
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+namespace System.Web.Security {
+ public class MembershipUser {
+ protected MembershipUser ()
+ {
+ }
+
+ public MembershipUser (MembershipProvider provider, string name, string email,
+ string passwordQuestion, string comment, bool isApproved,
+ DateTime creationDate, DateTime lastLoginDate, DateTime lastActivityDate,
+ DateTime lastPasswordChangedDate)
+ {
+ this.provider = provider;
+ this.name = name;
+ this.email = email;
+ this.passwordQuestion = passwordQuestion;
+ this.comment = comment;
+ this.isApproved = isApproved;
+ this.creationDate = creationDate;
+ this.lastLoginDate = lastLoginDate;
+ this.lastActivityDate = lastActivityDate;
+ this.lastPasswordChangedDate = lastPasswordChangedDate;
+ }
+
+ public virtual bool ChangePassword (string oldPassword, string newPassword)
+ {
+ bool success = Provider.ChangePassword (Username, oldPassword, newPassword);
+ if (success)
+ LastPasswordChangedDate = DateTime.Now;
+
+ return success;
+ }
+
+ public virtual bool ChangePasswordQuestionAndAnswer (string password, string newPasswordQuestion, string newPasswordAnswer)
+ {
+ bool success = Provider.ChangePasswordQuestionAndAnswer (Username, password, newPasswordQuestion, newPasswordAnswer);
+ if (success)
+ passwordQuestion = newPasswordQuestion;
+
+ return success;
+ }
+
+ public virtual string GetPassword ()
+ {
+ return GetPassword (null);
+ }
+
+ public virtual string GetPassword (string answer)
+ {
+ return Provider.GetPassword (Username, answer);
+ }
+
+ public virtual string ResetPassword ()
+ {
+ return ResetPassword (null);
+ }
+
+ public virtual string ResetPassword (string answer)
+ {
+ string newPass = Provider.ResetPassword (Username, answer);
+ if (newPass != null)
+ LastPasswordChangedDate = DateTime.Now;
+
+ return newPass;
+ }
+
+ public virtual string Comment {
+ get { return comment; }
+ set { comment = value; }
+ }
+
+ public virtual DateTime CreationDate {
+ get { return creationDate; }
+ set { creationDate = value; }
+ }
+
+ public virtual string Email {
+ get { return email; }
+ set { email = value; }
+ }
+
+ public virtual bool IsApproved {
+ get { return isApproved; }
+ set { isApproved = value; }
+ }
+
+ [MonoTODO]
+ public bool IsOnline {
+ get { throw new NotImplementedException (); }
+ }
+
+ public virtual DateTime LastActivityDate {
+ get { return lastActivityDate; }
+ set { lastActivityDate = value; }
+ }
+
+ public virtual DateTime LastLoginDate {
+ get { return lastLoginDate; }
+ set { lastLoginDate = value; }
+ }
+
+ public virtual DateTime LastPasswordChangedDate {
+ get { return lastPasswordChangedDate; }
+ set { lastPasswordChangedDate = value; }
+ }
+
+ public virtual string PasswordQuestion {
+ get { return passwordQuestion; }
+ }
+
+ public virtual MembershipProvider Provider {
+ get { return provider; }
+ }
+
+ public virtual string Username {
+ get { return name; }
+ }
+
+ MembershipProvider provider;
+ string name;
+ string email;
+ string passwordQuestion;
+ string comment;
+ bool isApproved;
+ DateTime creationDate;
+ DateTime lastLoginDate;
+ DateTime lastActivityDate;
+ DateTime lastPasswordChangedDate;
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/MembershipUserCollection.cs b/mcs/class/System.Web/System.Web.Security/MembershipUserCollection.cs
new file mode 100644
index 00000000000..f754de1f980
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/MembershipUserCollection.cs
@@ -0,0 +1,109 @@
+//
+// System.Web.Security.MembershipUserCollection
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Web.UI;
+
+namespace System.Web.Security {
+ public class MembershipUserCollection : ICloneable, ICollection {
+ public MembershipUserCollection ()
+ {
+ }
+
+ public void Add (MembershipUser user)
+ {
+ CheckNotReadOnly ();
+ store.Add (user.Username, user);
+ }
+
+ public void Clear ()
+ {
+ CheckNotReadOnly ();
+ store.Clear ();
+ }
+
+ public object Clone ()
+ {
+ MembershipUserCollection clone = new MembershipUserCollection ();
+ foreach (MembershipUser u in this)
+ clone.Add (u);
+ return clone;
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ store.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return ((IEnumerable) store).GetEnumerator ();
+ }
+
+ public void Remove (string name)
+ {
+ CheckNotReadOnly ();
+ store.Remove (name);
+ }
+
+ public void SetReadOnly ()
+ {
+ readOnly = true;
+ }
+
+ public int Count {
+ get { return store.Count; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public MembershipUser this [string name] {
+ get { return (MembershipUser) store [name]; }
+ }
+
+ public object SyncRoot {
+ get { return this; }
+ }
+
+ void CheckNotReadOnly ()
+ {
+ if (readOnly)
+ throw new InvalidOperationException ();
+ }
+
+ KeyedList store = new KeyedList ();
+ bool readOnly = false;
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventArgs.cs b/mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventArgs.cs
new file mode 100644
index 00000000000..d8543dead74
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventArgs.cs
@@ -0,0 +1,75 @@
+//
+// System.Web.Security.PassportAuthenticationEventArgs
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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;
+using System.Security.Principal;
+using System.Web;
+
+namespace System.Web.Security
+{
+ public sealed class PassportAuthenticationEventArgs : EventArgs
+ {
+ PassportIdentity identity;
+ HttpContext context;
+ IPrincipal user;
+
+ public PassportAuthenticationEventArgs (PassportIdentity identity, HttpContext context)
+ {
+ this.identity = identity;
+ this.context = context;
+ }
+
+ public HttpContext Context
+ {
+ get {
+ return context;
+ }
+ }
+
+ public PassportIdentity Identity
+ {
+ get {
+ return identity;
+ }
+ }
+
+ public IPrincipal User
+ {
+ get {
+ return user;
+ }
+
+ set {
+ user = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventHandler.cs b/mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventHandler.cs
new file mode 100644
index 00000000000..777a0c22240
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.Security.PassportAuthenticationEventHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.
+//
+
+namespace System.Web.Security
+{
+ public delegate void PassportAuthenticationEventHandler (object sender,
+ PassportAuthenticationEventArgs e);
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/PassportAuthenticationModule.cs b/mcs/class/System.Web/System.Web.Security/PassportAuthenticationModule.cs
new file mode 100644
index 00000000000..21646f3c2f3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/PassportAuthenticationModule.cs
@@ -0,0 +1,52 @@
+//
+// System.Web.Security.PassportAuthenticationModule
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.Web;
+
+namespace System.Web.Security
+{
+ public sealed class PassportAuthenticationModule : IHttpModule
+ {
+ public event PassportAuthenticationEventHandler Authenticate;
+
+ public void Dispose ()
+ {
+ if (Authenticate != null)
+ Authenticate = null;
+ }
+
+ [MonoTODO("Will we ever implement this? :-)")]
+ public void Init (HttpApplication app)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/PassportIdentity.cs b/mcs/class/System.Web/System.Web.Security/PassportIdentity.cs
new file mode 100644
index 00000000000..df27fdda89f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/PassportIdentity.cs
@@ -0,0 +1,489 @@
+//
+// System.Web.Security.PassportIdentity.cs
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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;
+using System.Security.Principal;
+
+namespace System.Web.Security
+{
+ public sealed class PassportIdentity : IIdentity
+ {
+ [MonoTODO]
+ public PassportIdentity ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ ~PassportIdentity ()
+ {
+ }
+
+ public string AuthUrl ()
+ {
+ return AuthUrl (null, -1, -1, null, -1, null, -1, -1);
+ }
+
+#if (!NET_1_0)
+ public string AuthUrl (String strReturnUrl)
+ {
+ return AuthUrl (strReturnUrl, -1, -1, null, -1, null, -1, -1);
+ }
+#endif
+
+ public string AuthUrl (string strReturnUrl,
+ int iTimeWindow,
+ bool fForceLogin,
+ string strCoBrandedArgs,
+ int iLangID,
+ string strNameSpace,
+ int iKPP,
+ bool bUseSecureAuth)
+ {
+ return AuthUrl (strReturnUrl, iTimeWindow, (fForceLogin ? 1 : 0), strCoBrandedArgs, iLangID, strNameSpace, iKPP, (bUseSecureAuth ? 1 : 0));
+ }
+
+ [MonoTODO]
+ public string AuthUrl (string strReturnUrl,
+ int iTimeWindow,
+ int iForceLogin,
+ string strCoBrandedArgs,
+ int iLangID,
+ string strNameSpace,
+ int iKPP,
+ int iUseSecureAuth)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string AuthUrl2 ()
+ {
+ return AuthUrl2 (null, -1, -1, null, -1, null, -1, -1);
+ }
+
+#if (!NET_1_0)
+ public string AuthUrl2 (String strReturnUrl)
+ {
+ return AuthUrl2 (strReturnUrl, -1, -1, null, -1, null, -1, -1);
+ }
+#endif
+
+ public string AuthUrl2 (string strReturnUrl,
+ int iTimeWindow,
+ bool fForceLogin,
+ string strCoBrandedArgs,
+ int iLangID,
+ string strNameSpace,
+ int iKPP,
+ bool bUseSecureAuth)
+ {
+ return AuthUrl2 (strReturnUrl, iTimeWindow, (fForceLogin ? 1 : 0), strCoBrandedArgs, iLangID, strNameSpace, iKPP, (bUseSecureAuth ? 1 : 0));
+ }
+
+ [MonoTODO]
+ public string AuthUrl2 (string strReturnUrl,
+ int iTimeWindow,
+ int iForceLogin,
+ string strCoBrandedArgs,
+ int iLangID,
+ string strNameSpace,
+ int iKPP,
+ int iUseSecureAuth)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string Compress (string strData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool CryptIsValid ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static int CryptPutHost (string strHost)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static int CryptPutSite (string strSite)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string Decompress (string strData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string Decrypt (string strData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string Encrypt (string strData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetCurrentConfig (string strAttribute)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetDomainAttribute (string strAttribute, int iLCID, string strDomain)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetDomainFromMemberName (string strMemberName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public bool GetIsAuthenticated (int iTimeWindow, bool bForceLogin, bool bCheckSecure)
+ {
+ return this.GetIsAuthenticated (iTimeWindow, (bForceLogin ? 1 : 0), (bCheckSecure ? 1 : 0));
+ }
+
+ [MonoTODO]
+ public bool GetIsAuthenticated (int iTimeWindow, int iForceLogin, int iCheckSecure)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string GetLoginChallenge ()
+ {
+ return GetLoginChallenge (null, -1, -1, null, -1, null, -1, -1, null);
+ }
+
+#if (!NET_1_0)
+ public string GetLoginChallenge (String strReturnUrl)
+ {
+ return GetLoginChallenge (strReturnUrl, -1, -1, null, -1, null, -1, -1, null);
+ }
+#endif
+
+ [MonoTODO]
+ public string GetLoginChallenge (string szRetURL,
+ int iTimeWindow,
+ int fForceLogin,
+ string szCOBrandArgs,
+ int iLangID,
+ string strNameSpace,
+ int iKPP,
+ int iUseSecureAuth,
+ object oExtraParams)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetOption (string strOpt)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetProfileObject (string strProfileName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool HasFlag (int iFlagMask)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool HasProfile (string strProfile)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool HaveConsent (bool bNeedFullConsent, bool bNeedBirthdate)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public int LoginUser ()
+ {
+ return LoginUser (null, -1, -1, null, -1, null, -1, -1, null);
+ }
+
+#if (!NET_1_0)
+ public int LoginUser (String strReturnUrl)
+ {
+ return LoginUser (strReturnUrl, -1, -1, null, -1, null, -1, -1, null);
+ }
+#endif
+
+ public int LoginUser (string szRetURL,
+ int iTimeWindow,
+ bool fForceLogin,
+ string szCOBrandArgs,
+ int iLangID,
+ string strNameSpace,
+ int iKPP,
+ bool fUseSecureAuth,
+ object oExtraParams)
+ {
+ return LoginUser (szRetURL, iTimeWindow, (fForceLogin ? 1 : 0), szCOBrandArgs, iLangID, strNameSpace, iKPP, (fUseSecureAuth ? 1 : 0), null);
+ }
+
+ [MonoTODO]
+ public int LoginUser (string szRetURL,
+ int iTimeWindow,
+ int fForceLogin,
+ string szCOBrandArgs,
+ int iLangID,
+ string strNameSpace,
+ int iKPP,
+ int iUseSecureAuth,
+ object oExtraParams)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string LogoTag ()
+ {
+ return LogoTag (null, -1, -1, null, -1, -1, null, -1, -1);
+ }
+
+#if (!NET_1_0)
+ public string LogoTag (String strReturnUrl)
+ {
+ return LogoTag (strReturnUrl, -1, -1, null, -1, -1, null, -1, -1);
+ }
+#endif
+
+ public string LogoTag (string strReturnUrl,
+ int iTimeWindow,
+ bool fForceLogin,
+ string strCoBrandedArgs,
+ int iLangID,
+ bool fSecure,
+ string strNameSpace,
+ int iKPP,
+ bool bUseSecureAuth)
+ {
+ return LogoTag (strReturnUrl, iTimeWindow, (fForceLogin ? 1 : 0), strCoBrandedArgs, iLangID, (fSecure ? 1 : 0), strNameSpace, iKPP, (bUseSecureAuth ? 1 : 0));
+ }
+
+ [MonoTODO]
+ public string LogoTag (string strReturnUrl,
+ int iTimeWindow,
+ int iForceLogin,
+ string strCoBrandedArgs,
+ int iLangID,
+ int iSecure,
+ string strNameSpace,
+ int iKPP,
+ int iUseSecureAuth)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string LogoTag2 ()
+ {
+ return LogoTag2 (null, -1, -1, null, -1, -1, null, -1, -1);
+ }
+
+#if (!NET_1_0)
+ public string LogoTag2 (String strReturnUrl)
+ {
+ return LogoTag2 (strReturnUrl, -1, -1, null, -1, -1, null, -1, -1);
+ }
+#endif
+
+ public string LogoTag2 (string strReturnUrl,
+ int iTimeWindow,
+ bool fForceLogin,
+ string strCoBrandedArgs,
+ int iLangID,
+ bool fSecure,
+ string strNameSpace,
+ int iKPP,
+ bool bUseSecureAuth)
+ {
+ return LogoTag2 (strReturnUrl, iTimeWindow, (fForceLogin ? 1 : 0), strCoBrandedArgs, iLangID, (fSecure ? 1 : 0), strNameSpace, iKPP, (bUseSecureAuth ? 1 : 0));
+ }
+
+ [MonoTODO]
+ public string LogoTag2 (string strReturnUrl,
+ int iTimeWindow,
+ int iForceLogin,
+ string strCoBrandedArgs,
+ int iLangID,
+ int iSecure,
+ string strNameSpace,
+ int iKPP,
+ int iUseSecureAuth)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string LogoutURL ()
+ {
+ return LogoutURL (null, null, -1, null, -1);
+ }
+
+ [MonoTODO]
+ public string LogoutURL (string szReturnURL,
+ string szCOBrandArgs,
+ int iLangID,
+ string strDomain,
+ int iUseSecureAuth)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetOption (string strOpt, object vOpt)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void SignOut (string strSignOutDotGifFileName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object Ticket (string strAttribute)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string AuthenticationType
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int Error
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool GetFromNetworkServer
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool HasSavedPassword
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool HasTicket
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string HexPUID
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool IsAuthenticated
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string this [string strProfileName]
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string Name
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int TicketAge
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int TimeSinceSignIn
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/RoleManagerEventArgs.cs b/mcs/class/System.Web/System.Web.Security/RoleManagerEventArgs.cs
new file mode 100644
index 00000000000..c063e1c50e2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/RoleManagerEventArgs.cs
@@ -0,0 +1,56 @@
+//
+// System.Web.Security.RoleManagerEventArgs
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.Security {
+ public sealed class RoleManagerEventArgs : EventArgs {
+ public RoleManagerEventArgs (HttpContext context)
+ {
+ this.context = context;
+ }
+
+ HttpContext context;
+ public HttpContext Context {
+ get { return context; }
+ }
+
+ bool rolesPopulated;
+ public bool RolesPopulated {
+ get { return rolesPopulated; }
+ set { rolesPopulated = value; }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/RoleManagerEventHandler.cs b/mcs/class/System.Web/System.Web.Security/RoleManagerEventHandler.cs
new file mode 100644
index 00000000000..067c654a5d5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/RoleManagerEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.Security.RoleManagerEventHandler
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+namespace System.Web.Security {
+ public delegate void RoleManagerEventHandler (object sender, RoleManagerEventArgs e);
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/RoleManagerModule.cs b/mcs/class/System.Web/System.Web.Security/RoleManagerModule.cs
new file mode 100644
index 00000000000..42a8ca1311a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/RoleManagerModule.cs
@@ -0,0 +1,54 @@
+//
+// System.Web.Security.RoleManagerModule
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.Security {
+ public sealed class RoleManagerModule : IHttpModule {
+ public event RoleManagerEventHandler GetRoles;
+
+ [MonoTODO]
+ public void Dispose ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Init (HttpApplication app)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/RolePrincipal.cs b/mcs/class/System.Web/System.Web.Security/RolePrincipal.cs
new file mode 100644
index 00000000000..3920f799b57
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/RolePrincipal.cs
@@ -0,0 +1,142 @@
+//
+// System.Web.Security.RolePrincipal
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Security;
+using System.Security.Principal;
+
+namespace System.Web.Security {
+ public sealed class RolePrincipal : IPrincipal {
+
+ [MonoTODO]
+ public RolePrincipal ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public RolePrincipal (bool createFromCookie)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public RolePrincipal (string encryptedTicket)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string [] GetRoles ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Init ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void InitFromCookie (string cookieName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void InitFromEncryptedTicket (string strTicket)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsInRole (string role)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string ToEncryptedTicket ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool CachedListChanged {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string CookiePath {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public bool Expired {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public DateTime ExpireDate {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public IIdentity Identity {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public bool IsRoleListCached {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public DateTime IssueDate {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string UserData {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int Version {
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/RoleProvider.cs b/mcs/class/System.Web/System.Web.Security/RoleProvider.cs
new file mode 100644
index 00000000000..1ed6c098e28
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/RoleProvider.cs
@@ -0,0 +1,56 @@
+//
+// System.Web.Security.IRoleProvider
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Configuration.Provider;
+
+namespace System.Web.Security
+{
+ public abstract class RoleProvider : ProviderBase
+ {
+ protected RoleProvider ()
+ {
+ }
+
+ public abstract void AddUsersToRoles (string [] usernames, string [] rolenames);
+ public abstract void CreateRole (string rolename);
+ public abstract void DeleteRole (string rolename, bool throwOnPopulatedRole);
+ public abstract void FindUsersInRole (string roleName, string usernameToMatch);
+ public abstract string [] GetAllRoles ();
+ public abstract string [] GetRolesForUser (string username);
+ public abstract string [] GetUsersInRole (string rolename);
+ public abstract bool IsUserInRole (string username, string rolename);
+ public abstract void RemoveUsersFromRoles (string [] usernames, string [] rolenames);
+ public abstract bool RoleExists (string rolename);
+ public abstract string ApplicationName { get; set; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/RoleProviderCollection.cs b/mcs/class/System.Web/System.Web.Security/RoleProviderCollection.cs
new file mode 100644
index 00000000000..dcb28f362f7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/RoleProviderCollection.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.Security.RoleProviderCollection
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Configuration.Provider;
+
+namespace System.Web.Security {
+ public class RoleProviderCollection : ProviderCollection {
+ public override void Add (ProviderBase provider)
+ {
+ if (provider is RoleProvider)
+ base.Add (provider);
+ else
+ throw new HttpException ();
+ }
+
+ public new RoleProvider this [string name] {
+ get { return (RoleProvider) base [name]; }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/Roles.cs b/mcs/class/System.Web/System.Web.Security/Roles.cs
new file mode 100644
index 00000000000..17950833c9c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/Roles.cs
@@ -0,0 +1,205 @@
+//
+// System.Web.Security.Roles
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.Security {
+ public sealed class Roles {
+
+ [MonoTODO]
+ public static void AddUsersToRole (string [] usernames, string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void AddUsersToRoles (string [] usernames, string [] rolenames)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void AddUserToRole (string username, string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void AddUserToRoles (string username, string [] rolenames)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void CreateRole (string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void DeleteCookie ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void DeleteRole (string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string [] GetAllRoles ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string [] GetRolesForUser ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string [] GetRolesForUser (string username)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string [] GetUsersInRole (string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool IsUserInRole (string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool IsUserInRole (string username, string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void RemoveUserFromRole (string username, string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void RemoveUserFromRoles (string username, string [] rolenames)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void RemoveUsersFromRole (string [] usernames, string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void RemoveUsersFromRoles (string [] usernames, string [] rolenames)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool RoleExists (string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string ApplicationName {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static bool CacheRolesInCookie {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static string CookieName {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static string CookiePath {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static CookieProtection CookieProtectionValue {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static bool CookieRequireSSL {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static bool CookieSlidingExpiration {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static int CookieTimeout {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static bool Enabled {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static RoleProvider Provider {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static RoleProviderCollection Providers {
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/SqlMembershipProvider.cs b/mcs/class/System.Web/System.Web.Security/SqlMembershipProvider.cs
new file mode 100644
index 00000000000..3437bd31a26
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/SqlMembershipProvider.cs
@@ -0,0 +1,174 @@
+//
+// System.Web.Security.SqlMembershipProvider
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.Security {
+ public class SqlMembershipProvider : MembershipProvider {
+
+ [MonoTODO]
+ public override bool ChangePassword (string username, string oldPwd, string newPwd)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool ChangePasswordQuestionAndAnswer (string username, string password, string newPwdQuestion, string newPwdAnswer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override MembershipUser CreateUser (string username, string password, string email, string pwdQuestion, string pwdAnswer, bool isApproved, out MembershipCreateStatus status)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool DeleteUser (string username, bool deleteAllRelatedData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual string GeneratePassword ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override MembershipUserCollection FindUsersByEmail (string emailToMatch, int pageIndex, int pageSize, out int totalRecords)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override MembershipUserCollection FindUsersByName (string nameToMatch, int pageIndex, int pageSize, out int totalRecords)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override MembershipUserCollection GetAllUsers (int pageIndex, int pageSize, out int totalRecords)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetNumberOfUsersOnline ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string GetPassword (string username, string answer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override MembershipUser GetUser (string username, bool userIsOnline)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string GetUserNameByEmail (string email)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void Initialize (string name, NameValueCollection config)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ResetPassword (string username, string answer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void UpdateUser (MembershipUser user)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool ValidateUser (string username, string password)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ApplicationName {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual string Description {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override bool EnablePasswordReset {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override bool EnablePasswordRetrieval {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual MembershipPasswordFormat PasswordFormat {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override bool RequiresQuestionAndAnswer {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual bool RequiresUniqueEmail {
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/SqlRoleProvider.cs b/mcs/class/System.Web/System.Web.Security/SqlRoleProvider.cs
new file mode 100644
index 00000000000..370056ebb9b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/SqlRoleProvider.cs
@@ -0,0 +1,118 @@
+//
+// System.Web.Security.SqlRoleProvider
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.Security {
+ public class SqlRoleProvider: RoleProvider {
+
+ [MonoTODO]
+ public override void AddUsersToRoles (string [] usernames, string [] rolenames)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void CreateRole (string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void DeleteRole (string rolename, bool throwOnPopulatedRole)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void FindUsersInRole (string roleName, string usernameToMatch)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string [] GetAllRoles ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string [] GetRolesForUser (string username)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string [] GetUsersInRole (string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void Initialize (string name, NameValueCollection config)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsUserInRole (string username, string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void RemoveUsersFromRoles (string [] usernames, string [] rolenames)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool RoleExists (string rolename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ApplicationName {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual string Description {
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Security/UrlAuthorizationModule.cs b/mcs/class/System.Web/System.Web.Security/UrlAuthorizationModule.cs
new file mode 100644
index 00000000000..0d6d82de8c1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/UrlAuthorizationModule.cs
@@ -0,0 +1,74 @@
+//
+// System.Web.Security.UrlAuthorizationModule
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.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;
+using System.Web;
+using System.Web.Configuration;
+using System.Security.Principal;
+
+namespace System.Web.Security
+{
+ public sealed class UrlAuthorizationModule : IHttpModule
+ {
+ public UrlAuthorizationModule ()
+ {
+ }
+
+ public void Dispose ()
+ {
+ }
+
+ public void Init (HttpApplication app)
+ {
+ app.AuthorizeRequest += new EventHandler (OnAuthorizeRequest);
+ }
+
+ void OnAuthorizeRequest (object sender, EventArgs args)
+ {
+ HttpApplication app = (HttpApplication) sender;
+ HttpContext context = app.Context;
+ if (context.SkipAuthorization)
+ return;
+
+ AuthorizationConfig config = (AuthorizationConfig) context.GetConfig ("system.web/authorization");
+ if (config == null)
+ return;
+
+ if (!config.IsValidUser (context.User, context.Request.HttpMethod)) {
+ HttpException e = new HttpException (401, "Unauthorized");
+
+ context.Response.StatusCode = 401;
+ context.Response.Write (e.GetHtmlErrorMessage ());
+ app.CompleteRequest ();
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventArgs.cs b/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventArgs.cs
new file mode 100644
index 00000000000..d73e9925475
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventArgs.cs
@@ -0,0 +1,75 @@
+//
+// System.Web.Security.WindowsAuthenticationEventArgs
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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;
+using System.Security.Principal;
+using System.Web;
+
+namespace System.Web.Security
+{
+ public sealed class WindowsAuthenticationEventArgs : EventArgs
+ {
+ WindowsIdentity identity;
+ HttpContext context;
+ IPrincipal user;
+
+ public WindowsAuthenticationEventArgs (WindowsIdentity identity, HttpContext context)
+ {
+ this.identity = identity;
+ this.context = context;
+ }
+
+ public System.Web.HttpContext Context
+ {
+ get {
+ return context;
+ }
+ }
+
+ public WindowsIdentity Identity
+ {
+ get {
+ return identity;
+ }
+ }
+
+ public IPrincipal User
+ {
+ get {
+ return user;
+ }
+
+ set {
+ user = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventHandler.cs b/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventHandler.cs
new file mode 100644
index 00000000000..29b67e2478d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.Security.WindowsAuthenticationEventHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.
+//
+
+namespace System.Web.Security
+{
+ public delegate void WindowsAuthenticationEventHandler (object sender,
+ WindowsAuthenticationEventArgs e);
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationModule.cs b/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationModule.cs
new file mode 100644
index 00000000000..a47af129aec
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationModule.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.Security.WindowsAuthenticationModule
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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;
+using System.Web;
+
+namespace System.Web.Security
+{
+ public sealed class WindowsAuthenticationModule : IHttpModule
+ {
+ public event WindowsAuthenticationEventHandler Authenticate;
+
+ public void Dispose ()
+ {
+ if (Authenticate != null)
+ Authenticate = null;
+ }
+
+ [MonoTODO]
+ public void Init (HttpApplication app)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/ChangeLog b/mcs/class/System.Web/System.Web.SessionState/ChangeLog
new file mode 100644
index 00000000000..e5c1b1dd916
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/ChangeLog
@@ -0,0 +1,327 @@
+2005-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SessionSQLServerHandler.cs:
+ * SessionStateServerHandler.cs: removed warnigs.
+
+2005-03-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SessionStateModule.cs:
+ * SessionId.cs: share the same RNG for all the instances of
+ SessionStateModule.
+
+2005-02-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SessionStateModule.cs: hack that makes static files work on sites that
+ use the Session object in global.asax. You need to set
+ MONO_XSP_STATIC_SESSION to enable it and by dong so you will lose a bit
+ of performance when serving static files. Fixes bug #71133.
+
+2004-11-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SessionStateModule.cs: set the path modifier when using cookie-less
+ sessions.
+
+2004-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SessionStateModule.cs: use SetCurrentExePath instead of SetFilePath.
+
+2004-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpSessionState.cs: don't share static session objects declared in
+ the application file across the application, but on a per-session
+ basis. Fixes bug #65446.
+
+2004-08-31 Sanjay Gupta <gsanjay@novell.com>
+
+ * SessionStateItemExpireCallback.cs: Explicit modifier "sealed" not
+ required in definition.
+
+2004-08-09 Sanjay Gupta <gsanjay@novell.com>
+
+ * SessionStateItemExpireCallback.cs: Added delegate.
+ * SessionStateStoreData.cs: Added a new class.
+
+2004-08-05 Sanjay Gupta <gsanjay@novell.com>
+
+ * IHttpSessionState.cs:
+ * ISessionIDModule.cs:
+ * ISessionStateItemCollection.cs: Added new interfaces.
+
+2004-08-04 Sanjay Gupta <gsanjay@novell.com>
+
+ * SessionStateActionFlags.cs: Added enumeration.
+
+2004-07-07 Juraj Skripsky <juraj@hotfeet.ch>
+
+ * SessionStateModule.cs: set path in session cookie to application
+ path.
+
+2004-06-18 Gert Driesen <drieseng@users.sourceforge.net>
+
+ * IStateRuntime.cs: added missing marshalling attributes
+
+2004-06-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SessionSQLServerHandler.cs:
+ * SessionStateServerHandler.cs:
+ * ISessionHandler.cs: added new parameter to Init.
+
+ * SessionInProcHandler.cs: use the HttpRuntime cache to store the
+ sessions and handle expiration.
+
+ * SessionStateModule.cs: added OnSessionRemoved internal method that is
+ called whenever a session expires or is removed.
+
+2004-05-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpSessionState.cs: added Clone (), which makes and exact copy but
+ with a cloned SessionDictionary. When EnableSessionState is set to
+ ReadOnly, we can modify the collection, but changes are not propagated.
+
+ * ISessionHandler.cs: changed signature of UpdateContext().
+
+ * SessionDictionary.cs: added Clone.
+
+ * SessionInProcHandler.cs:
+ * SessionSQLServerHandler.cs:
+ * SessionStateServerHandler.cs: don't create a new session if the
+ handler do not require it. UpdateContext() now returns an
+ HttpSessionState to the module.
+
+ * SessionStateModule.cs: removed IsReadOnly as it is now passed as a
+ parameter to the session handler. If the session is read-only, clone
+ it so that it can be changed but changes are not kept.
+
+ In short, we don't create session objects when not required and we
+ honor the ReadOnly sessions.
+
+2004-02-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SessionInProcHandler.cs:
+ * SessionSQLServerHandler.cs:
+ * SessionStateServerHandler.cs: when creating the
+ HttpSessionStateObjets, use the session objects that we know about
+ in HttpApplicationFactory.
+
+2004-01-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpSessionState.cs:
+ * SessionInProcHandler.cs: IsNewSession doesn't have a public setter.
+
+ * SessionStateModule.cs: doesn't implement IRequiresSessionState.
+ * StateServerItem.cs: not public.
+
+2004-01-05 Alon Gazit <along@mainsoft.com>
+
+ * SessionDictionary.cs: can't set item's value to null if the item is
+ new.
+
+2003-12-25 Jackson Harper <jackson@ximian.com>
+
+ * SessionStateModule.cs: Handle SessionStateMode.Off properly in
+ Init. Only set session cookies if a new session is created. This
+ fixes bug #52501.
+
+2003-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IStateRuntime.cs:
+ * SessionStateModule.cs: class status based fixes.
+
+2003-12-05 Jackson Harper <jackson@ximian.com>
+
+ * SessionStateModule.cs: Add readonly property for readonly
+ sessions. This fixes bug #51647.
+ * SessionInProcHandler.cs:
+ * SessionSQLServerHandler.cs:
+ * SessionStateServerHandler.cs: Cleanup params for
+ HttpSessionState ctor. Make sure to always set is new, cookieless,
+ and readonly properly.
+
+2003-12-03 Jackson Harper <jackson@ximian.com>
+
+ * SessionStateModule.cs: If using cookieless sessions add an
+ onbegin request handler that parsers out session ids and rewrites
+ the path. Also redirect to a url with an embedded session id if we
+ are creating a new cookieless session.
+ * SesionInProcHandler.cs:
+ * SessionSQLServerHandler.cs:
+ * SessionStateServerHandler.cs: Use SessionId::Lookup to lookup session
+ ids, don't set the session id cookie anymore. That is handled by
+ the SessionStateModule.
+ * SessionId.cs: Add method for looking up session ids, add some constants.
+
+2003-11-26 Jackson Harper <jackson@ximian.com>
+
+ * SessionSQLServerHandler.cs: Fix typo in param name.
+
+2003-11-25 Jackson Harper <jackson@ximian.com>
+
+ * RemoteStateServer.cs: Update the session dictionary data and the
+ static objects data.
+ * SessionDictionary.cs: Remove type serialization methods, these
+ have been moved to a utility class. Add convenience methods for
+ converting to/from byte arrays.
+ * SessionSQLServerHandler.cs:
+ * SessionStateServerHandler.cs: Save/Restore static objects. Use new
+ to/from byte array methods.
+ * StateServerItem.cs: Hold static objects data.
+
+2003-11-24 Jackson Harper <jackson@ximian.com>
+
+ * SessionStateServerHandler.cs: Parse connection string. Need to
+ look into what MS allows/doesn't allow better.
+
+2003-11-24 Jackson Harper <jackson@ximian.com>
+
+ * RemoteStateServer.cs: The state server object that will reside
+ on the server and store session data and ids.
+ * StateServerItem.cs: Container for session data.
+ * SessionStateServerHandler.cs: Handler that communicates with the
+ StateServer so sessions can be stored out of process.
+ * SessionStateModule.cs: Allow state server mode.
+
+2003-11-13 Jackson Harper <jackson@ximian.com>
+
+ * SessionInProcHandler.cs: Use AppDomain.SetData so data is
+ available across all threads. Set the path of session id
+ cookies. Patch by Mohammad DAMT. Fixes bug #50922.
+
+2003-11-06 Jackson Harper <jackson@ximian.com>
+
+ * ISessionHandler.cs: Pass the SessionStateModule to handlers when
+ updating.
+ * SessionSqlServerHandler.cs:
+ * SessionInProcHandler.cs: Accept SessionStateModule when
+ updating. Use new SessionId.Create method for creating session
+ ids.
+ * SessionStateModule.cs: Add a random number generator that will
+ be used for creating session ids. Pass this to handlers when
+ updating.
+ * SessionId.cs: New class for creating session ids.
+
+2003-11-03 Jackson Harper <jackson@ximian.com>
+
+ * HttpSessionState.cs (CopyTo): Copy values not keys. Patch by Yaron Shkop.
+
+2003-11-03 Jackson Harper <jackson@ximian.com>
+
+ * HttpSessionState.cs: Make the SessionDictionary accessable
+ * ISessionHandler.cs: Add method to update the session state
+ data in the handler. Pass the session config to handlers when
+ initializing.
+ * SessionConfig.cs: Add StateNetworkTimeout
+ * SessionInProcHandler.cs: Updates because interface has
+ changed, all functionality is the same.
+ * SessionStateModule.cs: Get new config items, allow SQLServer
+ session manager type. Update session handlers when the session
+ state has been released.
+ * SessionStateSectionHandler.cs: Add StateNetworkTimeout
+ * SessionSQLServerHandler.cs: New class allows sessions to be
+ stored in a database.
+
+2003-10-28 Jackson Harper <jackson@ximian.com>
+
+ * HttpSessionState.cs: Do not allow timeout to be set to less then
+ one.
+
+2003-10-28 Jackson Harper <jackson@ximian.com>
+
+ * SessionInProcHandler.cs: Compute timeouts
+ correctly. DateTime.Milliseconds is the just the milliseconds part
+ of the time, it is not the entire time as milliseconds.
+
+2003-10-13 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * SessionStateModule.cs: prevent Context.State from being null if
+ the module is inited in another HttpApplication. Fixes #49569.
+
+2003-07-30 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * IStateRuntime.cs: New interface class
+ * StateRuntime.cs: New class - stubbed out
+
+2003-07-17 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * SessionInProcHandler.cs: Made these internal to fix signature and building CLS-compliant
+
+2003-07-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SessionDictionary.cs: locking.
+
+ * SessionInProcHandler.cs: use the new method instead of the setter.
+
+2003-07-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ISessionHandler.cs:
+ * SessionInProcHandler.cs:
+ * SessionStateModule.cs: UpdateContext returns a bool indicating if we
+ started a new session. Only call session start event if that is true.
+
+2003-05-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SessionStateModule.cs: fire application start and session start/end
+ events.
+
+2003-03-31 Stefan Görling <stefan@gorling.se>
+
+ * HttpSessionState.cs:
+ * ISessionHandler.cs:
+ * SessionInProcHandler.cs:
+ * SessionStateModule.cs: initial implementation of InProc session.
+
+2003-03-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpSessionState.cs: implemented CodePage.
+
+ * SessionStateModule.cs: initial stuff to make it work.
+
+2003-03-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpSessionState.cs: reworked to use SessionDictionary.
+ * SessionDictionary.cs: implemented serialization/deserialization.
+
+2003-03-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SessionConfig.cs:
+ * SessionStateSectionHandler.cs: new files to read <sessionState>
+ configuration.
+
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SessionStateModule.cs: don't throw exception. Just for testing the
+ configuration stuff until we implement this.
+
+2002-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpSessionState.cs: IsAbandoned is internal.
+ * SessionDictionary.cs: scope fixes.
+ * SessionStateModule.cs: added events.
+
+2002-06-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.SessionState/HttpSessionState.cs:
+ Fixes based on class status page:
+
+ - Add attributes (DefaultEvent, ParseChildren).
+ - Fix declarations.
+ - Explicitly implement some interfaces (IPostBackDataHandler
+ and IPostBackEventHandler).
+ - Implemented some missing methods.
+
+2002-06-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpSessionState.cs: implemented more methods/properties.
+ * SessionDictionary.cs: New file.
+
+2002-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.SessionState/HttpSessionState.cs:
+ * System.Web.SessionState/SessionStateModule.cs: new files with some
+ implementation and the rest stubbed.
+
+2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IReadOnlySessionState.cs:
+ * IRequiresSessionState.cs:
+ * SessionStateMode.cs: new files.
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs b/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs
new file mode 100644
index 00000000000..03fcacbb118
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs
@@ -0,0 +1,218 @@
+//
+// System.Web.SessionState.HttpSessionState
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.Text;
+using System.Threading;
+using System.Web;
+
+namespace System.Web.SessionState {
+public sealed class HttpSessionState : ICollection, IEnumerable
+{
+ private string _id;
+ private SessionDictionary _dict;
+ private HttpStaticObjectsCollection _staticObjects;
+ private int _timeout;
+ private bool _newSession;
+ private bool _isCookieless;
+ private SessionStateMode _mode;
+ private bool _isReadonly;
+ private bool _abandoned;
+
+ internal HttpSessionState (string id,
+ SessionDictionary dict,
+ HttpStaticObjectsCollection staticObjects,
+ int timeout,
+ bool newSession,
+ bool isCookieless,
+ SessionStateMode mode,
+ bool isReadonly)
+ {
+ _id = id;
+ _dict = dict;
+ _staticObjects = staticObjects.Clone ();
+ _timeout = timeout;
+ _newSession = newSession;
+ _isCookieless = isCookieless;
+ _mode = mode;
+ _isReadonly = isReadonly;
+ }
+
+ internal HttpSessionState Clone ()
+ {
+ return new HttpSessionState (_id, _dict.Clone (), _staticObjects, _timeout, _newSession,
+ _isCookieless, _mode, _isReadonly);
+
+ }
+
+ public int CodePage {
+ get {
+ HttpContext current = HttpContext.Current;
+ if (current == null)
+ return Encoding.Default.CodePage;
+
+ return current.Response.ContentEncoding.CodePage;
+ }
+
+ set {
+ HttpContext current = HttpContext.Current;
+ if (current != null)
+ current.Response.ContentEncoding = Encoding.GetEncoding (value);
+ }
+ }
+
+ public HttpSessionState Contents {
+ get { return this; }
+ }
+
+ public int Count {
+ get { return _dict.Count; }
+ }
+
+ internal bool IsAbandoned {
+ get { return _abandoned; }
+ }
+
+ public bool IsCookieless {
+ get { return _isCookieless; }
+ }
+
+ public bool IsNewSession {
+ get { return _newSession; }
+ }
+
+ public bool IsReadOnly {
+ get { return _isReadonly; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public object this [string key] {
+ get { return _dict [key]; }
+ set { _dict [key] = value; }
+ }
+
+ public object this [int index] {
+ get { return _dict [index]; }
+ set { _dict [index] = value; }
+ }
+
+ public NameObjectCollectionBase.KeysCollection Keys {
+ get { return _dict.Keys; }
+ }
+
+ public int LCID {
+ get { return Thread.CurrentThread.CurrentCulture.LCID; }
+ set { Thread.CurrentThread.CurrentCulture = new CultureInfo(value); }
+ }
+
+ public SessionStateMode Mode {
+ get { return _mode; }
+ }
+
+ public string SessionID {
+ get { return _id; }
+ }
+
+ public HttpStaticObjectsCollection StaticObjects {
+ get { return _staticObjects; }
+ }
+
+ public object SyncRoot {
+ get { return this; }
+ }
+
+ public int Timeout {
+ get { return _timeout; }
+ set {
+ if (value < 1)
+ throw new ArgumentException ("The argument to SetTimeout must be greater than 0.");
+ _timeout = value;
+ }
+ }
+
+ internal SessionDictionary SessionDictionary {
+ get { return _dict; }
+ }
+
+ internal void SetNewSession (bool value)
+ {
+ _newSession = value;
+ }
+
+ public void Abandon ()
+ {
+ _abandoned = true;
+ }
+
+ public void Add (string name, object value)
+ {
+ _dict [name] = value;
+ }
+
+ public void Clear ()
+ {
+ if (_dict != null)
+ _dict.Clear ();
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ NameObjectCollectionBase.KeysCollection all = Keys;
+ for (int i = 0; i < all.Count; i++)
+ array.SetValue (all.Get(i), i + index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return _dict.GetEnumerator ();
+ }
+
+ public void Remove (string name)
+ {
+ _dict.Remove (name);
+ }
+
+ public void RemoveAll ()
+ {
+ _dict.Clear ();
+ }
+
+ public void RemoveAt (int index)
+ {
+ _dict.RemoveAt (index);
+ }
+}
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/IHttpSessionState.cs b/mcs/class/System.Web/System.Web.SessionState/IHttpSessionState.cs
new file mode 100644
index 00000000000..5f3b1f06d6d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/IHttpSessionState.cs
@@ -0,0 +1,71 @@
+//
+// System.Web.SessionState.IReadOnlySessionState
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web;
+
+namespace System.Web.SessionState {
+ public interface IHttpSessionState
+ {
+ ///methods
+ void Abandon ();
+ void Add (string itemName, object itemValue);
+ void Clear ();
+ void CopyTo (Array sessionValues, int index);
+ IEnumerator GetEnumerator ();
+ void Remove (string itemName);
+ void RemoveAll ();
+ void RemoveAt (int index);
+
+ ///properties
+ int CodePage { get; set; }
+ HttpCookieMode CookieMode { get; }
+ int Count { get; }
+ bool IsCookieLess { get; }
+ bool IsNewSession { get; }
+ bool IsReadOnly { get; }
+ bool IsSynchronized { get; }
+ object this [int index] { get; set; }
+ object this [string name] { get; set;}
+ NameObjectCollectionBase.KeysCollection Keys { get; }
+ int LCID { get; set; }
+ SessionStateMode Mode { get; }
+ string SessionID { get; }
+ HttpStaticObjectsCollection StaticObjects { get; }
+ object SyncRoot { get; }
+ int Timeout { get; set; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/IReadOnlySessionState.cs b/mcs/class/System.Web/System.Web.SessionState/IReadOnlySessionState.cs
new file mode 100644
index 00000000000..5d71a0d86b6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/IReadOnlySessionState.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.SessionState.IReadOnlySessionState
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.
+//
+
+namespace System.Web.SessionState {
+public interface IReadOnlySessionState : IRequiresSessionState
+{
+}
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/IRequiresSessionState.cs b/mcs/class/System.Web/System.Web.SessionState/IRequiresSessionState.cs
new file mode 100644
index 00000000000..4d0264d1982
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/IRequiresSessionState.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.SessionState.IRequiresSessionState
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.
+//
+
+namespace System.Web.SessionState {
+public interface IRequiresSessionState
+{
+}
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/ISessionHandler.cs b/mcs/class/System.Web/System.Web.SessionState/ISessionHandler.cs
new file mode 100644
index 00000000000..04a2f1b7b9c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/ISessionHandler.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.SessionState.ISessionHandler
+//
+// Authors:
+// Stefan Görling, (stefan@gorling.se)
+//
+// (C) 2003 Stefan Görling
+//
+// This interface is simple, but as it's internal it shouldn't be hard to change it if we need to.
+//
+
+//
+// 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.
+//
+namespace System.Web.SessionState
+{
+ internal interface ISessionHandler
+ {
+ void Dispose ();
+ void Init (SessionStateModule module, HttpApplication context, SessionConfig config);
+ HttpSessionState UpdateContext (HttpContext context, SessionStateModule module, bool required,
+ bool read_only, ref bool isNew);
+
+ void UpdateHandler (HttpContext context, SessionStateModule module);
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/ISessionIDModule.cs b/mcs/class/System.Web/System.Web.SessionState/ISessionIDModule.cs
new file mode 100644
index 00000000000..b178fa72cfe
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/ISessionIDModule.cs
@@ -0,0 +1,48 @@
+//
+// System.Web.SessionState.ISessionIDModule
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Web;
+
+namespace System.Web.SessionState {
+ public interface ISessionIDModule
+ {
+ ///methods
+ string CreateSessionID (HttpContext context);
+ string GetSessionID (HttpContext context);
+ void RemoveSessionID (HttpContext context);
+ void SaveSessionID (HttpContext context, string sessionID, out bool isRedirected, out bool isCookieAdded);
+ bool Validate (string id);
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/ISessionStateItemCollection.cs b/mcs/class/System.Web/System.Web.SessionState/ISessionStateItemCollection.cs
new file mode 100644
index 00000000000..40537f89998
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/ISessionStateItemCollection.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.SessionState.ISessionStateItemCollection
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.SessionState {
+ public interface ISessionStateItemCollection
+ {
+ ///methods
+ void Clear ();
+ void Remove (string itemName);
+ void RemoveAt (int index);
+
+ ///properties
+ bool Dirty { get; set; }
+ object this [int index] { get; set; }
+ object this [string name] { get; set;}
+ NameObjectCollectionBase.KeysCollection Keys { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/IStateRuntime.cs b/mcs/class/System.Web/System.Web.SessionState/IStateRuntime.cs
new file mode 100644
index 00000000000..b1cd995f56e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/IStateRuntime.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.SessionState.IStateRuntime.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Runtime.InteropServices;
+
+namespace System.Web.SessionState
+{
+ [Guid ("7297744b-e188-40bf-b7e9-56698d25cf44")]
+ [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IStateRuntime
+ {
+ void ProcessRequest (
+ [In, MarshalAs(UnmanagedType.SysInt)] IntPtr tracker,
+ [In, MarshalAs(UnmanagedType.I4)] int verb,
+ [In, MarshalAs(UnmanagedType.LPWStr)] string uri,
+ [In, MarshalAs(UnmanagedType.I4)] int exclusive,
+ [In, MarshalAs(UnmanagedType.I4)] int timeout,
+ [In, MarshalAs(UnmanagedType.I4)] int lockCookieExists,
+ [In, MarshalAs(UnmanagedType.I4)] int lockCookie,
+ [In, MarshalAs(UnmanagedType.I4)] int contentLength,
+ [In, MarshalAs(UnmanagedType.SysInt)] IntPtr content);
+
+ void StopProcessing ();
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.SessionState/RemoteStateServer.cs b/mcs/class/System.Web/System.Web.SessionState/RemoteStateServer.cs
new file mode 100644
index 00000000000..a35b84e198e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/RemoteStateServer.cs
@@ -0,0 +1,75 @@
+//
+// System.Web.SessionState.RemoteStateServer
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2003 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
+// "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;
+using System.Collections;
+
+namespace System.Web.SessionState {
+
+ internal class RemoteStateServer : MarshalByRefObject {
+
+ private Hashtable table;
+
+ internal RemoteStateServer ()
+ {
+ table = new Hashtable ();
+ }
+
+ internal void Insert (string id, StateServerItem item)
+ {
+ table.Add (id, item);
+ }
+
+ internal void Update (string id, byte [] dict_data, byte [] sobjs_data)
+ {
+ StateServerItem item = table [id] as StateServerItem;
+
+ if (item == null)
+ return;
+
+ item.DictionaryData = dict_data;
+ item.StaticObjectsData = sobjs_data;
+ item.Touch ();
+ }
+
+ internal StateServerItem Get (string id)
+ {
+ StateServerItem item = table [id] as StateServerItem;
+
+ if (item == null || item.IsAbandoned ())
+ return null;
+
+ item.Touch ();
+ return item;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionConfig.cs b/mcs/class/System.Web/System.Web.SessionState/SessionConfig.cs
new file mode 100644
index 00000000000..423b3d3905d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionConfig.cs
@@ -0,0 +1,112 @@
+//
+// System.Web.SessionState.SessionConfig
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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;
+
+namespace System.Web.SessionState
+{
+ class SessionConfig
+ {
+ internal SessionStateMode Mode;
+ internal int Timeout; // minutes
+ internal bool CookieLess;
+ internal string StateConnectionString;
+ internal string SqlConnectionString;
+ internal string StateNetworkTimeout;
+
+ public SessionConfig (object parent)
+ {
+ if (parent is SessionConfig) {
+ SessionConfig p = (SessionConfig) parent;
+ CookieLess = p.CookieLess;
+ Mode = p.Mode;
+ Timeout = p.Timeout;
+ StateConnectionString = p.StateConnectionString;
+ SqlConnectionString = p.SqlConnectionString;
+ } else {
+ CookieLess = false;
+ Mode = SessionStateMode.InProc;
+ Timeout = 20;
+ StateConnectionString = "127.0.0.1:42424";
+ SqlConnectionString = "user id=sa;password=;data source=127.0.0.1";
+ }
+ }
+
+ internal bool SetMode (string value)
+ {
+ try {
+ Mode = (SessionStateMode) Enum.Parse (typeof (SessionStateMode), value, true);
+ } catch {
+ return false;
+ }
+
+ return true;
+ }
+
+ internal bool SetCookieLess (string value)
+ {
+ if (value == null)
+ return false;
+
+ CookieLess = (0 == String.Compare ("true", value, true));
+ if (!CookieLess && String.Compare ("false", value, true) != 0)
+ return false;
+
+ return true;
+ }
+
+ internal bool SetTimeout (string value)
+ {
+ try {
+ Timeout = Int32.Parse (value);
+ } catch {
+ return false;
+ }
+
+ return true;
+ }
+
+ internal void SetStateConnectionString (string value)
+ {
+ StateConnectionString = value;
+ }
+
+ internal void SetSqlConnectionString (string value)
+ {
+ SqlConnectionString = value;
+ }
+
+ internal void SetStateNetworkTimeout (string value)
+ {
+ StateNetworkTimeout = value;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs b/mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs
new file mode 100644
index 00000000000..d1b193d90d5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs
@@ -0,0 +1,209 @@
+//
+// System.Web.SessionState.SessionDictionary
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.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;
+using System.IO;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.SessionState {
+internal class SessionDictionary : NameObjectCollectionBase
+{
+ bool _dirty;
+
+ public SessionDictionary ()
+ {
+ }
+
+ internal SessionDictionary Clone ()
+ {
+ SessionDictionary sess = new SessionDictionary ();
+ int last = sess.Count;
+ for (int i = 0; i < last; i++) {
+ string key = GetKey (i);
+ sess [key] = this [key];
+ }
+
+ return sess;
+ }
+
+ internal void Clear ()
+ {
+ _dirty = true;
+ lock (this)
+ BaseClear ();
+ }
+
+ internal string GetKey (int index)
+ {
+ string value;
+ lock (this)
+ value = BaseGetKey (index);
+
+ return value;
+ }
+
+ internal static bool IsInmutable (object o)
+ {
+ Type t = o.GetType ();
+ return (t == typeof (string) || t.IsPrimitive);
+ }
+
+ internal void Remove (string s)
+ {
+ lock (this)
+ BaseRemove (s);
+ _dirty = true;
+ }
+
+ internal void RemoveAt (int index)
+ {
+ lock (this)
+ BaseRemoveAt (index);
+ _dirty = true;
+ }
+
+ internal void Serialize (BinaryWriter w)
+ {
+ lock (this) {
+ w.Write (Count);
+ foreach (string key in Keys) {
+ w.Write (key);
+ object value = BaseGet (key);
+ if (value == null) {
+ w.Write (System.Web.Util.AltSerialization.NullIndex);
+ continue;
+ }
+
+ System.Web.Util.AltSerialization.SerializeByType (w, value);
+ }
+ }
+ }
+
+ internal static SessionDictionary Deserialize (BinaryReader r)
+ {
+ SessionDictionary result = new SessionDictionary ();
+ for (int i = r.ReadInt32 (); i > 0; i--) {
+ string key = r.ReadString ();
+ int index = r.ReadInt32 ();
+ if (index == System.Web.Util.AltSerialization.NullIndex)
+ result [key] = null;
+ else
+ result [key] = System.Web.Util.AltSerialization.DeserializeFromIndex (index, r);
+ }
+
+ return result;
+ }
+
+ internal bool Dirty
+ {
+ get { return _dirty; }
+ set { _dirty = value; }
+ }
+
+ internal object this [string s]
+ {
+ get {
+ object o;
+ lock (this)
+ o = BaseGet (s);
+
+ return o;
+ }
+
+ set {
+ lock (this)
+ {
+ object obj = BaseGet(s);
+ if ((obj == null) && (value == null))
+ return;
+ BaseSet (s, value);
+ }
+
+ _dirty = true;
+ }
+ }
+
+ public object this [int index]
+ {
+ get {
+ object o;
+ lock (this)
+ o = BaseGet (index);
+
+ return o;
+ }
+ set {
+ lock (this)
+ {
+ object obj = BaseGet(index);
+ if ((obj == null) && (value == null))
+ return;
+ BaseSet (index, value);
+ }
+
+ _dirty = true;
+ }
+ }
+
+ internal byte [] ToByteArray ()
+ {
+ MemoryStream stream = null;
+ try {
+ stream = new MemoryStream ();
+ Serialize (new BinaryWriter (stream));
+ return stream.GetBuffer ();
+ } catch {
+ throw;
+ } finally {
+ if (stream != null)
+ stream.Close ();
+ }
+ }
+
+ internal static SessionDictionary FromByteArray (byte [] data)
+ {
+ SessionDictionary result = null;
+ MemoryStream stream = null;
+ try {
+ stream = new MemoryStream (data);
+ result = Deserialize (new BinaryReader (stream));
+ } catch {
+ throw;
+ } finally {
+ if (stream != null)
+ stream.Close ();
+ }
+ return result;
+ }
+}
+
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionId.cs b/mcs/class/System.Web/System.Web.SessionState/SessionId.cs
new file mode 100644
index 00000000000..cde77d0d3ec
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionId.cs
@@ -0,0 +1,87 @@
+//
+// System.Web.SessionState.SessionId
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com), All rights reserved
+//
+
+//
+// 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;
+using System.Text;
+using System.Security.Cryptography;
+
+namespace System.Web.SessionState {
+
+ internal class SessionId {
+
+ private static char [] allowed = { '0', '1', '2', '3', '4', '5',
+ '6', '7', '8', '9', 'A', 'B',
+ 'C', 'D', 'E', 'F' };
+
+ internal static readonly int IdLength = 30;
+ private static readonly int half_len = 15;
+
+ internal static string Create (RandomNumberGenerator rng)
+ {
+ if (rng == null)
+ throw new ArgumentNullException ("rng");
+
+ byte[] key = new byte [half_len];
+
+ lock (rng) {
+ rng.GetBytes (key);
+ }
+ return Encode (key);
+ }
+
+ internal static string Encode (byte[] key)
+ {
+ if (key == null)
+ throw new ArgumentNullException ("key");
+ if (key.Length != half_len)
+ throw new ArgumentException ("key must be 15 bytes long.");
+
+ // Just a standard hex conversion
+ char[] res = new char [IdLength];
+ for (int i=0; i < half_len; i++) {
+ int b = key [i];
+ res [i * 2] = allowed [b >> 4];
+ res [(i * 2) + 1] = allowed [b & 0xF];
+ }
+ return new String (res);
+ }
+
+ internal static string Lookup (HttpRequest request, bool cookieless)
+ {
+ if (cookieless)
+ return (string) request.Headers [SessionStateModule.HeaderName];
+ else if (request.Cookies [SessionStateModule.CookieName] != null)
+ return request.Cookies [SessionStateModule.CookieName].Value;
+ return null;
+ }
+ }
+
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionInProcHandler.cs b/mcs/class/System.Web/System.Web.SessionState/SessionInProcHandler.cs
new file mode 100644
index 00000000000..e0a327f8228
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionInProcHandler.cs
@@ -0,0 +1,91 @@
+//
+// System.Web.SessionState.SessionInProcHandler
+//
+// Authors:
+// Stefan Görling (stefan@gorling.se)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Stefan Görling
+// Copyright (c) 2004 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
+// "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;
+using System.IO;
+using System.Collections;
+using System.Web.Caching;
+
+namespace System.Web.SessionState
+{
+ class SessionInProcHandler : ISessionHandler
+ {
+ SessionConfig config;
+ CacheItemRemovedCallback removedCB;
+
+ public void Dispose () { }
+
+ public void Init (SessionStateModule module, HttpApplication context, SessionConfig config)
+ {
+ removedCB = new CacheItemRemovedCallback (module.OnSessionRemoved);
+ this.config = config;
+ }
+
+ public void UpdateHandler (HttpContext context, SessionStateModule module) { }
+
+ public HttpSessionState UpdateContext (HttpContext context, SessionStateModule module,
+ bool required, bool read_only, ref bool isNew)
+ {
+ if (!required)
+ return null;
+
+ Cache cache = HttpRuntime.Cache;
+ HttpSessionState state = null;
+ string id = SessionId.Lookup (context.Request, config.CookieLess);
+
+ if (id != null) {
+ state = (HttpSessionState) cache ["@@@InProc@" + id];
+ if (state != null)
+ return state;
+ }
+
+ // Create a new session.
+ string sessionID = SessionId.Create (module.Rng);
+ state = new HttpSessionState (sessionID, // unique identifier
+ new SessionDictionary(), // dictionary
+ HttpApplicationFactory.ApplicationState.SessionObjects,
+ config.Timeout, //lifetime before death.
+ true, //new session
+ false, // is cookieless
+ SessionStateMode.InProc,
+ read_only); //readonly
+
+ TimeSpan timeout = new TimeSpan (0, config.Timeout, 0);
+ cache.Insert ("@@@InProc@" + sessionID, state, null, DateTime.Now + timeout,
+ timeout, CacheItemPriority.AboveNormal, removedCB);
+
+ isNew = true;
+ return state;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionSQLServerHandler.cs b/mcs/class/System.Web/System.Web.SessionState/SessionSQLServerHandler.cs
new file mode 100644
index 00000000000..7b6ba2a4c4b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionSQLServerHandler.cs
@@ -0,0 +1,245 @@
+//
+// System.Web.SessionState.SessionSQLServerHandler
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2003 Novell, Inc. (http://www.novell.com), All rights reserved
+//
+
+//
+// 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;
+using System.IO;
+using System.Data;
+using System.Reflection;
+using System.Configuration;
+using System.Collections.Specialized;
+
+namespace System.Web.SessionState {
+
+ internal class SessionSQLServerHandler : ISessionHandler
+ {
+ private static Type cncType = null;
+ private IDbConnection cnc = null;
+ private SessionConfig config;
+
+ public void Dispose ()
+ {
+ if (cnc != null) {
+ cnc.Close ();
+ cnc = null;
+ }
+ }
+
+ public void Init (SessionStateModule module, HttpApplication context, SessionConfig config)
+ {
+ string connectionTypeName;
+ string providerAssemblyName;
+ string cncString;
+
+ this.config = config;
+
+ GetConnectionData (out providerAssemblyName, out connectionTypeName, out cncString);
+ if (cncType == null) {
+ Assembly dbAssembly = Assembly.Load (providerAssemblyName);
+ cncType = dbAssembly.GetType (connectionTypeName, true);
+ if (!typeof (IDbConnection).IsAssignableFrom (cncType))
+ throw new ApplicationException ("The type '" + cncType +
+ "' does not implement IDB Connection.\n" +
+ "Check 'DbConnectionType' in server.exe.config.");
+ }
+
+ cnc = (IDbConnection) Activator.CreateInstance (cncType);
+ cnc.ConnectionString = cncString;
+ try {
+ cnc.Open ();
+ } catch (Exception exc) {
+ cnc = null;
+ throw exc;
+ }
+ }
+
+ public void UpdateHandler (HttpContext context, SessionStateModule module)
+ {
+ if (context.Session == null || context.Session.IsReadOnly)
+ return;
+
+ string id = context.Session.SessionID;
+ SessionDictionary dict = context.Session.SessionDictionary;
+
+ UpdateSession (id, dict);
+ }
+
+ public HttpSessionState UpdateContext (HttpContext context, SessionStateModule module,
+ bool required, bool read_only, ref bool isNew)
+ {
+ if (!required)
+ return null;
+
+ HttpSessionState session = null;
+ string id = SessionId.Lookup (context.Request, config.CookieLess);
+
+ if (id != null) {
+ session = SelectSession (id, read_only);
+ if (session != null)
+ return session;
+ }
+
+ id = SessionId.Create (module.Rng);
+ session = new HttpSessionState (id, new SessionDictionary (),
+ HttpApplicationFactory.ApplicationState.SessionObjects, config.Timeout,
+ true, config.CookieLess, SessionStateMode.SQLServer, read_only);
+
+ InsertSession (session, config.Timeout);
+ isNew = true;
+ return session;
+ }
+
+ private void GetConnectionData (out string providerAssembly,
+ out string cncTypeName, out string cncString)
+ {
+ providerAssembly = null;
+ cncTypeName = null;
+ cncString = null;
+
+ NameValueCollection config = ConfigurationSettings.AppSettings as NameValueCollection;
+ if (config != null) {
+ foreach (string s in config.Keys) {
+ if (0 == String.Compare ("StateDBProviderAssembly", s, true)) {
+ providerAssembly = config [s];
+ } else if (0 == String.Compare ("StateDBConnectionType", s, true)) {
+ cncTypeName = config [s];
+ }
+ }
+ }
+
+ cncString = this.config.SqlConnectionString;
+
+ if (providerAssembly == null || providerAssembly == String.Empty)
+ providerAssembly = "Npgsql.dll";
+
+ if (cncTypeName == null || cncTypeName == String.Empty)
+ cncTypeName = "Npgsql.NpgsqlConnection";
+
+ if (cncString == null || cncString == String.Empty)
+ cncString = "SERVER=127.0.0.1;USER ID=monostate;PASSWORD=monostate;dbname=monostate";
+ }
+
+ private HttpSessionState SelectSession (string id, bool read_only)
+ {
+ HttpSessionState session = null;
+ IDbCommand command = cnc.CreateCommand();
+ IDataReader reader;
+
+ string select = "SELECT * from aspstatetempsessions WHERE SessionID = :SessionID";
+
+ command.CommandText = select;
+
+ command.Parameters.Add (CreateParam (command, DbType.String, ":SessionID", id));
+
+ try {
+ reader = command.ExecuteReader ();
+
+ if (!reader.Read ())
+ return null;
+
+ SessionDictionary dict;
+ HttpStaticObjectsCollection sobjs;
+
+ dict = SessionDictionary.FromByteArray (ReadBytes (reader, reader.FieldCount-1));
+ sobjs = HttpStaticObjectsCollection.FromByteArray (ReadBytes (reader, reader.FieldCount-2));
+
+ session = new HttpSessionState (id, dict, sobjs, 100, false, config.CookieLess,
+ SessionStateMode.SQLServer, read_only);
+ return session;
+ } catch {
+ throw;
+ }
+ }
+
+ private void InsertSession (HttpSessionState session, int timeout)
+ {
+ IDbCommand command = cnc.CreateCommand ();
+ IDataParameterCollection param;
+
+ string insert = "INSERT INTO ASPStateTempSessions VALUES " +
+ "(:SessionID, :Created, :Expires, :Timeout, :StaticObjectsData, :SessionData)";
+
+ command.CommandText = insert;
+
+ param = command.Parameters;
+ param.Add (CreateParam (command, DbType.String, ":SessionID", session.SessionID));
+ param.Add (CreateParam (command, DbType.DateTime, ":Created", DateTime.Now));
+ param.Add (CreateParam (command, DbType.DateTime, ":Expires", Tommorow ()));
+ param.Add (CreateParam (command, DbType.Int32, ":Timeout", timeout));
+ param.Add (CreateParam (command, DbType.Binary, ":StaticObjectsData",
+ session.StaticObjects.ToByteArray ()));
+ param.Add (CreateParam (command, DbType.Binary, ":SessionData",
+ session.SessionDictionary.ToByteArray ()));
+
+ command.ExecuteNonQuery ();
+ }
+
+ private void UpdateSession (string id, SessionDictionary dict)
+ {
+ IDbCommand command = cnc.CreateCommand ();
+ IDataParameterCollection param;
+
+ string update = "UPDATE ASPStateTempSessions SET " +
+ "SessionData = :SessionData WHERE SessionId = :SessionID";
+
+ command.CommandText = update;
+
+ param = command.Parameters;
+ param.Add (CreateParam (command, DbType.String, ":SessionID", id));
+ param.Add (CreateParam (command, DbType.Binary, ":SessionData",
+ dict.ToByteArray ()));
+
+ command.ExecuteNonQuery ();
+ }
+
+ private IDataParameter CreateParam (IDbCommand command, DbType type,
+ string name, object value)
+ {
+ IDataParameter result = command.CreateParameter ();
+ result.DbType = type;
+ result.ParameterName = name;
+ result.Value = value;
+ return result;
+ }
+
+ private DateTime Tommorow ()
+ {
+ return DateTime.Now.AddDays (1);
+ }
+
+ private byte [] ReadBytes (IDataReader reader, int index)
+ {
+ int len = (int) reader.GetBytes (reader.FieldCount-1, 0, null, 0, 0);
+ byte [] data = new byte [len];
+ reader.GetBytes (index, 0, data, 0, len);
+ return data;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionStateActionFlags.cs b/mcs/class/System.Web/System.Web.SessionState/SessionStateActionFlags.cs
new file mode 100644
index 00000000000..52a10def8ee
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionStateActionFlags.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.SessionState.SessionStateActionFlags.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.SessionState {
+ public enum SessionStateActionFlags {
+ InitializeItem = 1
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionStateItemExpireCallback.cs b/mcs/class/System.Web/System.Web.SessionState/SessionStateItemExpireCallback.cs
new file mode 100644
index 00000000000..3b2c04d1c02
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionStateItemExpireCallback.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.SessionState.SessionStateItemExpireCallback
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.SessionState
+{
+ public delegate void SessionStateItemExpireCallback (
+ string id, SessionStateStoreData item);
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionStateMode.cs b/mcs/class/System.Web/System.Web.SessionState/SessionStateMode.cs
new file mode 100644
index 00000000000..b76f1a5475b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionStateMode.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.SessionState.SessionStateMode
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.
+//
+
+namespace System.Web.SessionState {
+public enum SessionStateMode
+{
+ Off = 0,
+ InProc = 1,
+ StateServer = 2,
+ SQLServer = 3
+}
+
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs b/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs
new file mode 100644
index 00000000000..a15f1d03404
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs
@@ -0,0 +1,208 @@
+//
+// System.Web.SessionState.SesionStateModule
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Stefan Görling (stefan@gorling.se)
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2002,2003,2004,2005 Novell, Inc (http://www.novell.com)
+// (C) 2003 Stefan Görling (http://www.gorling.se)
+
+//
+// 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.Web;
+using System.Web.Caching;
+using System.Web.Util;
+using System.Security.Cryptography;
+
+namespace System.Web.SessionState
+{
+ public sealed class SessionStateModule : IHttpModule
+ {
+ internal static readonly string CookieName = "ASPSESSION";
+ internal static readonly string HeaderName = "AspFilterSessionId";
+
+ static SessionConfig config;
+ static Type handlerType;
+ ISessionHandler handler;
+ bool sessionForStaticFiles;
+
+ static RandomNumberGenerator rng = new RNGCryptoServiceProvider ();
+
+ public SessionStateModule ()
+ {
+ }
+
+ internal RandomNumberGenerator Rng {
+ get { return rng; }
+ }
+
+ public void Dispose ()
+ {
+ if (handler!=null)
+ handler.Dispose();
+ }
+
+ public void Init (HttpApplication app)
+ {
+ sessionForStaticFiles = (Environment.GetEnvironmentVariable ("MONO_XSP_STATIC_SESSION") != null);
+ if (config == null) {
+ config = (SessionConfig) HttpContext.GetAppConfig ("system.web/sessionState");
+ if (config == null)
+ config = new SessionConfig (null);
+
+ if (config.Mode == SessionStateMode.StateServer)
+ handlerType = typeof (SessionStateServerHandler);
+
+ if (config.Mode == SessionStateMode.SQLServer)
+ handlerType = typeof (SessionSQLServerHandler);
+
+ if (config.Mode == SessionStateMode.InProc)
+ handlerType = typeof (SessionInProcHandler);
+
+ if (config.Mode == SessionStateMode.Off)
+ return;
+ }
+
+ if (config.CookieLess)
+ app.BeginRequest += new EventHandler (OnBeginRequest);
+
+ app.AddOnAcquireRequestStateAsync (
+ new BeginEventHandler (OnBeginAcquireState),
+ new EndEventHandler (OnEndAcquireState));
+
+ app.ReleaseRequestState += new EventHandler (OnReleaseRequestState);
+ app.EndRequest += new EventHandler (OnEndRequest);
+
+ if (handlerType != null && handler == null) {
+ handler = (ISessionHandler) Activator.CreateInstance (handlerType);
+ handler.Init (this, app, config); //initialize
+ }
+ }
+
+ void OnBeginRequest (object o, EventArgs args)
+ {
+ HttpApplication application = (HttpApplication) o;
+ HttpContext context = application.Context;
+ string base_path = context.Request.BaseVirtualDir;
+ string id = UrlUtils.GetSessionId (base_path);
+
+ if (id == null)
+ return;
+
+ context.Request.SetCurrentExePath (UrlUtils.RemoveSessionId (base_path,
+ context.Request.FilePath));
+ context.Request.SetHeader (HeaderName, id);
+ context.Response.SetAppPathModifier (String.Format ("({0})", id));
+ }
+
+ void OnReleaseRequestState (object o, EventArgs args)
+ {
+ if (handler == null)
+ return;
+
+ HttpApplication application = (HttpApplication) o;
+ HttpContext context = application.Context;
+ handler.UpdateHandler (context, this);
+ }
+
+ void OnEndRequest (object o, EventArgs args)
+ {
+ }
+
+ IAsyncResult OnBeginAcquireState (object o, EventArgs args, AsyncCallback cb, object data)
+ {
+ HttpApplication application = (HttpApplication) o;
+ HttpContext context = application.Context;
+
+ bool required = (context.Handler is IRequiresSessionState);
+
+ // This is a hack. Sites that use Session in global.asax event handling code
+ // are not supposed to get a Session object for static files, but seems that
+ // IIS handles those files before getting there and thus they are served without
+ // error.
+ // As a workaround, setting MONO_XSP_STATIC_SESSION variable make this work
+ // on mono, but you lose performance when serving static files.
+ if (sessionForStaticFiles && context.Handler is StaticFileHandler)
+ required = true;
+ // hack end
+
+ bool read_only = (context.Handler is IReadOnlySessionState);
+
+ bool isNew = false;
+ HttpSessionState session = null;
+ if (handler != null)
+ session = handler.UpdateContext (context, this, required, read_only, ref isNew);
+
+ if (session != null) {
+ if (isNew)
+ session.SetNewSession (true);
+
+ if (read_only)
+ session = session.Clone ();
+
+ context.SetSession (session);
+
+ if (isNew && config.CookieLess) {
+ string id = context.Session.SessionID;
+ context.Request.SetHeader (HeaderName, id);
+ context.Response.Redirect (UrlUtils.InsertSessionId (id,
+ context.Request.FilePath));
+ } else if (isNew) {
+ string id = context.Session.SessionID;
+ HttpCookie cookie = new HttpCookie (CookieName, id);
+ cookie.Path = UrlUtils.GetDirectory (context.Request.ApplicationPath);
+ context.Response.AppendCookie (cookie);
+ }
+ }
+
+ // In the future, we might want to move the Async stuff down to
+ // the interface level, if we're going to support other than
+ // InProc, we might actually want to do things async, now we
+ // simply fake it.
+ HttpAsyncResult result=new HttpAsyncResult (cb,this);
+ result.Complete (true, o, null);
+ if (isNew && Start != null)
+ Start (this, args);
+
+ return result;
+ }
+
+ void OnEndAcquireState (IAsyncResult result) { }
+
+ internal void OnSessionRemoved (string key, object value, CacheItemRemovedReason reason)
+ {
+ OnEnd ();
+ }
+
+ internal void OnEnd ()
+ {
+ if (End != null)
+ End (this, EventArgs.Empty);
+ }
+
+ public event EventHandler Start;
+ public event EventHandler End;
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionStateSectionHandler.cs b/mcs/class/System.Web/System.Web.SessionState/SessionStateSectionHandler.cs
new file mode 100644
index 00000000000..2c681b5f56c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionStateSectionHandler.cs
@@ -0,0 +1,100 @@
+//
+// System.Web.SessionState.SessionStateSectionHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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;
+using System.Configuration;
+using System.Web.Configuration;
+using System.Xml;
+
+namespace System.Web.SessionState
+{
+ class SessionStateSectionHandler : IConfigurationSectionHandler
+ {
+ public object Create (object parent, object context, XmlNode section)
+ {
+ //TODO: context?
+ SessionConfig config = new SessionConfig (parent);
+ if (section.HasChildNodes)
+ ThrowException ("No children nodes allowed", section);
+
+ string attvalue = AttValue ("mode", section, false);
+ if (!config.SetMode (attvalue))
+ ThrowException ("Invalid mode value", section);
+
+ if (section.Attributes == null)
+ return config;
+
+ attvalue = AttValue ("cookieless", section);
+ if (attvalue != null)
+ if (!config.SetCookieLess (attvalue))
+ ThrowException ("Invalid cookieless value", section);
+
+ attvalue = AttValue ("timeout", section);
+ if (attvalue != null)
+ if (!config.SetTimeout (attvalue))
+ ThrowException ("Invalid timeout value", section);
+
+ attvalue = AttValue ("stateConnectionString", section);
+ if (attvalue != null)
+ config.SetStateConnectionString (attvalue);
+
+ attvalue = AttValue ("sqlConnectionString", section);
+ if (attvalue != null)
+ config.SetSqlConnectionString (attvalue);
+
+ attvalue = AttValue ("stateNetworkTimeout", section);
+ if (attvalue != null)
+ config.SetStateNetworkTimeout (attvalue);
+
+ if (section.Attributes != null && section.Attributes.Count > 0)
+ HandlersUtil.ThrowException ("Unknown attribute.", section);
+
+ return config;
+ }
+
+ // A few methods to save some typing
+ static string AttValue (string name, XmlNode node, bool optional)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, optional);
+ }
+
+ static string AttValue (string name, XmlNode node)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, true);
+ }
+
+ static void ThrowException (string message, XmlNode node)
+ {
+ HandlersUtil.ThrowException (message, node);
+ }
+ //
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionStateServerHandler.cs b/mcs/class/System.Web/System.Web.SessionState/SessionStateServerHandler.cs
new file mode 100644
index 00000000000..deda72d2b8e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionStateServerHandler.cs
@@ -0,0 +1,138 @@
+//
+// System.Web.SessionState.SessionStateServerHandler
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2003 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
+// "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;
+using System.IO;
+using System.Reflection;
+using System.Configuration;
+using System.Runtime.Remoting;
+
+namespace System.Web.SessionState {
+
+ internal class SessionStateServerHandler : ISessionHandler
+ {
+ const string CookieName = "ASPSESSION";
+
+ private RemoteStateServer state_server;
+ private SessionConfig config;
+
+ public void Dispose ()
+ {
+ }
+
+ public void Init (SessionStateModule module, HttpApplication context, SessionConfig config)
+ {
+ this.config = config;
+ RemotingConfiguration.Configure (null);
+ string cons, proto, server, port;
+ GetConData (config.StateConnectionString, out proto, out server, out port);
+ cons = String.Format ("{0}://{1}:{2}/StateServer", proto, server, port);
+ state_server = (RemoteStateServer) Activator.GetObject (typeof (RemoteStateServer), cons);
+ }
+
+ public void UpdateHandler (HttpContext context, SessionStateModule module)
+ {
+ if (context.Session == null || context.Session.IsReadOnly)
+ return;
+
+ string id = context.Session.SessionID;
+ SessionDictionary dict = context.Session.SessionDictionary;
+ HttpStaticObjectsCollection sobjs = context.Session.StaticObjects;
+ state_server.Update (id, dict.ToByteArray (), sobjs.ToByteArray ());
+ }
+
+ public HttpSessionState UpdateContext (HttpContext context, SessionStateModule module,
+ bool required, bool read_only, ref bool isNew)
+ {
+ if (!required)
+ return null;
+
+ StateServerItem item = null;
+ HttpSessionState session = null;
+ SessionDictionary dict = null;
+ HttpStaticObjectsCollection sobjs = null;
+ string id = GetId (context);
+
+ if (id != null) {
+ item = state_server.Get (id);
+ if (item != null) {
+ dict = SessionDictionary.FromByteArray (item.DictionaryData);
+ sobjs = HttpStaticObjectsCollection.FromByteArray (item.StaticObjectsData);
+ session = new HttpSessionState (id, dict,
+ HttpApplicationFactory.ApplicationState.SessionObjects,
+ config.Timeout, false, config.CookieLess,
+ SessionStateMode.StateServer, read_only);
+
+ return session;
+ }
+ }
+
+ id = SessionId.Create (module.Rng);
+ dict = new SessionDictionary ();
+ sobjs = HttpApplicationFactory.ApplicationState.SessionObjects;
+ item = new StateServerItem (dict.ToByteArray (), sobjs.ToByteArray (), config.Timeout);
+
+ state_server.Insert (id, item);
+
+ session = new HttpSessionState (id, dict, sobjs, config.Timeout, true,
+ config.CookieLess, SessionStateMode.StateServer,
+ read_only);
+
+ isNew = true;
+ return session;
+ }
+
+ private string GetId (HttpContext context)
+ {
+ if (!config.CookieLess &&
+ context.Request.Cookies [CookieName] != null)
+ return context.Request.Cookies [CookieName].Value;
+ return null;
+ }
+
+ private void GetConData (string cons, out string proto, out string server, out string port)
+ {
+ int ei = cons.IndexOf ('=');
+ int ci = cons.IndexOf (':');
+
+ if (ei < 0 || ci < 0)
+ throw new Exception ("Invalid StateConnectionString");
+
+ proto = cons.Substring (0, ei);
+ server = cons.Substring (ei+1, ci - ei - 1);
+ port = cons.Substring (ci+1, cons.Length - ci - 1);
+
+ if (proto == "tcpip")
+ proto = "tcp";
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionStateStoreData.cs b/mcs/class/System.Web/System.Web.SessionState/SessionStateStoreData.cs
new file mode 100644
index 00000000000..359bd1049da
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionStateStoreData.cs
@@ -0,0 +1,66 @@
+//
+// System.Web.SessionState.SessionStateStoreData.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Web;
+
+namespace System.Web.SessionState {
+ public class SessionStateStoreData
+ {
+ ISessionStateItemCollection sessionItems;
+ HttpStaticObjectsCollection staticObjects;
+ int timeout;
+
+ SessionStateStoreData (ISessionStateItemCollection items,
+ HttpStaticObjectsCollection objects,
+ int timeout)
+ {
+ sessionItems = items;
+ staticObjects = objects;
+ this.timeout = timeout;
+ }
+
+ public virtual ISessionStateItemCollection Items {
+ get { return sessionItems ; }
+ }
+
+ public virtual HttpStaticObjectsCollection StaticObjects {
+ get { return staticObjects; }
+ }
+
+ public virtual int Timeout {
+ get { return timeout; }
+ set { timeout = value; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.SessionState/StateRuntime.cs b/mcs/class/System.Web/System.Web.SessionState/StateRuntime.cs
new file mode 100644
index 00000000000..5cd9ae085ca
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/StateRuntime.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.SessionState.StateRuntime.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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.
+//
+
+namespace System.Web.SessionState
+{
+ public sealed class StateRuntime : IStateRuntime
+ {
+ [MonoTODO]
+ public void ProcessRequest (IntPtr tracker, int verb,
+ string uri, int exclusive, int timeout,
+ int lockCookieExists, int lockCookie,
+ int contentLength, IntPtr content)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void StopProcessing ()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.SessionState/StateServerItem.cs b/mcs/class/System.Web/System.Web.SessionState/StateServerItem.cs
new file mode 100644
index 00000000000..2d891e5dcee
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/StateServerItem.cs
@@ -0,0 +1,73 @@
+//
+// System.Web.SessionState.StateServerItem
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2003 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
+// "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;
+
+namespace System.Web.SessionState {
+
+ [Serializable]
+ class StateServerItem {
+
+ private byte [] dict_data;
+ private byte [] sobjs_data;
+ private DateTime last_access;
+ private int timeout;
+
+ public StateServerItem (byte [] dict_data, byte [] sobjs_data, int timeout)
+ {
+ this.dict_data = dict_data;
+ this.sobjs_data = sobjs_data;
+ this.timeout = timeout;
+ this.last_access = DateTime.Now;
+ }
+
+ public byte [] DictionaryData {
+ get { return dict_data; }
+ set { dict_data = value; }
+ }
+
+ public byte [] StaticObjectsData {
+ get { return sobjs_data; }
+ set { sobjs_data = value; }
+ }
+
+ public void Touch ()
+ {
+ last_access = DateTime.Now;
+ }
+
+ public bool IsAbandoned () {
+ if (last_access.AddMinutes (timeout) < DateTime.Now)
+ return true;
+ return false;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.Adapters/ChangeLog b/mcs/class/System.Web/System.Web.UI.Adapters/ChangeLog
new file mode 100644
index 00000000000..22bc7f60c4e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.Adapters/ChangeLog
@@ -0,0 +1,3 @@
+2004-08-04 Sanjay Gupta <gsanjay@novell.com>
+
+ * WmlPostFieldType.cs : Added enumeration.
diff --git a/mcs/class/System.Web/System.Web.UI.Adapters/WmlPostFieldType.cs b/mcs/class/System.Web/System.Web.UI.Adapters/WmlPostFieldType.cs
new file mode 100644
index 00000000000..0956c013400
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.Adapters/WmlPostFieldType.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.UI.Adapters.WmlPostFieldType.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.Adapters {
+ public enum WmlPostFieldType {
+ Normal = 0,
+ Submit = 1,
+ Variable = 2,
+ Raw = 3
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog b/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
new file mode 100644
index 00000000000..32d60e29465
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
@@ -0,0 +1,418 @@
+2005-04-22 Lluis Sanchez Gual <lluis@novell.com>
+
+ * HtmlForm.cs: Use the new WriteSubmitStatements method from
+ Page.ClientScript.
+
+2005-03-11 Lluis Sanchez Gual <lluis@novell.com>
+
+ * HtmlInputButton.cs, HtmlAnchor.cs, HtmlButton.cs: Don't use
+ Page.GetPostBackClientEvent since it is deprecated in 2.0.
+
+2005-02-25 Lluis Sanchez Gual <lluis@novell.com>
+
+ * HtmlForm.cs: Register the form in the page, so the page knows
+ which is the main form.
+
+2005-02-18 Lluis Sanchez Gual <lluis@novell.com>
+
+ * HtmlHead.cs: Method name fix.
+
+2005-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlForm.cs: submitStatements holds Hashtables.
+
+2004-12-20 Lluis Sanchez Gual <lluis@novell.com>
+
+ * HtmlHead.cs: Implemented.
+ * HtmlHeadBuilder.cs: Implemented.
+ * HtmlTitle.cs: Implemented.
+
+2004-12-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlForm.cs: MakeRelative() can be null. Thanks to Denis Gervaille.
+
+2004-11-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlForm.cs: fixed the Action property when running a different
+ page than the one requested (Transfer). Closes bug #69318.
+
+2004-11-26 Lluis Sanchez Gual <lluis@novell.com>
+
+ * HtmlForm.cs: Add submit statements from the new Page.ClientScript
+ property.
+
+2004-06-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlForm.cs: disabled smartnavigation as we have no scripts to support
+ it and failed when the browser was IE.
+
+2004-05-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlForm.cs: default value for Enctype is "".
+ * HtmlInputFile.cs: if no one set the encoding type for the HtmlForm,
+ we set it to "multipart/form-data". Fixes bug #58359.
+
+2004-01-15 Alon Gazit <along@mainsoft.com>
+ * HtmlForm.cs: The property name always return the value of the
+ property UniqueID.
+
+2003-12-28 Alon Gazit <along@mainsoft.com>
+ * HtmlSelect.cs: fix typo in LoadPostData().
+
+2003-12-29 Alon Gazit <along@mainsoft.com>
+ * HtmlInputButton.cs: update the implementation of RenderAttributes().
+ Change the if statement that determines if the onclick script is
+ rendered.
+
+2003-12-28 Alon Gazit <along@mainsoft.com>
+ * HtmlSelect.cs: add parentheses to if statement.
+ Currently the else statement refers to the inner if statement.
+
+2003-12-28 Alon Gazit <along@mainsoft.com>
+ * HtmlSelect.cs: fix upper bound of for statement.
+
+2003-12-19 Jackson Harper <jackson@ximian.com>
+
+ * HtmlInputFile.cs: Do not set value when loading post data.
+
+2003-12-14 Alon Gazit <along@mainsoft.com>
+ * HtmlInputButton.cs: The problem was in RenderAttributes().
+ Before adding the script to the HTML, the number of Validators should
+ be checked. fixes bug #52158.
+
+2003-12-07 Alon Gazit <along@mainsoft.com>
+ * HtmlTableCell.cs: fixing a typo in NoWrap property.
+
+2003-12-04 Jackson Harper <jackson@ximian.com>
+
+ * HtmlInputRadioButton.cs: Lookup name in postadata and compare to
+ value. This is because radio button groups are created by setting
+ the name to the same value with each button, then on postback the
+ value of the name is the id of the selected radio button.
+
+2003-12-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlContainerControl.cs: encode/decode InnerText. Fixes bug #51653.
+
+2003-12-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlSelect.cs: with the new LosFormatter, we get array types right, so
+ remove the code used to workaround that.
+
+2003-12-01 Jackson Harper <jackson@ximian.com>
+
+ * HtmlControl.cs: Fix disabled property. Patch by Alon Gazit
+ <along@mainsoft.com>.
+
+2003-11-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlSelect.cs: don't add items without data. Patch by Alon Gazit
+ <along@mainsoft.com>. Fixes bug #51377.
+
+2003-11-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlInputRadioButton.cs: initialize event indexer. Patch by Alon Gazit
+ <along@mainsoft.com>.
+
+2003-10-29 Jackson Harper <jackson@ximian.com>
+
+ * HtmlControl.cs: Make disabled an attribute of the control so it
+ is rendered. This is a slightly modifed version of a patch
+ by Yaron Shkop. Fixes bug #50160.
+
+2003-10-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlTextArea.cs: fixed infinite recursion.
+
+2003-10-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlForm.cs: render the onsubmit attribute.
+
+2003-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlGenericControl.cs: ConstructorNeedsTag defaults to false so we
+ need to pass true here. Fixes bug #47918.
+
+2003-07-17 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * HtmlContainerControl.cs: Added attributes
+ * HtmlControl.cs: Added attributes
+ * HtmlInputControl.cs: Fixed public signature
+ * HtmlInputRadioButton.cs: Fixed public signature
+ * HtmlSelect.cs: Added missing attribute
+ * HtmlTable.cs: Added missing attribute
+
+2003-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlSelect.cs: fixed bug #44894.
+
+2003-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlImage.cs:
+ * HtmlInputControl.cs:
+ * HtmlSelect.cs: added control builder attribute.
+
+ * HtmlSelectBuilder.cs: builder for HtmlSelect.
+
+ * HtmlControlBuilder.cs: common builder for all HtmlControls.
+
+2003-01-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlControl.cs: _tagName is now internal.
+ * HtmlGenericControl.cs: use the field in HtmlControl to keep the tag
+ name.
+
+2003-01-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI.HtmlControls/HtmlForm.cs: render 'action' attribute.
+
+2003-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlInputButton.cs: fixed bug #35677.
+
+2003-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlInputControl.cs: fixed bug #35673.
+
+2003-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlInputText.cs: fixed bug #35670.
+
+2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlSelect.cs: fixed LoadViewstate.
+
+2002-11-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlButton.cs: make it do a POST if the button has any ServerClick
+ events.
+
+2002-09-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlAnchor.cs:
+ * HtmlButton.cs:
+ * HtmlContainerControl.cs:
+ * HtmlControl.cs:
+ * HtmlForm.cs:
+ * HtmlGenericControl.cs:
+ * HtmlImage.cs:
+ * HtmlInputButton.cs:
+ * HtmlInputCheckBox.cs:
+ * HtmlInputControl.cs:
+ * HtmlInputFile.cs:
+ * HtmlInputHidden.cs:
+ * HtmlInputImage.cs:
+ * HtmlInputRadioButton.cs:
+ * HtmlInputText.cs:
+ * HtmlSelect.cs:
+ * HtmlTable.cs:
+ * HtmlTableCell.cs:
+ * HtmlTableRow.cs:
+ * HtmlTextArea.cs: added almost all missing attributes.
+
+2002-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlControl.cs: the attributes must use ViewState as its StateBag,
+ if not style values are lost between postbacks.
+
+2002-07-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlAnchor.cs:
+ * HtmlButton.cs:
+ * HtmlInputButton.cs:
+ * HtmlInputCheckBox.cs:
+ * HtmlInputHidden.cs:
+ * HtmlInputImage.cs:
+ * HtmlInputText.cs:
+ * HtmlTextArea.cs: Initialize EventHandlerList indexer.
+
+ * HtmlContainerControl.cs: almost rewritten to use a LiteralControl
+ instead of maintaining some flags and strings. Implemented
+ LoadViewState.
+
+ * HtmlControl.cs: fixed constructor and added ViewStateIgnoreCase.
+
+ * HtmlSelect.cs: fixed TrackViewState, SaveViewState, SelectedIndices
+ and Value.
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlGenericControl.cs: fixed TagName signature and get/set.
+ * HtmlInputImage.cs: added attribute and fixed signature of ServerClick.
+ * HtmlInputText.cs: added attribute.
+
+2002-07-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlForm.cs: don't render action attribute.
+
+2002-07-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlContainerControl.cs:
+ (CreateControlCollection): added. All containers must have a non-empty
+ control collection.
+
+2002-06-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI.HtmlControls/HtmlAnchor.cs:
+ * System.Web.UI.HtmlControls/HtmlButton.cs:
+ * System.Web.UI.HtmlControls/HtmlControl.cs:
+ * System.Web.UI.HtmlControls/HtmlForm.cs:
+ * System.Web.UI.HtmlControls/HtmlGenericControl.cs:
+ * System.Web.UI.HtmlControls/HtmlInputButton.cs:
+ * System.Web.UI.HtmlControls/HtmlInputCheckBox.cs:
+ * System.Web.UI.HtmlControls/HtmlInputControl.cs:
+ * System.Web.UI.HtmlControls/HtmlInputFile.cs:
+ * System.Web.UI.HtmlControls/HtmlInputHidden.cs:
+ * System.Web.UI.HtmlControls/HtmlInputImage.cs:
+ * System.Web.UI.HtmlControls/HtmlInputRadioButton.cs:
+ * System.Web.UI.HtmlControls/HtmlInputText.cs:
+ * System.Web.UI.HtmlControls/HtmlSelect.cs:
+ * System.Web.UI.HtmlControls/HtmlTable.cs:
+ * System.Web.UI.HtmlControls/HtmlTableCell.cs:
+ * System.Web.UI.HtmlControls/HtmlTableRow.cs:
+ * System.Web.UI.HtmlControls/HtmlTextArea.cs:
+
+ Fixes based on class status page:
+
+ - Add attributes (DefaultEvent, ParseChildren).
+ - Fix declarations.
+ - Explicitly implement some interfaces (IPostBackDataHandler
+ and IPostBackEventHandler).
+ - Implemented some missing methods.
+
+2002-06-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlForm.cs:
+ (RenderChildren): use OnFormRender and OnFormPostRender.
+
+2002-06-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlSelect.cs:
+ (RenderAttributes): new -> override and fixes stack overflow.
+ (RenderChildren): only 1 option can be selected at any given time
+ except when Multiple property is true.
+ (Multiple): the attribute value is either "true" or "false", not
+ "multiple".
+
+ * HtmlTable.cs:
+ (Add):
+ (AddAt): allow HtmlTableRow as children, not HtmlTableCell.
+
+ * HtmlTableCell.cs:
+ (RenderEndTag): new -> override.
+
+ * HtmlTableRow.cs:
+ (RenderChildren): fixed another stack overflow.
+ (RenderEndTag): new -> override.
+
+ * HtmlTextArea.cs:
+ (RenderAttributes): new -> override.
+
+
+2002-06-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlInputHidden.cs: fixed constructor.
+
+ * HtmlInputRadioButton.cs:
+ (RenderAttributes): fixed stack overflow.
+
+ (Name):
+ (RenderedName): new -> override.
+
+ (Value): new property.
+
+ * HtmlInputText.cs:
+ (RenderAttributes): fixed the same kind of stack overflow and make
+ string comparison case insensitive.
+
+2002-06-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlForm.cs: fixed name of Enctype property and render enctype
+ enctype attribute.
+
+ * HtmlInputControl.cs: tag type is "input", not "type".
+
+2002-06-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlControl.cs: Render contents moved to new RenderBeginTag method,
+ defined in MS docs.
+
+ * HtmlForm.cs: Render output when no IE browser.
+
+ * HtmlInputButton.cs: added constructor without arguments. Xsp used it,
+ though now it always use the other .ctor.
+
+ * HtmlInputControl.cs: cosmetic changes and implemented set_Name.
+
+2002-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlButton.cs: RenderAttributes is an override, not new.
+
+ * HtmlContainerControl.cs: use the new Render method in HtmlControl.
+
+ * HtmlControl.cs: added Render method to render the tag and its
+ attributes. Works for container and non-containers.
+
+ * HtmlImage.cs: RenderAttributes don't need to be new. Implemented
+ Height property.
+
+2002-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlContainerControl.cs: some formatting and use HttpUtility.Encode
+ instead of Page.Server to encode InnerText.
+
+2002-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlAnchor.cs:
+ (RenderAttributes): new -> override and fixed little bug that made
+ it cause an stack overflow.
+
+ * HtmlContainerControl.cs: reformatted and added tag and attributes
+ rendering.
+
+ * HtmlGenericControl.cs: removed TagName, which is already in
+ HtmlControl.
+
+ * HtmlTable.cs:
+ (RenderEndTag): new -> override.
+
+2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI.HtmlControls/HtmlForm.cs:
+ (RenderAttributes): changed new by override.
+ (Name): allow setting the property.
+
+2002-05-10 Duncan Mak <duncan@ximian.com>
+
+ * HtmlTableCellCollection.cs (this): Updated the indexer to return
+ the right type, HtmlTableCell instead of HtmlTableRow.
+
+ * HtmlInputImage.cs (OnServerClick): Commented out parts that
+ won't compile.
+
+ * HtmlForm.cs (RenderAttributes):
+ (RenderChildren): Commented out code that doesn't compile.
+
+2002-05-07 Duncan Mak <duncan@ximian.com>
+
+ * HtmlSelect.cs (TrackViewState): Added 'new' keyword to avoid
+ clashing with the method defined in the parent class.
+ (OnDataBinding): Added missing casts.
+
+ * HtmlForm.cs (Render): Fixed call too SetAttribute, need to cast
+ 'this' to IAttributeAccessor before calling interface method.
+ Also renamed some calls to reflect changes in the API.
+
+ * HtmlControl.cs (WriteOnClickAttribute): Made it not static and
+ fixed a typo.
+
+2001-09-03 Leen Toelen <toelen@hotmail.com>
+
+ * HtmlAnchor.cs: Initial implementation.
+ * HtmlTextArea.cs: Initial implementation.
+
+2001-08-22 Bob Smith <bob@thestuff.net>
+
+ * HtmlContainerControl.cs: Initial implementation.
+ * HtmlControl.cs: Initial implementation.
+ * HtmlGenericControl.cs: Initial implementation.
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
new file mode 100644
index 00000000000..f41cc40bdd5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
@@ -0,0 +1,119 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerClick")]
+ public class HtmlAnchor : HtmlContainerControl, IPostBackEventHandler{
+
+ private static readonly object EventServerClick = new object ();
+
+ public HtmlAnchor(): base("a"){}
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+ if (Page != null && Events [EventServerClick] != null)
+ Page.RequiresPostBackScript ();
+ }
+
+ protected virtual void OnServerClick(EventArgs e){
+ EventHandler handler;
+ handler = (EventHandler) Events[EventServerClick];
+ if (handler != null)
+ handler (this, e);
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ if ( Events[EventServerClick] != null){
+ Attributes.Remove("href");
+ base.RenderAttributes(writer);
+ writer.WriteAttribute("href", Page.ClientScript.GetPostBackClientHyperlink(this,String.Empty));
+ }
+ else{
+ PreProcessRelativeReference(writer,"href");
+ base.RenderAttributes(writer);
+ }
+ }
+
+ void System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(string eventArgument){
+ OnServerClick(EventArgs.Empty);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the control is clicked.")]
+ public event EventHandler ServerClick{
+ add{
+ Events.AddHandler(EventServerClick, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerClick, value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Action")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string HRef{
+ get{
+ string attr = Attributes["href"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["href"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Navigation")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string Name{
+ get{
+ string attr = Attributes["name"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["name"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Navigation")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string Target{
+ get{
+ string attr = Attributes["target"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["target"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string Title{
+ get{
+ string attr = Attributes["title"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["title"] = AttributeToString(value);
+ }
+ }
+
+ } // class HtmlAnchor
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
new file mode 100644
index 00000000000..73dbef9edb4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
@@ -0,0 +1,93 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerClick")]
+ public class HtmlButton : HtmlContainerControl, IPostBackEventHandler{
+
+ private static readonly object EventServerClick = new object ();
+
+ //Checked
+ public HtmlButton(): base("button"){}
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+ if (Page != null && Events [EventServerClick] != null)
+ Page.RequiresPostBackScript ();
+ }
+
+ //Checked
+ protected virtual void OnServerClick(EventArgs e){
+ EventHandler handler;
+ handler = (EventHandler) Events[EventServerClick];
+ if (handler != null)
+ handler (this, e);
+
+
+ }
+
+ protected override void RenderAttributes (HtmlTextWriter writer)
+ {
+ if (Page != null && Events [EventServerClick] != null) {
+ string script = Page.ClientScript.GetPostBackClientEvent (this, String.Empty);
+ AttributeCollection coll = Attributes;
+ if (coll ["language"] != null)
+ coll.Remove ("language");
+ writer.WriteAttribute ("language", "javascript");
+
+ string onclick;
+ if ((onclick = coll ["onclick"]) != null) {
+ script = onclick + " " + script;
+ coll.Remove ("onclick");
+ }
+
+ writer.WriteAttribute ("onclick", script);
+ }
+ base.RenderAttributes(writer);
+ }
+
+ void System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(string eventArgument){
+ if (CausesValidation){
+ Page.Validate();
+ }
+ OnServerClick(EventArgs.Empty);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the control is clicked.")]
+ public event EventHandler ServerClick{
+ add{
+ Events.AddHandler(EventServerClick, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerClick, value);
+ }
+ }
+
+ [DefaultValue(true)]
+ [WebCategory("Behavior")]
+ public bool CausesValidation{
+ get{
+ object attr = ViewState["CausesValidation"];
+ if (attr != null){
+ return (Boolean) attr;
+ }
+ return true;
+ }
+ set{
+ ViewState["CausesValidation"] = (Boolean) value;
+ }
+ }
+
+ } // class HtmlButton
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs
new file mode 100644
index 00000000000..a24d8ca6d71
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs
@@ -0,0 +1,124 @@
+//
+// System.Web.UI.HtmlControls.HtmlContainerControl.cs
+//
+// Authors:
+// Bob Smith <bob@thestuff.net>
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) Bob Smith
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Text;
+using System.Web;
+using System.Web.UI;
+
+//LAMESPEC: The dox talk about HttpException but are very ambigious.
+//TODO: Check to see if Render really is overridden instead of a LiteralControl being added. It apears that this is the
+//case due to testing. Anything inside the block is overwritten by the content of this control, so it doesnt apear
+//to do anything with children.
+// a doc references this. add? protected override ControlCollection CreateControlCollection();
+
+//TODO: If Test.InnerText = Test.InnerHtml without ever assigning anything into InnerHtml, you get this:
+// Exception Details: System.Web.HttpException: Cannot get inner content of Message because the contents are not literal.
+//[HttpException (0x80004005): Cannot get inner content of Message because the contents are not literal.]
+// System.Web.UI.HtmlControls.HtmlContainerControl.get_InnerHtml() +278
+// ASP.test3_aspx.AnchorBtn_Click(Object Source, EventArgs E) in \\genfs2\www24\bobsmith11\test3.aspx:6
+// System.Web.UI.HtmlControls.HtmlAnchor.OnServerClick(EventArgs e) +108
+// System.Web.UI.HtmlControls.HtmlAnchor.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +26
+// System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
+// System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +149
+// System.Web.UI.Page.ProcessRequestMain() +660
+
+
+namespace System.Web.UI.HtmlControls
+{
+ public abstract class HtmlContainerControl : HtmlControl{
+
+ public HtmlContainerControl () : this ("span") {}
+
+ public HtmlContainerControl (string tag) : base(tag) {}
+
+ [HtmlControlPersistable (false)]
+ [BrowsableAttribute(false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public virtual string InnerHtml
+ {
+ get {
+ if (Controls.Count == 0)
+ return String.Empty;
+
+ bool is_literal = true;
+ StringBuilder text = new StringBuilder ();
+ foreach (Control ctrl in Controls) {
+ LiteralControl lc = ctrl as LiteralControl;
+ if (lc == null) {
+ is_literal = false;
+ break;
+ }
+ text.Append (lc.Text);
+ }
+
+ if (!is_literal)
+ throw new HttpException ("There is no literal content!");
+
+ return text.ToString ();
+ }
+
+ set {
+ Controls.Clear ();
+ Controls.Add (new LiteralControl (value));
+ ViewState ["innerhtml"] = value;
+ }
+ }
+
+ [HtmlControlPersistable (false)]
+ [BrowsableAttribute(false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public virtual string InnerText
+ {
+ get {
+ return HttpUtility.HtmlDecode (InnerHtml);
+ }
+
+ set {
+ InnerHtml = HttpUtility.HtmlEncode (value);
+ }
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ RenderBeginTag (writer);
+ RenderChildren (writer);
+ RenderEndTag (writer);
+ }
+
+ protected virtual void RenderEndTag (HtmlTextWriter writer)
+ {
+ writer.WriteEndTag (TagName);
+ }
+
+ protected override void RenderAttributes (HtmlTextWriter writer)
+ {
+ ViewState.Remove ("innerhtml");
+ base.RenderAttributes (writer);
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new ControlCollection (this);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState != null) {
+ base.LoadViewState (savedState);
+ string inner = ViewState ["innerhtml"] as string;
+ if (inner != null)
+ InnerHtml = inner;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs
new file mode 100644
index 00000000000..c69c185829b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs
@@ -0,0 +1,143 @@
+//
+// System.Web.UI.HtmlControls.HtmlControl.cs
+//
+// Author
+// Bob Smith <bob@thestuff.net>
+//
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [ToolboxItem(false)]
+ [Designer ("System.Web.UI.Design.HtmlIntrinsicControlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ public abstract class HtmlControl : Control, IAttributeAccessor
+ {
+ internal string _tagName;
+ private AttributeCollection _attributes;
+
+
+ public HtmlControl() : this ("span") {}
+
+ public HtmlControl(string tag)
+ {
+ _tagName = tag;
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new EmptyControlCollection (this);
+ }
+
+ internal static string AttributeToString(int n){
+ if (n != -1)return n.ToString(NumberFormatInfo.InvariantInfo);
+ return null;
+ }
+
+ internal static string AttributeToString(string s){
+ if (s != null && s.Length != 0) return s;
+ return null;
+ }
+
+ internal void PreProcessRelativeReference(HtmlTextWriter writer, string attribName){
+ string attr = Attributes[attribName];
+ if (attr != null){
+ if (attr.Length != 0){
+ try{
+ attr = ResolveUrl(attr);
+ }
+ catch (Exception) {
+ throw new HttpException(attribName + " property had malformed url");
+ }
+ writer.WriteAttribute(attribName, attr);
+ Attributes.Remove(attribName);
+ }
+ }
+ }
+
+ string System.Web.UI.IAttributeAccessor.GetAttribute(string name){
+ return Attributes[name];
+ }
+
+ void System.Web.UI.IAttributeAccessor.SetAttribute(string name, string value){
+ Attributes[name] = value;
+ }
+
+ protected virtual void RenderBeginTag (HtmlTextWriter writer)
+ {
+ writer.WriteBeginTag (TagName);
+ RenderAttributes (writer);
+ writer.Write ('>');
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ RenderBeginTag (writer);
+ }
+
+ protected virtual void RenderAttributes(HtmlTextWriter writer){
+ if (ID != null){
+ writer.WriteAttribute("id",ClientID);
+ }
+ Attributes.Render(writer);
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public AttributeCollection Attributes
+ {
+ get {
+ if (_attributes == null)
+ _attributes = new AttributeCollection (ViewState);
+ return _attributes;
+ }
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Behavior")]
+ public bool Disabled
+ {
+ get {
+ string disableAttr = Attributes["disabled"] as string;
+ return (disableAttr != null);
+ }
+ set {
+ if (!value)
+ Attributes.Remove ("disabled");
+ else
+ Attributes["disabled"] = "disabled";
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public CssStyleCollection Style
+ {
+ get { return Attributes.CssStyle; }
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Appearance")]
+ public virtual string TagName
+ {
+ get { return _tagName; }
+ }
+
+ protected override bool ViewStateIgnoresCase
+ {
+ get {
+ return true;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControlBuilder.cs
new file mode 100644
index 00000000000..b41de8ad6f6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControlBuilder.cs
@@ -0,0 +1,22 @@
+//
+// System.Web.UI.HtmlControls.HtmlControlBuilder
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls
+{
+ class HtmlControlBuilder : ControlBuilder
+ {
+ public override bool HasBody ()
+ {
+ return false;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
new file mode 100644
index 00000000000..e95af8c311f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
@@ -0,0 +1,171 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Web.Util;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlForm : HtmlContainerControl{
+
+ // Unused
+ //private static string SmartNavIncludeScriptKey = "SmartNavIncludeScript";
+
+ public HtmlForm(): base("form"){}
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name", Name);
+ Attributes.Remove("name");
+ writer.WriteAttribute("method", Method);
+ Attributes.Remove("method");
+ writer.WriteAttribute("action", Action, true);
+ Attributes.Remove("action");
+ if (Enctype != null){
+ writer.WriteAttribute ("enctype", Enctype);
+ Attributes.Remove ("enctype");
+ }
+
+ string submitStatements = Page.ClientScript.WriteSubmitStatements ();
+ if (submitStatements != null) {
+ string prev = Attributes ["onsubmit"];
+ if (prev != null) {
+ submitStatements = prev + submitStatements;
+ Attributes.Remove ("onsubmit");
+ }
+
+ writer.WriteAttribute ("language", "javascript");
+ writer.WriteAttribute ("onsubmit", submitStatements);
+ }
+
+ if (ID == null)
+ writer.WriteAttribute ("id", ClientID);
+
+ base.RenderAttributes (writer);
+ }
+
+ protected override void Render(HtmlTextWriter output){
+ /*** Disabled smart navigation. We have no scripts - Gonzalo
+ if (Page.SmartNavigation == false){
+ base.Render (output);
+ return;
+ }
+
+ ((IAttributeAccessor) this).SetAttribute("_smartNavigation","true");
+ HttpBrowserCapabilities browserCap = Context.Request.Browser;
+ if (browserCap.Browser.ToLower() != "ie" && browserCap.MajorVersion < 5){
+ base.Render(output);
+ return;
+ }
+ output.WriteLine("<IFRAME ID=_hifSmartNav NAME=_hifSmartNav STYLE=display:none ></IFRAME>");
+
+ if (browserCap.MinorVersion < 0.5 && browserCap.MajorVersion != 5)
+ Page.RegisterClientScriptFile("SmartNavIncludeScript","JScript","SmartNavIE5.js");
+ else if (Page.IsPostBack) Page.RegisterClientScriptFile("SmartNavIncludeScript","JScript","SmartNav.js");
+ */
+ base.Render(output);
+ }
+
+ protected override void RenderChildren (HtmlTextWriter writer)
+ {
+ Page.OnFormRender (writer,ClientID);
+ base.RenderChildren (writer);
+ Page.OnFormPostRender (writer,ClientID);
+ }
+
+ protected override void OnInit(EventArgs e){
+ base.OnInit(e);
+ Page.RegisterViewStateHandler();
+#if NET_2_0
+ Page.RegisterForm (this);
+#endif
+ }
+
+ internal string Action {
+ get{
+ string executionFilePath = Context.Request.CurrentExecutionFilePath;
+ string filePath = Context.Request.FilePath;
+ string attr;
+ if (executionFilePath == filePath) {
+ attr = filePath;
+ int lastSlash = attr.LastIndexOf('/');
+ if (lastSlash >= 0)
+ attr = attr.Substring(lastSlash + 1);
+ } else {
+ attr = UrlUtils.MakeRelative (executionFilePath, UrlUtils.GetDirectory (filePath));
+ if (attr == null)
+ attr = executionFilePath;
+ }
+ string queryString = Context.Request.QueryStringRaw;
+ if (queryString != null && queryString.Length > 0)
+ attr = String.Concat(attr, '?', queryString);
+ return attr;
+ }
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Behavior")]
+ public string Enctype{
+ get{
+ string attr = Attributes["enctype"];
+ if (attr != null){
+ return attr;
+ }
+ return "";
+ }
+ set{
+ Attributes["enctype"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Behavior")]
+ public string Method{
+ get{
+ string attr = Attributes["method"];
+ if (attr != null){
+ return attr;
+ }
+ return "post";
+ }
+ set{
+ Attributes["method"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Behavior")]
+ public string Target{
+ get{
+ string attr = Attributes["target"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["target"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Appearance")]
+ public virtual string Name{
+ get{
+ return UniqueID;
+ }
+ set {
+ }
+ }
+ } // class HtmlForm
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs
new file mode 100644
index 00000000000..ca8940adb1d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.UI.HtmlControls.HtmlGenericControl.cs
+//
+// Authors:
+// Bob Smith <bob@thestuff.net>
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) Bob Smith
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [ConstructorNeedsTag(true)]
+ public class HtmlGenericControl : HtmlContainerControl {
+ public HtmlGenericControl() :
+ this ("span")
+ {
+ }
+
+ public HtmlGenericControl (string tag) :
+ base ()
+ {
+ if (tag == null)
+ tag = "";
+ _tagName = tag;
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Appearance")]
+ public new string TagName
+ {
+ get { return _tagName; }
+ set { _tagName = value; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlHead.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlHead.cs
new file mode 100644
index 00000000000..1d80f45ff89
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlHead.cs
@@ -0,0 +1,165 @@
+//
+// System.Web.UI.HtmlControls.HtmlHead
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 Novell, Inc.
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Collections;
+
+namespace System.Web.UI.HtmlControls
+{
+ [ControlBuilder (typeof(HtmlHeadBuilder))]
+ public class HtmlHead: HtmlContainerControl, IPageHeader
+ {
+ HtmlTitle title;
+ Hashtable metadata;
+ ArrayList styleSheets;
+ StyleSheetBag styleSheet;
+
+ public HtmlHead(): base("head") {}
+
+ protected override void OnInit (EventArgs e)
+ {
+ Page.SetHeader (this);
+ }
+
+ protected override void RenderChildren (HtmlTextWriter writer)
+ {
+ base.RenderChildren (writer);
+ if (metadata != null) {
+ foreach (DictionaryEntry entry in metadata) {
+ writer.AddAttribute ("name", entry.Key.ToString ());
+ writer.AddAttribute ("content", entry.Value.ToString ());
+ writer.RenderBeginTag (HtmlTextWriterTag.Meta);
+ writer.RenderEndTag ();
+ }
+ }
+
+ if (styleSheet != null)
+ styleSheet.Render (writer);
+ }
+
+ protected override void AddParsedSubObject (object ob)
+ {
+ if (ob is HtmlTitle)
+ title = (HtmlTitle) ob;
+
+ base.AddParsedSubObject (ob);
+ }
+
+ protected internal override void AddedControl (Control control, int index)
+ {
+ base.AddedControl (control, index);
+ }
+
+ IList IPageHeader.LinkedStyleSheets {
+ get {
+ if (styleSheets == null) styleSheets = new ArrayList ();
+ return styleSheets;
+ }
+ }
+
+ IDictionary IPageHeader.Metadata {
+ get {
+ if (metadata == null) metadata = new Hashtable ();
+ return metadata;
+ }
+ }
+
+ IStyleSheet IPageHeader.StyleSheet {
+ get {
+ if (styleSheet == null) styleSheet = new StyleSheetBag (Page);
+ return styleSheet;
+ }
+ }
+
+ string IPageHeader.Title {
+ get { return title.Text; }
+ set { title.Text = value; }
+ }
+ }
+
+ internal class StyleSheetBag: IStyleSheet
+ {
+ ArrayList entries = new ArrayList ();
+ Page page;
+
+ internal class StyleEntry
+ {
+ public Style Style;
+ public string Selection;
+ public IUrlResolutionService UrlResolver;
+ }
+
+ public StyleSheetBag (Page page)
+ {
+ this.page = page;
+ }
+
+ public void CreateStyleRule (Style style, string selection, IUrlResolutionService urlResolver)
+ {
+ StyleEntry entry = new StyleEntry ();
+ entry.Style = style;
+ entry.UrlResolver = urlResolver;
+ entry.Selection = selection;
+ entries.Add (entry);
+ }
+
+ public void RegisterStyle (Style style, IUrlResolutionService urlResolver)
+ {
+ for (int n=0; n<entries.Count; n++) {
+ if (((StyleEntry)entries[n]).Style == style)
+ return;
+ }
+
+ string name = "aspnet_" + entries.Count;
+ style.SetRegisteredCssClass (name);
+ CreateStyleRule (style, "." + name, urlResolver);
+ }
+
+ public void Render (HtmlTextWriter writer)
+ {
+ writer.AddAttribute ("type", "text/css");
+ writer.RenderBeginTag (HtmlTextWriterTag.Style);
+
+ foreach (StyleEntry entry in entries) {
+ CssStyleCollection sts = entry.Style.GetStyleAttributes (entry.UrlResolver);
+ writer.Write ("\n" + entry.Selection + " {" + sts.BagToString () + "}");
+ }
+
+ writer.RenderEndTag ();
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlHeadBuilder.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlHeadBuilder.cs
new file mode 100644
index 00000000000..26b689f2632
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlHeadBuilder.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.UI.HtmlControls.HtmlHeadBuilder
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 Novell, Inc.
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System.Web.UI;
+using System.Collections;
+
+namespace System.Web.UI.HtmlControls
+{
+ class HtmlHeadBuilder : ControlBuilder
+ {
+ public override bool AllowWhitespaceLiterals ()
+ {
+ return false;
+ }
+
+ public override Type GetChildControlType (string tagName, IDictionary attribs)
+ {
+ if (string.Compare (tagName, "TITLE", true) == 0)
+ return typeof(HtmlTitle);
+ return null;
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
new file mode 100755
index 00000000000..b08d6575d79
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
@@ -0,0 +1,122 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls{
+ [ControlBuilder (typeof (HtmlControlBuilder))]
+ public class HtmlImage : HtmlControl{
+
+ public HtmlImage(): base("img"){}
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ PreProcessRelativeReference(writer,"src");
+ base.RenderAttributes(writer);
+ writer.Write(" /");
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Layout")]
+ public string Align{
+ get{
+ string attr = Attributes["align"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Appearance")]
+ public string Alt{
+ get{
+ string attr = Attributes["alt"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["alt"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue(0)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Appearance")]
+ public int Border{
+ get{
+ string attr = Attributes["border"];
+ if (attr != null){
+ return Int32.Parse(attr,CultureInfo.InvariantCulture);
+ }
+ return -1;
+ }
+ set{
+ Attributes["border"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue(100)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Layout")]
+ public int Height
+ {
+ get {
+ string attr = Attributes ["height"];
+ if (attr != null)
+ return Int32.Parse (attr, CultureInfo.InvariantCulture);
+
+ return -1;
+ }
+
+ set { Attributes["height"] = AttributeToString (value); }
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Behavior")]
+ public string Src{
+ get{
+ string attr = Attributes["src"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["src"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue(100)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Layout")]
+ public int Width{
+ get{
+ string attr = Attributes["width"];
+ if (attr != null){
+ return Int32.Parse(attr,CultureInfo.InvariantCulture);
+ }
+ return -1;
+ }
+ set{
+ Attributes["width"] = AttributeToString(value);
+ }
+ }
+
+ } // class HtmlImage
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
new file mode 100755
index 00000000000..1a962de0cd0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
@@ -0,0 +1,103 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerClick")]
+ public class HtmlInputButton : HtmlInputControl, IPostBackEventHandler{
+
+ private static readonly object EventServerClick = new object ();
+
+ public HtmlInputButton(): base ("button")
+ {
+ }
+
+ public HtmlInputButton(string type): base(type){}
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender(e);
+ if (Page != null && Events [EventServerClick] != null)
+ Page.RequiresPostBackScript ();
+ }
+
+ protected override void RenderAttributes (HtmlTextWriter writer)
+ {
+ if (Page != null && CausesValidation) {
+ string type = Type;
+ if (String.Compare (type, "button", true) == 0 || String.Compare (type, "submit", true) == 0) {
+ string script = Page.ClientScript.GetPostBackClientEvent (this, String.Empty);
+ if (script != null &&
+ ((String.Compare (type, "button", true) == 0 && Events[EventServerClick] != null )||
+ (String.Compare (type, "submit", true) == 0 && Page.Validators.Count > 0))){
+ AttributeCollection coll = Attributes;
+ if (coll ["language"] != null)
+ coll.Remove ("language");
+ writer.WriteAttribute ("language", "javascript");
+
+ string onclick;
+ if ((onclick = coll ["onclick"]) != null) {
+ script = onclick + " " + script;
+ coll.Remove ("onclick");
+ }
+
+ writer.WriteAttribute ("onclick", script);
+ }
+ }
+ }
+
+ base.RenderAttributes (writer);
+ }
+
+ protected virtual void OnServerClick(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerClick];
+ if (handler != null){
+ handler (this, e);
+ }
+ }
+
+ void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
+ {
+ if(CausesValidation == true){
+ Page.Validate();
+ }
+ OnServerClick(EventArgs.Empty);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the control is clicked.")]
+ public event EventHandler ServerClick{
+ add{
+ Events.AddHandler(EventServerClick, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerClick, value);
+ }
+ }
+
+ [DefaultValue(true)]
+ [WebCategory("Behavior")]
+ public bool CausesValidation{
+ get{
+ object causesVal = ViewState["CausesValidation"];
+ if (causesVal != null){
+ return (Boolean) causesVal;
+ }
+ return true;
+ }
+ set{
+ ViewState["CausesValidation"] = (Boolean) value;
+ }
+ }
+
+ } // end of System.Web.UI.HtmlControls.HtmlInputButton
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs
new file mode 100755
index 00000000000..8224d0f6710
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs
@@ -0,0 +1,86 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerChange")]
+ public class HtmlInputCheckBox : HtmlInputControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange = new object ();
+
+ public HtmlInputCheckBox(): base("checkbox"){}
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ string postValue = postCollection [postDataKey];
+ bool postChecked = false;
+ bool retval = false;
+
+ if (postValue != null)
+ postChecked = postValue.Length > 0;
+
+ if (Checked != postChecked){
+ retval = true;
+ Checked = postChecked;
+ }
+
+ return retval;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnServerChange (EventArgs.Empty);
+ }
+
+ protected virtual void OnServerChange(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerChange];
+ if (handler != null)
+ handler (this, e);
+ }
+
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && !Disabled)
+ Page.RegisterRequiresPostBack(this);
+ if (Events[EventServerChange] != null && !Disabled)
+ ViewState.SetItemDirty("checkbox",false);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the checked satte of the control is changed.")]
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Misc")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool Checked{
+ get{
+ string attr = Attributes["checked"];
+ if (attr != null)
+ return attr.Equals("checked");
+ return false;
+ }
+ set{
+ Attributes["checked"] = (value == true)? "checked": null;
+ }
+ }
+
+ } // class HtmlInputCheckBox
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs
new file mode 100755
index 00000000000..45ff48b976d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs
@@ -0,0 +1,70 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls
+{
+ [ControlBuilder (typeof (HtmlControlBuilder))]
+ public abstract class HtmlInputControl : HtmlControl
+ {
+
+ public HtmlInputControl (string type) : base ("input")
+ {
+ Attributes ["type"] = type;
+ }
+
+ protected override void RenderAttributes (HtmlTextWriter writer)
+ {
+ writer.WriteAttribute ("name",RenderedName);
+ Attributes.Remove ("name");
+ base.RenderAttributes (writer);
+ writer.Write (" /");
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual string Name
+ {
+ get { return UniqueID; }
+ set { }
+ }
+
+ internal virtual string RenderedName
+ {
+ get { return Name; }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Type
+ {
+ get {
+ string _type = Attributes ["type"];
+ return ((_type != null) ? _type : String.Empty);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual string Value
+ {
+ get {
+ string attr = Attributes ["value"];
+ return ((attr != null) ? attr : String.Empty);
+ }
+
+ set { Attributes["value"] = value; }
+ }
+ } // class HtmlInputControl
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs
new file mode 100755
index 00000000000..e1e009316a7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs
@@ -0,0 +1,115 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+ [ValidationProperty("Value")]
+ public class HtmlInputFile : HtmlInputControl, IPostBackDataHandler{
+
+ public HtmlInputFile():base("file"){}
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Accept{
+ get{
+ string attr = Attributes["accept"];
+ if (attr != null)
+ return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["accept"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int MaxLength{
+ get{
+ string attr = Attributes["maxlength"];
+ if (attr != null)
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["accept"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Size{
+ get{
+ string attr = Attributes["size"];
+ if (attr != null)
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["size"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Misc")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public HttpPostedFile PostedFile{
+ get{
+ return Context.Request.Files[RenderedName];
+ }
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+ for (Control ctrl = this.Parent; ctrl != null && !(ctrl is Page); ctrl = ctrl.Parent) {
+ if (!(ctrl is HtmlForm))
+ continue;
+
+ HtmlForm form = (HtmlForm) ctrl;
+ if (form.Enctype == "")
+ form.Enctype = "multipart/form-data";
+ break;
+ }
+ }
+#if NET_1_1
+ [Browsable (false)]
+ public override string Value {
+ get {
+ HttpPostedFile file = PostedFile;
+ if (file == null)
+ return "";
+
+ return file.FileName;
+ }
+
+ set {
+ throw new NotSupportedException ();
+ }
+ }
+#endif
+
+ } // class HtmlInputFile
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs
new file mode 100755
index 00000000000..577d3c0f7e5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs
@@ -0,0 +1,63 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerChange")]
+ public class HtmlInputHidden : HtmlInputControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange = new object ();
+
+ public HtmlInputHidden () : base ("hidden")
+ {
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ string postValue = postCollection [postDataKey];
+ if (postValue != null)
+ Value = postValue;
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ // don't need anything. LoadPostData always returns false.
+ }
+
+ protected virtual void OnServerChange (EventArgs e)
+ {
+ EventHandler handler = (EventHandler) Events [EventServerChange];
+ if (handler != null)
+ handler (this, e);
+ }
+
+ protected override void OnPreRender(EventArgs e){
+ if (Events[EventServerChange] != null && !Disabled)
+ ViewState.SetItemDirty("value",false);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the value of the control changes.")]
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ } // class HtmlInputFile
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs
new file mode 100755
index 00000000000..fc690e4f990
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs
@@ -0,0 +1,145 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerClick")]
+ public class HtmlInputImage : HtmlInputControl, IPostBackEventHandler, IPostBackDataHandler{
+
+ private static readonly object EventServerClick = new object ();
+ private int _x, _y;
+
+ public HtmlInputImage(): base("image"){}
+
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && !Disabled){
+ Page.RegisterRequiresPostBack(this);
+ }
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer)
+ {
+ base.RenderAttributes (writer);
+ // Anything else?
+ }
+
+ protected virtual void OnServerClick(ImageClickEventArgs e){
+ ImageClickEventHandler handler = (ImageClickEventHandler) Events[EventServerClick];
+ if (handler != null) handler (this, e);
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ string postX = postCollection[String.Concat(RenderedName,".x")];
+ string postY = postCollection[String.Concat(RenderedName,".y")];
+ if (postX != null && postY != null && postX.Length >= 0 && postY.Length >= 0){
+ _x = Int32.Parse(postX, CultureInfo.InvariantCulture);
+ _y = Int32.Parse(postY, CultureInfo.InvariantCulture);
+ Page.RegisterRequiresRaiseEvent(this);
+ }
+ return false;
+ }
+
+ void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
+ {
+ if (CausesValidation)
+ Page.Validate();
+ OnServerClick (new ImageClickEventArgs(_x, _y));
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the image is clicked.")]
+ public event ImageClickEventHandler ServerClick{
+ add{
+ Events.AddHandler(EventServerClick, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerClick, value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Align{
+ get{
+ string attr = Attributes["align"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Alt{
+ get{
+ string attr = Attributes["alt"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["alt"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Border{
+ get{
+ string attr = Attributes["border"];
+ if (attr != null) return Int32.Parse(attr,CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["border"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue(true)]
+ [WebCategory("Behavior")]
+ public bool CausesValidation{
+ get{
+ object causesVal = ViewState["CausesValidation"];
+ if (causesVal != null) return (Boolean) causesVal;
+ return true;
+ }
+ set{
+ ViewState["CausesValidation"] = (Boolean) value;
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Src{
+ get{
+ string attr = Attributes["src"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["src"] = AttributeToString(value);
+ }
+ }
+ } // class HtmlInputImage
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
new file mode 100755
index 00000000000..8367374ec4c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
@@ -0,0 +1,134 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerChange")]
+ public class HtmlInputRadioButton : HtmlInputControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange = new object ();
+
+ public HtmlInputRadioButton(): base("radio"){}
+
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && !Disabled){
+ Page.RegisterRequiresPostBack(this);
+ }
+ if (Events[EventServerChange] != null && !Disabled){
+ ViewState.SetItemDirty("checked", false);
+ }
+ }
+
+ protected virtual void OnServerChange(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerChange];
+ if (handler != null){
+ handler (this, e);
+ }
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("value", Value);
+ Attributes.Remove("value");
+ base.RenderAttributes(writer);
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ string postValue = postCollection [Name];
+ bool myBool = false;
+ if (postValue != null && postValue.Equals (Value)) {
+ if (!Checked) {
+ Checked = true;
+ myBool = true;
+ }
+ } else {
+ if (Checked) {
+ Checked = false;
+ myBool = false;
+ }
+ }
+ return myBool;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnServerChange (EventArgs.Empty);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the checked state of the control changes.")]
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Misc")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool Checked{
+ get{
+ string attr = Attributes["checked"];
+ if (attr != null){
+ return attr.Equals("checked");
+ }
+ return false;
+ }
+ set{
+ if (value)
+ Attributes["checked"] = "checked";
+ else
+ Attributes.Remove ("checked");
+ }
+ }
+ public override string Name
+ {
+ get {
+ string attr = Attributes ["name"]; // Gotta use "name" to group radio buttons
+ return (attr == null) ? String.Empty : attr;
+ }
+ set { Attributes ["name"] = value; }
+ }
+
+ internal override string RenderedName{
+ get{
+ string attr = base.RenderedName;
+ string id = UniqueID;
+ int indexOfX = id.LastIndexOf('X');
+ if (indexOfX != 0 && indexOfX >= 0){
+ attr = String.Concat(attr, id.Substring(0,indexOfX+1));
+ }
+ return attr;
+ }
+ }
+
+ public override string Value
+ {
+ get {
+ string v = Attributes ["value"];
+ if (v != null && v != "")
+ return v;
+ v = ID;
+ Attributes ["value"] = v;
+ return v;
+ }
+
+ set { Attributes ["value"] = value; }
+ }
+
+ } // class HtmlInputRadioButton
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs
new file mode 100755
index 00000000000..cbbbb33e5b9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs
@@ -0,0 +1,113 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerChange")]
+ [ValidationProperty("Value")]
+ public class HtmlInputText : HtmlInputControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange = new object ();
+
+ public HtmlInputText(string type):base(type){}
+ public HtmlInputText():base("text"){}
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ if (Events [EventServerChange] == null && !Disabled)
+ ViewState.SetItemDirty("value",false);
+ }
+
+ protected virtual void OnServerChange (EventArgs e)
+ {
+ EventHandler handler = (EventHandler) Events [EventServerChange];
+ if (handler != null) handler (this, e);
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ //hide value when password box
+ if (String.Compare (Type, "password",true) == 0)
+ ViewState.Remove ("value");
+
+ base.RenderAttributes(writer);
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ string currentValue = Value;
+ string[] postedValue = postCollection.GetValues (postDataKey);
+ if (!currentValue.Equals (postedValue)){
+ Value = postedValue [0];
+ return true;
+ }
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnServerChange (EventArgs.Empty);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the the text within the control changes.")]
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int MaxLength{
+ get{
+ string attr = (String) ViewState["maxlength"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["maxlength"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Size{
+ get{
+ string attr = (String) ViewState["size"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["size"] = AttributeToString(value);
+ }
+ }
+
+ public override string Value{
+ get{
+ string attr = Attributes["value"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["value"] = AttributeToString(value);
+ }
+ }
+
+ } // class HtmlInputText
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs
new file mode 100755
index 00000000000..24c5b50e0d7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs
@@ -0,0 +1,453 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.Util;
+using System.Globalization;
+using System.ComponentModel;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ [ControlBuilder (typeof (HtmlSelectBuilder))]
+ [DefaultEvent("ServerChange")]
+ [ValidationProperty("Value")]
+ public class HtmlSelect : HtmlContainerControl, IPostBackDataHandler{
+
+
+ private int _cachedSelectedIndex;
+ private object _dataSource;
+ private static readonly object EventServerChange = new object ();
+ private ListItemCollection _items;
+
+ public HtmlSelect():base("select"){
+ _cachedSelectedIndex = -1;
+ }
+
+ protected override void AddParsedSubObject(object obj){
+ if (obj as ListItem != null) {
+ this.Items.Add((ListItem) obj);
+ return;
+ }
+ throw new HttpException("HtmlSelect cannot have children of Type " + obj.GetType().Name);
+ }
+
+ protected virtual void ClearSelection()
+ {
+ foreach (ListItem item in Items)
+ item.Selected = false;
+ }
+
+ protected override ControlCollection CreateControlCollection(){
+ return new EmptyControlCollection(this);
+ }
+
+ protected override void LoadViewState(object savedState)
+ {
+ if (savedState != null) {
+ Triplet state = (Triplet) savedState;
+ base.LoadViewState (state.First);
+ Items.LoadViewState (state.Second);
+ object indices = state.Third;
+ if (indices != null) {
+ Select ((int []) indices);
+ }
+ }
+ }
+
+ protected override void OnDataBinding (EventArgs e)
+ {
+ base.OnDataBinding (e);
+ IEnumerable resolvedDataSource = DataSourceHelper.GetResolvedDataSource (DataSource, DataMember);
+ if (resolvedDataSource != null) {
+ string text = DataTextField;
+ string value = DataValueField;
+ Items.Clear();
+
+ ICollection rdsCollection = resolvedDataSource as ICollection;
+ if (rdsCollection != null)
+ Items.Capacity = rdsCollection.Count;
+
+ bool valid = false;
+ if (text.Length > 0 && value.Length > 0)
+ valid = true;
+
+ foreach (object current in resolvedDataSource) {
+ ListItem li = new ListItem ();
+ if (valid == true){
+ if (text.Length > 0)
+ li.Text = DataBinder.GetPropertyValue (current, text, null);
+ if (value.Length > 0)
+ li.Value = DataBinder.GetPropertyValue (current, value, null);
+ } else {
+ li.Value = li.Text = current.ToString();
+ }
+
+ Items.Add (li);
+ }
+ }
+
+ if (_cachedSelectedIndex != -1) {
+ SelectedIndex = _cachedSelectedIndex;
+ _cachedSelectedIndex = -1;
+ }
+ }
+
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && Size >= 0 && !Disabled){
+ Page.RegisterRequiresPostBack(this);
+ }
+ }
+
+ protected virtual void OnServerChange(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerChange];
+ if (handler != null)
+ handler (this,e);
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name", Name);
+ Attributes.Remove("name");
+ Attributes.Remove("DataValueField");
+ Attributes.Remove("DataTextField");
+ Attributes.Remove("DataMember");
+ base.RenderAttributes(writer);
+ }
+
+ protected override void RenderChildren(HtmlTextWriter writer){
+ //flush output
+ writer.WriteLine();
+ // increase indent level, improves readability
+ writer.Indent = writer.Indent + 1;
+ if (Items.Count >= 0){
+ // display all options, and set the selected option
+ bool rendered_selected = false;
+ foreach (ListItem option in Items){
+ //write begin tag with attributes
+ writer.WriteBeginTag("option");
+ if (!rendered_selected && option.Selected){
+ writer.WriteAttribute("selected","selected");
+ if (!Multiple)
+ rendered_selected = true;
+ }
+ else if (option.Selected){
+ option.Selected = false;
+ }
+
+ writer.WriteAttribute("value",option.Value,true);
+ option.Attributes.Remove("text");
+ option.Attributes.Remove("value");
+ option.Attributes.Remove("selected");
+ option.Attributes.Render(writer);
+ writer.Write('>');
+ //write the option text
+ HttpUtility.HtmlEncode(option.Text, writer);
+ //close the current option tag
+ writer.WriteEndTag("option");
+ //flush output
+ writer.WriteLine();
+ }
+ }
+ // set the indent level back to normal
+ writer.Indent = writer.Indent - 1;
+ }
+
+ protected override object SaveViewState ()
+ {
+ object baseViewState = base.SaveViewState ();
+ object itemsViewState = Items.SaveViewState ();
+ object indices = null;
+
+ if (Events[EventServerChange] != null || !Disabled || Visible)
+ indices = SelectedIndices;
+
+ if (indices != null || baseViewState != null || itemsViewState != null)
+ return new Triplet (baseViewState, itemsViewState, indices);
+
+ return null;
+ }
+
+ protected virtual void Select(int[] selectedIndices){
+ // unselect all options
+ ClearSelection();
+ // iterate through options, and set when selected
+ foreach (int current in selectedIndices){
+ if (current >= 0 && current < Items.Count){
+ Items[current].Selected = true;
+ }
+ }
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ //get the posted selectedIndices[]
+ string [] postedValueColl = postCollection.GetValues(postDataKey);
+ bool changed = false;
+ if (postedValueColl != null){
+ if (!Multiple){
+ //single selection
+ //int postedValue = Items.FindIndexByValue(postedValueColl[0]);
+ int postedValue = Items.IndexOf(Items.FindByValue(postedValueColl[0]));
+ if (postedValue != SelectedIndex){
+ //set the SelectedIndex
+ SelectedIndex = postedValue;
+ changed = true;
+ }
+ }
+ else{
+ //multiple selection
+ int postedValueCount = postedValueColl.Length;
+ int[] arr= new int[postedValueCount];
+ //fill an array with the posted Values
+ for (int i = 0; i < postedValueCount; i++)
+ arr[i] = Items.IndexOf(Items.FindByValue(postedValueColl[i]));
+ //test if everything went fine
+ if( postedValueCount == SelectedIndices.Length){
+ for (int i = 0; i < postedValueCount; i++)
+ if(arr[i] != SelectedIndices[i])
+ changed = true;
+ }
+ else
+ changed = true;
+ //commit the posted Values
+ if(changed)
+ Select(arr);
+ }
+ }
+ else if (SelectedIndex != -1){
+ SelectedIndex = -1;
+ changed = true;
+ }
+ return changed;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnServerChange (EventArgs.Empty);
+ }
+
+ //starts tracking changes to the viewstate
+ protected override void TrackViewState(){
+ base.TrackViewState();
+ Items.TrackViewState();
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the selection changes.")]
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Data")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription("The data member of the select.")]
+ public virtual string DataMember{
+ get{
+ object viewStateDataMember = ViewState["DataMember"];
+ if ( viewStateDataMember != null) return (String) viewStateDataMember;
+ return String.Empty;
+ }
+ set{
+ Attributes["DataMember"] = HtmlControl.AttributeToString(value);
+ }
+ }
+
+ [DefaultValue(null)]
+ [WebCategory("Data")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription("The data source used to populate the list with data.")]
+ public virtual object DataSource{
+ get{
+ return _dataSource;
+ }
+ set{
+ if (value != null && !(value is IListSource)) {
+ if (!(value is IEnumerable))
+ throw new ArgumentException ("Invalid dataSource type");
+ }
+ _dataSource = value;
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Data")]
+ [WebSysDescription("The field in the data source that provides the item value.")]
+ public virtual string DataTextField{
+ get{
+ string attr = Attributes["DataTextField"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["DataTextField"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Data")]
+ [WebSysDescription("The field in the data source that provides the item value.")]
+ public virtual string DataValueField{
+ get{
+ string attr = Attributes["DataValueField"];
+ if (attr != null)return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["DataValueField"] = AttributeToString(value);
+ }
+ }
+
+ public override string InnerHtml{
+ get{
+ throw new NotSupportedException("InnerHtml is not supported by " + this.GetType().Name);
+ }
+ set{
+ throw new NotSupportedException("InnerHtml is not supported by " + this.GetType().Name);
+ }
+ }
+
+ public override string InnerText{
+ get{
+ throw new NotSupportedException("InnerText is not supported by " + this.GetType().Name);
+ }
+ set{
+ throw new NotSupportedException("InnerText is not supported by " + this.GetType().Name);
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public ListItemCollection Items{
+ get{
+ if (_items == null){
+ _items = new ListItemCollection();
+ if (IsTrackingViewState) _items.TrackViewState();
+ }
+ return _items;
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool Multiple{
+ get{
+ string attr = Attributes["multiple"];
+ if (attr != null) return (0 == String.Compare (attr, "true", true));
+ return false;
+ }
+ set{
+ Attributes["multiple"] = value.ToString ();
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Name{
+ get{
+ return UniqueID;
+ }
+ set{
+ //LAMESPEC
+ return;
+ }
+ }
+
+ [HtmlControlPersistable (false)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual int SelectedIndex {
+ get{
+ for (int i=0; i<Items.Count; i++){
+ if (Items[i].Selected == true) return i;
+ }
+ if (Size<=1 && !Multiple){
+ if(Items.Count > 0) Items[0].Selected = true;
+ return 0;
+ }
+ return -1;
+ }
+ set{
+ if(Items.Count == 0){
+ _cachedSelectedIndex = value;
+ return;
+ }
+
+ if (value < -1 || value >= Items.Count)
+ throw new ArgumentOutOfRangeException();
+
+ ClearSelection();
+ if (value >= 0)
+ Items[value].Selected = true;
+ }
+ }
+
+ protected virtual int[] SelectedIndices {
+ get{
+ int[] indices = new int[3];
+ int indicesCount = 0;
+ for(int i=0; i < Items.Count; i++){
+ if (Items[i].Selected){
+ if( indicesCount == (int) indices.Length){
+ int[] temp = new int[indicesCount + indicesCount];
+ indices.CopyTo(temp,0);
+ indices = temp;
+ }
+ indices[indicesCount] = i;
+ indicesCount++;
+ }
+ }
+ int[] arr = new int[indicesCount];
+ System.Array.Copy(indices,0,arr,0,indicesCount);
+ return arr;
+ }
+ }
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Size{
+ get{
+ string attr = Attributes["size"];
+ if (attr != null){
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ }
+ return -1;
+ }
+ set{
+ Attributes["size"] = AttributeToString(value);
+ }
+ }
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Value {
+ get{
+ int selectedIndex = SelectedIndex;
+ if (selectedIndex >=0 && selectedIndex < Items.Count){
+ return Items[selectedIndex].Value;
+ }
+ return String.Empty;
+ }
+ set{
+ int findValue = Items.IndexOf(Items.FindByValue(value));
+ if (findValue >= 0) SelectedIndex = findValue;
+ }
+ }
+
+ } // class HtmlSelect
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelectBuilder.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelectBuilder.cs
new file mode 100644
index 00000000000..d0d09a963ac
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelectBuilder.cs
@@ -0,0 +1,32 @@
+//
+// System.Web.UI.HtmlControls.HtmlSelectBuilder
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Collections;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.HtmlControls
+{
+ class HtmlSelectBuilder : ControlBuilder
+ {
+ public override bool AllowWhitespaceLiterals ()
+ {
+ return false;
+ }
+
+ public override Type GetChildControlType (string tagName, IDictionary attribs)
+ {
+ if (System.String.Compare (tagName, "option", true) != 0)
+ return null;
+
+ return typeof (ListItem);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs
new file mode 100755
index 00000000000..79750d5efe8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs
@@ -0,0 +1,200 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls{
+
+ [ParseChildren(true, "Rows")]
+ public class HtmlTable : HtmlContainerControl {
+ private HtmlTableRowCollection _rows;
+
+ public HtmlTable():base("table"){}
+
+ protected override ControlCollection CreateControlCollection(){
+ return new HtmlTableRowControlCollection(this);
+ }
+
+ protected override void RenderChildren(HtmlTextWriter writer){
+ writer.WriteLine();
+ writer.Indent = writer.Indent + 1;
+ base.RenderChildren(writer);
+ writer.Indent = writer.Indent - 1;
+ }
+
+ protected override void RenderEndTag(HtmlTextWriter writer){
+ base.RenderEndTag(writer);
+ writer.WriteLine();
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Align {
+ get{
+ string attr = Attributes["align"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string BgColor {
+ get{
+ string attr = Attributes["bgcolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bgcolor"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue(-1)]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Border {
+ get{
+ string attr = Attributes["border"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["border"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string BorderColor {
+ get{
+ string attr = Attributes["bordercolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bordercolor"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int CellPadding {
+ get{
+ string attr = Attributes["cellpadding"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["cellpadding"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int CellSpacing {
+ get{
+ string attr = Attributes["cellspacing"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["cellspacing"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Height {
+ get{
+ string attr = Attributes["height"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["height"] = AttributeToString(value);
+ }
+ }
+
+ public override string InnerHtml {
+ get{
+ throw new NotSupportedException("InnerHtml property not supported by HtmlTable");
+ }
+ set{
+ throw new NotSupportedException("InnerHtml property not supported by HtmlTable");
+ }
+ }
+
+ public override string InnerText {
+ get{
+ throw new NotSupportedException("InnerText property not supported by HtmlTable");
+ }
+ set{
+ throw new NotSupportedException("InnerText property not supported by HtmlTable");
+ }
+ }
+
+ [IgnoreUnknownContent ()]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual HtmlTableRowCollection Rows {
+ get{
+ if (_rows == null) _rows = new HtmlTableRowCollection(this);
+ return _rows;
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Width {
+ get{
+ string attr = Attributes["width"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["width"] = AttributeToString(value);
+ }
+ }
+
+ protected class HtmlTableRowControlCollection : ControlCollection {
+
+ internal HtmlTableRowControlCollection(Control owner): base(owner){}
+
+ public override void Add(Control child){
+ if ((child as HtmlTableRow) != null){
+ base.Add(child);
+ }
+ else{
+ throw new ArgumentException("HtmlTableRow cannot have children of type " + child.GetType().Name);
+ }
+ }
+
+ public override void AddAt(int index, Control child){
+ if ((child as HtmlTableRow) != null){
+ base.AddAt(index,child);
+ }
+ else{
+ throw new ArgumentException("HtmlTableRow cannot have children of type " + child.GetType().Name);
+ }
+ }
+ } // end of HtmlTableRowControlCollection
+ }
+ // end of System.Web.UI.HtmlControl
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs
new file mode 100755
index 00000000000..c9cf10ae48a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs
@@ -0,0 +1,158 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls{
+ [ConstructorNeedsTag]
+ public class HtmlTableCell : HtmlContainerControl {
+ public HtmlTableCell(): base("td"){}
+
+ public HtmlTableCell(string tagName): base(tagName){}
+
+ protected override void RenderEndTag(HtmlTextWriter writer){
+ base.RenderEndTag(writer);
+ writer.WriteLine();
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Align {
+ get{
+ string attr = Attributes["align"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string BgColor {
+ get{
+ string attr = Attributes["bgcolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bgcolor"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string BorderColor {
+ get{
+ string attr = Attributes["bordercolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bordercolor"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int ColSpan {
+ get{
+ string attr = Attributes["colspan"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["colspan"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Height {
+ get{
+ string attr = Attributes["height"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["height"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool NoWrap {
+ get{
+ string attr = Attributes["nowrap"];
+ if (attr != null) return attr.Equals("nowrap");
+ return false;
+ }
+ set{
+ if (value == true){
+ Attributes["nowrap"] = "nowrap";
+ }
+ else{
+ Attributes["nowrap"] = null;
+ }
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int RowSpan {
+ get{
+ string attr = Attributes["rowspan"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["rowspan"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string VAlign {
+ get{
+ string attr = Attributes["valign"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["valign"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Width {
+ get{
+ string attr = Attributes["width"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["width"] = AttributeToString(value);
+ }
+ }
+
+ }
+ // System.Web.UI.HtmlControls.HtmlTableCell
+
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs
new file mode 100755
index 00000000000..e6926f10eb7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs
@@ -0,0 +1,84 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Collections;
+
+namespace System.Web.UI.HtmlControls{
+ public sealed class HtmlTableCellCollection : ICollection {
+ private HtmlTableRow _owner;
+
+ internal HtmlTableCellCollection(HtmlTableRow owner){
+ _owner = owner;
+ }
+
+ public void Add(HtmlTableCell cell){
+ Insert(-1, cell);
+ }
+
+ public void Clear(){
+ if (_owner.HasControls()) _owner.Controls.Clear();
+ }
+
+ public void CopyTo(Array array, int index){
+ IEnumerator tablecell = this.GetEnumerator();
+ while(tablecell.MoveNext()){
+ index = index + 1;
+ array.SetValue(tablecell.Current, index);
+ }
+ }
+
+ public IEnumerator GetEnumerator(){
+ return _owner.Controls.GetEnumerator();
+ }
+
+ public void Insert(int index, HtmlTableCell cell){
+ _owner.Controls.AddAt(index,cell);
+ }
+
+ public void Remove(HtmlTableCell cell){
+ _owner.Controls.Remove(cell);
+ }
+
+ public void RemoveAt(int index){
+ _owner.Controls.RemoveAt(index);
+ }
+
+ public int Count {
+ get{
+ if (_owner.HasControls()) return _owner.Controls.Count;
+ return 0;
+ }
+ }
+
+ public bool IsReadOnly {
+ get{
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get{
+ return false;
+ }
+ }
+
+ public HtmlTableCell this[int index] {
+ get{
+ return _owner.Controls[index] as HtmlTableCell;
+ }
+ }
+
+ public object SyncRoot {
+ get{
+ return null;
+ }
+ }
+
+ } // end of System.Web.UI.HtmlControls.HtmlTableCellCollection
+
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs
new file mode 100755
index 00000000000..d282a7039bf
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs
@@ -0,0 +1,156 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+ [ParseChildren(true, "Cells")]
+ public class HtmlTableRow : HtmlContainerControl {
+ private HtmlTableCellCollection _cells;
+ public HtmlTableRow():base("tr"){}
+
+ protected override ControlCollection CreateControlCollection(){
+ return new HtmlTableCellControlCollection(this);
+ }
+
+ protected override void RenderChildren(HtmlTextWriter writer){
+ writer.WriteLine();
+ writer.Indent = writer.Indent + 1;
+ base.RenderChildren(writer);
+ writer.Indent = writer.Indent - 1;
+ }
+
+ protected override void RenderEndTag(HtmlTextWriter writer){
+ base.RenderEndTag(writer);
+ writer.WriteLine();
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Align {
+ get{
+ string attr = Attributes["align"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string BgColor {
+ get{
+ string attr = Attributes["bgcolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bgcolor"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string BorderColor {
+ get{
+ string attr = Attributes["bordercolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bordercolor"] = AttributeToString(value);
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual HtmlTableCellCollection Cells {
+ get{
+ if (_cells == null) _cells = new HtmlTableCellCollection(this);
+ return _cells;
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Height {
+ get{
+ string attr = Attributes["height"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["height"] = AttributeToString(value);
+ }
+ }
+
+ public override string InnerHtml {
+ get{
+ throw new NotSupportedException("InnerHtml is not supported by HtmlTableRow");
+ }
+ set{
+ throw new NotSupportedException("InnerHtml is not supported by HtmlTableRow");
+ }
+ }
+
+ public override string InnerText {
+ get{
+ throw new NotSupportedException("InnerText is not supported by HtmlTableRow");
+ }
+ set{
+ throw new NotSupportedException("InnerText is not supported by HtmlTableRow");
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string VAlign {
+ get{
+ string attr = Attributes["valign"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["valign"] = AttributeToString(value);
+ }
+ }
+
+
+
+ protected class HtmlTableCellControlCollection : ControlCollection {
+
+ internal HtmlTableCellControlCollection(Control owner): base(owner){}
+
+ public override void Add(Control child){
+ if (child is HtmlTableCell){
+ base.Add(child);
+ }
+ else{
+ throw new ArgumentException("HtmlTableRow cannot have children of Type " + child.GetType().Name);
+ }
+ }
+
+ public override void AddAt(int index, Control child){
+ if (child is HtmlTableCell){
+ base.AddAt(index,child);
+ }
+ else{
+ throw new ArgumentException("HtmlTableRow cannot have children of Type " + child.GetType().Name);
+ }
+ }
+ }
+ } // end of System.Web.UI.HtmlControls.HtmlTableRow+HtmlTableCellControlCollection
+ // end of System.Web.UI.HtmlControls.HtmlTableRow
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs
new file mode 100755
index 00000000000..987c8aed674
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs
@@ -0,0 +1,83 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Collections;
+
+namespace System.Web.UI.HtmlControls{
+ public sealed class HtmlTableRowCollection : ICollection {
+
+ private HtmlTable _owner;
+
+ internal HtmlTableRowCollection(HtmlTable owner){
+ _owner = owner;
+ }
+
+ public void Add(HtmlTableRow row){
+ Insert(-1, row);
+ }
+
+ public void Clear(){
+ if (_owner.HasControls()) _owner.Controls.Clear();
+ }
+
+ public void CopyTo(Array array, int index){
+ IEnumerator tablerow = this.GetEnumerator();
+ while (tablerow.MoveNext()){
+ index = index + 1;
+ array.SetValue(tablerow.Current, index);
+ }
+ }
+
+ public IEnumerator GetEnumerator(){
+ return _owner.Controls.GetEnumerator();
+ }
+
+ public void Insert(int index, HtmlTableRow row){
+ _owner.Controls.AddAt(index,row);
+ }
+
+ public void Remove(HtmlTableRow row){
+ _owner.Controls.Remove(row);
+ }
+
+ public void RemoveAt(int index){
+ _owner.Controls.RemoveAt(index);
+ }
+
+ public int Count {
+ get{
+ if (_owner.HasControls()) return _owner.Controls.Count;
+ return 0;
+ }
+ }
+
+ public bool IsReadOnly {
+ get{
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get{
+ return false;
+ }
+ }
+
+ public HtmlTableRow this[int index] {
+ get{
+ return (HtmlTableRow) _owner.Controls[index];
+ }
+ }
+
+ public object SyncRoot {
+ get{
+ return this;
+ }
+ }
+ }//System.Web.UI.HtmlControls.HtmlTableRowCollection
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs
new file mode 100644
index 00000000000..7a533670214
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs
@@ -0,0 +1,137 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerChange")]
+ [ValidationProperty("Value")]
+ public class HtmlTextArea : HtmlContainerControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange = new object ();
+
+ public HtmlTextArea(): base("textarea"){}
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Cols{
+ get{
+ string attr = Attributes["cols"];
+ if (attr != null){
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ }
+ return -1;
+ }
+ set{
+ Attributes["cols"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Rows{
+ get{
+ string attr = Attributes["rows"];
+ if (attr != null){
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ }
+ return -1;
+ }
+ set{
+ Attributes["rows"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Value{
+ get{
+ return InnerHtml;
+ }
+ set{
+ InnerHtml = value;
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual string Name{
+ get{
+ if (UniqueID != null){
+ return UniqueID;
+ }
+ return String.Empty;
+ }
+ set{}
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the text within the control changes.")]
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ protected virtual void OnServerChange(EventArgs e){
+ EventHandler handler;
+ handler = (EventHandler) Events[EventServerChange];
+ if(handler != null){
+ handler (this, e);
+ }
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ string currentValue = Value;
+ string postedValue = postCollection[postDataKey];
+ if (!currentValue.Equals(postedValue) && currentValue != null){
+ Value = HttpUtility.HtmlEncode(postedValue);
+ return true;
+ }
+ return false;
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name", Name);
+ Attributes.Remove("name");
+ base.RenderAttributes(writer);
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnServerChange (EventArgs.Empty);
+ }
+
+ protected override void OnPreRender(EventArgs e){
+ if(Events[EventServerChange]==null || Disabled){
+ ViewState.SetItemDirty("value",false);
+ }
+ }
+
+ protected override void AddParsedSubObject(object obj){
+ if (obj is LiteralControl || obj is DataBoundLiteralControl)
+ base.AddParsedSubObject(obj);
+ else
+ throw new NotSupportedException("HtmlTextArea cannot have children of Type " + obj.GetType().Name);
+ }
+
+ } // class HtmlTextArea
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTitle.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTitle.cs
new file mode 100644
index 00000000000..5a1abe78fdf
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTitle.cs
@@ -0,0 +1,61 @@
+//
+// System.Web.UI.HtmlControls.HtmlTitle
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 Novell, Inc.
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls
+{
+ public class HtmlTitle : HtmlControl
+ {
+ string text;
+
+ protected override void AddParsedSubObject(object obj)
+ {
+ LiteralControl lit = obj as LiteralControl;
+ if (lit != null) text = lit.Text;
+ }
+
+ public string Text {
+ get { return text; }
+ set { text = value; }
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ writer.RenderBeginTag (HtmlTextWriterTag.Title);
+ writer.Write (text);
+ writer.RenderEndTag ();
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.Imaging/ChangeLog b/mcs/class/System.Web/System.Web.UI.Imaging/ChangeLog
new file mode 100644
index 00000000000..0e608568ba7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.Imaging/ChangeLog
@@ -0,0 +1,5 @@
+2004-08-03 Sanjay Gupta <gsanjay@novell.com>
+
+ * ImageScaleMode.cs:
+ * ImageType.cs:
+ * StorageType.cs: Added enumerations.
diff --git a/mcs/class/System.Web/System.Web.UI.Imaging/ImageScaleMode.cs b/mcs/class/System.Web/System.Web.UI.Imaging/ImageScaleMode.cs
new file mode 100644
index 00000000000..49765d4f35a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.Imaging/ImageScaleMode.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.UI.Imaging.ImageScaleMode.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.Imaging {
+ public enum ImageScaleMode {
+ FitBasedOnWidth = 0,
+ FitBasedOnHeight = 1,
+ ScaleBasedOnWidth = 2,
+ ScaleBasedOnHeight = 3,
+ NoScaling = 4
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.Imaging/ImageType.cs b/mcs/class/System.Web/System.Web.UI.Imaging/ImageType.cs
new file mode 100644
index 00000000000..8467b096bf3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.Imaging/ImageType.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.UI.Imaging.ImageType.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.Imaging {
+ public enum ImageType {
+ Automatic = 0,
+ Jpeg = 1,
+ Png = 2,
+ Gif = 3,
+ Bmp = 4
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.Imaging/StorageType.cs b/mcs/class/System.Web/System.Web.UI.Imaging/StorageType.cs
new file mode 100644
index 00000000000..630d9b6a879
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.Imaging/StorageType.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.UI.Imaging.StorageType.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.Imaging {
+ public enum StorageType {
+ Cache = 0,
+ Disk = 1
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ChangeLog b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ChangeLog
new file mode 100644
index 00000000000..7ab73e7d074
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ChangeLog
@@ -0,0 +1,115 @@
+2004-11-11 Martin Baulig <martin@ximian.com>
+
+ * WebPart.cs: Don't use String.Empty in attributes.
+
+2004-09-29 Sanjay Gupta <gsanjay@novell.com>
+
+ * WebPartVerb.cs: Added attributes.
+
+2004-09-29 Sanjay Gupta <gsanjay@novell.com>
+
+ * ConnectionPoint.cs: Initial implementation.
+ * ConsumerConnectionPoint.cs:
+ * ProviderConnectionPoint.cs: Added stubs.
+ * TypeCollection.cs: Completed.
+
+2004-09-29 Sanjay Gupta <gsanjay@novell.com>
+
+ * IWebPart.cs: Added new property and removed extra property.
+ * WebPart.cs: Corrected according to change in interface IWebPart.
+
+2004-09-29 Sanjay Gupta <gsanjay@novell.com>
+
+ * WebPartPageMenuMode.cs: Added new enumeration.
+
+2004-09-28 Sanjay Gupta <gsanjay@novell.com>
+
+ * Part.cs: Corrected access modifier of constructor.
+
+2004-09-28 Sanjay Gupta <gsanjay@novell.com>
+
+ * WebPart.cs: Updated source and fixed bug 66907.
+
+2004-09-28 Sanjay Gupta <gsanjay@novell.com>
+
+ * WebPartVerbCollection.cs: Completed and corrected implementation.
+
+2004-09-28 Sanjay Gupta <gsanjay@novell.com>
+
+ * WebPartVerbCollection.cs: Initial implementation.
+
+2004-09-28 Sanjay Gupta <gsanjay@novell.com>
+
+ * WebPartVerb.cs: Initial implementation.
+
+2004-09-15 Gaurav Vaish <gaurav[dot]vaish[at]gmail[dot]com>
+
+ * Part.cs : Completed
+ * WebPart.cs : Initial implementation
+
+2004-08-31 Sanjay Gupta <gsanjay@novell.com>
+
+ * ConnectionConsumerCallback.cs:
+ * ConnectionProviderCallback.cs:
+ * IFilter.cs:
+ * IParameters.cs:
+ * IPersonalizable.cs:
+ * IVersioningPersonalizable.cs:
+ * WebPartAuthorizationEventArgs.cs:
+ * WebPartAuthorizationEventHandler.cs:
+ * WebPartCancelEventHandler.cs:
+ * WebPartConnectionsEventHandler.cs:
+ * WebPartDisplayModeCancelEventHandler.cs:
+ * WebPartDisplayModeEventHandler.cs:
+ * WebPartEventHandler.cs:
+ * WebPartVerbsEventHandler.cs: Minor modifications, compiler error
+ corrections and removal of "sealed" specifier from *EventHandler.cs
+ * WebPartDisplayMode.cs: Added new file.
+
+2004-08-12 Sanjay Gupta <gsanjay@novell.com>
+
+ * IField.cs:
+ * IFilter.cs:
+ * IParameters.cs:
+ * IPersonalizable.cs:
+ * IRow.cs:
+ * ITable.cs:
+ * ITrackingPersonalizable.cs:
+ * ITransformerConfigurationControl.cs:
+ * IVersioningPersonalizable.cs:
+ * IWebActionable.cs:
+ * IWebEditable.cs:
+ * IWebPart.cs:
+ * IWebPartHttpHandler.cs: Added new interfaces.
+
+2004-08-12 Sanjay Gupta <gsanjay@novell.com>
+
+ * ConnectionConsumerCallback.cs:
+ * ConnectionProviderCallback.cs:
+ * WebPartAuthorizationEventArgs.cs:
+ * WebPartAuthorizationEventHandler.cs:
+ * WebPartCancelEventArgs.cs:
+ * WebPartCancelEventHandler.cs:
+ * WebPartConnectionsEventArgs.cs:
+ * WebPartConnectionsEventHandler.cs:
+ * WebPartDisplayModeCancelEventArgs.cs:
+ * WebPartDisplayModeCancelEventHandler.cs:
+ * WebPartDisplayModeEventArgs.cs:
+ * WebPartDisplayModeEventHandler.cs:
+ * WebPartEventArgs.cs:
+ * WebPartEventHandler.cs:
+ * WebPartVerbsEventArgs.cs:
+ * WebPartVerbsEventHandler.cs: Added new EventArgs and EventHandler.
+
+2004-08-03 Sanjay Gupta <gsanjay@novell.com>
+
+ * ConnectionPointType.cs : Implemented enumeration.
+ * PartChromeState.cs : Implemented enumeration.
+ * PartChromeType.cs : Implemented enumeration.
+ * PersonalizationScope.cs : Implemented enumeration.
+ * WebPartExportMode.cs : Implemented enumeration.
+ * WebPartHelpMode.cs : Implemented enumeration.
+
+
+
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConnectionConsumerCallback.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConnectionConsumerCallback.cs
new file mode 100644
index 00000000000..64afdcbb1db
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConnectionConsumerCallback.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.WebParts.ConnectionConsumerCallback.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls.WebParts {
+ public delegate void ConnectionConsumerCallback (object conn);
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConnectionPoint.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConnectionPoint.cs
new file mode 100644
index 00000000000..bc3ffce480f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConnectionPoint.cs
@@ -0,0 +1,84 @@
+//
+// System.Web.UI.WebControls.WebParts.ConnectionPoint.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+using System.Web;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls.WebParts {
+ public abstract class ConnectionPoint
+ {
+ private bool allowMultiConn;
+ private string name = string.Empty;
+ private string id = "default";
+ private Type interfaceType;
+ private Type controlType;
+ private Control control;
+ private MethodInfo callBackMethod;
+
+ public const string DefaultID = "default";
+
+ internal ConnectionPoint (MethodInfo callBack, Type interFace,
+ Type control, string name, string id,
+ bool allowsMultiConnections)
+ {
+ this.allowMultiConn = allowsMultiConnections;
+ this.interfaceType = interFace;
+ this.controlType = control;
+ this.name = name;
+ this.id = id;
+ this.callBackMethod = callBack;
+ }
+
+ [MonoTODO]
+ public virtual bool GetEnabled (Control control)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public bool AllowsMultipleConnections {
+ get { return allowMultiConn; }
+ }
+
+ public Type ControlType {
+ get { return controlType; }
+ }
+
+ public string ID {
+ get { return id; }
+ }
+
+ public Type InterfaceType {
+ get { return interfaceType; }
+ }
+
+ public string Name {
+ get { return name;}
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConnectionPointType.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConnectionPointType.cs
new file mode 100644
index 00000000000..7a53d3f7995
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConnectionPointType.cs
@@ -0,0 +1,35 @@
+//
+// System.Web.UI.WebControls.WebParts.ConnectionPointType.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls.WebParts {
+ public enum ConnectionPointType {
+ Consumer = 0,
+ Provider = 1
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConnectionProviderCallback.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConnectionProviderCallback.cs
new file mode 100644
index 00000000000..e7380e8a990
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConnectionProviderCallback.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.WebParts.ConnectionProviderCallback.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls.WebParts {
+ public delegate object ConnectionProviderCallback ();
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConsumerConnectionPoint.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConsumerConnectionPoint.cs
new file mode 100644
index 00000000000..85d32ff27f5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ConsumerConnectionPoint.cs
@@ -0,0 +1,57 @@
+//
+// System.Web.UI.WebControls.WebParts.ConsumerConnectionPoint.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+using System.Web;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public class ConsumerConnectionPoint : ConnectionPoint
+ {
+ public ConsumerConnectionPoint (MethodInfo callBack, Type interFace,
+ Type control, string name, string id,
+ bool allowsMultiConnections) : base (callBack, interFace,
+ control, name, id, allowsMultiConnections)
+ {
+ }
+
+ [MonoTODO]
+ public virtual void SetObject (Control control, object data)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool SupportsConnection (Control control,
+ TypeCollection interfaces)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IField.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IField.cs
new file mode 100644
index 00000000000..3912baefc58
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IField.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.UI.WebControls.WebParts.IField.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public interface IField
+ {
+ object FieldValue { get; }
+ PropertyDescriptor Schema { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IFilter.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IFilter.cs
new file mode 100644
index 00000000000..4e75997ccd2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IFilter.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.UI.WebControls.WebParts.IFilter.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+using System.Collections;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public interface IFilter
+ {
+ void SetConsumerSchema (PropertyDescriptorCollection schema);
+
+ IDictionary FilterData { get; }
+ PropertyDescriptorCollection Schema { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IParameters.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IParameters.cs
new file mode 100644
index 00000000000..fb3c87d6cb4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IParameters.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.UI.WebControls.WebParts.IParameters.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+using System.Collections;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public interface IParameters
+ {
+ void SetConsumerSchema (PropertyDescriptorCollection schema);
+
+ IDictionary ParametersData { get; }
+ PropertyDescriptorCollection Schema { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IPersonalizable.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IPersonalizable.cs
new file mode 100644
index 00000000000..1246278552c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IPersonalizable.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.UI.WebControls.WebParts.IPersonalizable.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+
+using System.Collections;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public interface IPersonalizable
+ {
+ void Load (IDictionary sharedState, IDictionary userState);
+ void Save (IDictionary state);
+
+ bool IsDirty { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IRow.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IRow.cs
new file mode 100644
index 00000000000..7ea296e967a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IRow.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.UI.WebControls.WebParts.IRows.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public interface IRow
+ {
+ object RowData { get; }
+ PropertyDescriptorCollection Schema { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ITable.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ITable.cs
new file mode 100644
index 00000000000..a0fbb02342d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ITable.cs
@@ -0,0 +1,45 @@
+//
+// System.Web.UI.WebControls.WebParts.ITable.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public interface ITable
+ {
+ PropertyDescriptorCollection Schema { get; }
+ ICollection TableData { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ITrackingPersonalizable.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ITrackingPersonalizable.cs
new file mode 100644
index 00000000000..25ce2562642
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ITrackingPersonalizable.cs
@@ -0,0 +1,48 @@
+//
+// System.Web.UI.WebControls.WebParts.ITrackingPersonalizable.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public interface ITrackingPersonalizable
+ {
+ void BeginLoad ();
+ void BeginSave ();
+ void EndLoad ();
+ void EndSave ();
+
+ bool TracksChanges { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ITransformerConfigurationControl.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ITransformerConfigurationControl.cs
new file mode 100644
index 00000000000..61c691b6845
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ITransformerConfigurationControl.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.WebControls.WebParts.ITransformerConfigurationControl.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public interface ITransformerConfigurationControl
+ {
+ event EventHandler Cancelled;
+ event EventHandler Succeeded;
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IVersioningPersonalizable.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IVersioningPersonalizable.cs
new file mode 100644
index 00000000000..9fb6bdf56f1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IVersioningPersonalizable.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.WebControls.WebParts.IVersioningPersonalizable.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+
+using System.Collections;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public interface IVersioningPersonalizable
+ {
+ void Load (IDictionary unknownProperties);
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IWebActionable.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IWebActionable.cs
new file mode 100644
index 00000000000..e7916a67c00
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IWebActionable.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.UI.WebControls.WebParts.IWebActionable.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public interface IWebActionable
+ {
+ WebPartVerbCollection Verbs { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IWebEditable.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IWebEditable.cs
new file mode 100644
index 00000000000..c5d9e8265f5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IWebEditable.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.WebControls.WebParts.IWebEditable.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public interface IWebEditable
+ {
+ EditorPartCollection CreateEditorParts ();
+
+ object WebBrowsableObject { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IWebPart.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IWebPart.cs
new file mode 100644
index 00000000000..dcd5e0b6a1b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IWebPart.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.UI.WebControls.WebParts.IWebPart.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public interface IWebPart
+ {
+ string CatalogIconImageUrl { get; set; }
+ string Description { get; set; }
+ string Subtitle { get; }
+ string Title { get; set; }
+ string TitleIconImageUrl { get; set; }
+ string TitleUrl { get; set; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IWebPartHttpHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IWebPartHttpHandler.cs
new file mode 100644
index 00000000000..ac88457a532
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/IWebPartHttpHandler.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.UI.WebControls.WebParts.IWebPartHttpHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public interface IWebPartHttpHandler
+ {
+ PersonalizationScope DesiredScope { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/Part.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/Part.cs
new file mode 100644
index 00000000000..f55f462dd25
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/Part.cs
@@ -0,0 +1,127 @@
+//
+// System.Web.UI.WebControls.WebParts.Part.cs
+//
+// Authors:
+// Gaurav Vaish (gaurav[DOT]vaish[AT]gmail[DOT]com)
+//
+// (C) 2004 Gaurav Vaish (http://www.mastergaurav.org)
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public abstract class Part : Panel, INamingContainer,
+ ICompositeControlDesignerAccessor
+ {
+ internal Part()
+ { }
+
+ public virtual PartChromeState ChromeState
+ {
+ get {
+ object o = ViewState["ChromeState"];
+ if(o != null)
+ return (PartChromeState)o;
+ return PartChromeState.Normal;
+ }
+ set {
+ if(!Enum.IsDefined(typeof(PartChromeState), value))
+ throw new ArgumentException("value");
+ ViewState["ChromeState"] = value;
+ }
+ }
+
+ public virtual PartChromeType ChromeType
+ {
+ get {
+ object o = ViewState["ChromeType"];
+ if(o != null)
+ return (PartChromeType)o;
+ return PartChromeType.Default;
+ }
+ set {
+ if(!Enum.IsDefined(typeof(PartChromeType), value))
+ throw new ArgumentException("value");
+ ViewState["ChromeType"] = value;
+ }
+ }
+
+ public override ControlCollection Controls
+ {
+ get {
+ EnsureChildControls();
+ return Controls;
+ }
+ }
+
+ [Localizable(true)]
+ public virtual string Description
+ {
+ get {
+ object o = ViewState["Description"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set {
+ ViewState["Description"] = value;
+ }
+ }
+
+ [Localizable(true)]
+ public virtual string Title
+ {
+ get {
+ object o = ViewState["Title"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set {
+ ViewState["Title"] = value;
+ }
+ }
+
+ public override void DataBind()
+ {
+ OnDataBinding(EventArgs.Empty);
+ EnsureChildControls();
+ DataBindChildren();
+ }
+
+ void ICompositeControlDesignerAccessor.RecreateChildControls()
+ {
+ ChildControlsCreated = false;
+ EnsureChildControls();
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/PartChromeState.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/PartChromeState.cs
new file mode 100644
index 00000000000..8ff8f027384
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/PartChromeState.cs
@@ -0,0 +1,35 @@
+//
+// System.Web.UI.WebControls.WebParts.PartChromeState.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls.WebParts {
+ public enum PartChromeState {
+ Normal = 0,
+ Minimized = 1
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/PartChromeType.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/PartChromeType.cs
new file mode 100644
index 00000000000..60662c4ffea
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/PartChromeType.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.UI.WebControls.WebParts.PartChromeType.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls.WebParts {
+ public enum PartChromeType {
+ Default = 0,
+ TitleAndBorder = 1,
+ None = 2,
+ TitleOnly = 3,
+ BorderOnly = 4
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/PersonalizationScope.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/PersonalizationScope.cs
new file mode 100644
index 00000000000..b19104caa32
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/PersonalizationScope.cs
@@ -0,0 +1,35 @@
+//
+// System.Web.UI.WebControls.WebParts.PersonalizationScope.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls.WebParts {
+ public enum PersonalizationScope {
+ User = 0,
+ Shared = 1
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ProviderConnectionPoint.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ProviderConnectionPoint.cs
new file mode 100644
index 00000000000..d3e8ce39aee
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/ProviderConnectionPoint.cs
@@ -0,0 +1,56 @@
+//
+// System.Web.UI.WebControls.WebParts.ProviderConnectionPoint.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+using System.Web;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public class ProviderConnectionPoint : ConnectionPoint
+ {
+ public ProviderConnectionPoint (MethodInfo callBack, Type interFace,
+ Type control, string name, string id,
+ bool allowsMultiConnections) : base (callBack, interFace,
+ control, name, id, allowsMultiConnections)
+ {
+ }
+
+ [MonoTODO]
+ public virtual void GetObject (Control control)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual TypeCollection GetSecondaryInterfaces (Control control)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/TypeCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/TypeCollection.cs
new file mode 100644
index 00000000000..573ab822943
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/TypeCollection.cs
@@ -0,0 +1,77 @@
+//
+// System.Web.UI.WebControls.WebParts.TypeCollection.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public class TypeCollection : ReadOnlyCollectionBase
+ {
+ public TypeCollection ()
+ {
+ }
+
+ public TypeCollection (ICollection types)
+ {
+ InnerList.AddRange (types);
+ }
+
+ public TypeCollection (TypeCollection existingTypes,
+ ICollection types)
+ {
+ InnerList.AddRange (existingTypes.InnerList);
+ InnerList.AddRange (types);
+ }
+
+ public static readonly TypeCollection Empty = new TypeCollection ();
+
+ public bool Contains (Type value)
+ {
+ return InnerList.Contains (value);
+ }
+
+ public void CopyTo (Type [] array, int index)
+ {
+ InnerList.CopyTo (0, array, index, Count);
+ }
+
+ public int IndexOf (Type value)
+ {
+ return (InnerList.IndexOf (value));
+ }
+
+ public Type this [int index ] {
+ get { return (Type)InnerList [index]; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPart.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPart.cs
new file mode 100644
index 00000000000..d2be54c7c1b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPart.cs
@@ -0,0 +1,210 @@
+//
+// System.Web.UI.WebControls.WebParts.Part.cs
+//
+// Authors:
+// Gaurav Vaish (gaurav[DOT]vaish[AT]gmail[DOT]com)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 Gaurav Vaish (http://www.mastergaurav.org)
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.WebParts.WebPartDesigner, System.Design",
+ "System.ComponentModel.Design.IDesigner")]
+ public class WebPart : Part, IWebPart, IWebActionable
+ {
+ private bool allowClose = true;
+ private bool allowEdit = true;
+ private bool allowHide = true;
+ private bool allowMinimize = true;
+ private bool allowZoneChange = true;
+ private bool allowHelp = true;
+
+ private bool isStatic = true;
+ private bool isStandalone = true;
+ private bool isClosed = true;
+
+ private PartChromeState chromeState = PartChromeState.Normal;
+ private PartChromeType chromeType = PartChromeType.Default;
+ private WebPartExportMode exportMode = WebPartExportMode.None;
+ private WebPartHelpMode helpMode = WebPartHelpMode.Navigate;
+
+ private string subtitle;
+ private string catalogIconImageUrl;
+ private string description;
+ private string titleIconImageUrl;
+ private string title;
+ private string titleUrl;
+ private WebPartVerbCollection verbCollection;
+
+ protected WebPart()
+ {
+ }
+
+ [WebSysDescriptionAttribute ("Determines Whether the Web Part can be closed."),
+ DefaultValueAttribute (true), WebCategoryAttribute ("Behavior of Web Part")]
+ //, PersonalizableAttribute
+ public virtual bool AllowClose {
+ get { return allowClose; }
+ set { allowClose = value; }
+ }
+
+ [WebSysDescriptionAttribute ("Determines Whether properties of the Web Part can be changed using the EditorZone."),
+ DefaultValueAttribute (true), WebCategoryAttribute ("Behavior of Web Part")]
+ //, PersonalizableAttribute
+ public virtual bool AllowEdit {
+ get { return allowEdit; }
+ set { allowEdit = value; }
+ }
+
+ [WebSysDescriptionAttribute ("Determines Whether properties of the Web Part can be changed using the EditorZone."),
+ DefaultValueAttribute (true), WebCategoryAttribute ("Behavior of Web Part")]
+ //, PersonalizableAttribute
+ public virtual bool AllowHelp {
+ get { return AllowHelp; }
+ set { allowHelp = value; }
+ }
+
+ [WebSysDescriptionAttribute ("Determines Whether the Web Part can be minimized."),
+ DefaultValueAttribute (true), WebCategoryAttribute ("Behavior of Web Part")]
+ //, PersonalizableAttribute
+ public virtual bool AllowMinimize {
+ get { return allowMinimize; }
+ set { allowMinimize = value; }
+ }
+
+ [WebSysDescriptionAttribute ("Determines Whether the Web Part can be moved to some other zone."),
+ DefaultValueAttribute (true), WebCategoryAttribute ("Behavior of Web Part")]
+ //, PersonalizableAttribute
+ public virtual bool AllowZoneChange {
+ get { return allowZoneChange; }
+ set { allowZoneChange = value; }
+ }
+
+ [BrowsableAttribute (false),
+ DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public bool IsClosed {
+ get { return isClosed; }
+ }
+
+ [BrowsableAttribute (false),
+ DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public bool IsStandalone
+ {
+ get { return isStandalone; }
+ }
+
+ //[PersonalizableAttribute ]
+ public override PartChromeState ChromeState {
+ get { return chromeState; }
+ set {
+ if(!Enum.IsDefined (typeof (PartChromeState), value))
+ throw new ArgumentException ("value");
+ chromeState = value;
+ }
+ }
+
+ //[PersonalizableAttribute ]
+ public override PartChromeType ChromeType {
+ get { return chromeType; }
+ set {
+ if(!Enum.IsDefined (typeof (PartChromeType), value))
+ throw new ArgumentException ("value");
+ chromeType = value;
+ }
+ }
+
+ [BrowsableAttribute (false),
+ DesignerSerializationVisibilityAttribute (System.ComponentModel.DesignerSerializationVisibility.Hidden),
+ LocalizableAttribute (true)]
+ string IWebPart.Subtitle {
+ get { return subtitle; }
+ }
+
+ [DefaultValueAttribute (""),
+ EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design",
+ "System.Drawing.Design.UITypeEditor, System.Drawing") ,
+ WebCategoryAttribute ("Appearance of the Web Part"),
+ WebSysDescriptionAttribute ("Specifies URL of image which is displayed in WebPart's Catalog.")]
+ //UrlPropertyAttribute, PersonalizableAttribute
+ string IWebPart.CatalogIconImageUrl {
+ get { return catalogIconImageUrl; }
+ set { catalogIconImageUrl = value; }
+ }
+
+ string IWebPart.Description {
+ get { return description; }
+ set { description = value; }
+ }
+
+ string IWebPart.Title {
+ get { return title; }
+ set { title = value; }
+ }
+
+ [DefaultValueAttribute (""),
+ EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design",
+ "System.Drawing.Design.UITypeEditor, System.Drawing"),
+ WebCategoryAttribute ("Appearance of the Web Part"),
+ WebSysDescriptionAttribute ("Specifies URL of image which is displayed in WebPart's title bar.")]
+ //UrlPropertyAttribute, PersonalizableAttribute
+ string IWebPart.TitleIconImageUrl
+ {
+ get { return titleIconImageUrl; }
+ set { titleIconImageUrl = value; }
+ }
+
+ [DefaultValueAttribute (""),
+ EditorAttribute ("System.Web.UI.Design.UrlEditor, System.Design",
+ "System.Drawing.Design.UITypeEditor, System.Drawing"),
+ WebCategoryAttribute ("Behavior of the Web Part"),
+ WebSysDescriptionAttribute ("Specifies URL of page, containing additional information about this WebPart.")]
+ //UrlPropertyAttribute, PersonalizableAttribute
+ string IWebPart.TitleUrl {
+ get { return titleUrl; }
+ set { titleUrl = value; }
+ }
+
+ [BrowsableAttribute (false),
+ DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ WebPartVerbCollection IWebActionable.Verbs {
+ get {
+ if (verbCollection == null) {
+ verbCollection = new WebPartVerbCollection ();
+ }
+ return verbCollection;
+ }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartAuthorizationEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartAuthorizationEventArgs.cs
new file mode 100644
index 00000000000..9037482575d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartAuthorizationEventArgs.cs
@@ -0,0 +1,49 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartAuthorizationEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public class WebPartAuthorizationEventArgs : WebPartEventArgs
+ {
+ private bool authorized;
+ public WebPartAuthorizationEventArgs (WebPart part) : base (part)
+ {
+ this.authorized = false;
+ }
+
+ public bool IsAuthorized {
+ get { return authorized; }
+ set { authorized = value; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartAuthorizationEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartAuthorizationEventHandler.cs
new file mode 100644
index 00000000000..818c7958c97
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartAuthorizationEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartAuthorizationEventHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls.WebParts {
+ public delegate void WebPartAuthorizationEventHandler (object source, WebPartAuthorizationEventArgs e);
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartCancelEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartCancelEventArgs.cs
new file mode 100644
index 00000000000..499827f1fb2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartCancelEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartCancelEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public class WebPartCancelEventArgs : CancelEventArgs
+ {
+ private WebPart part;
+
+ public WebPartCancelEventArgs (WebPart part)
+ {
+ this.part = part;
+ }
+
+ public WebPart WebPart {
+ get { return part; }
+ set { part = value; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartCancelEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartCancelEventHandler.cs
new file mode 100644
index 00000000000..a20af7dd405
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartCancelEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartCancelEventHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls.WebParts {
+ public delegate void WebPartCancelEventHandler (object source, WebPartCancelEventArgs e);
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartConnectionsEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartConnectionsEventArgs.cs
new file mode 100644
index 00000000000..cffcbfaa24e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartConnectionsEventArgs.cs
@@ -0,0 +1,80 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartConnectionsEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public class WebPartConnectionsEventArgs : EventArgs
+ {
+ private WebPart providerPart;
+ private WebPart consumerPart;
+ private ProviderConnectionPoint providerPoint;
+ private ConsumerConnectionPoint consumerPoint;
+ private Connection connection;
+
+ public WebPartConnectionsEventArgs (WebPart providerPart, ProviderConnectionPoint providerPoint,
+ WebPart consumerPart, ConsumerConnectionPoint consumerPoint) : this (providerPart,
+ providerPoint, consumerPart, consumerPoint, null)
+ {}
+
+ public WebPartConnectionsEventArgs (WebPart providerPart, ProviderConnectionPoint providerPoint,
+ WebPart consumerPart, ConsumerConnectionPoint consumerPoint, Connection connection)
+ {
+ this.providerPart = providerPart;
+ this.providerPoint = providerPoint;
+ this.consumerPart = consumerPart;
+ this.consumerPart = consumerPoint;
+ this.connection = connection;
+ }
+
+ public Connection Connection {
+ get { return connection; }
+ }
+
+ public ConsumerConnectionPoint ConsumerConnectionPoint {
+ get { return consumerPoint; }
+ }
+
+ public WebPart ConsumerWebPart {
+ get { return consumerPart; }
+ }
+
+ public ProviderConnectionPoint ProviderConnectionPoint {
+ get { return providerPoint; }
+ }
+
+ public WebPart ProviderWebPart {
+ get { return providerPart; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartConnectionsEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartConnectionsEventHandler.cs
new file mode 100644
index 00000000000..3a7666717f4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartConnectionsEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartConnectionsEventHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls.WebParts {
+ public delegate void WebPartConnectionsEventHandler (object source, WebPartConnectionsEventArgs e);
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayMode.cs
new file mode 100644
index 00000000000..9536a43a5d6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayMode.cs
@@ -0,0 +1,51 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartDisplayMode.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public abstract class WebPartDisplayMode
+ {
+ protected WebPartDisplayMode ()
+ {}
+
+ public abstract bool IsEnabled (WebPartManager manager);
+
+ public abstract bool AllowPageDesign { get; }
+
+ public abstract string Name { get; }
+
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayModeCancelEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayModeCancelEventArgs.cs
new file mode 100644
index 00000000000..edab869d895
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayModeCancelEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartDisplayModeCancelEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public class WebPartDisplayModeCancelEventArgs : CancelEventArgs
+ {
+ private WebPartDisplayMode displayMode;
+
+ public WebPartDisplayModeCancelEventArgs (WebPartDisplayMode displayMode)
+ {
+ this.displayMode = displayMode;
+ }
+
+ public WebPartDisplayMode NewDisplayMode {
+ get { return displayMode; }
+ set { displayMode = value; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayModeCancelEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayModeCancelEventHandler.cs
new file mode 100644
index 00000000000..54f18a2e538
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayModeCancelEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartDisplayModeCancelEventHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls.WebParts {
+ public delegate void WebPartDisplayModeCancelEventHandler (object source, WebPartDisplayModeCancelEventArgs e);
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayModeEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayModeEventArgs.cs
new file mode 100644
index 00000000000..79497c32b73
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayModeEventArgs.cs
@@ -0,0 +1,51 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartDisplayModeEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public class WebPartDisplayModeEventArgs : EventArgs
+ {
+ private WebPartDisplayMode displayMode;
+
+ public WebPartDisplayModeEventArgs (WebPartDisplayMode displayMode)
+ {
+ this.displayMode = displayMode;
+ }
+
+ public WebPartDisplayMode OldDisplayMode {
+ get { return displayMode; }
+ set { displayMode = value; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayModeEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayModeEventHandler.cs
new file mode 100644
index 00000000000..973815b2b80
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartDisplayModeEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartDisplayModeEventHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls.WebParts {
+ public delegate void WebPartDisplayModeEventHandler (object source, WebPartDisplayModeEventArgs e);
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartEventArgs.cs
new file mode 100644
index 00000000000..b505bebf46b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartEventArgs.cs
@@ -0,0 +1,52 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public class WebPartEventArgs : EventArgs
+ {
+ private WebPart part;
+
+ public WebPartEventArgs ()
+ {}
+
+ public WebPartEventArgs (WebPart part)
+ {
+ this.part = part;
+ }
+
+ public WebPart WebPart {
+ get { return part; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartEventHandler.cs
new file mode 100644
index 00000000000..61abe7812f1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartEventHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls.WebParts {
+ public delegate void WebPartEventHandler (object source, WebPartEventArgs e);
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartExportMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartExportMode.cs
new file mode 100644
index 00000000000..a40bac9a480
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartExportMode.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartExportMode.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls.WebParts {
+ public enum WebPartExportMode {
+ None = 0,
+ All = 1,
+ NonSensitiveData = 2
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartHelpMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartHelpMode.cs
new file mode 100644
index 00000000000..62826c1e7e1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartHelpMode.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartHelpMode.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls.WebParts {
+ public enum WebPartHelpMode {
+ Modal = 0,
+ Modeless = 1,
+ Navigate = 2
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartPageMenuMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartPageMenuMode.cs
new file mode 100644
index 00000000000..958a09c0865
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartPageMenuMode.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartPageMenuMode.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls.WebParts {
+ [Serializable]
+ public enum WebPartPageMenuMode {
+ Menu = 0,
+ DropDown = 1
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerb.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerb.cs
new file mode 100644
index 00000000000..ed2c768bdf7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerb.cs
@@ -0,0 +1,194 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartVerb.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+using System;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ [TypeConverterAttribute ("System.Web.UI.WebControls.WebParts.WebPartVerbConverter, System.Web")]
+ public class WebPartVerb : IStateManager
+ {
+ private string clientClickHandler;
+ private WebPartEventHandler serverClickHandler;
+ private StateBag stateBag;
+ private bool isChecked = false;
+ private string description = string.Empty;
+ private bool enabled = true;
+ private string imageUrl = string.Empty;
+ private string text = string.Empty;
+ private bool visible = true;
+
+ public WebPartVerb (string clientHandler)
+ {
+ this.clientClickHandler = clientHandler;
+ stateBag = new StateBag ();
+ stateBag.Add ("clientClickHandler", clientHandler);
+
+ }
+
+ public WebPartVerb (WebPartEventHandler serverHandler)
+ {
+ this.serverClickHandler = serverHandler;
+ stateBag = new StateBag ();
+ stateBag.Add ("serverClickHandler", serverHandler);
+ }
+
+ public WebPartVerb (WebPartEventHandler serverHandler, string clientHandler)
+ {
+ this.serverClickHandler = serverHandler;
+ this.clientClickHandler = clientHandler;
+ stateBag = new StateBag ();
+ stateBag.Add ("serverClickHandler", serverHandler);
+ stateBag.Add ("clientClickHandler", clientHandler);
+ }
+
+ [MonoTODO]
+ protected virtual void LoadViewState (object savedState)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual object SaveViewState()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void TrackViewState()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ void IStateManager.LoadViewState (object savedState)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ object IStateManager.SaveViewState ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IStateManager.TrackViewState ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IStateManager.IsTrackingViewState {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [WebSysDescriptionAttribute ("Denotes verb is checked or not."),
+ DefaultValueAttribute (false),
+ NotifyParentPropertyAttribute (true) ]
+ public virtual bool Checked {
+ get { return isChecked; }
+ set { isChecked = value; }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden),
+ BrowsableAttribute (false)]
+ public string ClientClickHandler {
+ get { return clientClickHandler; }
+ }
+
+ [LocalizableAttribute (true),
+ WebSysDescriptionAttribute ("Gives descriptive information about the verb"),
+ NotifyParentPropertyAttribute (true)]
+ //WebSysDefaultValueAttribute (string.Empty)]
+ public virtual string Description {
+ get { return description; }
+ set { description = value; }
+ }
+
+ [NotifyParentPropertyAttribute (true),
+ DefaultValueAttribute (true),
+ WebSysDescriptionAttribute ("Determines whether verb is enabled.")]
+ public virtual bool Enabled {
+ get { return enabled; }
+ set { enabled = value; }
+ }
+
+ [WebSysDescriptionAttribute ("Denotes URL of the image to be displayed for the verb"),
+ EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design",
+ "System.Drawing.Design.UITypeEditor, System.Drawing"),
+ LocalizableAttribute (true), NotifyParentPropertyAttribute (true)]
+ //UrlPropertyAttribute, DefaultValueAttribute (String.Empty)
+ public string ImageUrl {
+ get { return imageUrl; }
+ set { imageUrl = value; }
+ }
+
+ protected virtual bool IsTrackingViewState {
+ get { throw new NotImplementedException (); }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden),
+ BrowsableAttribute (false)]
+ public WebPartEventHandler ServerClickHandler
+ {
+ get { return serverClickHandler; }
+ }
+
+ [WebSysDescriptionAttribute ("Denotes text to be displayed for the verb"),
+ LocalizableAttribute (true), NotifyParentPropertyAttribute (true)]
+ //DefaultValueAttribute (String.Empty)
+ public virtual string Text
+ {
+ get { return text; }
+ set { text = value; }
+ }
+
+ protected StateBag ViewState {
+ get { return stateBag; }
+ }
+
+ [DefaultValueAttribute (true),
+ WebSysDescriptionAttribute ("Denotes whether the verb is visible"),
+ LocalizableAttribute (true), NotifyParentPropertyAttribute (true)]
+ public bool Visible
+ {
+ get { return visible; }
+ set { visible = value; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerbCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerbCollection.cs
new file mode 100644
index 00000000000..1fef3870060
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerbCollection.cs
@@ -0,0 +1,77 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartVerbCollection.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public class WebPartVerbCollection : ReadOnlyCollectionBase
+ {
+ public WebPartVerbCollection ()
+ {
+ }
+
+ public WebPartVerbCollection (ICollection verbs)
+ {
+ InnerList.AddRange (verbs);
+ }
+
+ public WebPartVerbCollection (WebPartVerbCollection existingVerbs,
+ ICollection verbs)
+ {
+ InnerList.AddRange (existingVerbs.InnerList);
+ InnerList.AddRange (verbs);
+ }
+
+ public static readonly WebPartVerbCollection Empty = new WebPartVerbCollection ();
+
+ public bool Contains (WebPartVerb value)
+ {
+ return InnerList.Contains (value);
+ }
+
+ public void CopyTo (WebPartVerb [] array, int index)
+ {
+ InnerList.CopyTo (0, array, index, Count);
+ }
+
+ public int IndexOf(WebPartVerb value)
+ {
+ return (InnerList.IndexOf (value));
+ }
+
+ public WebPartVerb this [int index ] {
+ get { return (WebPartVerb)InnerList [index]; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerbsEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerbsEventArgs.cs
new file mode 100644
index 00000000000..3c4e16e7152
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerbsEventArgs.cs
@@ -0,0 +1,54 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartVerbsEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls.WebParts
+{
+ public class WebPartVerbsEventArgs : EventArgs
+ {
+ private WebPartVerbCollection verbs;
+
+ public WebPartVerbsEventArgs ()
+ {}
+
+ public WebPartVerbsEventArgs (WebPartVerbCollection verbs)
+ {
+ this.verbs = verbs;
+ }
+
+ public WebPartVerbCollection Verbs {
+ get { return verbs; }
+ set { verbs = value; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerbsEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerbsEventHandler.cs
new file mode 100644
index 00000000000..574a7d9dee3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPartVerbsEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.WebParts.WebPartVerbsEventHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls.WebParts {
+ public delegate void WebPartVerbsEventHandler (object source, WebPartVerbsEventArgs e);
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/.cvsignore b/mcs/class/System.Web/System.Web.UI.WebControls/.cvsignore
new file mode 100644
index 00000000000..05b071879be
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/.cvsignore
@@ -0,0 +1,3 @@
+*.exe
+*.xml
+semantic.cache
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AccessDataSource.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AccessDataSource.cs
new file mode 100644
index 00000000000..a6534d460be
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AccessDataSource.cs
@@ -0,0 +1,129 @@
+//
+// System.Web.UI.WebControls.AccessDataSource.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.IO;
+using System.ComponentModel;
+using System.Security.Permissions;
+
+namespace System.Web.UI.WebControls {
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.AccessDataSourceDesigner, System.Design",
+ "System.ComponentModel.Design.IDesigner")]
+ public class AccessDataSource : SqlDataSource
+ {
+ string dataFile;
+
+ public AccessDataSource () : base ()
+ {
+ this.ProviderName = "System.Data.OleDb";
+ }
+
+ public AccessDataSource (string dataFile, string selectCommand) :
+ base (String.Empty, selectCommand)
+ {
+ this.dataFile = dataFile;
+ //After setting dataFile, connectionString gets recreated
+ //On accessing ConnectionString, MS.Net throws NullReferenceException
+ //Need to dig more on this.
+ this.ProviderName = "System.Data.OleDb";
+ }
+
+ protected override SqlDataSourceView CreateDataSourceView (string viewName)
+ {
+ AccessDataSourceView view = new AccessDataSourceView (this, viewName, this.Context);
+ view.DataSourceViewChanged += new EventHandler (ViewChanged);
+ if (IsTrackingViewState)
+ ((IStateManager) view).TrackViewState ();
+ return view;
+ }
+
+ void ViewChanged (object source, EventArgs e)
+ {
+ OnDataSourceChanged (e);
+ }
+
+ /*[MonoTODO]
+ protected internal override void SaveDataToCache (int startingRowIndex,
+ int maxRows, object data)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override void SaveTotalRowCountToCache(int totalRows)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override string SqlCacheDependency {
+ get { throw new NotSupportedException ("AccessDataSource does not supports SQL Cache Dependencies."); }
+ set { throw new NotSupportedException ("AccessDataSource does not supports SQL Cache Dependencies."); }
+ }*/
+
+ //Above commented out portion will come into place after implementing
+ // stuff in SqlDataSource class.
+ //Overrid implementation will depend on how .Net stores data in
+ //Cache property of HttpContext object.
+
+ [BrowsableAttribute (false),
+ DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public override string ConnectionString {
+ get { return this.ConnectionString; }
+ set { throw new InvalidOperationException
+ ("The ConnectionString is automatically generated for AccessDataSource and hence cannot be set.");
+ }
+ }
+
+ [UrlPropertyAttribute (), DefaultValueAttribute (""),
+ WebCategoryAttribute ("Data"),
+ WebSysDescriptionAttribute ("MS Office Access database file name"),
+ EditorAttribute ("System.Web.UI.Design.MdbDataFileEditor, System.Design",
+ "System.Drawing.Design.UITypeEditor, System.Drawing")]
+ public string DataFile {
+ get { return dataFile; }
+ set { dataFile = value; }
+ //After setting dataFile, connectionString gets recreated
+ //On accessing ConnectionString, MS.Net throws NullReferenceException
+ //Need to dig more on this.
+ }
+
+ [BrowsableAttribute (false),
+ DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public override string ProviderName {
+ get { return this.ProviderName; }
+ set { throw new InvalidOperationException
+ ("Setting ProviderName on an AccessDataSource is not allowed");
+ }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AccessDataSourceView.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AccessDataSourceView.cs
new file mode 100644
index 00000000000..f0003bbc71e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AccessDataSourceView.cs
@@ -0,0 +1,85 @@
+//
+// System.Web.UI.WebControls.AccessDataSourceView
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Data;
+using System.ComponentModel;
+using System.Data.OleDb;
+using System.Security.Permissions;
+
+namespace System.Web.UI.WebControls {
+
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public class AccessDataSourceView : SqlDataSourceView {
+
+ OleDbConnection oleConnection;
+ OleDbCommand oleCommand;
+ AccessDataSource dataSource;
+ public AccessDataSourceView (AccessDataSource owner, string name, HttpContext context)
+ : base (owner, name, context)
+ {
+ dataSource = owner;
+ oleConnection = new OleDbConnection (owner.ConnectionString);
+ }
+
+ [MonoTODO ("Handle arguments")]
+ protected internal override IEnumerable ExecuteSelect (
+ DataSourceSelectArguments arguments)
+ {
+ oleCommand = new OleDbCommand (this.SelectCommand, oleConnection);
+ SqlDataSourceCommandEventArgs cmdEventArgs = new SqlDataSourceCommandEventArgs (oleCommand);
+ OnSelecting (cmdEventArgs);
+ IEnumerable enums = null;
+ Exception exception = null;
+ OleDbDataReader reader = null;
+ try {
+ System.IO.File.OpenRead (dataSource.DataFile).Close ();
+ oleConnection.Open ();
+ reader = oleCommand.ExecuteReader ();
+
+ //enums = reader.GetEnumerator ();
+ throw new NotImplementedException("OleDbDataReader doesnt implements GetEnumerator method yet");
+ } catch (Exception e) {
+ exception = e;
+ }
+ SqlDataSourceStatusEventArgs statusEventArgs =
+ new SqlDataSourceStatusEventArgs (oleCommand, reader.RecordsAffected, exception);
+ OnSelected (statusEventArgs);
+ if (exception !=null)
+ throw exception;
+ return enums;
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventArgs.cs
new file mode 100755
index 00000000000..06f89a60e7d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventArgs.cs
@@ -0,0 +1,116 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: AdCreatedEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+#if !NET_2_0
+ sealed
+#endif
+ public class AdCreatedEventArgs: EventArgs
+ {
+
+ private IDictionary adProperties;
+ private string alternateText;
+ private string imageUrl;
+ private string navigateUrl;
+
+ public AdCreatedEventArgs(IDictionary adProperties): base()
+ {
+ Initialize();
+ this.adProperties = adProperties;
+ if(adProperties!=null)
+ {
+ imageUrl = (string)adProperties["ImageUrl"];
+ navigateUrl = (string)adProperties["NavigateUrl"];
+ alternateText = (string)adProperties["AlternateText"];
+ }
+ }
+
+ private void Initialize()
+ {
+ alternateText = string.Empty;
+ imageUrl = string.Empty;
+ navigateUrl = string.Empty;
+ }
+
+ public IDictionary AdProperties
+ {
+ get
+ {
+ return adProperties;
+ }
+ }
+
+ public string AlternateText
+ {
+ get
+ {
+ return alternateText;
+ }
+ set
+ {
+ alternateText = value;
+ }
+ }
+
+ public string ImageUrl
+ {
+ get
+ {
+ return imageUrl;
+ }
+ set
+ {
+ imageUrl = value;
+ }
+ }
+
+ public string NavigateUrl
+ {
+ get
+ {
+ return navigateUrl;
+ }
+ set
+ {
+ navigateUrl = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventHandler.cs
new file mode 100755
index 00000000000..a52c5c8a4d2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventHandler.cs
@@ -0,0 +1,38 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: AdCreatedEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void AdCreatedEventHandler(object sender, AdCreatedEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs
new file mode 100755
index 00000000000..43234557d2a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs
@@ -0,0 +1,526 @@
+//
+// System.Web.UI.WebControls.AdRotator.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+// (C) 2004 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
+// "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;
+using System.IO;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web;
+using System.Web.Caching;
+using System.Web.UI;
+using System.Xml;
+using System.Web.Util;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("AdCreated")]
+ [DefaultProperty("AdvertisementFile")]
+ [Designer ("System.Web.UI.Design.WebControls.AdRotatorDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ [ToolboxData("<{0}:AdRotator runat=\"server\" Height=\"60px\" "
+ + "Width=\"468\"></{0}:AdRotator>")]
+ public class AdRotator:
+#if NET_2_0
+ DataBoundControl
+#else
+ WebControl
+#endif
+ {
+ string advertisementFile;
+ static readonly object AdCreatedEvent = new object();
+
+ // Will be set values during (On)PreRender-ing
+ string alternateText;
+ string imageUrl;
+ string navigateUrl;
+ string fileDirectory;
+ Random random;
+
+ public AdRotator ()
+ {
+ advertisementFile = "";
+ fileDirectory = null;
+ }
+
+ AdRecord[] LoadAdFile (string file)
+ {
+ Stream fStream;
+ try {
+ fStream = new FileStream (file, FileMode.Open, FileAccess.Read, FileShare.Read);
+ } catch (Exception e) {
+ throw new HttpException("AdRotator: Unable to open file", e);
+ }
+
+ ArrayList list = new ArrayList ();
+ try {
+ IDictionary hybridDict = null;
+ XmlDocument document = new XmlDocument ();
+ document.Load (fStream);
+
+ XmlElement docElem = document.DocumentElement;
+
+ if (docElem == null)
+ throw new HttpException ("No advertisements found");
+
+ if (docElem.LocalName != "Advertisements")
+ throw new HttpException ("No advertisements found: invalid document element");
+
+ XmlNode node = docElem.FirstChild;
+ while (node != null) {
+ if (node.LocalName == "Ad") {
+ XmlNode innerNode = node.FirstChild;
+ while (innerNode != null) {
+ if (node.NodeType == XmlNodeType.Element) {
+ if (hybridDict == null)
+ hybridDict = new HybridDictionary ();
+
+ hybridDict.Add (innerNode.LocalName, innerNode.InnerText);
+ }
+ innerNode = innerNode.NextSibling;
+ }
+
+ if (hybridDict != null) {
+ list.Add (hybridDict);
+ hybridDict = null;
+ }
+ }
+ node = node.NextSibling;
+ }
+
+ } catch(Exception e) {
+ throw new HttpException("Parse error:" + file, e);
+ } finally {
+ if (fStream != null)
+ fStream.Close();
+ }
+
+ if (list.Count == 0)
+ throw new HttpException ("No advertisements found");
+
+ AdRecord [] adsArray = new AdRecord [list.Count];
+ int count = list.Count;
+ for (int i = 0; i < count; i++)
+ adsArray [i] = new AdRecord ((IDictionary) list [i]);
+
+ return adsArray;
+ }
+
+ AdRecord [] GetData (string file)
+ {
+ string physPath = MapPathSecure (file);
+ string AdKey = "AdRotatorCache: " + physPath;
+ fileDirectory = UrlUtils.GetDirectory (UrlUtils.Combine (TemplateSourceDirectory, file));
+ Cache cache = HttpRuntime.Cache;
+ AdRecord[] records = (AdRecord[]) cache [AdKey];
+ if (records == null) {
+ records = LoadAdFile (physPath);
+ cache.Insert (AdKey, records, new CacheDependency (physPath));
+ }
+
+ return records;
+ }
+
+ IDictionary SelectAd ()
+ {
+ AdRecord[] records = GetData (AdvertisementFile);
+ if (records == null || records.Length ==0)
+ return null;
+
+ int impressions = 0;
+ int rlength = records.Length;
+ for (int i=0 ; i < rlength; i++) {
+ if (IsAdMatching (records [i]))
+ impressions += records [i].Hits;
+ }
+
+ if (impressions == 0)
+ return null;
+
+ if (random == null)
+ random = new Random ();
+
+ int rnd = random.Next (impressions) + 1;
+ int counter = 0;
+ int index = 0;
+ for (int i = 0; i < rlength; i++) {
+ if(IsAdMatching(records[i])) {
+ if (rnd <= (counter + records [i].Hits)) {
+ index = i;
+ break;
+ }
+ counter += records [i].Hits;
+ }
+ }
+
+ return records [index].Properties;
+ }
+
+ private bool IsAdMatching (AdRecord currAd)
+ {
+ if (KeywordFilter != String.Empty)
+ return (0 == String.Compare (currAd.Keyword, KeywordFilter, true));
+
+ return true;
+ }
+
+ private string ResolveAdUrl (string relativeUrl)
+ {
+ if (relativeUrl.Length==0 || !UrlUtils.IsRelativeUrl (relativeUrl))
+ return relativeUrl;
+
+ string fullUrl;
+ if (fileDirectory != null)
+ fullUrl = fileDirectory;
+ else
+ fullUrl = TemplateSourceDirectory;
+
+ if (fullUrl.Length == 0)
+ return relativeUrl;
+
+ return UrlUtils.Combine (fullUrl, relativeUrl);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("AdRotator_OnAdCreated")]
+ public event AdCreatedEventHandler AdCreated {
+ add { Events.AddHandler (AdCreatedEvent, value); }
+ remove { Events.RemoveHandler (AdCreatedEvent, value); }
+ }
+
+ [Bindable(true)]
+ [DefaultValue("")]
+ [Editor ("System.Web.UI.Design.XmlUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [WebCategory("Behavior")]
+ [WebSysDescription("AdRotator_AdvertisementFile")]
+#if NET_2_0
+ [Localizable (true)]
+ [UrlProperty ()]
+#endif
+ public string AdvertisementFile {
+ get { return ((advertisementFile != null) ? advertisementFile : ""); }
+ set { advertisementFile = value; }
+ }
+
+ [Browsable (false), EditorBrowsable (EditorBrowsableState.Never)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public override FontInfo Font {
+ get { return base.Font; }
+ }
+
+ [Bindable(true)]
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [WebSysDescription("AdRotator_KeywordFilter")]
+ public string KeywordFilter {
+ get {
+ object o = ViewState ["KeywordFilter"];
+ if (o != null)
+ return (string) o;
+
+ return String.Empty;
+ }
+ set {
+ if(value != null)
+ ViewState ["KeywordFilter"] = value.Trim ();
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue("")]
+ [TypeConverter(typeof(TargetConverter))]
+ [WebCategory("Behavior")]
+ [WebSysDescription("AdRotator_Target")]
+ public string Target {
+ get {
+ object o = ViewState ["Target"];
+ if (o != null)
+ return (string) o;
+
+ return "_top";
+ }
+ set {
+ ViewState["Target"] = value;
+ }
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new EmptyControlCollection (this);
+ }
+
+ protected virtual void OnAdCreated (AdCreatedEventArgs e)
+ {
+ if (Events == null)
+ return;
+
+ AdCreatedEventHandler aceh = (AdCreatedEventHandler) Events [AdCreatedEvent];
+ if (aceh != null)
+ aceh (this, e);
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ if(AdvertisementFile == String.Empty)
+ return;
+
+ AdCreatedEventArgs acea = new AdCreatedEventArgs (SelectAd ());
+ OnAdCreated (acea);
+ imageUrl = acea.ImageUrl;
+ navigateUrl = acea.NavigateUrl;
+ alternateText = acea.AlternateText;
+ }
+
+ [MonoTODO ("Update method with net 2.0 properties added for AdRotator class")]
+ protected override void Render (HtmlTextWriter writer)
+ {
+ HyperLink hLink = new HyperLink ();
+ Image adImage = new Image();
+ foreach (string current in Attributes.Keys)
+ hLink.Attributes [current] = Attributes [current];
+
+ if (ID != null && ID.Length > 0)
+ hLink.ID = ID;
+
+ hLink.Target = Target;
+ hLink.AccessKey = AccessKey;
+ hLink.Enabled = Enabled;
+ hLink.TabIndex = TabIndex;
+ if (navigateUrl != null && navigateUrl.Length != 0)
+ hLink.NavigateUrl = ResolveAdUrl (navigateUrl);
+
+ hLink.RenderBeginTag (writer);
+ if (ControlStyleCreated)
+ adImage.ApplyStyle(ControlStyle);
+
+ if(imageUrl!=null && imageUrl.Length > 0)
+ adImage.ImageUrl = ResolveAdUrl (imageUrl);
+
+ adImage.AlternateText = alternateText;
+ adImage.ToolTip = ToolTip;
+ adImage.RenderControl (writer);
+ hLink.RenderEndTag (writer);
+ }
+
+#if NET_2_0
+ AdType adType;
+
+ [DefaultValueAttribute ("Banner")]
+ [WebCategoryAttribute ("Behavior")]
+ [WebSysDescriptionAttribute ("Advertisement of specific type is created by specified value")]
+ public AdType AdType {
+ get { return adType; }
+ set { adType = value; }
+ }
+
+ string alternateTextField;
+
+ [DefaultValueAttribute ("AlternateText")]
+ [WebCategoryAttribute ("Behavior")]
+ [WebSysDescriptionAttribute ("Alternate text is retrieved from the elmenet name specified.")]
+ //[VerificationAttribute ()]
+ public string AlternateTextField {
+ get { return alternateTextField; }
+ set { alternateTextField = value; }
+ }
+
+ bool countClicks;
+
+ [DefaultValueAttribute (false)]
+ [WebCategoryAttribute ("Site Counters")]
+ [WebSysDescriptionAttribute ("On clicking an advertisement, click-through events should be counted.")]
+ public bool CountClicks {
+ get { return countClicks; }
+ set { countClicks = value; }
+ }
+
+ string counterGroup;
+
+ [DefaultValueAttribute ("AdRotator")]
+ [WebCategoryAttribute ("Site Counters")]
+ [WebSysDescriptionAttribute ("Name of the group which takes care of counting.")]
+ public string CounterGroup {
+ get { return counterGroup; }
+ set { counterGroup = value; }
+ }
+
+ string counterName;
+
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Site Counters")]
+ [WebSysDescriptionAttribute ("Name of the group which takes care of counting.")]
+ public string CounterName {
+ get { return counterName; }
+ set { counterName = value; }
+ }
+
+ bool countViews;
+
+ [DefaultValueAttribute (false)]
+ [WebCategoryAttribute ("Site Counters")]
+ [WebSysDescriptionAttribute ("On creation of an advertisement, view events should be counted.")]
+ public bool CountViews {
+ get { return countViews; }
+ set { countViews = value; }
+ }
+
+ string imageUrlField;
+
+ [DefaultValueAttribute ("ImageUrl")]
+ [WebCategoryAttribute ("Behavior")]
+ [WebSysDescriptionAttribute ("Image URL is retrieved from the elmenet name specified.")]
+ public string ImageUrlField {
+ get { return imageUrlField; }
+ set { imageUrlField = value; }
+ }
+
+ string navigateUrlField;
+
+ [DefaultValueAttribute ("NavigateUrl")]
+ [WebCategoryAttribute ("Behavior")]
+ [WebSysDescriptionAttribute ("Advertisement Web page URL is retrieved from the elmenet name specified.")]
+ public string NavigateUrlField {
+ get { return navigateUrlField; }
+ set { navigateUrlField = value; }
+ }
+
+ int popFrequency;
+
+ [DefaultValueAttribute ("100")]
+ [WebCategoryAttribute ("Behavior")]
+ [WebSysDescriptionAttribute ("Frequency in percentage for creation of Popup or PopUnder advertisement.")]
+ public int PopFrequency {
+ get { return popFrequency; }
+ set { popFrequency = value; }
+ }
+
+ int popPositionLeft;
+
+ [DefaultValueAttribute ("-1")]
+ [WebCategoryAttribute ("Appearance")]
+ [WebSysDescriptionAttribute ("Specifies X-coordinate in pixels of Popunder or Popup advertisements top-left corner.")]
+ public int PopPositionLeft {
+ get { return popPositionLeft; }
+ set { popPositionLeft = value; }
+ }
+
+ int popPositionTop;
+
+ [DefaultValueAttribute ("-1")]
+ [WebCategoryAttribute ("Appearance")]
+ [WebSysDescriptionAttribute ("Specifies Y-coordinate in pixels of Popunder or Popup advertisements top-left corner.")]
+ public int PopPositionTop {
+ get { return popPositionTop; }
+ set { popPositionTop = value; }
+ }
+
+ int rowsPerDay;
+
+ [DefaultValueAttribute ("-1")]
+ [WebCategoryAttribute ("Site Counters")]
+ [WebSysDescriptionAttribute ("On a given day this many number of rows of data needs to be collected.")]
+ public int RowsPerDay {
+ get { return rowsPerDay; }
+ set { rowsPerDay = value; }
+ }
+
+ string siteCountersProvider;
+
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Site Counters")]
+ [WebSysDescriptionAttribute ("Control uses the specified provider.")]
+ public string SiteCountersProvider {
+ get { return siteCountersProvider; }
+ set { siteCountersProvider = value; }
+ }
+
+ bool trackApplicationName;
+
+ [DefaultValueAttribute (true)]
+ [WebCategoryAttribute ("Site Counters")]
+ [WebSysDescriptionAttribute ("SiteCounters service tracks and stores the specified application name in a database.")]
+ public bool TrackApplicationName {
+ get { return trackApplicationName; }
+ set { trackApplicationName = value; }
+ }
+
+ bool trackNavigateUrl;
+
+ [DefaultValueAttribute (true)]
+ [WebCategoryAttribute ("Site Counters")]
+ [WebSysDescriptionAttribute ("SiteCounters service tracks and stores the destination URL of click through event in a database.")]
+ public bool TrackNavigateUrl {
+ get { return trackNavigateUrl; }
+ set { trackNavigateUrl = value; }
+ }
+
+ bool trackPageUrl;
+
+ [DefaultValueAttribute (true)]
+ [WebCategoryAttribute ("Site Counters")]
+ [WebSysDescriptionAttribute ("SiteCounters service tracks and stores the originating page URL in a database.")]
+ public bool TrackPageUrl {
+ get { return trackPageUrl; }
+ set { trackPageUrl = value; }
+ }
+#endif
+
+ class AdRecord
+ {
+ public IDictionary Properties;
+ public int Hits; // or impressions or clicks
+ public string Keyword;
+
+ public AdRecord (IDictionary adProps)
+ {
+ this.Properties = adProps;
+ Keyword = Properties ["Keyword"] as string;
+ if (Keyword == null)
+ Keyword = "";
+
+ string imp = Properties ["Impressions"] as string;
+ Hits = 1;
+ if (imp != null) {
+ try {
+ Hits = Int32.Parse (imp);
+ } catch {
+ }
+ }
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AdType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AdType.cs
new file mode 100644
index 00000000000..99e8a0dd431
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AdType.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.UI.WebControls.AdType.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum AdType {
+ Banner = 0,
+ Popup = 1,
+ Popunder = 2
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AssociatedControlConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AssociatedControlConverter.cs
new file mode 100644
index 00000000000..c8c3674c359
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AssociatedControlConverter.cs
@@ -0,0 +1,51 @@
+//
+// System.Web.UI.WebControls.AssociatedControlConverter.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI.WebControls
+{
+ public class AssociatedControlConverter : ControlIDConverter
+ {
+ public AssociatedControlConverter () : base ()
+ { }
+
+ protected override bool FilterControl (Control control)
+ {
+ if (control is WebControl)
+ return true;
+
+ return false;
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AuthenticateEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AuthenticateEventArgs.cs
new file mode 100644
index 00000000000..2cb091f76a7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AuthenticateEventArgs.cs
@@ -0,0 +1,51 @@
+//
+// System.Web.UI.WebControls.AuthenticateEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public class AuthenticateEventArgs : EventArgs
+ {
+ bool authenticated;
+
+ public AuthenticateEventArgs (): this (false)
+ {
+ }
+
+ public AuthenticateEventArgs (bool authenticated)
+ {
+ this.authenticated = authenticated;
+ }
+
+ public bool Authenticated {
+ get { return authenticated; }
+ set { authenticated = value; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AuthenticateEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AuthenticateEventHandler.cs
new file mode 100644
index 00000000000..af9abdb3342
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AuthenticateEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.AuthenticateEventHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void AuthenticateEventHandler (object sender, AuthenticateEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AutoCompleteType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AutoCompleteType.cs
new file mode 100644
index 00000000000..1df568cce62
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AutoCompleteType.cs
@@ -0,0 +1,68 @@
+//
+// System.Web.UI.WebControls.AutoCompleteType.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum AutoCompleteType {
+ None = 0,
+ Disabled = 1,
+ Cellular = 2,
+ Company = 3,
+ Department = 4,
+ DisplayName = 5,
+ Email = 6,
+ FirstName = 7,
+ Gender = 8,
+ HomeCity = 9,
+ HomeCountry = 10,
+ HomeFax = 11,
+ HomePhone = 12,
+ HomeState = 13,
+ HomeStreetAddress = 14,
+ HomeZipCode = 15,
+ Homepage = 16,
+ JobTitle = 17,
+ LastName = 18,
+ MiddleName = 19,
+ Notes = 20,
+ Office = 21,
+ Pager = 22,
+ BusinessCity = 23,
+ BusinessCountry = 24,
+ BusinessFax = 25,
+ BusinessPhone = 26,
+ BusinessState = 27,
+ BusinessStreetAddress = 28,
+ BusinessUrl = 29,
+ BusinessZipCode = 30,
+ Search = 31,
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AutoGeneratedField.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AutoGeneratedField.cs
new file mode 100644
index 00000000000..74097c3b801
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AutoGeneratedField.cs
@@ -0,0 +1,146 @@
+//
+// System.Web.UI.WebControls.AutoGeneratedField.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Security.Permissions;
+
+namespace System.Web.UI.WebControls {
+
+ [EditorBrowsableAttribute (EditorBrowsableState.Never)]
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public sealed class AutoGeneratedField : BoundField
+ {
+ Type dataType;
+
+ internal AutoGeneratedField ()
+ {
+ }
+
+ public AutoGeneratedField (string dataField)
+ {
+ DataField = dataField;
+ }
+
+ internal AutoGeneratedField (AutoGeneratedFieldProperties fieldProperties)
+ {
+ DataField = fieldProperties.DataField;
+ SortExpression = fieldProperties.DataField;
+ DataType = fieldProperties.Type;
+ HeaderText = fieldProperties.Name;
+ ReadOnly = fieldProperties.IsReadOnly;
+ }
+
+ [MonoTODO]
+ public Type DataType {
+ get { return dataType; }
+ set { dataType = value; }
+ }
+
+ public override bool ConvertEmptyStringToNull {
+ get { return true; }
+ set { throw new NotSupportedException (); }
+ }
+
+ public override string DataFormatString {
+ get { return string.Empty; }
+ set { throw new NotSupportedException (); }
+ }
+
+ public override bool InsertVisible {
+ get { return true; }
+ set { throw new NotSupportedException (); }
+ }
+
+ [MonoTODO ("Support other data types")]
+ public override void ExtractValuesFromCell (IOrderedDictionary dictionary,
+ DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
+ {
+ if (dataType == typeof(bool)) {
+ CheckBox box = (CheckBox) cell.Controls [0];
+ dictionary [DataField] = box.Checked;
+ } else
+ base.ExtractValuesFromCell (dictionary, cell, rowState, includeReadOnly);
+ }
+
+
+ [MonoTODO ("Support other data types")]
+ public override void InitializeDataCell (DataControlFieldCell cell, DataControlRowState rowState)
+ {
+ bool editable = (rowState & (DataControlRowState.Edit | DataControlRowState.Insert)) != 0;
+
+ if (dataType == typeof(bool)) {
+ CheckBox box = new CheckBox ();
+ box.Enabled = editable && !ReadOnly;
+ cell.Controls.Add (box);
+ } else
+ base.InitializeDataCell (cell, rowState);
+ }
+
+ [MonoTODO ("Support other data types")]
+ protected override void OnDataBindField (object sender, EventArgs e)
+ {
+ DataControlFieldCell cell = (DataControlFieldCell) sender;
+ if (dataType == typeof(bool)) {
+ CheckBox box = (CheckBox) cell.Controls [0];
+ object val = GetValue (cell.BindingContainer);
+ if (val != null) {
+ box.Checked = (bool)val;
+ if (!box.Visible)
+ box.Visible = true;
+ }
+ else
+ box.Visible = false;
+ } else
+ base.OnDataBindField (sender, e);
+ }
+
+ public override void ValidateSupportsCallback ()
+ {
+ }
+
+ protected override DataControlField CreateField ()
+ {
+ return new AutoGeneratedField ();
+ }
+
+ protected override void CopyProperties (DataControlField newField)
+ {
+ base.CopyProperties (newField);
+ AutoGeneratedField field = (AutoGeneratedField) newField;
+ field.DataType = DataType;
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AutoGeneratedFieldProperties.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AutoGeneratedFieldProperties.cs
new file mode 100644
index 00000000000..6d11bb4e8f6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AutoGeneratedFieldProperties.cs
@@ -0,0 +1,106 @@
+//
+// System.Web.UI.WebControls.AutoGeneratedFieldProperties.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System.Web.UI;
+using System.Security.Permissions;
+
+namespace System.Web.UI.WebControls {
+
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public sealed class AutoGeneratedFieldProperties: IStateManager
+ {
+ StateBag ViewState = new StateBag ();
+
+ public string DataField {
+ get {
+ object ob = ViewState ["DataField"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["DataField"] = value;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ object val = ViewState ["IsReadOnly"];
+ return val != null ? (bool) val : false;
+ }
+ set {
+ ViewState ["IsReadOnly"] = value;
+ }
+ }
+
+ public string Name {
+ get {
+ object ob = ViewState ["Name"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["Name"] = value;
+ }
+ }
+
+ public Type Type {
+ get {
+ object ob = ViewState ["Type"];
+ if (ob != null) return (Type) ob;
+ return null;
+ }
+ set {
+ ViewState ["Type"] = value;
+ }
+ }
+
+ void IStateManager.LoadViewState (object state)
+ {
+ ViewState.LoadViewState (state);
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ return ViewState.SaveViewState ();
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ ViewState.TrackViewState ();
+ }
+
+ bool IStateManager.IsTrackingViewState {
+ get { return ViewState.IsTrackingViewState; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs
new file mode 100755
index 00000000000..8cf061706c6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs
@@ -0,0 +1,416 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: BaseCompareValidator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Globalization;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public abstract class BaseCompareValidator: BaseValidator
+ {
+ protected BaseCompareValidator(): base()
+ {
+ }
+
+ public static bool CanConvert(string text, ValidationDataType type)
+ {
+ object o = null;
+ return Convert(text, type, out o);
+ }
+
+#if NET_2_0
+ public static bool CanConvert (string text, ValidationDataType type, bool cultureInvariant)
+ {
+ object o = null;
+ return Convert(text, type, cultureInvariant, out o);
+ }
+#endif
+
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue(ValidationDataType.String)]
+ [WebCategory("Behavior")]
+ [WebSysDescription("RangeValidator_Type")]
+ public ValidationDataType Type
+ {
+ get
+ {
+ object o = ViewState["Type"];
+ if(o!=null)
+ return (ValidationDataType)o;
+ return ValidationDataType.String;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(ValidationDataType), value))
+ throw new ArgumentException();
+ ViewState["Type"] = value;
+ }
+ }
+
+#if NET_2_0
+ [DefaultValueAttribute (false)]
+ [ThemeableAttribute (false)]
+ [WebCategory ("Behavior")]
+ public bool CultureInvariantValues {
+ get {
+ object o = ViewState ["CultureInvariantValues"];
+ if (o != null) return (bool) o;
+ return false;
+ }
+ set {
+ ViewState ["CultureInvariantValues"] = value;
+ }
+ }
+#endif
+
+ protected static int CutoffYear
+ {
+ get
+ {
+ return DateTimeFormatInfo.CurrentInfo.Calendar.TwoDigitYearMax;
+ }
+ }
+
+ protected static int GetFullYear(int shortYear)
+ {
+ int century = DateTime.Today.Year - (DateTime.Today.Year % 100);
+ if(century < CutoffYear)
+ {
+ return (shortYear + century);
+ }
+ return (shortYear + century - 100);
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(RenderUplevel)
+ {
+#if NET_2_0
+ CultureInfo culture = CultureInvariantValues ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture;
+ NumberFormatInfo currInfo = culture.NumberFormat;
+#else
+ NumberFormatInfo currInfo = NumberFormatInfo.CurrentInfo;
+#endif
+ writer.AddAttribute("type", PropertyConverter.EnumToString(typeof(ValidationDataType), Type));
+ if(Type == ValidationDataType.Double)
+ {
+ writer.AddAttribute("decimalchar", currInfo.NumberDecimalSeparator);
+ return;
+ }
+ if(Type == ValidationDataType.Currency)
+ {
+ writer.AddAttribute("decimalchar", currInfo.CurrencyDecimalSeparator);
+ string grpSep = currInfo.CurrencyGroupSeparator;
+ if(grpSep[0] == 0xA0)
+ {
+ grpSep = " ";
+ }
+ writer.AddAttribute("groupchar", grpSep);
+ writer.AddAttribute("digits", currInfo.CurrencyDecimalDigits.ToString(NumberFormatInfo.InvariantInfo));
+ return;
+ }
+ if(Type == ValidationDataType.Date)
+ {
+ writer.AddAttribute("cutoffyear", CutoffYear.ToString());
+ writer.AddAttribute("century", ( DateTime.Today.Year - (DateTime.Today.Year % 100) ).ToString());
+ return;
+ }
+ }
+ }
+
+ protected override bool DetermineRenderUplevel()
+ {
+#if NET_2_0
+ CultureInfo culture = CultureInvariantValues ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture;
+ DateTimeFormatInfo currInfo = culture.DateTimeFormat;
+#else
+ DateTimeFormatInfo currInfo = DateTimeFormatInfo.CurrentInfo;
+#endif
+ if(Type == ValidationDataType.Date && currInfo.Calendar.GetType() != typeof(GregorianCalendar))
+ {
+ return false;
+ }
+ return base.DetermineRenderUplevel();
+ }
+
+ protected static bool Compare(string leftText, string rightText, ValidationCompareOperator op, ValidationDataType type)
+ {
+ return Compare (leftText, false, rightText, false, op, type);
+ }
+
+#if NET_2_0
+ protected
+#endif
+ static bool Compare(string leftText, bool cultureInvariantLeftText, string rightText, bool cultureInvariantRightText, ValidationCompareOperator op, ValidationDataType type)
+ {
+ object left = null, right = null;
+ if(!Convert(leftText, type, cultureInvariantLeftText, out left))
+ {
+ return false;
+ }
+ if(op == ValidationCompareOperator.DataTypeCheck)
+ {
+ return true;
+ }
+ if(!Convert(rightText, type, cultureInvariantRightText, out right))
+ {
+ return true;
+ }
+ int compareResult = 0;
+ switch(type)
+ {
+ case ValidationDataType.String:
+ compareResult = ((String)left).CompareTo(right);
+ break;
+ case ValidationDataType.Integer:
+ compareResult = ((int)left).CompareTo(right);
+ break;
+ case ValidationDataType.Double:
+ compareResult = ((Double)left).CompareTo(right);
+ break;
+ case ValidationDataType.Date:
+ compareResult = ((DateTime)left).CompareTo(right);
+ break;
+ case ValidationDataType.Currency:
+ compareResult = ((Decimal)left).CompareTo(right);
+ break;
+ }
+ switch(op)
+ {
+ case ValidationCompareOperator.Equal:
+ return (compareResult == 0);
+ case ValidationCompareOperator.NotEqual:
+ return (compareResult != 0);
+ case ValidationCompareOperator.GreaterThan:
+ return (compareResult > 0);
+ case ValidationCompareOperator.GreaterThanEqual:
+ return (compareResult >= 0);
+ case ValidationCompareOperator.LessThan:
+ return (compareResult < 0);
+ case ValidationCompareOperator.LessThanEqual:
+ return (compareResult <= 0);
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected static string GetDateElementOrder ()
+ {
+ string pattern = DateTimeFormatInfo.CurrentInfo.ShortDatePattern;
+
+ //TODO: What are the various possibilities?
+ // I can think of only y*/M*/d*, d*/M*/y*, M*/d*/y*
+ if(pattern.IndexOf('y') < pattern.IndexOf('M'))
+ {
+ return "ymd";
+ }
+ if(pattern.IndexOf('M') < pattern.IndexOf('d'))
+ {
+ return "mdy";
+ }
+ return "dmy";
+ }
+
+ static bool ConvertDate (string text, ValidationDataType type, CultureInfo culture, ref object convertedValue)
+ {
+ //Console.WriteLine (DateTimeFormatInfo.CurrentInfo.Calendar.GetType ());
+ // FIXME: sometime, somehow, the condition is true even when GetType () says
+ // it's a GregorianCalendar.
+ if (culture.DateTimeFormat.Calendar.GetType () != typeof (GregorianCalendar)) {
+ convertedValue = DateTime.Parse (text);
+ return true;
+ }
+
+ string order = GetDateElementOrder ();
+ int date = 0, mth = 0, year = 0;
+ string dateStr = null;
+ string mthStr = null;
+ string yearStr = null;
+ Match match = Regex.Match (text, @"^\s*((\d{4})|(\d{2}))([\.\/-])(\d{1,2})\4(\d{1,2})\s*$");
+ if (match.Success || order == "ymd") {
+ dateStr = match.Groups [6].Value;
+ mthStr = match.Groups [5].Value;
+ if (match.Groups [2].Success)
+ yearStr = match.Groups [2].Value;
+ else
+ yearStr = match.Groups [3].Value;
+ } else {
+ match = Regex.Match(text, @"^\s*(\d{1,2})([\.\/-])(\d{1,2})\2((\d{4}|\d{2}))\s*$");
+ if (!match.Success)
+ return false;
+
+ if (order == "dmy") {
+ dateStr = match.Groups [1].Value;
+ mthStr = match.Groups [3].Value;
+ if (match.Groups [5].Success)
+ yearStr = match.Groups [5].Value;
+ else
+ yearStr = match.Groups [6].Value;
+ } else if (order == "mdy") {
+ dateStr = match.Groups [3].Value;
+ mthStr = match.Groups [1].Value;
+ if (match.Groups [5].Success)
+ yearStr = match.Groups [5].Value;
+ else
+ yearStr = match.Groups [6].Value;
+ }
+ }
+
+ if (dateStr == null || mthStr == null || yearStr == null) {
+ return false;
+ }
+
+ CultureInfo inv = CultureInfo.InvariantCulture;
+ date = Int32.Parse (dateStr, inv);
+ mth = Int32.Parse (mthStr, inv);
+ year = Int32.Parse (yearStr, inv);
+ year = (year < 100 ? GetFullYear (year) : year);
+ if (date != 0 && mth != 0 && year != 0) {
+ convertedValue = new DateTime (year, mth, date);
+ return true;
+ }
+
+ return false;
+ }
+
+ static bool ConvertDouble (string text, ValidationDataType type, CultureInfo culture, ref object convertedValue)
+ {
+ Match match = Regex.Match (text, @"^\s*([-\+])?(\d+)?(\" +
+ culture.NumberFormat.NumberDecimalSeparator +
+ @"(\d+))?\s*$");
+
+ if (!match.Success)
+ return false;
+
+ string sign = (match.Groups [1].Success ? match.Groups [1].Value : "+");
+ string decPart = (match.Groups [2].Success ? match.Groups [2].Value : "0");
+ string mantissa = (match.Groups [4].Success ? match.Groups [4].Value : "0");
+ string num = sign + decPart + "." + mantissa;
+ convertedValue = Double.Parse (num, CultureInfo.InvariantCulture);
+ return true;
+ }
+
+ static bool ConvertCurrency (string text, ValidationDataType type, CultureInfo culture, ref object convertedValue)
+ {
+ string decSep = culture.NumberFormat.CurrencyDecimalSeparator;
+ string grpSep = culture.NumberFormat.CurrencyGroupSeparator;
+ int decDig = culture.NumberFormat.CurrencyDecimalDigits;
+ if (grpSep [0] == 0xA0)
+ grpSep = " ";
+
+ string [] patternArray = new string [5];
+ patternArray [0] = "^\\s*([-\\+])?(((\\d+)\\";
+ patternArray [1] = grpSep;
+ patternArray [2] = @")*)(\d+)";
+ if (decDig > 0) {
+ string [] decPattern = new string [5];
+ decPattern [0] = "(\\";
+ decPattern [1] = decSep;
+ decPattern [2] = @"(\d{1,";
+ decPattern [3] = decDig.ToString (NumberFormatInfo.InvariantInfo);
+ decPattern [4] = @"}))";
+ patternArray [3] = String.Concat (decPattern);
+
+ } else {
+ patternArray [3] = String.Empty;
+ }
+
+ patternArray [4] = @"?\s*$";
+ Match match = Regex.Match (text, String.Concat (patternArray));
+ if (!match.Success)
+ return false;
+
+ StringBuilder sb = new StringBuilder ();
+ sb.Append (match.Groups [1]);
+ CaptureCollection cc = match.Groups [4].Captures;
+ foreach (IEnumerable current in cc)
+ sb.Append ((Capture) current);
+
+ sb.Append (match.Groups [5]);
+ if (decDig > 0) {
+ sb.Append (".");
+ sb.Append (match.Groups [7]);
+ }
+
+ convertedValue = Decimal.Parse (sb.ToString (), CultureInfo.InvariantCulture);
+ return true;
+ }
+
+ protected static bool Convert (string text, ValidationDataType type, out object convertedValue)
+ {
+ return Convert (text, type, true, out convertedValue);
+ }
+
+#if NET_2_0
+ protected
+#endif
+ static bool Convert (string text, ValidationDataType type, bool cultureInvariant, out object convertedValue)
+ {
+ CultureInfo culture = cultureInvariant ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture;
+ convertedValue = null;
+ try {
+ switch(type) {
+ case ValidationDataType.String:
+ convertedValue = text;
+ break;
+ case ValidationDataType.Integer:
+ convertedValue = Int32.Parse (text, culture);
+ break;
+ case ValidationDataType.Double:
+ return ConvertDouble (text, type, culture, ref convertedValue);
+ case ValidationDataType.Date:
+ return ConvertDate (text, type, culture, ref convertedValue);
+ case ValidationDataType.Currency:
+ return ConvertCurrency (text, type, culture, ref convertedValue);
+ }
+ } catch (Exception) {
+ convertedValue = null;
+ }
+
+ return (convertedValue != null);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BaseDataBoundControl.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BaseDataBoundControl.cs
new file mode 100644
index 00000000000..2014bbdfa51
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BaseDataBoundControl.cs
@@ -0,0 +1,145 @@
+//
+// System.Web.UI.WebControls.BaseDataBoundControl.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty ("DataSourceID")]
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.BaseDataBoundControlDesigner, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+ public abstract class BaseDataBoundControl: WebControl
+ {
+ public event EventHandler DataBound;
+
+ object dataSource;
+ string dataSourceId;
+ bool initialized;
+ bool requiresDataBinding;
+
+ [BindableAttribute (true)]
+ [ThemeableAttribute (false)]
+ [DefaultValueAttribute (null)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public virtual object DataSource {
+ get {
+ return dataSource;
+ }
+ set {
+ ValidateDataSource (value);
+ dataSource = value;
+ if (initialized)
+ OnDataPropertyChanged ();
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [ThemeableAttribute (false)]
+ public virtual string DataSourceID {
+ get {
+ return dataSourceId != null ? dataSourceId : string.Empty;
+ }
+ set {
+ dataSourceId = value;
+ if (initialized)
+ OnDataPropertyChanged ();
+ }
+ }
+
+ protected bool Initialized {
+ get { return initialized; }
+ }
+
+ protected bool IsBoundUsingDataSourceID {
+ get { return DataSourceID.Length > 0; }
+ }
+
+ protected bool RequiresDataBinding {
+ get { return requiresDataBinding; }
+ set { requiresDataBinding = value; }
+ }
+
+ protected void ConfirmInitState ()
+ {
+ initialized = true;
+ }
+
+ public override void DataBind ()
+ {
+ RequiresDataBinding = false;
+ PerformSelect ();
+ base.DataBind ();
+ OnDataBound (EventArgs.Empty);
+ }
+
+ protected void EnsureDataBound ()
+ {
+ if (RequiresDataBinding && IsBoundUsingDataSourceID)
+ DataBind ();
+ }
+
+ protected virtual void OnDataBound (EventArgs e)
+ {
+ if (DataBound != null)
+ DataBound (this, e);
+ }
+
+ protected virtual void OnDataPropertyChanged ()
+ {
+ RequiresDataBinding = true;
+ }
+
+ protected override void OnInit (EventArgs e)
+ {
+ base.OnInit (e);
+ Page.PreLoad += new EventHandler (OnPagePreLoad);
+ }
+
+ protected virtual void OnPagePreLoad (object sender, EventArgs e)
+ {
+ ConfirmInitState ();
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ EnsureDataBound ();
+ base.OnPreRender (e);
+ }
+
+ protected abstract void PerformSelect ();
+
+ protected abstract void ValidateDataSource (object dataSource);
+
+ }
+}
+
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BaseDataList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BaseDataList.cs
new file mode 100755
index 00000000000..6c305847d8b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BaseDataList.cs
@@ -0,0 +1,471 @@
+//
+// System.Web.UI.WebControls.BaseDataList.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) Gaurav Vaish (2001)
+// (C) 2003 Andreas Nahr
+// (C) 2004 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
+// "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;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.Web.Util;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("SelectedIndexChanged")]
+ [DefaultProperty("DataSource")]
+ [Designer("System.Web.UI.Design.WebControls.BaseDataListDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ public abstract class BaseDataList: WebControl
+ {
+ private static readonly object SelectedIndexChangedEvent = new object();
+ internal static string ItemCountViewStateKey = "_!ItemCount";
+
+ private DataKeyCollection dataKeys;
+ private object dataSource;
+
+#if NET_2_0
+ bool inited;
+ IDataSource currentSource;
+ DataSourceSelectArguments selectArguments = null;
+ bool requiresDataBinding;
+#endif
+
+ public BaseDataList() : base()
+ {
+ }
+
+ public static bool IsBindableType(Type type)
+ {
+ if(type.IsPrimitive || type == typeof(string) || type == typeof(DateTime) || type == typeof(Decimal))
+ return true;
+ return false;
+ }
+
+ public override ControlCollection Controls
+ {
+ get
+ {
+ EnsureChildControls();
+ return base.Controls;
+ }
+ }
+
+ public override void DataBind()
+ {
+ #if NET_2_0
+ RequiresDataBinding = false;
+ #endif
+ OnDataBinding(EventArgs.Empty);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("BaseDataList_OnSelectedIndexChanged")]
+ public event EventHandler SelectedIndexChanged
+ {
+ add
+ {
+ Events.AddHandler(SelectedIndexChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(SelectedIndexChangedEvent, value);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable(true)]
+#endif
+ [DefaultValue(-1)]
+ [WebCategory("Layout")]
+ [WebSysDescription("BaseDataList_CellPadding")]
+ public virtual int CellPadding
+ {
+ get
+ {
+ if(!ControlStyleCreated)
+ return -1;
+ return ((TableStyle)ControlStyle).CellPadding;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellPadding = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable(true)]
+#endif
+ [DefaultValue(-1)]
+ [WebCategory("Layout")]
+ [WebSysDescription("BaseDataList_CellSpacing")]
+ public virtual int CellSpacing
+ {
+ get
+ {
+ if(!ControlStyleCreated)
+ return -1;
+ return ((TableStyle)ControlStyle).CellSpacing;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellSpacing = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue("")]
+ [WebCategory("Data")]
+ [WebSysDescription("BaseDataList_DataKeyField")]
+ public virtual string DataKeyField
+ {
+ get
+ {
+ object o = ViewState["DataKeyField"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataKeyField"] = value;
+ }
+ }
+
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription("BaseDataList_DataKeys")]
+ public DataKeyCollection DataKeys
+ {
+ get
+ {
+ if( dataKeys==null )
+ dataKeys = new DataKeyCollection(DataKeysArray);
+ return dataKeys;
+
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue("")]
+ [WebCategory("Data")]
+ [WebSysDescription("BaseDataList_DataMember")]
+ public string DataMember
+ {
+ get
+ {
+ object o = ViewState["DataMember"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataMember"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [Bindable(true)]
+ [DefaultValue(null)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Data")]
+ [WebSysDescription("BaseDataList_DataSource")]
+ public virtual object DataSource {
+ get {
+ return dataSource;
+ }
+ set {
+ if (value == null || value is IListSource || value is IEnumerable) {
+ dataSource = value;
+#if NET_2_0
+ if (inited) OnDataPropertyChanged ();
+#endif
+ } else {
+ throw new ArgumentException (HttpRuntime.FormatResourceString (
+ "Invalid_DataSource_Type", ID));
+ }
+ }
+ }
+
+#if !NET_2_0
+ [Bindable(true)]
+#endif
+ [DefaultValue(GridLines.Both)]
+ [WebCategory("Appearance")]
+ [WebSysDescription("BaseDataList_GridLines")]
+ public virtual GridLines GridLines
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ return ((TableStyle)ControlStyle).GridLines;
+ return GridLines.Both;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).GridLines = value;
+ }
+ }
+
+ // LAMESPEC HorizontalAlign has a Category attribute, this should obviously be a WebCategory attribute
+ // but is defined incorrectly in the MS framework
+
+#if !NET_2_0
+ [Bindable(true)]
+#endif
+ [DefaultValue(HorizontalAlign.NotSet)]
+ [Category("Layout")]
+ [WebSysDescription("BaseDataList_HorizontalAlign")]
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ return ((TableStyle)ControlStyle).HorizontalAlign;
+ return HorizontalAlign.NotSet;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).HorizontalAlign = value;
+ }
+ }
+
+ protected ArrayList DataKeysArray
+ {
+ get
+ {
+ object o = ViewState["DataKeys"];
+ if(o == null)
+ {
+ o = new ArrayList();
+ ViewState["DataKeys"] = o;
+ }
+ return (ArrayList)o;
+ }
+ }
+
+ protected override void AddParsedSubObject(object o)
+ {
+ // Preventing literal controls from being added as children.
+ }
+
+ protected override void CreateChildControls()
+ {
+ Controls.Clear();
+ if(ViewState[ItemCountViewStateKey]!=null)
+ {
+ CreateControlHierarchy(false);
+ ClearChildViewState();
+ }
+ }
+
+ protected override void OnDataBinding(EventArgs e)
+ {
+ base.OnDataBinding(e);
+ Controls.Clear();
+ ClearChildViewState();
+ CreateControlHierarchy(true);
+ ChildControlsCreated = true;
+ TrackViewState();
+ }
+
+ protected virtual void OnSelectedIndexChanged(EventArgs e)
+ {
+ if(Events != null)
+ {
+ EventHandler eh = (EventHandler)(Events[SelectedIndexChangedEvent]);
+ if(eh!=null)
+ eh(this, e);
+ }
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ PrepareControlHierarchy();
+ RenderContents(writer);
+ }
+
+ protected abstract void PrepareControlHierarchy();
+ protected abstract void CreateControlHierarchy(bool useDataSource);
+
+ #if NET_2_0
+
+ protected override void OnInit (EventArgs e)
+ {
+ base.OnInit(e);
+ Page.PreLoad += new EventHandler (OnPagePreLoad);
+ }
+
+ void OnPagePreLoad (object sender, EventArgs e)
+ {
+ SubscribeSourceChangeEvent ();
+ inited = true;
+ }
+
+ void SubscribeSourceChangeEvent ()
+ {
+ IDataSource ds = GetDataSource ();
+
+ if (currentSource != ds && currentSource != null) {
+ currentSource.DataSourceChanged -= new EventHandler (OnDataSourceViewChanged);
+ currentSource = ds;
+ }
+
+ if (ds != null)
+ ds.DataSourceChanged += new EventHandler (OnDataSourceViewChanged);
+ }
+
+ protected override void OnLoad (EventArgs e)
+ {
+ if (IsBoundUsingDataSourceID && (!Page.IsPostBack || !EnableViewState))
+ RequiresDataBinding = true;
+
+ base.OnLoad(e);
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ EnsureDataBound ();
+ base.OnPreRender (e);
+ }
+
+ protected bool IsBoundUsingDataSourceID {
+ get { return DataSourceID.Length > 0; }
+ }
+
+ protected void EnsureDataBound ()
+ {
+ if (RequiresDataBinding && IsBoundUsingDataSourceID)
+ DataBind ();
+ }
+
+ IDataSource GetDataSource ()
+ {
+ if (IsBoundUsingDataSourceID) {
+ Control ctrl = NamingContainer.FindControl (DataSourceID);
+ if (ctrl == null)
+ throw new HttpException (string.Format ("A control with ID '{0}' could not be found.", DataSourceID));
+ if (!(ctrl is IDataSource))
+ throw new HttpException (string.Format ("The control with ID '{0}' is not a control of type IDataSource.", DataSourceID));
+ return (IDataSource) ctrl;
+ }
+ return DataSource as IDataSource;
+ }
+
+ protected IEnumerable GetData ()
+ {
+ if (DataSource != null && IsBoundUsingDataSourceID)
+ throw new HttpException ("Control bound using both DataSourceID and DataSource properties.");
+
+ IDataSource ds = GetDataSource ();
+ if (ds != null)
+ return ds.GetView (DataMember).ExecuteSelect (SelectArguments);
+
+ IEnumerable ie = DataSourceHelper.GetResolvedDataSource (DataSource, DataMember);
+ if (ie != null) return ie;
+
+ throw new HttpException (string.Format ("Unexpected data source type: {0}", DataSource.GetType()));
+ }
+
+ protected virtual void OnDataSourceViewChanged (object sender, EventArgs e)
+ {
+ RequiresDataBinding = true;
+ }
+
+ protected virtual void OnDataPropertyChanged ()
+ {
+ RequiresDataBinding = true;
+ SubscribeSourceChangeEvent ();
+ }
+
+ [DefaultValueAttribute ("")]
+ [IDReferencePropertyAttribute (typeof(System.Web.UI.DataSourceControl))]
+ [ThemeableAttribute (false)]
+ public virtual string DataSourceID {
+ get {
+ object o = ViewState ["DataSourceID"];
+ if (o != null)
+ return (string)o;
+
+ return String.Empty;
+ }
+ set {
+ ViewState ["DataSourceID"] = value;
+ if (inited) OnDataPropertyChanged ();
+ }
+ }
+
+ protected bool Initialized {
+ get { return inited; }
+ }
+
+ protected bool RequiresDataBinding {
+ get { return requiresDataBinding; }
+ set { requiresDataBinding = value; }
+ }
+
+ protected virtual DataSourceSelectArguments CreateDataSourceSelectArguments ()
+ {
+ return DataSourceSelectArguments.Empty;
+ }
+
+ protected DataSourceSelectArguments SelectArguments {
+ get {
+ if (selectArguments == null)
+ selectArguments = CreateDataSourceSelectArguments ();
+ return selectArguments;
+ }
+ }
+
+ internal IEnumerable GetResolvedDataSource ()
+ {
+ return GetData ();
+ }
+
+ #else
+ internal IEnumerable GetResolvedDataSource ()
+ {
+ if (DataSource != null)
+ return DataSourceHelper.GetResolvedDataSource (DataSource, DataMember);
+ else
+ return null;
+ }
+ #endif
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs
new file mode 100755
index 00000000000..eb37dff68ff
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs
@@ -0,0 +1,473 @@
+//
+// System.Web.UI.WebControls.BaseValidator.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Web;
+using System.Web.UI;
+using System.Drawing;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("ErrorMessage")]
+ [Designer ("System.Web.UI.Design.WebControls.BaseValidatorDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ public abstract class BaseValidator: Label, IValidator
+ {
+ private bool isValid;
+ private bool isPreRenderCalled;
+ private bool isPropertiesChecked;
+ private bool propertiesValid;
+ private bool renderUplevel;
+
+ protected BaseValidator() : base()
+ {
+ isValid = true;
+ ForeColor = Color.Red;
+ propertiesValid = true;
+ isPropertiesChecked = false;
+ renderUplevel = false;
+ }
+
+#if NET_2_0
+ [IDReferencePropertyAttribute (typeof(System.Web.UI.Control))]
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (""), WebCategory ("Behavior")]
+ [TypeConverter (typeof (ValidatedControlConverter))]
+ [WebSysDescription ("The ID of the control to validate.")]
+ public string ControlToValidate
+ {
+ get
+ {
+ object o = ViewState["ControlToValidate"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ControlToValidate"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (ValidatorDisplay), "Static"), WebCategory ("Appearance")]
+ [WebSysDescription ("Determines how the validator is displayed.")]
+ public ValidatorDisplay Display
+ {
+ get
+ {
+ object o = ViewState["Display"];
+ if(o != null)
+ {
+ return (ValidatorDisplay)o;
+ }
+ return ValidatorDisplay.Static;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(ValidatorDisplay), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["Display"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (true), WebCategory ("Behavior")]
+ [WebSysDescription ("Determines if client script is activated on uplevel browsers.")]
+ public bool EnableClientScript
+ {
+ get
+ {
+ object o = ViewState["EnableClientScript"];
+ if(o != null)
+ {
+ return (bool)o;
+ }
+ return true;
+ }
+ set
+ {
+ ViewState["EnableClientScript"] = value;
+ }
+ }
+
+ public override bool Enabled
+ {
+ get
+ {
+ return base.Enabled;
+ }
+ set
+ {
+ if (value == false)
+ isValid = true;
+ base.Enabled = value;
+ }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Appearance")]
+ [WebSysDescription ("An error message that is displayed if the control validates to false.")]
+ public string ErrorMessage
+ {
+ get
+ {
+ object o = ViewState["ErrorMessage"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ErrorMessage"] = value;
+ }
+ }
+
+ [DefaultValue (null)]
+ public override Color ForeColor
+ {
+ get
+ {
+ return base.ForeColor;
+ }
+ set
+ {
+ base.ForeColor = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (true), Browsable (false), WebCategory ("Misc")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("Indicates if the control validated to false.")]
+ public bool IsValid
+ {
+ get { return isValid; }
+ set { isValid = value; }
+ }
+
+ public static PropertyDescriptor GetValidationProperty(object component)
+ {
+ System.ComponentModel.AttributeCollection coll = TypeDescriptor.GetAttributes (component);
+ Type type = typeof (ValidationPropertyAttribute);
+ ValidationPropertyAttribute attrib = (ValidationPropertyAttribute) coll [type];
+ if (attrib != null && attrib.Name != null)
+ return (TypeDescriptor.GetProperties (component)) [attrib.Name];
+ return null;
+ }
+
+ public void Validate()
+ {
+ if(!Visible || (Visible && !Enabled))
+ {
+ IsValid = true;
+ return;
+ }
+
+ Control ctrl = Parent;
+ while(ctrl != null)
+ {
+ if(!ctrl.Visible)
+ {
+ IsValid = true;
+ return;
+ }
+ ctrl = ctrl.Parent;
+ }
+ isPropertiesChecked = false;
+ if(!PropertiesValid)
+ {
+ IsValid = true;
+ return;
+ }
+ IsValid = EvaluateIsValid();
+ }
+
+ protected bool PropertiesValid
+ {
+ get
+ {
+ if(!isPropertiesChecked)
+ {
+ propertiesValid = ControlPropertiesValid();
+ isPropertiesChecked = true;
+ }
+ return propertiesValid;
+ }
+ }
+
+ protected bool RenderUplevel
+ {
+ get
+ {
+ return renderUplevel;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ bool enabled = base.Enabled;
+ if (enabled)
+ Enabled = true;
+
+ base.AddAttributesToRender(writer);
+ if(RenderUplevel)
+ {
+ if(ID == null)
+ {
+ writer.AddAttribute("id", ClientID);
+ }
+ if(ControlToValidate.Length > 0)
+ {
+ writer.AddAttribute("controltovalidate", GetControlRenderID(ControlToValidate));
+ }
+ if(ErrorMessage.Length > 0)
+ {
+ writer.AddAttribute("errormessage", ErrorMessage, true);
+ }
+ if(Display == ValidatorDisplay.Static)
+ {
+ writer.AddAttribute("display", Enum.Format(typeof(ValidatorDisplay), Display, "G").Replace('_','-'));
+ //writer.AddAttribute("display", PropertyConverter.EnumToString(typeof(ValidatorDisplay), Display));
+ }
+ if(!IsValid)
+ {
+ writer.AddAttribute("isvalid", "False");
+ }
+
+ ControlStyle.AddAttributesToRender (writer, this);
+ if(!enabled)
+ {
+ writer.AddAttribute("enabled", "False");
+ }
+ }
+
+ if(enabled)
+ {
+ base.Enabled = false;
+ }
+ }
+
+ protected void CheckControlValidationProperty(string name, string propertyName)
+ {
+ Control ctrl = NamingContainer.FindControl(name);
+ if(ctrl == null)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_control_not_found",
+ name, propertyName/*, ID*/));
+ }
+ PropertyDescriptor pd = GetValidationProperty(ctrl);
+ if(pd == null)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_bad_control_type",
+ name, propertyName/*, ID*/));
+ }
+ }
+
+ protected virtual bool ControlPropertiesValid()
+ {
+ if(ControlToValidate.Length == 0)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_control_blank", ID));
+ }
+ CheckControlValidationProperty(ControlToValidate, "ControlToValidate");
+ return true;
+ }
+
+ protected virtual bool DetermineRenderUplevel()
+ {
+ Page page = Page;
+ if(page == null || page.Request == null)
+ {
+ return false;
+ }
+
+ if(EnableClientScript)
+ {
+ if(page.Request.Browser.MSDomVersion.Major > 4)
+ {
+ return page.Request.Browser.EcmaScriptVersion.CompareTo(new Version(1,2)) >= 0;
+ }
+ return false;
+ }
+ return false;
+ }
+
+ protected string GetControlRenderID(string name)
+ {
+ Control ctrl = FindControl(name);
+ if(ctrl != null)
+ {
+ return ctrl.ClientID;
+ }
+ return String.Empty;
+ }
+
+ protected string GetControlValidationValue(string name)
+ {
+ Control ctrl = NamingContainer.FindControl(name);
+ if(ctrl != null)
+ {
+ PropertyDescriptor pd = GetValidationProperty(ctrl);
+ if(pd != null)
+ {
+ object item = pd.GetValue (ctrl);
+ if (item is ListItem)
+ return ((ListItem) item).Value;
+
+ if (item == null)
+ return String.Empty;
+
+ return item.ToString ();
+ }
+ }
+ return null;
+ }
+
+ protected override void OnInit(EventArgs e)
+ {
+ base.OnInit(e);
+ Page.Validators.Add(this);
+ }
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ base.OnPreRender(e);
+ isPreRenderCalled = true;
+ isPropertiesChecked = false;
+ renderUplevel = DetermineRenderUplevel();
+ if(renderUplevel)
+ {
+ RegisterValidatorCommonScript();
+ }
+ }
+
+ protected override void OnUnload(EventArgs e)
+ {
+ if(Page != null)
+ {
+ Page.Validators.Remove(this);
+ }
+ base.OnUnload(e);
+ }
+
+ [MonoTODO("Damn_This_Is_Really_Frustrating___by_Gaurav")]
+ protected void RegisterValidatorCommonScript()
+ {
+ if(Page.ClientScript.IsClientScriptBlockRegistered("ValidatorIncludeScript"))
+ return;
+
+ //string jsDirectory = System.Web.UI.Utils.GetScriptLocation(Context);
+ //string jsFile = jsDirectory + "/WebUIValidation.js";
+
+ //TODO: Ok, now add the <script language="javascript"> etc
+ //FIXME: Should I check for 'Explorer'? MS-Net seems to do it!
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("I_have_to_know_javascript_for_this_I_know_it_but_for_ALL_browsers_NO")]
+ protected virtual void RegisterValidatorDeclaration()
+ {
+ //FIXME: How to make is more abstract?
+ //Browser Info... but future browsers???
+ //I'm confused! This will make it work, at least on IE
+ string val = "document.all[\"" + ClientID;
+ val += "\"]";
+ Page.ClientScript.RegisterArrayDeclaration("Page_Validators", val);
+ }
+
+ [MonoTODO("Render_ing_always_left")]
+ protected override void Render (HtmlTextWriter writer)
+ {
+ bool valid;
+
+ if (!Enabled)
+ return;
+
+ if (isPreRenderCalled) {
+ valid = IsValid;
+ } else {
+ isPropertiesChecked = true;
+ propertiesValid = true;
+ renderUplevel = false;
+ valid = true;
+ }
+
+ if (PropertiesValid) {
+ if (Page != null)
+ Page.VerifyRenderingInServerForm (this);
+
+ ValidatorDisplay dis = Display;
+ if (RenderUplevel) {
+ //FIXME: as of now, don't do client-side validation
+ throw new NotImplementedException();
+ }
+
+ if (!valid && dis != ValidatorDisplay.None) {
+ RenderBeginTag (writer);
+ if (Text.Trim ().Length > 0 || HasControls ())
+ RenderContents (writer);
+ else
+ writer.Write (ErrorMessage);
+ RenderEndTag (writer);
+ return;
+ }
+ } else {
+ writer.Write ("&nbsp;");
+ }
+ }
+
+ protected abstract bool EvaluateIsValid();
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BorderStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BorderStyle.cs
new file mode 100755
index 00000000000..0c57408e9eb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BorderStyle.cs
@@ -0,0 +1,50 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: BorderStyle
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum BorderStyle
+ {
+ NotSet,
+ None,
+ Dotted,
+ Dashed,
+ Solid,
+ Double,
+ Groove,
+ Ridge,
+ Inset,
+ Outset
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BoundColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BoundColumn.cs
new file mode 100755
index 00000000000..04654f8c706
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BoundColumn.cs
@@ -0,0 +1,206 @@
+//
+// System.Web.UI.WebControls.BoundColumn.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class BoundColumn : DataGridColumn
+ {
+ public static readonly string thisExpr = "!";
+
+ private bool boundFieldDescriptionValid;
+ private string boundField;
+ private string formatting;
+
+ private PropertyDescriptor desc;
+
+ public BoundColumn(): base()
+ {
+ }
+
+ public override void Initialize()
+ {
+ base.Initialize();
+
+ desc = null;
+ boundField = DataField;
+ formatting = DataFormatString;
+ boundFieldDescriptionValid = false;
+ }
+
+ public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ base.InitializeCell(cell, columnIndex, itemType);
+
+ Control bindCtrl = null;
+ Control toAdd = null;
+ switch(itemType)
+ {
+ case ListItemType.Item : goto case ListItemType.SelectedItem;
+ case ListItemType.AlternatingItem
+ : goto case ListItemType.SelectedItem;
+ case ListItemType.SelectedItem
+ : if(DataField.Length != 0)
+ bindCtrl = cell;
+ break;
+ case ListItemType.EditItem
+ : if(!ReadOnly)
+ {
+ TextBox box = new TextBox();
+ toAdd = box;
+ if(DataField.Length != 0)
+ bindCtrl = box;
+ } else
+ goto case ListItemType.SelectedItem;
+
+ break;
+ }
+ if(toAdd != null)
+ cell.Controls.Add(toAdd);
+ if(bindCtrl != null)
+ bindCtrl.DataBinding += new EventHandler(OnDataBindColumn);
+ //throw new NotImplementedException();
+ }
+
+ private void OnDataBindColumn(object sender, EventArgs e)
+ {
+ Control senderCtrl = (Control)sender;
+ DataGridItem item = (DataGridItem)senderCtrl.NamingContainer;
+ object data = item.DataItem;
+
+ if(!boundFieldDescriptionValid)
+ {
+ if(boundField != BoundColumn.thisExpr)
+ {
+ desc = TypeDescriptor.GetProperties(data).Find(boundField, true);
+ if(desc == null && !DesignMode)
+ {
+ throw new HttpException(
+ HttpRuntime.FormatResourceString("File_Not_Found",
+ boundField));
+ }
+ boundFieldDescriptionValid = true;
+ }
+ }
+ object value = data;
+ string val = String.Empty;
+ if(desc == null && DesignMode)
+ {
+ throw new NotImplementedException();
+ } else
+ {
+ if(desc != null)
+ value = desc.GetValue(data);
+ val = FormatDataValue(value);
+ }
+ if(senderCtrl is TableCell)
+ {
+ if(val.Length == 0)
+ val = "&nbsp;";
+ ((TableCell)senderCtrl).Text = val;
+ } else
+ {
+ ((TextBox)senderCtrl).Text = val;
+ }
+ }
+
+ [DefaultValue (""), WebCategory ("Misc")]
+ [WebSysDescription ("The field that this column is bound to.")]
+ public virtual string DataField
+ {
+ get
+ {
+ object o = ViewState["DataField"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataField"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ [DefaultValue (""), WebCategory ("Misc")]
+ [WebSysDescription ("A format string that is applied to the data value.")]
+ public virtual string DataFormatString
+ {
+ get
+ {
+ object o = ViewState["DataFormatString"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataFormatString"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ [DefaultValue (false), WebCategory ("Misc")]
+ [WebSysDescription ("Determines if the databound field can only be displayed or also edited.")]
+ public virtual bool ReadOnly
+ {
+ get
+ {
+ object o = ViewState["ReadOnly"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["ReadOnly"] = value;
+ }
+ }
+
+ protected virtual string FormatDataValue(Object dataValue)
+ {
+ string retVal = String.Empty;
+ if(dataValue != null)
+ {
+ if(formatting.Length == 0)
+ retVal = dataValue.ToString();
+ else
+ retVal = String.Format(formatting, dataValue);
+ }
+ return retVal;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BoundField.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BoundField.cs
new file mode 100644
index 00000000000..c3b30b2558e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BoundField.cs
@@ -0,0 +1,242 @@
+//
+// System.Web.UI.WebControls.BoundField.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Security.Permissions;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls {
+
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public class BoundField : DataControlField
+ {
+ public static readonly string ThisExpression = "!";
+
+ PropertyDescriptor boundProperty;
+
+ [DefaultValueAttribute (true)]
+ [WebCategoryAttribute ("Behavior")]
+ public virtual bool ConvertEmptyStringToNull {
+ get {
+ object ob = ViewState ["ConvertEmptyStringToNull"];
+ if (ob != null) return (bool) ob;
+ return true;
+ }
+ set {
+ ViewState ["ConvertEmptyStringToNull"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [TypeConverterAttribute ("System.Web.UI.Design.DataSourceViewSchemaConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [WebCategoryAttribute ("Data")]
+ [DefaultValueAttribute ("")]
+ public virtual string DataField {
+ get {
+ object ob = ViewState ["DataField"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["DataField"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Data")]
+ public virtual string DataFormatString {
+ get {
+ object ob = ViewState ["DataFormatString"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["DataFormatString"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Behavior")]
+ public virtual string NullDisplayText {
+ get {
+ object ob = ViewState ["NullDisplayText"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["NullDisplayText"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (false)]
+ public bool ReadOnly {
+ get {
+ object val = ViewState ["ReadOnly"];
+ return val != null ? (bool) val : false;
+ }
+ set {
+ ViewState ["ReadOnly"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("HtmlEncode")]
+ [DefaultValueAttribute (true)]
+ public virtual bool HtmlEncode {
+ get {
+ object val = ViewState ["HtmlEncode"];
+ return val != null ? (bool) val : true;
+ }
+ set {
+ ViewState ["HtmlEncode"] = true;
+ OnFieldChanged ();
+ }
+ }
+
+ public override void ExtractValuesFromCell (IOrderedDictionary dictionary,
+ DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
+ {
+ bool editable = (rowState & (DataControlRowState.Edit | DataControlRowState.Insert)) != 0;
+ if (editable && !ReadOnly) {
+ if (cell.Controls.Count > 0) {
+ TextBox box = (TextBox) cell.Controls [0];
+ dictionary [DataField] = box.Text;
+ }
+ } else if (includeReadOnly) {
+ dictionary [DataField] = cell.Text;
+ }
+ }
+
+ public override void InitializeCell (DataControlFieldCell cell,
+ DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
+ {
+ base.InitializeCell (cell, cellType, rowState, rowIndex);
+ if (cellType == DataControlCellType.DataCell) {
+ InitializeDataCell (cell, rowState);
+ if ((rowState & DataControlRowState.Insert) == 0)
+ cell.DataBinding += new EventHandler (OnDataBindField);
+ }
+ }
+
+ public virtual void InitializeDataCell (DataControlFieldCell cell, DataControlRowState rowState)
+ {
+ bool editable = (rowState & (DataControlRowState.Edit | DataControlRowState.Insert)) != 0;
+ if (editable && !ReadOnly) {
+ TextBox box = new TextBox ();
+ cell.Controls.Add (box);
+ }
+ }
+
+ protected virtual bool SupportsHtmlEncode {
+ get { return true; }
+ }
+
+ protected virtual string FormatDataValue (object value, bool encode)
+ {
+ string res;
+ if (value == null || (value.ToString().Length == 0 && ConvertEmptyStringToNull))
+ res = NullDisplayText;
+ else if (DataFormatString.Length > 0)
+ res = string.Format (DataFormatString, value);
+ else
+ res = value.ToString ();
+
+ if (encode) return HttpUtility.HtmlEncode (res);
+ else return res;
+ }
+
+ protected virtual object GetValue (Control controlContainer)
+ {
+ if (DesignMode)
+ return GetDesignTimeValue ();
+ else
+ return GetBoundValue (controlContainer);
+ }
+
+ protected virtual object GetDesignTimeValue ()
+ {
+ return GetBoundValue (Control);
+ }
+
+ object GetBoundValue (Control controlContainer)
+ {
+ if (DataField == ThisExpression)
+ return controlContainer.ToString ();
+ else {
+ IDataItemContainer dic = (IDataItemContainer) controlContainer;
+ if (boundProperty == null) {
+ boundProperty = TypeDescriptor.GetProperties (dic.DataItem) [DataField];
+ if (boundProperty == null)
+ new InvalidOperationException ("Property '" + DataField + "' not found in object of type " + dic.DataItem.GetType());
+ }
+ return boundProperty.GetValue (dic.DataItem);
+ }
+ }
+
+ protected virtual void OnDataBindField (object sender, EventArgs e)
+ {
+ DataControlFieldCell cell = (DataControlFieldCell) sender;
+ if (cell.Controls.Count > 0) {
+ TextBox box = (TextBox) cell.Controls [0];
+ object val = GetValue (cell.BindingContainer);
+ box.Text = val != null ? val.ToString() : "";
+ }
+ else
+ cell.Text = FormatDataValue (GetValue (cell.BindingContainer), SupportsHtmlEncode && HtmlEncode);
+ }
+
+ protected override DataControlField CreateField ()
+ {
+ return new BoundField ();
+ }
+
+ protected override void CopyProperties (DataControlField newField)
+ {
+ base.CopyProperties (newField);
+ BoundField field = (BoundField) newField;
+ field.ConvertEmptyStringToNull = ConvertEmptyStringToNull;
+ field.DataField = DataField;
+ field.DataFormatString = DataFormatString;
+ field.NullDisplayText = NullDisplayText;
+ field.ReadOnly = ReadOnly;
+ field.HtmlEncode = HtmlEncode;
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BulletStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BulletStyle.cs
new file mode 100644
index 00000000000..63f60d2719d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BulletStyle.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.UI.WebControls.BulletStyle.cs
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum BulletStyle {
+ NotSet,
+ Numbered,
+ LowerAlpha,
+ UpperAlpha,
+ LowerRoman,
+ UpperRoman,
+ Disc,
+ Circle,
+ Square,
+ CustomImage,
+ }
+}
+#endif \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BulletedList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BulletedList.cs
new file mode 100644
index 00000000000..8685cbdde92
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BulletedList.cs
@@ -0,0 +1,314 @@
+//
+// System.Web.UI.WebControls.BulletedList.cs
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+#if NET_2_0
+using System.IO;
+using System.Collections;
+using System.Globalization;
+using System.Text;
+using System.Drawing;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+
+namespace System.Web.UI.WebControls {
+
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.BulletedListDesigner, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+ [DefaultEventAttribute ("Click")]
+ [DefaultPropertyAttribute ("BulletStyle")]
+ public class BulletedList : ListControl, IPostBackEventHandler {
+
+ [MonoTODO ("we are missing a new style enum, we should be using it")]
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ const string ListStyleType = "list-style-type";
+ const string ListStyleImage = "list-style-image";
+
+ bool isNumeric = false;
+ switch (BulletStyle)
+ {
+ case BulletStyle.NotSet:
+ break;
+
+ case BulletStyle.Numbered:
+ writer.AddStyleAttribute (ListStyleType, "decimal");
+ isNumeric = true;
+ break;
+
+ case BulletStyle.LowerAlpha:
+ writer.AddStyleAttribute (ListStyleType, "lower-alpha");
+ isNumeric = true;
+ break;
+
+ case BulletStyle.UpperAlpha:
+ writer.AddStyleAttribute (ListStyleType, "upper-alpha");
+ isNumeric = true;
+ break;
+
+ case BulletStyle.LowerRoman:
+ writer.AddStyleAttribute (ListStyleType, "lower-roman");
+ isNumeric = true;
+ break;
+
+ case BulletStyle.UpperRoman:
+ writer.AddStyleAttribute (ListStyleType, "lower-roman");
+ isNumeric = true;
+ break;
+
+ case BulletStyle.Disc:
+ writer.AddStyleAttribute (ListStyleType, "disc");
+ break;
+
+ case BulletStyle.Circle:
+ writer.AddStyleAttribute (ListStyleType, "circle");
+ break;
+
+ case BulletStyle.Square:
+ writer.AddStyleAttribute (ListStyleType, "square");
+ break;
+
+ case BulletStyle.CustomImage:
+ writer.AddStyleAttribute (ListStyleImage, "url(" + BulletImageUrl+ ")");
+ break;
+ }
+
+ if (isNumeric && FirstBulletNumber != 1)
+ writer.AddAttribute ("start", FirstBulletNumber.ToString ());
+
+ base.AddAttributesToRender (writer);
+ }
+
+ bool cacheIsEnabled;
+ [MonoTODO ("new bool prop on ListItem: Enabled")]
+ protected virtual void RenderBulletText (ListItem item, int index, HtmlTextWriter writer)
+ {
+ switch (DisplayMode) {
+ case BulletedListDisplayMode.Text:
+ //if (!item.Enabled) {
+ // writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+ // writer.RenderBeginTag (HtmlTextWriterTag.Span);
+ //}
+ writer.Write (item.Text);
+ //if (!item.Enabled)
+ // writer.RenderEndTag ();
+ break;
+
+ case BulletedListDisplayMode.HyperLink:
+ //if (cacheIsEnabled && item.Enabled) {
+ // writer.AddAttribute (HtmlTextWriterAttribute.Href, item.Value);
+ // if (Target != "")
+ // writer.AddAttribute(HtmlTextWriterAttribute.Target, this.Target);
+ //
+ //}
+ //else
+ writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+
+ writer.RenderBeginTag (HtmlTextWriterTag.A);
+ writer.Write (item.Text);
+ writer.RenderEndTag ();
+ break;
+
+ case BulletedListDisplayMode.LinkButton:
+ //if (cacheIsEnabled && item.Enabled)
+ writer.AddAttribute (HtmlTextWriterAttribute.Href, Page.ClientScript.GetPostBackClientHyperlink (this, (index.ToString (CultureInfo.InvariantCulture))));
+ //else
+ // writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+ writer.RenderBeginTag (HtmlTextWriterTag.A);
+ writer.Write (item.Text);
+ writer.RenderEndTag ();
+ break;
+ }
+ }
+
+ protected override void RenderContents (HtmlTextWriter writer)
+ {
+ cacheIsEnabled = this.Enabled;
+ int idx = 0;
+ foreach (ListItem i in Items) {
+ writer.RenderBeginTag (HtmlTextWriterTag.Li);
+ this.RenderBulletText (i, idx ++, writer);
+ writer.RenderEndTag ();
+ }
+ }
+
+ void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
+ {
+ RaisePostBackEvent (eventArgument);
+ }
+
+ [MonoTODO ("ListControl has a CausesValidation prop in v1.2, we need to use it")]
+ protected virtual void RaisePostBackEvent (string eventArgument)
+ {
+ //if (CausesValidation)
+ // Page.Validate ();
+
+ this.OnClick (new BulletedListEventArgs (int.Parse (eventArgument, CultureInfo.InvariantCulture)));
+ }
+
+ [BrowsableAttribute (false)]
+ [EditorBrowsableAttribute (EditorBrowsableState.Never)]
+ public override bool AutoPostBack {
+ get { return base.AutoPostBack; }
+ set { throw new NotSupportedException (String.Format ("This property is not supported in {0}", GetType ())); }
+ }
+
+ [EditorBrowsableAttribute (EditorBrowsableState.Never)]
+ public override int SelectedIndex {
+ get { return base.SelectedIndex; }
+ set { throw new NotSupportedException (String.Format ("This property is not supported in {0}", GetType ())); }
+ }
+
+ [EditorBrowsableAttribute (EditorBrowsableState.Never)]
+ public override ListItem SelectedItem {
+ get { return base.SelectedItem; }
+ }
+
+ [DefaultValueAttribute ("")]
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [UrlPropertyAttribute]
+ public virtual string BulletImageUrl {
+ get {
+ object ret = ViewState ["BulletImageUrl"];
+ if (ret != null)
+ return (string) ret;
+
+ return "";
+ }
+ set {
+ ViewState ["BulletImageUrl"] = value;
+ }
+ }
+
+ [DefaultValueAttribute (BulletStyle.NotSet)]
+ public virtual BulletStyle BulletStyle {
+ get {
+ object ret = ViewState ["BulletStyle"];
+ if (ret != null)
+ return (BulletStyle) ret;
+
+ return BulletStyle.NotSet;
+ }
+ set {
+ if ((int) value < 0 || (int) value > 9)
+ throw new ArgumentOutOfRangeException ("value");
+
+ ViewState ["BulletStyle"] = value;
+ }
+ }
+
+ public override ControlCollection Controls { get { return new EmptyControlCollection (this); } }
+
+ [DefaultValueAttribute (BulletedListDisplayMode.Text)]
+ public virtual BulletedListDisplayMode DisplayMode {
+ get {
+ object ret = ViewState ["DisplayMode"];
+ if (ret != null)
+ return (BulletedListDisplayMode) ret;
+
+ return BulletedListDisplayMode.Text;
+ }
+ set {
+ if ((int) value < 0 || (int) value > 2)
+ throw new ArgumentOutOfRangeException ("value");
+
+ ViewState ["DisplayMode"] = value;
+ }
+ }
+
+ [DefaultValueAttribute (1)]
+ public virtual int FirstBulletNumber {
+ get {
+ object ret = ViewState ["FirstBulletNumber"];
+ if (ret != null)
+ return (int) ret;
+
+ return 1;
+ }
+ set {
+ ViewState ["FirstBulletNumber"] = value;
+ }
+ }
+
+
+ protected override HtmlTextWriterTag TagKey {
+ get {
+ switch (BulletStyle) {
+ case BulletStyle.Numbered:
+ case BulletStyle.LowerAlpha:
+ case BulletStyle.UpperAlpha:
+ case BulletStyle.LowerRoman:
+ case BulletStyle.UpperRoman:
+ return HtmlTextWriterTag.Ol;
+
+ case BulletStyle.NotSet:
+ case BulletStyle.Disc:
+ case BulletStyle.Circle:
+ case BulletStyle.Square:
+ case BulletStyle.CustomImage:
+ default:
+ return HtmlTextWriterTag.Ul;
+ }
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ public virtual string Target {
+ get {
+ object ret = ViewState ["Target"];
+ if (ret != null)
+ return (string) ret;
+
+ return "";
+ }
+ set {
+ ViewState ["Target"] = value;
+ }
+ }
+
+ static readonly object ClickEvent = new object ();
+ public event BulletedListEventHandler Click
+ {
+ add {
+ Events.AddHandler (ClickEvent, value);
+ }
+ remove {
+ Events.RemoveHandler (ClickEvent, value);
+ }
+ }
+
+ protected virtual void OnClick (BulletedListEventArgs e)
+ {
+ if (Events != null) {
+ BulletedListEventHandler eh = (BulletedListEventHandler) (Events [ClickEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BulletedListDisplayMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BulletedListDisplayMode.cs
new file mode 100644
index 00000000000..f135f292065
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BulletedListDisplayMode.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.UI.WebControls.BulletedListDisplayMode.cs
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum BulletedListDisplayMode {
+ Text,
+ HyperLink,
+ LinkButton,
+ }
+}
+#endif \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BulletedListEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BulletedListEventArgs.cs
new file mode 100644
index 00000000000..23d40637d9d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BulletedListEventArgs.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.WebControls.BulletedListEventArgs.cs
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public class BulletedListEventArgs : EventArgs {
+ int index;
+
+ public BulletedListEventArgs (int index) {
+ this.index = index;
+ }
+
+ public int Index { get { return index; } }
+ }
+}
+#endif \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BulletedListEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BulletedListEventHandler.cs
new file mode 100644
index 00000000000..25b3d5d87fe
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BulletedListEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.BulletedListEventHandler.cs
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void BulletedListEventHandler (object sender, BulletedListEventArgs e);
+}
+#endif \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Button.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Button.cs
new file mode 100755
index 00000000000..0a7c0b1cf88
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Button.cs
@@ -0,0 +1,340 @@
+//
+// System.Web.UI.WebControls.Button.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("Click")]
+ [DefaultProperty("Text")]
+ [Designer("System.Web.UI.Design.WebControls.ButtonDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ [DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
+ [ToolboxData("<{0}:Button runat=\"server\" Text=\"Button\"></{0}:Button>")]
+ public class Button : WebControl, IPostBackEventHandler
+#if NET_2_0
+ , IButtonControl
+#endif
+ {
+ private static readonly object ClickEvent = new object();
+ private static readonly object CommandEvent = new object();
+
+ //private EventHandlerList ehList;
+
+ public Button(): base (HtmlTextWriterTag.Input)
+ {
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#else
+ [Bindable (false)]
+#endif
+ [DefaultValue (true), WebCategory ("Behavior")]
+ [WebSysDescription ("Determines if validation is performed when clicked.")]
+ public bool CausesValidation
+ {
+ get
+ {
+ Object cv = ViewState["CausesValidation"];
+ if(cv!=null)
+ return (Boolean)cv;
+ return true;
+ }
+ set
+ {
+ ViewState["CausesValidation"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (""), Bindable (true), WebCategory ("Behavior")]
+ [WebSysDescription ("An argument for the Command of this control.")]
+ public string CommandArgument
+ {
+ get
+ {
+ string ca = (string) ViewState["CommandArgument"];
+ if(ca!=null)
+ return ca;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandArgument"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (""), WebCategory ("Behavior")]
+ [WebSysDescription ("The name of the Command of this control.")]
+ public string CommandName
+ {
+ get
+ {
+ string cn = (string)ViewState["CommandName"];
+ if(cn!=null)
+ return cn;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandName"] = value;
+ }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#endif
+ [DefaultValue (""), Bindable (true), WebCategory ("Appearance")]
+ [WebSysDescription ("The text that should be shown on this Button.")]
+ public string Text
+ {
+ get
+ {
+ string text = (string)ViewState["Text"];
+ if(text!=null)
+ return text;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Text"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+ [EditorAttribute ("System.Web.UI.Design.UrlEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [DefaultValueAttribute ("")]
+ [UrlProperty]
+ public string PostBackUrl {
+ get {
+ string text = (string)ViewState["PostBackUrl"];
+ if (text!=null) return text;
+ return String.Empty;
+ }
+ set {
+ ViewState["PostBackUrl"] = value;
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [ThemeableAttribute (false)]
+ [WebCategoryAttribute ("Behavior")]
+ public string ValidationGroup {
+ get {
+ string text = (string)ViewState["ValidationGroup"];
+ if (text!=null) return text;
+ return String.Empty;
+ }
+ set {
+ ViewState["ValidationGroup"] = value;
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [ThemeableAttribute (false)]
+ [WebCategoryAttribute ("Behavior")]
+ public string OnClientClick {
+ get {
+ string text = (string)ViewState["OnClientClick"];
+ if (text!=null) return text;
+ return String.Empty;
+ }
+ set {
+ ViewState["OnClientClick"] = value;
+ }
+ }
+
+ [DefaultValueAttribute (true)]
+ [ThemeableAttribute (false)]
+ [WebCategoryAttribute ("Behavior")]
+ public bool UseSubmitBehavior {
+ get {
+ object b = ViewState["UseSubmitBehavior"];
+ if (b != null) return (bool)b;
+ return true;
+ }
+ set {
+ ViewState["UseSubmitBehavior"] = value;
+ }
+ }
+#endif
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when the Button is clicked.")]
+ public event EventHandler Click
+ {
+ add
+ {
+ Events.AddHandler(ClickEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ClickEvent, value);
+ }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when a Button Command is executed.")]
+ public event CommandEventHandler Command
+ {
+ add
+ {
+ Events.AddHandler(CommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(CommandEvent, value);
+ }
+ }
+
+ protected virtual void OnClick(EventArgs e)
+ {
+ if(Events != null)
+ {
+ EventHandler eh = (EventHandler)(Events[ClickEvent]);
+ if(eh!= null)
+ eh(this,e);
+ }
+ }
+
+ protected virtual void OnCommand(CommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ CommandEventHandler eh = (CommandEventHandler)(Events[CommandEvent]);
+ if(eh!= null)
+ eh(this,e);
+ }
+ RaiseBubbleEvent(this, e);
+ }
+
+#if NET_2_0
+ void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
+ {
+ RaisePostBackEvent (eventArgument);
+ }
+
+ protected virtual void RaisePostBackEvent (string eventArgument)
+ {
+ if (CausesValidation)
+ Page.Validate (ValidationGroup);
+
+ OnClick (EventArgs.Empty);
+ OnCommand (new CommandEventArgs (CommandName, CommandArgument));
+ }
+#else
+ void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
+ {
+ if (CausesValidation)
+ Page.Validate ();
+
+ OnClick (EventArgs.Empty);
+ OnCommand (new CommandEventArgs (CommandName, CommandArgument));
+ }
+#endif
+
+#if NET_2_0
+ protected virtual PostBackOptions GetPostBackOptions ()
+ {
+ PostBackOptions ops = new PostBackOptions (this);
+ if (PostBackUrl != "")
+ ops.ActionUrl = PostBackUrl;
+ ops.PerformValidation = Page.Validators.Count > 0 && CausesValidation;
+ if (ops.PerformValidation && ValidationGroup != "")
+ ops.ValidationGroup = ValidationGroup;
+ ops.ClientSubmit = !UseSubmitBehavior;
+ ops.RequiresJavaScriptProtocol = false;
+ return ops;
+ }
+#endif
+
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ if (Page != null)
+ Page.VerifyRenderingInServerForm (this);
+
+ writer.AddAttribute (HtmlTextWriterAttribute.Type, "submit");
+ writer.AddAttribute (HtmlTextWriterAttribute.Name, base.UniqueID);
+ writer.AddAttribute (HtmlTextWriterAttribute.Value, Text);
+
+ if (Page != null) {
+ string script = "";
+#if NET_2_0
+ script = OnClientClick;
+ if (script.Length > 0) script += ";";
+
+ PostBackOptions ops = GetPostBackOptions ();
+ bool submitBehavior = UseSubmitBehavior && !ops.ClientSubmit;
+
+ if (ops.RequiresSpecialPostBack) {
+ script += Page.ClientScript.GetPostBackEventReference (ops);
+ }
+ else if (CausesValidation && Page.Validators.Count > 0) {
+ if (submitBehavior)
+ script += Utils.GetClientValidatedEvent (Page);
+ else
+ script += Utils.GetClientValidatedPostBack (this);
+ }
+ else if (!submitBehavior) {
+ script += Page.ClientScript.GetPostBackClientEvent (this,"");
+ }
+#else
+ if (CausesValidation && Page.Validators.Count > 0) {
+ script += Utils.GetClientValidatedEvent (Page);
+ }
+#endif
+
+ if (script != "") {
+ writer.AddAttribute (System.Web.UI.HtmlTextWriterAttribute.Onclick, script);
+ writer.AddAttribute ("language", "javascript");
+ }
+ }
+
+ base.AddAttributesToRender (writer);
+ }
+
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ // Preventing base classes to do anything
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumn.cs
new file mode 100755
index 00000000000..5505eced38e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumn.cs
@@ -0,0 +1,232 @@
+//
+// System.Web.UI.WebControls.ButtonColumn.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class ButtonColumn : DataGridColumn
+ {
+ private PropertyDescriptor textFieldDescriptor;
+
+ public ButtonColumn(): base()
+ {
+ }
+
+ public override void Initialize()
+ {
+ base.Initialize();
+ textFieldDescriptor = null;
+ }
+
+ public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ base.InitializeCell(cell, columnIndex, itemType);
+ if (Enum.IsDefined(typeof(ListItemType), itemType) &&
+ itemType != ListItemType.Footer &&
+ itemType != ListItemType.Header)
+ {
+ WebControl toDisplay = null;
+ if(ButtonType == ButtonColumnType.PushButton)
+ {
+ Button b = new Button();
+ b.Text = Text;
+ b.CommandName = CommandName;
+ b.CausesValidation = false;
+ toDisplay = b;
+ } else
+ {
+ LinkButton lb = new DataGridLinkButton();
+ lb.Text = Text;
+ lb.CommandName = CommandName;
+ lb.CausesValidation = false;
+ toDisplay = lb;
+ }
+ if(DataTextField.Length > 0)
+ {
+ toDisplay.DataBinding += new EventHandler(OnDataBindButtonColumn);
+ }
+ cell.Controls.Add(toDisplay);
+ }
+ }
+
+ private void OnDataBindButtonColumn(object sender, EventArgs e)
+ {
+ Control ctrl = (Control)sender;
+ object item = ((DataGridItem)ctrl.NamingContainer).DataItem;
+ if(textFieldDescriptor == null)
+ {
+ textFieldDescriptor = TypeDescriptor.GetProperties(item).Find(DataTextField, true);
+ if(textFieldDescriptor == null && !DesignMode)
+ throw new HttpException(HttpRuntime.FormatResourceString("Field_Not_Found", DataTextField));
+ }
+ string text;
+ if(textFieldDescriptor != null)
+ {
+ text = FormatDataTextValue(textFieldDescriptor.GetValue(item));
+ } else
+ {
+ text = "Sample_DataBound_Text";
+ }
+ if(ctrl is LinkButton)
+ {
+ ((LinkButton)ctrl).Text = text;
+ }
+ else
+ {
+ ((Button)ctrl).Text = text;
+ }
+ }
+
+ protected virtual string FormatDataTextValue(object dataTextValue)
+ {
+ string retVal = null;
+ if(dataTextValue != null)
+ {
+ if(DataTextFormatString.Length > 0)
+ {
+ retVal = String.Format(DataTextFormatString, dataTextValue);
+ }
+ else
+ {
+ retVal = dataTextValue.ToString();
+ }
+ }
+ return retVal;
+ }
+
+ // LAMESPEC The framework uses Description values for metadata here. However they should be WebSysDescriptions
+ // because all metadata in this namespace has WebSysDescriptions
+
+#if !NET_2_0
+ [Description ("The type of button used in this column.")]
+#endif
+ [DefaultValue (typeof (ButtonColumnType), "LinkButton"), WebCategory ("Misc")]
+ public virtual ButtonColumnType ButtonType
+ {
+ get
+ {
+ object o = ViewState["ButtonType"];
+ if(o!=null)
+ return (ButtonColumnType)o;
+ return ButtonColumnType.LinkButton;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(ButtonColumnType), value))
+ throw new ArgumentException();
+ ViewState["ButtonType"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Description ("The command assigned to this column.")]
+#endif
+ [DefaultValue (""), WebCategory ("Misc")]
+ public virtual string CommandName
+ {
+ get
+ {
+ string cn = (string)ViewState["CommandName"];
+ if(cn!=null)
+ return cn;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandName"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Description ("The datafield that is bound to the text property.")]
+#endif
+ [DefaultValue (""), WebCategory ("Misc")]
+ public virtual string DataTextField
+ {
+ get
+ {
+ string dtf = (string)ViewState["DataTextField"];
+ if(dtf!=null)
+ return dtf;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataTextField"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Description ("A format that is applied to the bound text property.")]
+#endif
+ [DefaultValue (""), WebCategory ("Misc")]
+ public virtual string DataTextFormatString
+ {
+ get
+ {
+ string dtfs = (string)ViewState["DataTextFormatString"];
+ if(dtfs!=null)
+ return dtfs;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataTextFormatString"] = value;
+ }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#else
+ [Description ("The text used for this button.")]
+#endif
+ [DefaultValue (""), WebCategory ("Misc")]
+ public virtual string Text
+ {
+ get
+ {
+ string text = (string)ViewState["Text"];
+ if(text!=null)
+ return text;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Text"] = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumnType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumnType.cs
new file mode 100755
index 00000000000..6f1fae88299
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumnType.cs
@@ -0,0 +1,42 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ButtonColumnType
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ButtonColumnType
+ {
+ LinkButton,
+ PushButton
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ButtonField.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonField.cs
new file mode 100644
index 00000000000..c11ccc4d08c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonField.cs
@@ -0,0 +1,197 @@
+//
+// System.Web.UI.WebControls.ButtonField.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System.Reflection;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Security.Permissions;
+
+namespace System.Web.UI.WebControls {
+
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public class ButtonField : ButtonFieldBase
+ {
+ PropertyDescriptor boundProperty;
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute ("")]
+ public virtual string CommandName {
+ get {
+ object ob = ViewState ["CommandName"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["CommandName"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Data")]
+ [DefaultValueAttribute ("")]
+ [TypeConverterAttribute ("System.Web.UI.Design.DataSourceViewSchemaConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public virtual string DataTextField {
+ get {
+ object ob = ViewState ["DataTextField"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["DataTextField"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Data")]
+ [DefaultValueAttribute ("")]
+ public virtual string DataTextFormatString {
+ get {
+ object ob = ViewState ["DataTextFormatString"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["DataTextFormatString"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("")]
+ [UrlPropertyAttribute]
+ public virtual string ImageUrl {
+ get {
+ object ob = ViewState ["ImageUrl"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["ImageUrl"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [LocalizableAttribute (true)]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("")]
+ public virtual string Text {
+ get {
+ object ob = ViewState ["Text"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["Text"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ public override bool Initialize (bool sortingEnabled, Control control)
+ {
+ return base.Initialize (sortingEnabled, control);
+ }
+
+ protected virtual string FormatDataTextValue (object value)
+ {
+ if (DataTextFormatString.Length > 0)
+ return string.Format (DataTextFormatString, value);
+ else if (value == null)
+ return string.Empty;
+ else
+ return value.ToString ();
+ }
+
+ public override void InitializeCell (DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
+ {
+ string index = rowIndex.ToString ();
+
+ if (cellType == DataControlCellType.DataCell) {
+ DataControlButton btn = new DataControlButton (Control);
+ btn.CommandName = CommandName;
+ btn.CommandArgument = index;
+
+ if (DataTextField != "") {
+ if ((rowState & DataControlRowState.Insert) == 0)
+ cell.DataBinding += new EventHandler (OnDataBindField);
+ }
+ else {
+ btn.Text = Text;
+ btn.ButtonType = ButtonType;
+ if (ButtonType == ButtonType.Image) btn.ImageUrl = ImageUrl;
+ }
+ cell.Controls.Add (btn);
+ }
+ else
+ base.InitializeCell (cell, cellType, rowState, rowIndex);
+ }
+
+ void OnDataBindField (object sender, EventArgs e)
+ {
+ DataControlFieldCell cell = (DataControlFieldCell) sender;
+ DataControlButton btn = (DataControlButton) cell.Controls [0];
+ btn.Text = FormatDataTextValue (GetBoundValue (cell.BindingContainer));
+ if (ButtonType == ButtonType.Image) btn.ImageUrl = ImageUrl;
+ btn.ButtonType = ButtonType;
+ }
+
+ object GetBoundValue (Control controlContainer)
+ {
+ IDataItemContainer dic = controlContainer as IDataItemContainer;
+ if (boundProperty == null) {
+ boundProperty = TypeDescriptor.GetProperties (dic.DataItem) [DataTextField];
+ if (boundProperty == null)
+ new InvalidOperationException ("Property '" + DataTextField + "' not found in object of type " + dic.DataItem.GetType());
+ }
+ return boundProperty.GetValue (dic.DataItem);
+ }
+
+ protected override DataControlField CreateField ()
+ {
+ return new ButtonField ();
+ }
+
+ protected override void CopyProperties (DataControlField newField)
+ {
+ base.CopyProperties (newField);
+ ButtonField field = (ButtonField) newField;
+ field.CommandName = CommandName;
+ field.DataTextField = DataTextField;
+ field.DataTextFormatString = DataTextFormatString;
+ field.ImageUrl = ImageUrl;
+ field.Text = Text;
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ButtonFieldBase.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonFieldBase.cs
new file mode 100644
index 00000000000..61236ddd351
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonFieldBase.cs
@@ -0,0 +1,110 @@
+//
+// System.Web.UI.WebControls.ButtonFieldBase.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Security.Permissions;
+
+namespace System.Web.UI.WebControls {
+
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public abstract class ButtonFieldBase : DataControlField
+ {
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute (ButtonType.Link)]
+ public virtual ButtonType ButtonType {
+ get {
+ object ob = ViewState ["ButtonType"];
+ if (ob != null) return (ButtonType) ob;
+ return ButtonType.Link;
+ }
+ set {
+ ViewState ["ButtonType"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValueAttribute (false)]
+ [WebCategoryAttribute ("Behavior")]
+ public virtual bool CausesValidation {
+ get {
+ object ob = ViewState ["CausesValidation"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["CausesValidation"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (false)]
+ public override bool ShowHeader {
+ get {
+ object val = ViewState ["showHeader"];
+ return val != null ? (bool) val : false;
+ }
+ set {
+ ViewState ["showHeader"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute ("")]
+ public virtual string ValidationGroup {
+ get {
+ object ob = ViewState ["ValidationGroup"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["ValidationGroup"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ protected override void CopyProperties (DataControlField newField)
+ {
+ base.CopyProperties (newField);
+ ButtonFieldBase field = (ButtonFieldBase) newField;
+ field.ButtonType = ButtonType;
+ field.CausesValidation = CausesValidation;
+ field.ShowHeader = ShowHeader;
+ field.ValidationGroup = ValidationGroup;
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ButtonType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonType.cs
new file mode 100644
index 00000000000..480e29b3e5a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonType.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.UI.WebControls.ButtonType.cs
+//
+// Author: Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls
+{
+ public enum ButtonType
+ {
+ Button = 0,
+ Image = 1,
+ Link = 2,
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs
new file mode 100755
index 00000000000..165f54820c2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs
@@ -0,0 +1,1416 @@
+//
+// System.Web.UI.WebControls.Calendar.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (c) Copyright 2002 Ximian, Inc. (http://www.ximian.com)
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.IO;
+using System.Collections;
+using System.Globalization;
+using System.Text;
+using System.Web;
+using System.Web.UI;
+using System.Drawing;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+
+namespace System.Web.UI.WebControls
+{
+#if NET_2_0
+// [ControlValuePropertyAttribute ("SelectedDate", DateTime.MinValue)]
+#endif
+ [DefaultEvent("SelectionChanged")]
+ [DefaultProperty("SelectedDate")]
+ [Designer("System.Web.UI.Design.WebControls.CalendarDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ [DataBindingHandler("System.Web.UI.Design.WebControls.CalendarDataBindingHandler, " + Consts.AssemblySystem_Design)]
+ public class Calendar : WebControl, IPostBackEventHandler
+ {
+ //
+ private TableItemStyle dayHeaderStyle;
+ private TableItemStyle dayStyle;
+ private TableItemStyle nextPrevStyle;
+ private TableItemStyle otherMonthDayStyle;
+ private SelectedDatesCollection selectedDates;
+ private ArrayList selectedDatesList;
+ private TableItemStyle selectedDayStyle;
+ private TableItemStyle selectorStyle;
+ private TableItemStyle titleStyle;
+ private TableItemStyle todayDayStyle;
+ private TableItemStyle weekendDayStyle;
+
+ private static readonly object DayRenderEvent = new object();
+ private static readonly object SelectionChangedEvent = new object();
+ private static readonly object VisibleMonthChangedEvent = new object();
+
+ private Color defaultTextColor;
+ private System.Globalization.Calendar globCal;
+ private DateTimeFormatInfo infoCal = DateTimeFormatInfo.CurrentInfo;
+
+ private static readonly DateTime begin_date = new DateTime (2000,01,01,0,0,0,0);
+
+
+ private static int MASK_WEEKEND = (0x01 << 0);
+ private static int MASK_OMONTH = (0x01 << 1);
+ private static int MASK_TODAY = (0x01 << 2);
+ private static int MASK_SELECTED = (0x01 << 3);
+ private static int MASK_DAY = (0x01 << 4);
+
+ public Calendar(): base()
+ {
+ }
+
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (2), WebCategory ("Layout")]
+ [WebSysDescription ("The border left within the calendar days.")]
+ public int CellPadding
+ {
+ get
+ {
+ object o = ViewState["CellPadding"];
+ if(o!=null)
+ return (int)o;
+ return 2;
+ }
+ set
+ {
+ if (value < -1)
+ throw new ArgumentOutOfRangeException ("value", "CellPadding value has to be -1 for 'not set' or > -1.");
+ ViewState["CellPadding"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (0), WebCategory ("Layout")]
+ [WebSysDescription ("The border left between calendar days.")]
+ public int CellSpacing
+ {
+ get
+ {
+ object o = ViewState["CellSpacing"];
+ if(o!=null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ if (value < -1)
+ throw new ArgumentOutOfRangeException ("value", "CellSpacing value has to be -1 for 'not set' or > -1.");
+ ViewState["CellSpacing"] = value;
+ }
+ }
+
+ [NotifyParentProperty (true), WebCategory ("Style")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to the day header.")]
+ public TableItemStyle DayHeaderStyle
+ {
+ get
+ {
+ if(dayHeaderStyle==null)
+ dayHeaderStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ dayHeaderStyle.TrackViewState();
+ return dayHeaderStyle;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (DayNameFormat), "Short"), WebCategory ("Appearance")]
+ [WebSysDescription ("The format for the day name display.")]
+ public DayNameFormat DayNameFormat
+ {
+ get
+ {
+ object o = ViewState["DayNameFormat"];
+ if(o!=null)
+ return (DayNameFormat)o;
+ return DayNameFormat.Short;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(DayNameFormat),value))
+ throw new ArgumentOutOfRangeException ("value", "Only valid enumeration members are allowed");
+ ViewState["DayNameFormat"] = value;
+ }
+ }
+
+ [DefaultValue (null)]
+ [NotifyParentProperty (true), WebCategory ("Style")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to the day entry.")]
+ public TableItemStyle DayStyle
+ {
+ get
+ {
+ if(dayStyle==null)
+ dayStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ dayStyle.TrackViewState();
+ return dayStyle;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (FirstDayOfWeek), "Default"), WebCategory ("Appearance")]
+ [WebSysDescription ("The day that a week begins with.")]
+ public FirstDayOfWeek FirstDayOfWeek
+ {
+ get
+ {
+ object o = ViewState["FirstDayOfWeek"];
+ if(o!=null)
+ return (FirstDayOfWeek)o;
+ return FirstDayOfWeek.Default;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(FirstDayOfWeek), value))
+ throw new ArgumentOutOfRangeException ("value", "Only valid enumeration members are allowed");
+ ViewState["FirstDayOfWeek"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#else
+ [Localizable (true)]
+#endif
+ [DefaultValue (">"), WebCategory ("Appearance")]
+ [WebSysDescription ("The text for selecting the next month.")]
+ public string NextMonthText
+ {
+ get
+ {
+ object o = ViewState["NextMonthText"];
+ if(o!=null)
+ return (string)o;
+ return "&gt;";
+ }
+ set
+ {
+ ViewState["NextMonthText"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (NextPrevFormat), "CustomText"), WebCategory ("Appearance")]
+ [WebSysDescription ("The format for the month navigation.")]
+ public NextPrevFormat NextPrevFormat
+ {
+ get
+ {
+ object o = ViewState["NextPrevFormat"];
+ if(o!=null)
+ return (NextPrevFormat)o;
+ return NextPrevFormat.CustomText;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(NextPrevFormat), value))
+ throw new ArgumentOutOfRangeException ("value", "Only valid enumeration members are allowed");
+ ViewState["NextPrevFormat"] = value;
+ }
+ }
+
+ [NotifyParentProperty (true), WebCategory ("Style")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to the month navigation.")]
+ public TableItemStyle NextPrevStyle
+ {
+ get
+ {
+ if(nextPrevStyle == null)
+ nextPrevStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ nextPrevStyle.TrackViewState();
+ return nextPrevStyle;
+ }
+ }
+
+ [DefaultValue (null)]
+ [NotifyParentProperty (true), WebCategory ("Style")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to day entries belonging to another month.")]
+ public TableItemStyle OtherMonthDayStyle
+ {
+ get
+ {
+ if(otherMonthDayStyle == null)
+ otherMonthDayStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ otherMonthDayStyle.TrackViewState();
+ return otherMonthDayStyle;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#else
+ [Localizable (true)]
+#endif
+ [DefaultValue ("<"), WebCategory ("Appearance")]
+ [WebSysDescription ("The text for selecting the previous month.")]
+ public string PrevMonthText
+ {
+ get
+ {
+ object o = ViewState["PrevMonthText"];
+ if(o!=null)
+ return (string)o;
+ return "&lt;";
+ }
+ set
+ {
+ ViewState["PrevMonthText"] = value;
+ }
+ }
+
+ [DefaultValue (null), Bindable (true)]
+ [WebSysDescription ("The currently selected date.")]
+ public DateTime SelectedDate
+ {
+ get
+ {
+ if(SelectedDates.Count > 0)
+ {
+ return SelectedDates[0];
+ }
+ return DateTime.MinValue;
+ }
+ set
+ {
+ if(value == DateTime.MinValue)
+ {
+ SelectedDates.Clear();
+ } else
+ {
+ SelectedDates.SelectRange(value, value);
+ }
+ }
+ }
+
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("All currently selected dates.")]
+ public SelectedDatesCollection SelectedDates
+ {
+ get
+ {
+ if(selectedDates==null)
+ {
+ if(selectedDatesList == null)
+ selectedDatesList = new ArrayList();
+ selectedDates = new SelectedDatesCollection(selectedDatesList);
+ }
+ return selectedDates;
+ }
+ }
+
+ [DefaultValue (null)]
+ [NotifyParentProperty (true), WebCategory ("Style")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to the selected day.")]
+ public TableItemStyle SelectedDayStyle
+ {
+ get
+ {
+ if(selectedDayStyle==null)
+ selectedDayStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ selectedDayStyle.TrackViewState();
+ return selectedDayStyle;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (CalendarSelectionMode), "Day"), WebCategory ("Behavior")]
+ [WebSysDescription ("The mode in which days or other entries are selected.")]
+ public CalendarSelectionMode SelectionMode
+ {
+ get
+ {
+ object o = ViewState["SelectionMode"];
+ if(o!=null)
+ return (CalendarSelectionMode)o;
+ return CalendarSelectionMode.Day;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(CalendarSelectionMode), value))
+ throw new ArgumentOutOfRangeException ("value", "Only valid enumeration members are allowed");
+ ViewState["SelectionMode"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#else
+ [Localizable (true)]
+#endif
+ [DefaultValue (">>"), WebCategory ("Appearance")]
+ [WebSysDescription ("The text that is used for selection of months.")]
+ public string SelectMonthText
+ {
+ get
+ {
+ object o = ViewState["SelectMonthText"];
+ if(o!=null)
+ return (string)o;
+ return "&gt;&gt;";
+ }
+ set
+ {
+ ViewState["SelectMonthText"] = value;
+ }
+ }
+
+ [NotifyParentProperty (true), WebCategory ("Style")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to the selector.")]
+ public TableItemStyle SelectorStyle
+ {
+ get
+ {
+ if(selectorStyle==null)
+ selectorStyle = new TableItemStyle();
+ return selectorStyle;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#else
+ [Localizable (true)]
+#endif
+ [DefaultValue (">"), WebCategory ("Appearance")]
+ [WebSysDescription ("The text that is used for selection of weeks.")]
+ public string SelectWeekText
+ {
+ get
+ {
+ object o = ViewState["SelectWeekText"];
+ if(o!=null)
+ return (string)o;
+ return "&gt;";
+ }
+ set
+ {
+ ViewState["SelectWeekText"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (true), WebCategory ("Appearance")]
+ [WebSysDescription ("Determines if the header for days is shown.")]
+ public bool ShowDayHeader
+ {
+ get
+ {
+ object o = ViewState["ShowDayHeader"];
+ if(o!=null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["ShowDayHeader"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (false), WebCategory ("Appearance")]
+ [WebSysDescription ("Determines if gridlines are shown.")]
+ public bool ShowGridLines
+ {
+ get
+ {
+ object o = ViewState["ShowGridLines"];
+ if(o!=null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["ShowGridLines"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (true), WebCategory ("Appearance")]
+ [WebSysDescription ("Determines if month navigation is shown.")]
+ public bool ShowNextPrevMonth
+ {
+ get
+ {
+ object o = ViewState["ShowNextPrevMonth"];
+ if(o!=null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["ShowNextPrevMonth"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (true), WebCategory ("Appearance")]
+ [WebSysDescription ("Determines if the title is shown.")]
+ public bool ShowTitle
+ {
+ get
+ {
+ object o = ViewState["ShowTitle"];
+ if(o!=null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["ShowTitle"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (TitleFormat), "MonthYear"), WebCategory ("Appearance")]
+ [WebSysDescription ("The format in which the title is rendered.")]
+ public TitleFormat TitleFormat
+ {
+ get
+ {
+ object o = ViewState["TitleFormat"];
+ if(o!=null)
+ return (TitleFormat)o;
+ return TitleFormat.MonthYear;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(TitleFormat), value))
+ throw new ArgumentOutOfRangeException ("value", "Only valid enumeration members are allowed");
+ ViewState["TitleFormat"] = value;
+ }
+ }
+
+ [NotifyParentProperty (true), WebCategory ("Style")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to the title.")]
+ public TableItemStyle TitleStyle
+ {
+ get
+ {
+ if(titleStyle==null)
+ titleStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ titleStyle.TrackViewState();
+ return titleStyle;
+ }
+ }
+
+ [DefaultValue (null)]
+ [NotifyParentProperty (true), WebCategory ("Style")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to the today's date display.")]
+ public TableItemStyle TodayDayStyle
+ {
+ get
+ {
+ if(todayDayStyle==null)
+ todayDayStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ todayDayStyle.TrackViewState();
+ return todayDayStyle;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The current date.")]
+ public DateTime TodaysDate
+ {
+ get
+ {
+ object o = ViewState["TodaysDate"];
+ if(o!=null)
+ return (DateTime)o;
+ return DateTime.Today;
+ }
+ set
+ {
+ ViewState["TodaysDate"] = value.Date;
+ }
+ }
+
+ [DefaultValue (null), Bindable (true)]
+ [WebSysDescription ("The month that is displayed.")]
+ public DateTime VisibleDate
+ {
+ get
+ {
+ object o = ViewState["VisibleDate"];
+ if(o!=null)
+ return (DateTime)o;
+ return DateTime.MinValue;
+ }
+ set
+ {
+ ViewState["VisibleDate"] = value.Date;
+ }
+ }
+
+ [NotifyParentProperty (true), WebCategory ("Style")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to weekend days.")]
+ public TableItemStyle WeekendDayStyle
+ {
+ get
+ {
+ if(weekendDayStyle == null)
+ weekendDayStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ weekendDayStyle.TrackViewState();
+ }
+ return weekendDayStyle;
+ }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when a day entry is rendered.")]
+ public event DayRenderEventHandler DayRender
+ {
+ add
+ {
+ Events.AddHandler(DayRenderEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(DayRenderEvent, value);
+ }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when another entry is selected.")]
+ public event EventHandler SelectionChanged
+ {
+ add
+ {
+ Events.AddHandler(SelectionChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(SelectionChangedEvent, value);
+ }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when a the currently visible month has changed.")]
+ public event MonthChangedEventHandler VisibleMonthChanged
+ {
+ add
+ {
+ Events.AddHandler(VisibleMonthChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(VisibleMonthChangedEvent, value);
+ }
+ }
+
+#if NET_2_0
+ [MonoTODO ("Do something with this")]
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Appearance")]
+ public string CalendarEntryText {
+ get {
+ object o = ViewState ["CalendarEntryText"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["CalendarEntryText"] = value;
+ }
+ }
+
+ [LocalizableAttribute (true)]
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Accessibility")]
+ public string Caption {
+ get {
+ object o = ViewState ["Caption"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["Caption"] = value;
+ }
+ }
+
+ [WebCategoryAttribute ("Accessibility")]
+ [DefaultValueAttribute (TableCaptionAlign.NotSet)]
+ public TableCaptionAlign CaptionAlign {
+ get {
+ object o = ViewState ["CaptionAlign"];
+ if (o != null) return (TableCaptionAlign) o;
+ return TableCaptionAlign.NotSet;
+ }
+ set {
+ ViewState ["CaptionAlign"] = value;
+ }
+ }
+
+ [DefaultValueAttribute (false)]
+ [WebCategoryAttribute ("Accessibility")]
+ public bool UseAccessibleHeader {
+ get {
+ object o = ViewState ["UseAccessibleHeader"];
+ if (o != null) return (bool) o;
+ return false;
+ }
+ set {
+ ViewState ["UseAccessibleHeader"] = value;
+ }
+ }
+#endif
+
+ protected virtual void OnDayRender(TableCell cell, CalendarDay day)
+ {
+ if(Events!=null)
+ {
+ DayRenderEventHandler dreh = (DayRenderEventHandler)(Events[DayRenderEvent]);
+ if(dreh!=null)
+ dreh(this, new DayRenderEventArgs(cell, day));
+ }
+ }
+
+ protected virtual void OnSelectionChanged()
+ {
+ if(Events!=null)
+ {
+ EventHandler eh = (EventHandler)(Events[SelectionChangedEvent]);
+ if(eh!=null)
+ eh(this, new EventArgs());
+ }
+ }
+
+ protected virtual void OnVisibleMonthChanged(DateTime newDate, DateTime prevDate)
+ {
+ if(Events!=null)
+ {
+ MonthChangedEventHandler mceh = (MonthChangedEventHandler)(Events[VisibleMonthChangedEvent]);
+ if(mceh!=null)
+ mceh(this, new MonthChangedEventArgs(newDate, prevDate));
+ }
+ }
+
+ /// <remarks>
+ /// See test6.aspx in Tests directory for verification
+ /// </remarks>
+#if NET_2_0
+ void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
+ {
+ RaisePostBackEvent (eventArgument);
+ }
+
+ protected virtual void RaisePostBackEvent (string eventArgument)
+#else
+ void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
+#endif
+ {
+ // initialize the calendar...TODO: find out why this isn't done in the constructor
+ // if the culture is changed between rendering and postback this will be broken
+ globCal = DateTimeFormatInfo.CurrentInfo.Calendar;
+
+ // TODO: Find out what kind of exceptions to throw when we get bad data
+ if (eventArgument.StartsWith ("V")) {
+ TimeSpan mod = new TimeSpan (Int32.Parse (eventArgument.Substring (1)), 0, 0, 0);
+ DateTime new_date = begin_date + mod;
+ VisibleDate = new_date;
+ OnVisibleMonthChanged (VisibleDate, new_date);
+ } else if (eventArgument.StartsWith ("R")) {
+ TimeSpan mod = new TimeSpan (Int32.Parse (eventArgument.Substring (1,
+ eventArgument.Length - 3)), 0, 0, 0);
+ DateTime range_begin = begin_date + mod;
+ int sel_days = Int32.Parse (eventArgument.Substring (eventArgument.Length - 2));
+ SelectRangeInternal (range_begin, range_begin.AddDays (sel_days - 1), GetEffectiveVisibleDate ());
+ } else {
+ TimeSpan mod = new TimeSpan (Int32.Parse (eventArgument), 0, 0, 0);
+ DateTime day = begin_date + mod;
+ SelectRangeInternal (day, day, GetEffectiveVisibleDate ());
+ }
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ globCal = DateTimeFormatInfo.CurrentInfo.Calendar;
+ DateTime visDate = GetEffectiveVisibleDate();
+ DateTime firstDate = GetFirstCalendarDay(visDate);
+
+ bool isEnabled;
+ bool isHtmlTextWriter;
+ //FIXME: when Control.Site works, reactivate this
+ //if (Page == null || Site == null) {
+ // isEnabled = false;
+ // isHtmlTextWriter = false;
+ //} else {
+ isEnabled = Enabled;
+ isHtmlTextWriter = (writer.GetType() != typeof(HtmlTextWriter));
+ //}
+ defaultTextColor = ForeColor;
+ if(defaultTextColor == Color.Empty)
+ defaultTextColor = Color.Black;
+
+ Table calTable = new Table ();
+ calTable.ID = ID;
+ calTable.CopyBaseAttributes(this);
+ if(ControlStyleCreated)
+ calTable.ApplyStyle(ControlStyle);
+ calTable.Width = Width;
+ calTable.Height = Height;
+ calTable.CellSpacing = CellSpacing;
+ calTable.CellPadding = CellPadding;
+
+ if (ControlStyleCreated &&
+ ControlStyle.IsSet (WebControls.Style.BORDERWIDTH) &&
+ BorderWidth != Unit.Empty)
+ calTable.BorderWidth = BorderWidth;
+ else
+ calTable.BorderWidth = Unit.Pixel(1);
+
+ if (ShowGridLines)
+ calTable.GridLines = GridLines.Both;
+ else
+ calTable.GridLines = GridLines.None;
+
+#if NET_2_0
+ calTable.Caption = Caption;
+ calTable.CaptionAlign = CaptionAlign;
+#endif
+
+ calTable.RenderBeginTag (writer);
+
+ if (ShowTitle)
+ RenderTitle (writer, visDate, SelectionMode, isEnabled);
+
+ if (ShowDayHeader)
+ RenderHeader (writer, firstDate, SelectionMode, isEnabled, isHtmlTextWriter);
+
+ RenderAllDays (writer, firstDate, visDate, SelectionMode, isEnabled, isHtmlTextWriter);
+
+ calTable.RenderEndTag(writer);
+ }
+
+ protected override ControlCollection CreateControlCollection()
+ {
+ return new EmptyControlCollection(this);
+ }
+
+ protected override void LoadViewState(object savedState)
+ {
+ if (savedState!=null) {
+ object[] states = (object[]) savedState;
+ if(states[0] != null)
+ base.LoadViewState(states[0]);
+ if(states[1] != null)
+ DayHeaderStyle.LoadViewState(states[1]);
+ if(states[2] != null)
+ DayStyle.LoadViewState(states[2]);
+ if(states[3] != null)
+ NextPrevStyle.LoadViewState(states[3]);
+ if(states[4] != null)
+ OtherMonthDayStyle.LoadViewState(states[4]);
+ if(states[5] != null)
+ SelectedDayStyle.LoadViewState(states[5]);
+ if(states[6] != null)
+ SelectorStyle.LoadViewState(states[6]);
+ if(states[7] != null)
+ TitleStyle.LoadViewState(states[7]);
+ if(states[8] != null)
+ TodayDayStyle.LoadViewState(states[8]);
+ if(states[9] != null)
+ WeekendDayStyle.LoadViewState(states[9]);
+
+ ArrayList dateList = ViewState ["_CalendarSelectedDates"] as ArrayList;
+ if (dateList != null)
+ selectedDates = new SelectedDatesCollection (dateList);
+ }
+ }
+
+ protected override object SaveViewState()
+ {
+ if (SelectedDates.Count > 0)
+ ViewState["_CalendarSelectedDates"] = selectedDates.GetDateList ();
+
+ object[] states = new object [10];
+ states[0] = base.SaveViewState();
+ states[1] = (dayHeaderStyle == null ? null : dayHeaderStyle.SaveViewState());
+ states[2] = (dayStyle == null ? null : dayStyle.SaveViewState());
+ states[3] = (nextPrevStyle == null ? null : nextPrevStyle.SaveViewState());
+ states[4] = (otherMonthDayStyle == null ? null : otherMonthDayStyle.SaveViewState());
+ states[5] = (selectedDayStyle == null ? null : selectedDayStyle.SaveViewState());
+ states[6] = (selectorStyle == null ? null : selectorStyle.SaveViewState());
+ states[7] = (titleStyle == null ? null : titleStyle.SaveViewState());
+ states[8] = (todayDayStyle == null ? null : todayDayStyle.SaveViewState());
+ states[9] = (weekendDayStyle == null ? null : weekendDayStyle.SaveViewState());
+ for(int i=0; i < states.Length; i++)
+ {
+ if(states[i]!=null)
+ return states;
+ }
+ return null;
+ }
+
+ protected override void TrackViewState()
+ {
+ base.TrackViewState();
+ if(titleStyle!=null)
+ {
+ titleStyle.TrackViewState();
+ }
+ if(nextPrevStyle!=null)
+ {
+ nextPrevStyle.TrackViewState();
+ }
+ if(dayStyle!=null)
+ {
+ dayStyle.TrackViewState();
+ }
+ if(dayHeaderStyle!=null)
+ {
+ dayHeaderStyle.TrackViewState();
+ }
+ if(todayDayStyle!=null)
+ {
+ todayDayStyle.TrackViewState();
+ }
+ if(weekendDayStyle!=null)
+ {
+ weekendDayStyle.TrackViewState();
+ }
+ if(otherMonthDayStyle!=null)
+ {
+ otherMonthDayStyle.TrackViewState();
+ }
+ if(selectedDayStyle!=null)
+ {
+ selectedDayStyle.TrackViewState();
+ }
+ if(selectorStyle!=null)
+ {
+ selectorStyle.TrackViewState();
+ }
+ }
+
+ private void RenderAllDays (HtmlTextWriter writer,
+ DateTime firstDay,
+ DateTime activeDate,
+ CalendarSelectionMode mode,
+ bool isActive,
+ bool isDownLevel)
+ {
+ TableItemStyle weeksStyle = null;
+ TableCell weeksCell = new TableCell ();
+ TableItemStyle weekendStyle = WeekendDayStyle;
+ TableItemStyle otherMonthStyle = OtherMonthDayStyle;
+ Unit size;
+ bool isWeekMode = (mode == CalendarSelectionMode.DayWeek ||
+ mode == CalendarSelectionMode.DayWeekMonth);
+
+ if (isWeekMode) {
+ weeksStyle = new TableItemStyle ();
+ weeksStyle.Width = Unit.Percentage (12);
+ weeksStyle.HorizontalAlign = HorizontalAlign.Center;
+ weeksStyle.CopyFrom (SelectorStyle);
+ size = Unit.Percentage (12);
+ } else {
+ size = Unit.Percentage (14);
+ }
+
+ TableItemStyle [] styles = new TableItemStyle [32];
+ int definedStyles = MASK_SELECTED;
+ if (weekendStyle != null && !weekendStyle.IsEmpty)
+ definedStyles |= MASK_WEEKEND;
+ if (otherMonthStyle != null && !otherMonthStyle.IsEmpty)
+ definedStyles |= MASK_OMONTH;
+ if (todayDayStyle != null && !todayDayStyle.IsEmpty)
+ definedStyles |= MASK_TODAY;
+ if (dayStyle != null && !dayStyle.IsEmpty)
+ definedStyles |= MASK_DAY;
+
+ int month = globCal.GetMonth (activeDate);
+ DateTime currentDay = firstDay;
+ int begin = (int) (firstDay - begin_date).TotalDays;
+ for (int crr = 0; crr < 6; crr++) {
+ writer.Write ("<tr>");
+ if (isWeekMode) {
+ int week_offset = begin + crr * 7;
+ string cellText = GetCalendarLinkText (
+ "R" + week_offset + "07",
+ SelectWeekText,
+ "Select week " + (crr + 1),
+ weeksCell.ForeColor,
+ isActive);
+
+ weeksCell.Text = cellText;
+ weeksCell.ApplyStyle (weeksStyle);
+ RenderCalendarCell (writer, weeksCell, cellText);
+ }
+
+ for (int weekDay = 0; weekDay < 7; weekDay++) {
+ string dayString = currentDay.Day.ToString ();
+ DayOfWeek dow = currentDay.DayOfWeek;
+ CalendarDay calDay =
+ new CalendarDay (
+ currentDay,
+ dow == DayOfWeek.Sunday ||
+ dow == DayOfWeek.Saturday,
+ currentDay == TodaysDate,
+ SelectedDates.Contains (currentDay),
+ globCal.GetMonth (currentDay) != month,
+ dayString
+ );
+
+
+ int dayStyles = GetMask (calDay) & definedStyles;
+ TableItemStyle currentDayStyle = styles [dayStyles];
+ if (currentDayStyle == null) {
+ currentDayStyle = new TableItemStyle ();
+ if ((dayStyles & MASK_DAY) != 0)
+ currentDayStyle.CopyFrom (DayStyle);
+
+ if ((dayStyles & MASK_WEEKEND) != 0)
+ currentDayStyle.CopyFrom (WeekendDayStyle);
+
+ if ((dayStyles & MASK_TODAY) != 0)
+ currentDayStyle.CopyFrom (TodayDayStyle);
+
+ if ((dayStyles & MASK_OMONTH) != 0)
+ currentDayStyle.CopyFrom (OtherMonthDayStyle);
+
+ if ((dayStyles & MASK_SELECTED) != 0) {
+ currentDayStyle.ForeColor = Color.White;
+ currentDayStyle.BackColor = Color.Silver;
+ currentDayStyle.CopyFrom (SelectedDayStyle);
+ }
+
+ currentDayStyle.Width = size;
+ currentDayStyle.HorizontalAlign = HorizontalAlign.Center;
+ }
+
+ TableCell dayCell = new TableCell ();
+ dayCell.ApplyStyle (currentDayStyle);
+ LiteralControl number = new LiteralControl (dayString);
+ dayCell.Controls.Add (number);
+ calDay.IsSelectable = isActive;
+ OnDayRender (dayCell, calDay);
+ if (calDay.IsSelectable)
+ number.Text = GetCalendarLinkText ((begin + (crr * 7 + weekDay)).ToString (),
+ dayString,
+ currentDay.ToShortDateString (),
+ dayCell.ForeColor,
+ isActive);
+
+ dayCell.RenderControl (writer);
+ currentDay = globCal.AddDays (currentDay, 1);
+ }
+ writer.Write("</tr>");
+ }
+ }
+
+ private int GetMask (CalendarDay day)
+ {
+ int retVal = MASK_DAY;
+ if(day.IsSelected)
+ retVal |= MASK_SELECTED;
+ if(day.IsToday)
+ retVal |= MASK_TODAY;
+ if(day.IsOtherMonth)
+ retVal |= MASK_OMONTH;
+ if(day.IsWeekend)
+ retVal |= MASK_WEEKEND;
+ return retVal;
+ }
+
+ /// <remarks>
+ /// Refers to the second line of the calendar, that contains a link
+ /// to select whole month, and weekdays as defined by DayNameFormat
+ /// </remarks>
+ private void RenderHeader (HtmlTextWriter writer,
+ DateTime firstDay,
+ CalendarSelectionMode mode,
+ bool isActive,
+ bool isDownLevel)
+ {
+ writer.Write("<tr>");
+ bool isWeekMode = (mode == CalendarSelectionMode.DayWeek ||
+ mode == CalendarSelectionMode.DayWeekMonth);
+
+ TableCell headerCell = new TableCell ();
+ headerCell.HorizontalAlign = HorizontalAlign.Center;
+ string selMthText = String.Empty;
+ if (isWeekMode) {
+ if (mode == CalendarSelectionMode.DayWeekMonth) {
+ DateTime visDate = GetEffectiveVisibleDate ();
+ DateTime sel_month = new DateTime (visDate.Year, visDate.Month, 1);
+ int month_offset = (int) (sel_month - begin_date).TotalDays;
+ headerCell.ApplyStyle (SelectorStyle);
+ selMthText = GetCalendarLinkText ("R" + month_offset +
+ globCal.GetDaysInMonth (sel_month.Year,
+ sel_month.Month).ToString ("d2"), // maybe there are calendars with less then 10 days in a month
+ SelectMonthText,
+ "Select the whole month",
+ SelectorStyle.ForeColor,
+ isActive);
+ } else {
+ headerCell.ApplyStyle (DayHeaderStyle);
+ selMthText = String.Empty;
+ }
+ RenderCalendarCell (writer, headerCell, selMthText);
+ }
+
+ TableCell dayHeaderCell = new TableCell ();
+ dayHeaderCell.HorizontalAlign = HorizontalAlign.Center;
+ dayHeaderCell.ApplyStyle (dayHeaderStyle);
+
+ int dayOfWeek = (int) globCal.GetDayOfWeek (firstDay);
+ DateTimeFormatInfo currDTInfo = DateTimeFormatInfo.CurrentInfo;
+ for(int currDay = dayOfWeek; currDay < dayOfWeek + 7; currDay++) {
+ DayOfWeek effDay = (DayOfWeek) Enum.ToObject (typeof (DayOfWeek), currDay % 7);
+ string currDayContent;
+ switch(DayNameFormat) {
+ case DayNameFormat.Full:
+ currDayContent = currDTInfo.GetDayName (effDay);
+ break;
+ case DayNameFormat.FirstLetter:
+ currDayContent = currDTInfo.GetDayName (effDay).Substring (0,1);
+ break;
+ case DayNameFormat.FirstTwoLetters:
+ currDayContent = currDTInfo.GetDayName (effDay).Substring (0,2);
+ break;
+ case DayNameFormat.Short:
+ goto default;
+ default:
+ currDayContent = currDTInfo.GetAbbreviatedDayName (effDay);
+ break;
+ }
+
+ RenderCalendarHeaderCell (writer, dayHeaderCell, currDayContent, currDTInfo.GetDayName (effDay));
+ }
+ writer.Write ("</tr>");
+ }
+
+ private void RenderTitle (HtmlTextWriter writer,
+ DateTime visibleDate,
+ CalendarSelectionMode mode,
+ bool isActive)
+ {
+ writer.Write("<tr>");
+ Table innerTable = new Table ();
+ TableCell titleCell = new TableCell();
+ bool isWeekMode = (mode == CalendarSelectionMode.DayWeek ||
+ mode == CalendarSelectionMode.DayWeekMonth);
+
+ titleCell.ColumnSpan = (isWeekMode ? 8 : 7);
+ titleCell.BackColor = Color.Silver;
+
+ innerTable.GridLines = GridLines.None;
+ innerTable.Width = Unit.Percentage (100);
+ innerTable.CellSpacing = 0;
+ ApplyTitleStyle (innerTable, titleCell, TitleStyle);
+
+ titleCell.RenderBeginTag (writer);
+ innerTable.RenderBeginTag (writer);
+
+ writer.Write ("<tr>");
+ string prevContent = String.Empty;
+ if (ShowNextPrevMonth) {
+ TableCell prevCell = new TableCell ();
+ prevCell.Width = Unit.Percentage (15);
+ prevCell.HorizontalAlign = HorizontalAlign.Left;
+ if (NextPrevFormat == NextPrevFormat.CustomText) {
+ prevContent = PrevMonthText;
+ } else {
+ int pMthInt = globCal.GetMonth(globCal.AddMonths (visibleDate, -1));
+ if (NextPrevFormat == NextPrevFormat.FullMonth)
+ prevContent = infoCal.GetMonthName (pMthInt);
+ else
+ prevContent = infoCal.GetAbbreviatedMonthName (pMthInt);
+ }
+ DateTime prev_month = visibleDate.AddMonths (-1);
+ int prev_offset = (int) (new DateTime (prev_month.Year,
+ prev_month.Month, 1) - begin_date).TotalDays;
+ prevCell.ApplyStyle (NextPrevStyle);
+ RenderCalendarCell (writer,
+ prevCell,
+ GetCalendarLinkText ("V" + prev_offset,
+ prevContent,
+ "Go to previous month",
+ NextPrevStyle.ForeColor,
+ isActive)
+ );
+ }
+
+ TableCell currCell = new TableCell ();
+ currCell.Width = Unit.Percentage (70);
+ if (TitleStyle.HorizontalAlign == HorizontalAlign.NotSet)
+ currCell.HorizontalAlign = HorizontalAlign.Center;
+ else
+ currCell.HorizontalAlign = TitleStyle.HorizontalAlign;
+
+ currCell.Wrap = TitleStyle.Wrap;
+ string currMonthContent = String.Empty;
+ if (TitleFormat == TitleFormat.Month) {
+ currMonthContent = visibleDate.ToString ("MMMM");
+ } else {
+ string cmcFmt = infoCal.YearMonthPattern;
+ if (cmcFmt.IndexOf (',') >= 0)
+ cmcFmt = "MMMM yyyy";
+
+ currMonthContent = visibleDate.ToString (cmcFmt);
+ }
+
+ RenderCalendarCell (writer, currCell, currMonthContent);
+
+ string nextContent = String.Empty;
+ if (ShowNextPrevMonth) {
+ TableCell nextCell = new TableCell ();
+ nextCell.Width = Unit.Percentage(15);
+ nextCell.HorizontalAlign = HorizontalAlign.Right;
+ if (NextPrevFormat == NextPrevFormat.CustomText) {
+ nextContent = NextMonthText;
+ } else {
+ int nMthInt = globCal.GetMonth (globCal.AddMonths (visibleDate, 1));
+ if(NextPrevFormat == NextPrevFormat.FullMonth)
+ nextContent = infoCal.GetMonthName(nMthInt);
+ else
+ nextContent = infoCal.GetAbbreviatedMonthName(nMthInt);
+ }
+ DateTime next_month = visibleDate.AddMonths (1);
+ int next_offset = (int) (new DateTime (next_month.Year,
+ next_month.Month, 1) - begin_date).TotalDays;
+ nextCell.ApplyStyle(NextPrevStyle);
+ RenderCalendarCell (writer,
+ nextCell,
+ GetCalendarLinkText ("V" + next_offset,
+ nextContent,
+ "Go to next month",
+ NextPrevStyle.ForeColor,
+ isActive)
+ );
+ }
+
+ writer.Write("</tr>");
+ innerTable.RenderEndTag(writer);
+ titleCell.RenderEndTag(writer);
+
+ writer.Write("</tr>");
+ }
+
+ private void ApplyTitleStyle(Table table, TableCell cell, TableItemStyle style)
+ {
+ if(style.BackColor != Color.Empty)
+ {
+ cell.BackColor = style.BackColor;
+ }
+ if(style.BorderStyle != BorderStyle.NotSet)
+ {
+ cell.BorderStyle = style.BorderStyle;
+ }
+ if(style.BorderColor != Color.Empty)
+ {
+ cell.BorderColor = style.BorderColor;
+ }
+ if(style.BorderWidth != Unit.Empty)
+ {
+ cell.BorderWidth = style.BorderWidth;
+ }
+ if(style.Height != Unit.Empty)
+ {
+ cell.Height = style.Height;
+ }
+ if(style.VerticalAlign != VerticalAlign.NotSet)
+ {
+ cell.VerticalAlign = style.VerticalAlign;
+ }
+
+ if(style.ForeColor != Color.Empty)
+ {
+ table.ForeColor = style.ForeColor;
+ } else if(ForeColor != Color.Empty)
+ {
+ table.ForeColor = ForeColor;
+ }
+
+ if (style.CssClass != "") {
+ cell.CssClass = style.CssClass;
+ }
+
+ table.Font.CopyFrom(style.Font);
+ table.Font.MergeWith(Font);
+ }
+
+ private void RenderCalendarHeaderCell (HtmlTextWriter writer, TableCell cell, string text, string altText)
+ {
+#if NET_2_0
+ if (UseAccessibleHeader) {
+ writer.AddAttribute ("align", "center");
+ writer.AddAttribute ("abbr", altText);
+ writer.AddAttribute ("scope", "column");
+ writer.RenderBeginTag (HtmlTextWriterTag.Th);
+ writer.Write (text);
+ writer.RenderEndTag ();
+ return;
+ }
+#endif
+ RenderCalendarCell (writer, cell, text);
+ }
+
+ private void RenderCalendarCell (HtmlTextWriter writer, TableCell cell, string text)
+ {
+ cell.RenderBeginTag(writer);
+ writer.Write(text);
+ cell.RenderEndTag(writer);
+ }
+
+ private DateTime GetFirstCalendarDay(DateTime visibleDate)
+ {
+ int fow = (int) FirstDayOfWeek;
+ if (fow == 7)
+ fow = (int) infoCal.FirstDayOfWeek;
+
+ int days = (int) globCal.GetDayOfWeek (visibleDate) - fow;
+ if (days <= 0)
+ days += 7;
+ return globCal.AddDays (visibleDate, -days);
+ }
+
+ private DateTime GetEffectiveVisibleDate()
+ {
+ DateTime dt = VisibleDate;
+ if (VisibleDate == DateTime.MinValue)
+ dt = TodaysDate;
+
+ return globCal.AddDays (dt, 1 - globCal.GetDayOfMonth (dt));
+ }
+
+ /// <summary>
+ /// Creates text to be displayed, with all attributes if to be
+ /// shown as a hyperlink
+ /// </summary>
+ private string GetCalendarLinkText (string eventArg,
+ string text,
+ string altText,
+ Color foreground,
+ bool isLink)
+ {
+ if (isLink) {
+ StringBuilder dispVal = new StringBuilder ();
+ dispVal.Append ("<a href=\"");
+ dispVal.Append (Page.ClientScript.GetPostBackClientHyperlink (this, eventArg));
+ dispVal.Append ("\" style=\"color: ");
+ if (foreground.IsEmpty) {
+ dispVal.Append (ColorTranslator.ToHtml (defaultTextColor));
+ } else {
+ dispVal.Append (ColorTranslator.ToHtml (foreground));
+ }
+ dispVal.Append ("\"");
+#if NET_2_0
+ if (UseAccessibleHeader) {
+ dispVal.Append (" title=\"");
+ dispVal.Append (altText);
+ dispVal.Append ("\"");
+ }
+#endif
+ dispVal.Append (">");
+ dispVal.Append (text);
+ dispVal.Append ("</a>");
+ return dispVal.ToString ();
+ }
+ return text;
+ }
+
+ internal void SelectRangeInternal (DateTime fromDate, DateTime toDate, DateTime visibleDate)
+ {
+ TimeSpan span = toDate - fromDate;
+ if (SelectedDates.Count != span.Days + 1 ||
+ SelectedDates [0] != fromDate ||
+ SelectedDates [SelectedDates.Count - 1] != toDate) {
+ SelectedDates.SelectRange (fromDate, toDate);
+ OnSelectionChanged ();
+ }
+ }
+
+ protected bool HasWeekSelectors (CalendarSelectionMode selectionMode)
+ {
+ return selectionMode == CalendarSelectionMode.DayWeek ||
+ selectionMode == CalendarSelectionMode.DayWeekMonth;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CalendarDay.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CalendarDay.cs
new file mode 100644
index 00000000000..874df7fa36c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CalendarDay.cs
@@ -0,0 +1,121 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: CalendarDay
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class CalendarDay
+ {
+ private DateTime date;
+ private bool isWeekend;
+ private bool isToday;
+ private bool isSelected;
+ private bool isOtherMonth;
+ private bool isSelectable;
+ private string dayNumberText;
+
+ public CalendarDay(DateTime date, bool isWeekend, bool isToday, bool isSelected, bool isOtherMonth, string dayNumberText)
+ {
+ this.date = date;
+ this.isWeekend = isWeekend;
+ this.isToday = isToday;
+ this.isSelected = isSelected;
+ this.isOtherMonth = isOtherMonth;
+ this.dayNumberText = dayNumberText;
+ }
+
+ public DateTime Date
+ {
+ get
+ {
+ return date;
+ }
+ }
+
+ public string DayNumberText
+ {
+ get
+ {
+ return dayNumberText;
+ }
+ }
+
+ public bool IsOtherMonth
+ {
+ get
+ {
+ return isOtherMonth;
+ }
+ }
+
+ public bool IsSelectable
+ {
+ get
+ {
+ return isSelectable;
+ }
+ set
+ {
+ isSelectable = value;
+ }
+ }
+
+ public bool IsSelected
+ {
+ get
+ {
+ return isSelected;
+ }
+ }
+
+ public bool IsToday
+ {
+ get
+ {
+ return isToday;
+ }
+ }
+
+ public bool IsWeekend
+ {
+ get
+ {
+ return isWeekend;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CalendarSelectionMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CalendarSelectionMode.cs
new file mode 100755
index 00000000000..d0839193542
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CalendarSelectionMode.cs
@@ -0,0 +1,44 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: CalendarSelectionMode
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum CalendarSelectionMode
+ {
+ None,
+ Day,
+ DayWeek,
+ DayWeekMonth
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
new file mode 100644
index 00000000000..b2508ead98e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
@@ -0,0 +1,2825 @@
+2005-04-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs: OnDayRender can toggle IsSelectable on our back.
+
+2005-04-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs: when the day is active, modify the text of the literal
+ control that holds the number, not the text of the TableCell. Also call
+ OnDayRender before updating that text. Fixes bug #74718.
+
+2005-04-22 Lluis Sanchez Gual <lluis@novell.com>
+
+ * DataKey.cs: Added virtual TrackViewState and IsTrackingViewState
+ members.
+ * DataControlFieldHeaderCell.cs: Save Scope in view state.
+ Added AbbreviatedText property.
+ * AutoGeneratedField.cs: The constructor should actually be internal.
+ * DataGridItem.cs: Added implemented interface in 2.0.
+ * DataControlFieldCollection.cs: Implemented CloneFields and
+ GetKnownTypes().
+ *
+
+2005-04-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StringArrayConverter.cs:
+ * Calendar.cs: warnings.
+
+2005-04-21 Lluis Sanchez Gual <lluis@novell.com>
+
+ * FormViewDeleteEventArgs.cs:
+ * FormViewInsertEventArgs.cs:
+ * FormViewUpdateEventArgs.cs:
+ * FormViewDeletedEventArgs.cs:
+ * FormViewUpdatedEventArgs.cs:
+ * FormViewInsertedEventArgs.cs: Implemented some missing properties.
+
+ * LinkButton.cs:
+ * IButtonControl.cs:
+ * Button.cs: Removed SoftKey property.
+
+ * CheckBox.cs: Don't try to load post back data if the control
+ is disabled.
+
+ * ImageField.cs:
+ * AutoGeneratedField.cs:
+ * DataControlField.cs:
+ * CommandField.cs:
+ * ButtonFieldBase.cs:
+ * BoundField.cs:
+ * CheckBoxField.cs:
+ * TemplateField.cs:
+ * ButtonField.cs: Don't bind fields in Insert state.
+ Implemented CreateField and CopyProperties.
+
+ * GridView.cs:
+ * DetailsView.cs: Removed some unneeded interfaces. Don't
+ generate the field rows if there are no items in the data source.
+ Don't get the current keys until the whole control has been
+ bound.
+
+ * DetailsViewInsertedEventArgs.cs:
+ * DataBoundControl.cs:
+ * ObjectDataSourceView.cs: Made some methods private.
+
+ * MenuItemStyle.cs:
+ * Menu.cs: Changed some properties from int to Unit.
+
+ * DataControlButton.cs: javascript prefix is needed when raising
+ the postback event from a link.
+
+ * PagedDataSource.cs: Some fixes in Count and IsLastPage properties.
+ The result was wrong when the total data source count was 0.
+
+ * FormView.cs: Implemented.
+ * FormViewRow.cs: Implemented.
+
+ * Literal.cs:
+ * Localize.cs: Fixed base interface.
+
+ * BaseDataBoundControl.cs: In DataBind() call the base class
+ DataBind method, so the binding context is properly set.
+
+2005-04-15 Lluis Sanchez Gual <lluis@novell.com>
+
+ * DetailsView.cs: Added some null checks.
+ * TemplateField.cs: Implemented support for two-way bindings.
+
+2005-04-14 Lluis Sanchez Gual <lluis@novell.com>
+
+ * DetailsView.cs: Implemented support for Insert operation.
+ Added header and footer templates. Added missing style
+ properties.
+ * ObjectDataSourceView.cs: Use ParameterCollection.GetValues
+ to get filter values. Other minor fixes.
+ * CommandField.cs: Properly render the Insert and New buttons.
+ * ObjectDataSource.cs: Update the parameter collections after
+ the page is loaded. This will fire the ParameterChanged event
+ if needed.
+ * DataBoundControl.cs: The OnDataSourceViewChanged method
+ is called when the view changes, not when the datasource
+ changes.
+
+ * DetailsViewInsertedEventArgs.cs:
+ * DetailsViewInsertEventArgs.cs: Implement Values property.
+
+ * ImageField.cs:
+ * AutoGeneratedField.cs
+ * BoundField.cs:
+ * CheckBoxField.cs:
+ Take into account the Insert mode.
+
+ * ParameterCollection.cs: Implemented UpdateValues and fixed
+ GetValues (values can't be cached because can change).
+ * Parameter.cs: Detect value changes in GetValue, and fire
+ the change event if needed. Removed unused ParameterValue
+ property. Other fixes.
+
+2005-04-08 Lluis Sanchez Gual <lluis@novell.com>
+
+ * DetailsView.cs: Initial implementation.
+ * ObjectDataSourceView.cs: Notify changes in the parameters.
+ * DetailsViewDeletedEventArgs.cs, DetailsViewUpdatedEventArgs.cs,
+ DetailsViewDeleteEventArgs.cs, DetailsViewUpdateEventArgs.cs:
+ Implemented some properties.
+ * GridView.cs: Added null check in SelectedValue. Don't return null
+ for empty DataKeyNames list.
+ * DetailsViewRowCollection.cs: Implemented.
+ * DetailsViewRow.cs: Implemented.
+ * ButtonFieldBase.cs: By default button field don't have headers.
+ * BoundField.cs: Don't bind header fields.
+
+2005-04-07 Lluis Sanchez Gual <lluis@novell.com>
+
+ * ButtonField.cs: Get data item properties using TypeDescriptor.
+ Made OnDataBindField private.
+ * ObjectDataSourceView.cs: Implemented support for Delete and
+ Insert operations, support for filtering and sorting,
+ conflict detection, etc. It's now complete.
+ * ObjectDataSource.cs: Completed most of functionality. Only
+ caching support is missing.
+ * ObjectDataSourceFilteringEventHandler.cs: New event handler.
+ * TreeNode.cs: Get data item properties using TypeDescriptor.
+ * PagerSettings.cs: Flush.
+ * ObjectDataSourceFilteringEventArgs.cs: New event args.
+ * GridView.cs: Get data item properties using TypeDescriptor
+ and cache them. Properly set descending order in the sort
+ expression. In UpdateRow, make sure we get the old values
+ before the control is bound again.
+ * ImageField.cs: Implemented.
+ * AutoGeneratedField.cs: Initialize the field's sort
+ expression in the constructor.
+ * MenuItem.cs: Get data item properties using TypeDescriptor.
+ * BoundField.cs: Get data item properties using TypeDescriptor.
+ * CheckBoxField.cs: Added missing attributes.
+ * TemplateField.cs: Implemented.
+
+2005-04-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UnitConverter.cs:
+ * FontUnitConverter.cs: fixed ConvertTo to work with target
+ InstanceDescriptor and value as a string.
+
+ * Unit.cs: culture might be null.
+
+ Fixes bug #74431.
+
+2005-04-01 Lluis Sanchez Gual <lluis@novell.com>
+
+ * ButtonField.cs: Mostly implemented.
+ * DataControlFieldHeaderCell.cs: Implemented.
+ * ObjectDataSourceView.cs: Initial implementation.
+ * DataControlButton.cs: Added support for real buttons.
+ * Label.cs, DataControlField.cs: Flush.
+ * ObjectDataSource.cs: Initial implementation.
+ * HiddenField.cs: Added class stub.
+ * GridView.cs: Load autogenerated field properties before
+ creating the children, to make sure that column info is ready.
+ * ControlParameter.cs: Implemented Evaluate method.
+ * ImageField.cs: Added class stub.
+ * BoundField.cs: Added HtmlEncode property.
+ * DataControlFieldCell.cs: Moved AccessibleDataControlFieldCell
+ to its own file.
+ * CheckBoxField.cs: Mostly implemented.
+ * TemplateField.cs: Added class stub.
+ * ObjectDataSourceSelectingEventArgs.cs: Added missing property.
+ * ObjectDataSourceMethodEventArgs.cs: Fixed base class.
+ * Parameter.cs: Added internal GetValue method (Evaluate is protected)
+
+2005-03-23 Lluis Sanchez Gual <lluis@novell.com>
+
+ * DataControlField.cs: Added missing InsertVisible property.
+ * AutoGeneratedFieldProperties.cs: Implemented.
+ * PagerSettings.cs: Minor fix.
+ * GridView.cs: Implemented support for autogenerated fields, templates,
+ accessible headers. Implemented paging using PagedDataSource.
+ Implemented missing overridable methods.
+ * AutoGeneratedField.cs: Initial implementation.
+ * BoundField.cs: Added ReadOnly property.
+ * PagedDataSource.cs: Implemented 2.0 api.
+ * DataControlFieldCell.cs: Implemented AccessibleDataControlFieldCell
+ cell class to be used by accessible headers.
+ * TableCell.cs: Removed unneded constructor. If the cell is bound to
+ a template, call the default RenderContents method.
+
+2005-03-16 Lluis Sanchez Gual <lluis@novell.com>
+
+ * TreeNode.cs, TreeView.cs: Don't raise the SelectedNodeChanged
+ event when loading the view state. Fixes #73746.
+
+2005-03-16 Lluis Sanchez Gual <lluis@novell.com>
+
+ * ListControl.cs: Load selected indices in the right place. Fixes #73745.
+
+2005-03-11 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Button.cs, ImageButton.cs: Interpret PostBackOptions.ClientSubmit
+ correctly.
+ * CommandField.cs: Mostly implemented.
+ * Menu.cs: Use callback methods moved to ClientScriptManager.
+ * DataControlButton.cs: Internal control used to implement buttons
+ for navigating in data bound controls.
+ * DataControlField.cs, PagerSettings.cs: Use the new DataControlButton
+ to render the column headers.
+ * CheckBox.cs, RadioButton.cs, BulletedList.cs, TextBox.cs
+ DropDownList.cs, Calendar.cs, ListBox.cs, LinkButton.cs, TreeView.cs:
+ Don't use Page.GetPostBackClientEvent
+ since it is deprecated in 2.0.
+ * GridView.cs: Implemented some several interfaces.
+ Implemented support client sorting and page navigation (using callbacks).
+ Implemented the autogenerated command column using the new CommandField
+ class.
+ * ButtonFieldBase.cs: Implemented.
+ * GridView.js: New helper script to support client side sorting and
+ paging in the grid view.
+
+2005-03-04 Lluis Sanchez Gual <lluis@novell.com>
+
+ * DataKey.cs: Implemented.
+ * XmlDataSourceView.cs: Implemented support for row pagging.
+ * Table.cs: Fixed attribute value.
+ * DataControlField.cs: Added support for sorting headers.
+ * ChildTable.cs: Created.
+ * ListControl.cs: Delay selection assignment, since control state
+ is now loaded before view state.
+ * GridViewDeleteEventArgs.cs, GridViewUpdateEventArgs.cs,
+ GridViewDeletedEventArgs.cs, GridViewUpdatedEventArgs.cs: Implemented
+ several missing properties.
+ * PagerSettings.cs: Fully implemented.
+ * BaseDataList.cs: Added null check.
+ * GridView.cs: Implemented more functionality.
+ * BoundField.cs: Added support for cell editing.
+ * StringArrayConverter.cs: Implemented.
+ * DataKeyArray.cs: Implemented.
+ * BaseDataBoundControl.cs: Reset the requires binding flag before
+ executing the query. This avoids recursive query calls.
+ * GridViewRow.cs: Handler commands raised from row childs.
+
+2005-02-25 Lluis Sanchez Gual <lluis@novell.com>
+
+ * XmlDataSourceView.cs: ExecuteSelect now returns a list of
+ XmlDataSourceNodeDescriptor instead of a list of nodes. In this way
+ it is possible to query for properties fore each data item.
+ * Menu.cs, TreeView.cs: Make sure that objects are correctly created
+ when loading its view state.
+ * DataControlField.cs: Implement properties using a StateBag.
+ * XmlDataSourcePropertyDescriptor.cs: Implemented.
+ * PagerSettings.cs: Mostly implemented.
+ * AccessDataSourceView.cs, AccessDataSource.cs: Added security attribute.
+ * DataBoundControl.cs: Added null check.
+ * GridView.cs: Initial implementation.
+ * CompositeDataBoundControl.cs: Implemented.
+ * BoundField.cs: Initial implementation.
+ * GridViewRowCollection.cs: Initial implementation.
+ * DataControlFieldCollection.cs: Initial implementation.
+ * DataControlFieldCell.cs: Fixed control tag.
+ * GridViewRow: Initial implementation.
+ * XmlDataSourceNodeDescriptor.cs: Implemented.
+
+2005-02-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebControl.cs: correctly use TagName in RenderBeginTag, ie, if TagKey
+ is zero, use the TagName no matter its value. Fixes bug #72415.
+
+2005-02-18 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Style.cs: Method name fix.
+ * HyperLinkColumn.cs, HyperLink.cs: Moved SoftkeyLabel to HyperLink.
+ * BaseCompareValidator.cs: Method signature fix.
+ * CollectionDataSource.cs: Implemented DataSource wrapper for collections.
+ * BaseDataList.cs, Repeater.cs: Fixed data binding code.
+ * BulletedList.cs: Added missing method.
+ * DataBoundControl.cs, BaseDataBoundControl.cs: Made it behave like MS.NET.
+
+2005-02-16 Lluis Sanchez Gual <lluis@novell.com>
+
+ * HyperLinkColumn.cs, Label.cs: Added missing 2.0 properties.
+ * RadioButton.cs: Added missing 2.0 methods.
+ * ListItem.cs: Added Enabled property.
+ * MailMessageEventArgs.cs: Use the correct message class.
+ * ListControl.cs: Implemented missing properties and support for
+ control state. Implemented base RenderContents method.
+ * Image.cs: Implemented DescriptionUrl and GenerateEmptyAlternateText
+ properties.
+ * BaseCompareValidator.cs: Implemented methods that support conditional
+ use of the invariant culture.
+ * DataBoundControl.cs: Set RequiresDataBinding to true in OnLoad.
+ * SqlDataSourceCommandEventArgs.cs, SqlDataSourceStatusEventArgs.cs:
+ It takes a DbCommand instead of a IDbCommand.
+ * GridViewSortEventArgs.cs: Added SortDirection property.
+ * TextBox.cs, CheckBoxList.cs: Added protected version of
+ IPostBackDataHandler methods.
+ * RadioButtonList.cs: Added protected version of
+ IPostBackDataHandler and IRepeatInfoUser methods.
+ * Repeater.cs: Updated some method names.
+ * DropDownList.cs: Added protected version of
+ IPostBackDataHandler methods. Reuse RenderContents from base class.
+ * RepeaterItem.cs, Localize.cs, Literal.cs: Fix inheritance.
+ * GridViewUpdatedEventArgs.cs: Fix typo.
+ * ListBox.cs: Added protected version of IPostBackDataHandler methods.
+ Reuse RenderContents from base class.
+ * BaseDataBoundControl.cs: Several fixes.
+ * ImageButton.cs, LinkButton.cs: Implemented several 2.0 properties.
+
+2005-02-10 Lluis Sanchez Gual <lluis@novell.com>
+
+ * CheckBoxList.cs: Fix build.
+
+2005-02-10 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Button.cs: Use validation group when validating page.
+ * XmlDataSourceView.cs: Implemented ExecuteSelect.
+ * Menu.cs: Minor fix.
+ * CheckBox.cs: Added 2.0 properties and methods.
+ * BaseDataList.cs: Always databind the control if view state
+ is not enabled.
+ * DataList.cs: In 2.0, use control state to save the selected index.
+ * DetailsViewUpdatedEventArgs.cs: Fix typo.
+ * CustomValidator.cs: Implement IStaticTextControl interface.
+ * CheckBoxList.cs: Added missing 2.0 methods.
+ * DropDownList.cs: Added missing 2.0 methods. Implemented ITextControl
+ interface.
+ * XmlDataSource.cs: Return childs of DocumentElement, not the root
+ document.
+ * DayRenderEventArgs.cs, CompareValidator.cs, DataListItem.cs:
+ Implemented 2.0 API.
+
+
+2005-02-04 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Button.cs: Implemented all missing 2.0 features.
+ * Table.cs: Render the table caption, when specified.
+ * Calendar.cs: Implemented most of missing 2.0 features.
+ * TableCell.cs: Fixed attributes.
+
+2005-02-02 Lluis Sanchez Gual <lluis@novell.com>
+
+ * ControlPropertyNameConverter.cs: Added file.
+
+2005-02-02 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Button.cs, MonthChangedEventArgs.cs, FontInfo.cs, Xml.cs, Style.cs,
+ CookieParameter.cs, HyperLinkColumn.cs, Table.cs,
+ RegularExpressionValidator.cs, WizardNavigationEventArgs.cs,
+ ServerValidateEventArgs.cs, Menu.cs, DataControlField.cs,
+ DataGridPagerStyle.cs, Label.cs, CheckBox.cs, ListItem.cs,
+ RadioButton.cs, TableStyle.cs, ListControl.cs, Image.cs,
+ BaseCompareValidator.cs, FontUnit.cs, DataListCommandEventArgs.cs,
+ IButtonControl.cs, BaseDataList.cs, DataList.cs, BulletedList.cs,
+ RangeValidator.cs, DataBoundControl.cs, ControlParameter.cs,
+ RepeaterItemEventArgs.cs, SqlDataSource.cs, BaseValidator.cs,
+ CustomValidator.cs, MenuItem.cs, SessionParameter.cs, TextBox.cs,
+ QueryStringParameter.cs, Content.cs, ContentPlaceHolder.cs,
+ CheckBoxList.cs, RepeaterCommandEventArgs.cs, RadioButtonList.cs,
+ RequiredFieldValidator.cs, AdRotator.cs, DataListItemEventArgs.cs,
+ DataGridSortCommandEventArgs.cs, Repeater.cs,
+ MenuItemTemplateContainer.cs, HyperLink.cs, SqlDataSourceView.cs,
+ XmlDataSource.cs, MultiView.cs, DataGridCommandEventArgs.cs,
+ Panel.cs, CompositeControl.cs, DataGrid.cs, ButtonColumn.cs,
+ CompareValidator.cs, HierarchicalDataBoundControl.cs,
+ EditCommandColumn.cs, Calendar.cs, SiteMapDataSource.cs,
+ ListBox.cs, TableCell.cs, ObjectDataSourceSelectingEventArgs.cs,
+ ObjectDataSourceMethodEventArgs.cs,DataGridPageChangedEventArgs.cs,
+ WebControl.cs, BaseDataBoundControl.cs, FormParameter.cs,
+ ValidationSummary.cs, View.cs, ImageButton.cs, TableRow.cs,
+ LinkButton.cs, DataGridColumn.cs, Parameter.cs, TableItemStyle.cs,
+ AdCreatedEventArgs.cs:
+
+ General 2.0 API fixes: missing attributes, incorrect inheritance,
+ missing sealed keywords, wrong signatures, etc.
+
+2005-01-28 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Table.cs: Added some 2.0 properties.
+ * FontUnitConverter.cs, UnitConverter.cs: Implemented conversion to
+ InstanceDescriptor.
+ * BaseValidator.cs: Fix warning.
+ * MultiView.cs, ViewCollection.cs, View.cs: Implemented.
+
+2005-01-26 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Menu.cs: Rendering fixes.
+
+2005-01-21 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Content.cs, ContentPlaceHolder.cs, ContentControlBuilder.cs
+ ContentPlaceHolderBuilder.cs: Implemented.
+
+2005-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CheckBox.cs: when rendering the input tag inside a span tag, keep the
+ attributes that are meant to be in the input tag in their place.
+
+2005-01-10 Juraj Skripsky <juraj@hotfeet.ch>
+
+ * RepeatInfo.cs: fixed bug #68927 (DataList with RepeatLayout='Flow'
+ generates invalid html).
+
+2005-01-10 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Menu.cs: Implemented most of missing properties. Added support for
+ item templates. Implemented menu scrolling.
+ * MenuItemBinding.cs: Implemented most of missing properties.
+ * MenuItem.cs: Implemented most of missing properties.
+ * Menu.js: Implemented scrolling and menu reposition into screen.
+ * MenuItemTemplateContainer.cs: Implemented.
+ * SubMenuStyle.cs: Implemented.
+
+2004-12-20 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Style.cs: Implemented RegisteredCssClass property. Added
+ CopyTextStylesFrom method, which copies styles that only apply to text.
+ * Menu.cs, Menu.js: Added hover style support. Define all menu styles
+ in the page stylesheet. Added support for ItemSpacing property.
+ * MenuItemStyle.cs: Implemented FillStyleAttributes method.
+
+2004-12-17 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Style.cs: Generate styles using a CssStyleCollection, so the code can
+ be reused for the 2.0 FillStyleAttributes method.
+ * Menu.cs: Implemented more properties and events. Rendering is very
+ complete now.
+ * MenuItem.cs: Added PopOutImageUrl property.
+ * Menu.js: More work on submenu management.
+
+2004-12-10 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Menu.cs: Implemented basic rendering. Added some missing properties.
+ * MenuItem.cs: Improved implementation of Depth.
+ * Unit.cs: Added serializable attribute.
+ * TreeView.cs: Moved GetScriptLiteral method to ClientScriptManager,
+ so it can be reused.
+ * Menu.js: New script to support he Menu control.
+
+2004-12-03 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MenuEventArgs.cs: Changed to sealed.
+ * TreeView.cs: Minor fix.
+ * Menu.cs, MenuItemBindingCollection.cs, MenuItemCollection.cs,
+ MenuItemStyle.cs, MenuItemBinding.cs, MenuItem.cs,
+ MenuItemStyleCollection.cs: Initial Menu code.
+
+2004-12-02 Lluis Sanchez Gual <lluis@novell.com>
+
+ * TreeNodeBindingCollection.cs, TreeNodeStyleCollection.cs:
+ Implemented SetDirtyObject.
+ * Style.cs: Implemented SetDirty().
+ * TreeNodeBinding.cs: Added missing attributes. Implemented SetDirty().
+ * TreeNode.cs: Added missing attributes added support for
+ PopulateOnDemand. Added some missing property bindings.
+ * TreeNodeCollection.cs: Several minor fixes. SetDirty must be called
+ to newly added elements to make sure al new data is saved.
+ * TreeView.js: Implemented support for client population of nodes.
+ * TreeNodeStyle.cs: Added missing attributes.
+ * TreeView.cs: Implemented support for PopulateNodesFromClient and
+ PopulateOnDemand. Improved rendering.
+
+2004-11-29 Sanjay Gupta <gsanjay@novell.com>
+
+ * DataControlField.cs:
+ * DataControlFieldCell.cs: Initial implementation.
+
+2004-11-26 Lluis Sanchez Gual <lluis@novell.com>
+
+ * TreeNodeBindingCollection.cs: Implemented.
+ * TreeNodeBinding.cs: Implemented.
+ * TreeNode.cs: Added support for data binding.
+ * TreeView_Default_Collapse.gif, TreeView_Default_Expand.gif
+ TreeView_Default_NoExpand.gif: Moved to resources directory.
+ * ListControl.cs: Fixed api.
+ * XmlHierarchicalEnumerable.cs: Made internal.
+ * DataBoundControl.cs: Modified api to match latest ms.net.
+ * TreeView.js: New javascript file to support TreeView in the client.
+ * XmlDataSource.cs: Added missing attributes.
+ * HierarchicalDataBoundControl.cs: Mostly implemented.
+ * BaseDataBoundControl.cs: Mostly implemented.
+ * XmlHierarchyData.cs: Made internal.
+ * TreeView.cs: Mostly implemented. The major missing feature is
+ client side tree population.
+
+2004-11-25 Sanjay Gupta <gsanjay@novell.com>
+
+ * BaseDataList.cs:
+ * DataBountControl.cs:
+ * Repeater.cs: Added SelectArguments property and updated.
+ * SiteMapDataSourceView.cs:
+ * SqlDataSourceView.cs:
+ * XmlDataSourceView.cs: Removed extra method, which was there to
+ keep things compiling.
+
+2004-11-23 Lluis Sanchez Gual <lluis@novell.com>
+
+ * TreeNodeBindingCollection.cs, TreeNodeBinding.cs, TreeNode.cs,
+ TreeNodeCollection.cs, TreeNodeStyleCollection.cs, TreeNodeStyle.cs,
+ TreeView.cs: Initial implementation.
+ * DataBoundControl.cs: Set the correct base class.
+ * HierarchicalDataBoundControl.cs, BaseDataBoundControl.cs: Created stub.
+ * TreeNodeSelectAction.cs: Formatting.
+ * TreeView_Default_Collapse.gif, TreeView_Default_Expand.gif,
+ TreeView_Default_NoExpand.gif: TreeView images.
+
+2004-11-22 Sanjay Gupta <gsanjay@novell.com>
+
+ * SqlDataSourceView.cs: Updated methods and added one property.
+
+2004-11-19 Sanjay Gupta <gsanjay@novell.com>
+
+ * AccessDataSource.cs:
+ * SqlDataSourceView.cs: Implemented CreateDataSourceView () method.
+2004-11-19 Sanjay Gupta <gsanjay@novell.com>
+
+ * SqlDataSource.cs: Updated call to constructor of SqlDataSourceView.cs.
+ * SqlDataSourceView.cs: Updated constructor.
+
+2004-11-19 Sanjay Gupta <gsanjay@novell.com>
+
+ * AccessDataSourceView.cs: Added new class.
+
+2004-11-19 Sanjay Gupta <gsanjay@novell.com>
+
+ * SqlDataSourceView.cs: Corrected exception handling in
+ ExecuteSelect method.
+
+2004-11-18 Lluis Sanchez Gual <lluis@novell.com>
+
+ * SiteMapHierarchicalDataSourceView.cs, SiteMapDataSource.cs: New files.
+ * SiteMapDataSourceView.cs: Minor fix.
+
+2004-11-18 Sanjay Gupta <gsanjay@novell.com>
+
+ * SqlDataSourceView.cs: Updated ExecuteSelect method.
+
+2004-11-18 Sanjay Gupta <gsanjay@novell.com>
+
+ * SqlDataSource.cs: Corrected Select method.
+
+2004-11-18 Sanjay Gupta <gsanjay@novell.com>
+
+ * SqlDataSource.cs: Updated Select method definition.
+ * SqlDataSourceStatusEventArgs.cs: Updated class.
+
+2004-11-15 Lluis Sanchez Gual <lluis@novell.com>
+
+ * SqlDataSourceView.cs: Removed implementation of Events (it is inherited
+ from DataSourceView.cs).
+
+2004-11-10 Raja R Harinath <rharinath@novell.com>
+
+ * SqlDataSourceView.cs (Select): Add 'override' to make it compile.
+
+2004-11-05 Sanjay Gupta <gsanjay@novell.com>
+
+ * SqlDataSource.cs: Corrected method calls.
+ * SqlDataSourceView.cs: Partial implementation of few methods.
+
+2004-10-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListItemCollection.cs: fixed bug when indexing changed elements in
+ LoadViewState. Patch from Alois Bělaška.
+
+2004-10-20 Sanjay Gupta <gsanjay@novell.com>
+
+ * SiteMapDataSourceView.cs:
+ * SqlDataSourceView.cs:
+ * XmlDataSourceView.cs: Cosmetic changes because of modifications in
+ base class, DataSourceView. Changes are to keep things compiling.
+
+2004-10-19 Sanjay Gupta <gsanjay@novell.com>
+
+ * SiteMapDataSourceView.cs: Corrected class definition and updated.
+ * XmlHierarchicalDataSourceView.cs: Modified according to changes in
+ base class.
+
+2004-10-14 Sanjay Gupta <gsanjay@novell.com>
+
+ * AdRotator.cs: Updated.
+
+2004-10-12 Sanjay Gupta <gsanjay@novell.com>
+
+ * AccessDataSource.cs: Updated.
+
+2004-10-08 Sanjay Gupta <gsanjay@novell.com>
+
+ * ValidatedControlConverter.cs: Updated.
+
+2004-10-08 Sanjay Gupta <gsanjay@novell.com>
+
+ * AssociatedControlConverter.cs: Implemented.
+
+2004-10-08 Sanjay Gupta <gsanjay@novell.com>
+
+ * ControlIDConverter.cs: Initial implementation.
+
+2004-10-04 Sanjay Gupta <gsanjay@novell.com>
+
+ * IButtonControl.cs: Corrected property name.
+
+2004-10-04 Sanjay Gupta <gsanjay@novell.com>
+
+ * ParameterCollection.cs: Updated.
+
+2004-10-04 Sanjay Gupta <gsanjay@novell.com>
+
+ * Parameter.cs: Updated and completed implementation.
+
+2004-10-01 Sanjay Gupta <gsanjay@novell.com>
+
+ * ParameterCollection.cs: Resolved warnings, "Unreachable code detected"
+ while compilation.
+
+2004-10-01 Sanjay Gupta <gsanjay@novell.com>
+
+ * AccessDataSource.cs: Initial implementation.
+
+2004-09-30 Sanjay Gupta <gsanjay@novell.com>
+
+ * DataControlRowState.cs:
+ * ScrollBars.cs:
+ * TreeNodeTypes.cs: Added attribute.
+ * DataControlRowType.cs:
+ * HotSpotMode.cs:
+ * SortDirection.cs: Corrected enumeration values.
+ * TableRowSection.cs: Added new enumeration.
+ * ObjectDataSourceStatusEventHandler.cs: Corrected method name.
+
+2004-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TableStyle.cs: don't render empty 'rules' attribute (again).
+
+2004-09-21 Sanjay Gupta <gsanjay@novell.com>
+
+ * FormViewUpdatedEventArgs.cs: Spelling mistake.
+
+2004-09-14 Sanjay Gupta <gsanjay@novell.com>
+
+ * Literal.cs: Added new method Focus().
+
+2004-09-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RadioButton.cs: fix GroupName when the control is inside a
+ NamingContainer different from Page. Closes bug #65586.
+
+2004-09-07 Sanjay Gupta <gsanjay@novell.com>
+
+ * Localize.cs: Added new class.
+
+2004-09-03 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * CompositeControl.cs : Completed
+ * Login.cs : Initial implementation.
+
+2004-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Xml.cs: fixed get_DocumentContent (it was returning "" always!) and
+ don't call MapPathSecure on the content itself.
+
+ * XmlBuilder.cs: handle XML documents written inside asp:xml. The
+ document is checked at parse time and will be checked again at run time.
+
+ Fixes bug #63828.
+
+2004-08-31 Sanjay Gupta <gsanjay@novell.com>
+
+ * AuthenticateEventHandler.cs:
+ * CreateUserErrorEventArgs.cs:
+ * CreateUserErrorEventHandler.cs:
+ * DetailsViewCommandEventHandler.cs:
+ * DetailsViewDeleteEventArgs.cs:
+ * DetailsViewDeleteEventHandler.cs:
+ * DetailsViewDeletedEventArgs.cs:
+ * DetailsViewDeletedEventHandler.cs:
+ * DetailsViewInsertEventArgs.cs:
+ * DetailsViewInsertEventHandler.cs:
+ * DetailsViewInsertedEventArgs.cs:
+ * DetailsViewInsertedEventHandler.cs:
+ * DetailsViewModeEventArgs.cs:
+ * DetailsViewModeEventHandler.cs:
+ * DetailsViewPageEventHandler.cs:
+ * DetailsViewUpdateEventArgs.cs:
+ * DetailsViewUpdateEventHandler.cs:
+ * DetailsViewUpdatedEventArgs.cs:
+ * DetailsViewUpdatedEventHandler.cs:
+ * FormViewCommandEventHandler.cs:
+ * FormViewDeleteEventArgs.cs:
+ * FormViewDeleteEventHandler.cs:
+ * FormViewDeletedEventArgs.cs:
+ * FormViewDeletedEventHandler.cs:
+ * FormViewInsertEventArgs.cs:
+ * FormViewInsertEventHandler.cs:
+ * FormViewInsertedEventArgs.cs:
+ * FormViewInsertedEventHandler.cs:
+ * FormViewModeEventHandler.cs:
+ * FormViewPageEventHandler.cs:
+ * FormViewUpdateEventArgs.cs:
+ * FormViewUpdateEventHandler.cs:
+ * FormViewUpdatedEventArgs.cs:
+ * FormViewUpdatedEventHandler.cs:
+ * GridViewCancelEditEventArgs.cs:
+ * GridViewCancelEditEventHandler.cs:
+ * GridViewCommandEventHandler.cs:
+ * GridViewDeleteEventArgs.cs:
+ * GridViewDeleteEventHandler.cs:
+ * GridViewDeletedEventArgs.cs:
+ * GridViewDeletedEventHandler.cs:
+ * GridViewEditEventHandler.cs:
+ * GridViewPageEventHandler.cs:
+ * GridViewRowEventHandler.cs:
+ * GridViewSelectEventHandler.cs:
+ * GridViewSortEventArgs.cs:
+ * GridViewSortEventHandler.cs:
+ * GridViewUpdateEventArgs.cs:
+ * GridViewUpdateEventHandler.cs:
+ * GridViewUpdatedEventArgs.cs:
+ * GridViewUpdatedEventHandler.cs:
+ * ImageMapEventHandler.cs:
+ * MailMessageEventHandler.cs:
+ * MenuEventHandler.cs:
+ * ObjectDataSourceDisposingEventHandler.cs:
+ * ObjectDataSourceEventHandler.cs:
+ * ObjectDataSourceMethodEventArgs.cs:
+ * ObjectDataSourceMethodEventHandler.cs:
+ * ObjectDataSourceSelectingEventArgs.cs:
+ * ObjectDataSourceSelectingEventHandler.cs:
+ * ObjectDataSourceStatusEventArgs.cs:
+ * ObjectDataSourceStatusEventHandler.cs:
+ * SendMailErrorEventHandler.cs:
+ * SiteMapNodeItemEventHandler.cs:
+ * SqlDataSourceSelectingEventArgs.cs:
+ * SqlDataSourceSelectingEventHandler.cs:
+ * TreeNodeEventHandler.cs:
+ * WizardNavigationEventArgs.cs:
+ * WizardNavigationEventHandler.cs: Minor modifications, compiler error
+ corrections and removing "sealed" access specifier from *EventHandler.cs
+
+2004-08-18 Sanjay Gupta <gsanjay@novell.com>
+
+ * Literal.cs: Added new attributes and property for .Net 2.0
+
+2004-08-13 Sanjay Gupta <gsanjay@novell.com>
+
+ * GridViewDeleteEventArgs.cs: Removed extra code.
+
+2004-08-12 Sanjay Gupta <gsanjay@novell.com>
+
+ * SendMailErrorEventArgs.cs:
+ * SendMailErrorEventHandler.cs:
+ * SiteMapNodeItemEventArgs.cs:
+ * SiteMapNodeItemEventHandler.cs:
+ * SqlDataSourceSelectingEventArgs.cs:
+ * SqlDataSourceSelectingEventHandler.cs:
+ * TreeNodeEventArgs.cs:
+ * TreeNodeEventHandler.cs:
+ * WizardNavigationEventArgs.cs:
+ * WizardNavigationEventHandler.cs: Added new delegates.
+
+2004-08-11 Sanjay Gupta <gsanjay@novell.com>
+
+ * ImageMapEventArgs.cs:
+ * ImageMapEventHandler.cs:
+ * MailMessageEventArgs.cs:
+ * MailMessageEventHandler.cs:
+ * MenuEventArgs.cs:
+ * MenuEventHandler.cs:
+ * ObjectDataSourceDisposingEventArgs.cs:
+ * ObjectDataSourceDisposingEventHandler.cs:
+ * ObjectDataSourceEventArgs.cs:
+ * ObjectDataSourceEventHandler.cs:
+ * ObjectDataSourceMethodEventArgs.cs:
+ * ObjectDataSourceMethodEventHandler.cs:
+ * ObjectDataSourceSelectingEventArgs.cs:
+ * ObjectDataSourceSelectingEventHandler.cs:
+ * ObjectDataSourceStatusEventArgs.cs:
+ * ObjectDataSourceStatusEventHandler.cs: Added new delegates.
+
+2004-08-11 Sanjay Gupta <gsanjay@novell.com>
+
+ * DetailsViewCommandEventArgs.cs:
+ * FormViewCommandEventArgs.cs:
+ * GridViewCommandEventArgs.cs: Corrected constructor.
+
+2004-08-11 Sanjay Gupta <gsanjay@novell.com>
+
+ * GridViewCancelEditEventArgs.cs:
+ * GridViewCancelEditEventHandler.cs:
+ * GridViewCommandEventArgs.cs:
+ * GridViewCommandEventHandler.cs:
+ * GridViewDeletedEventArgs.cs:
+ * GridViewDeletedEventHandler.cs:
+ * GridViewDeleteEventArgs.cs:
+ * GridViewDeleteEventHandler.cs:
+ * GridViewEditEventArgs.cs:
+ * GridViewEditEventHandler.cs:
+ * GridViewPageEventArgs.cs:
+ * GridViewPageEventHandler.cs:
+ * GridViewRowEventArgs.cs:
+ * GridViewRowEventHandler.cs:
+ * GridViewSelectEventArgs.cs:
+ * GridViewSelectEventHandler.cs:
+ * GridViewSortEventArgs.cs:
+ * GridViewSortEventHandler.cs:
+ * GridViewUpdatedEventArgs.cs:
+ * GridViewUpdatedEventHandler.cs:
+ * GridViewUpdateEventArgs.cs:
+ * GridViewUpdateEventHandler.cs: Added new delegates.
+
+2004-08-11 Sanjay Gupta <gsanjay@novell.com>
+
+ * FormViewUpdatedEventArgs.cs: Corrected constructor.
+
+2004-08-11 Sanjay Gupta <gsanjay@novell.com>
+
+ * FormViewCommandEventArgs.cs: Corrected name of class.
+
+2004-08-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Xml.cs: use MapPath in DocumentSource and documentContent. Fixes
+ bug #62726.
+
+2004-08-10 Sanjay Gupta <gsanjay@novell.com>
+
+ * FormViewCommandEventArgs.cs:
+ * FormViewCommandEventHandler.cs:
+ * FormViewDeletedEventArgs.cs:
+ * FormViewDeletedEventHandler.cs:
+ * FormViewDeleteEventArgs.cs:
+ * FormViewDeleteEventHandler.cs:
+ * FormViewInsertedEventArgs.cs:
+ * FormViewInsertedEventHandler.cs:
+ * FormViewInsertEventArgs.cs:
+ * FormViewInsertEventHandler.cs:
+ * FormViewModeEventArgs.cs:
+ * FormViewModeEventHandler.cs:
+ * FormViewPageEventArgs.cs:
+ * FormViewPageEventHandler.cs:
+ * FormViewUpdatedEventArgs.cs:
+ * FormViewUpdatedEventHandler.cs:
+ * FormViewUpdateEventArgs.cs:
+ * FormViewUpdateEventHandler.cs: Added new delegates.
+
+2004-08-10 Sanjay Gupta <gsanjay@novell.com>
+
+ * DetailsViewCommandEventArgs.cs:
+ * DetailsViewCommandEventHandler.cs:
+ * DetailsViewDeletedEventArgs.cs:
+ * DetailsViewDeletedEventHandler.cs:
+ * DetailsViewDeleteEventArgs.cs:
+ * DetailsViewDeleteEventHandler.cs:
+ * DetailsViewInsertedEventArgs.cs:
+ * DetailsViewInsertedEventHandler.cs:
+ * DetailsViewInsertEventArgs.cs:
+ * DetailsViewInsertEventHandler.cs:
+ * DetailsViewModeEventArgs.cs:
+ * DetailsViewModeEventHandler.cs:
+ * DetailsViewPageEventArgs.cs:
+ * DetailsViewPageEventHandler.cs:
+ * DetailsViewUpdatedEventArgs.cs:
+ * DetailsViewUpdatedEventHandler.cs:
+ * DetailsViewUpdateEventArgs.cs:
+ * DetailsViewUpdateEventHandler.cs: Added new delegates.
+
+2004-08-09 Sanjay Gupta <gsanjay@novell.com>
+
+ * AuthenticateEventArgs.cs:
+ * AuthenticateEventHandler.cs:
+ * CreateUserErrorEventArgs.cs:
+ * CreateUserErrorEventHandler.cs: Added new delegates.
+
+2004-08-05 Sanjay Gupta <gsanjay@novell.com>
+
+ * IButtonControl.cs:
+ * ICallbackContainer.cs:
+ * ICompositeControlDesignerAccessor.cs:
+ * IPostBackContainer.cs: Added new interfaces.
+
+2004-08-03 Sanjay Gupta <gsanjay@novell.com>
+
+ * AdType.cs:
+ * AutoCompleteType.cs:
+ * ContentDirection.cs:
+ * DataControlCellType.cs:
+ * DataControlRowState.cs:
+ * DataControlRowType.cs:
+ * DetailsViewMode.cs:
+ * DynamicImageParameterMode.cs:
+ * FormViewMode.cs:
+ * HotSpotMode.cs:
+ * ImageFieldMode.cs:
+ * LiteralMode.cs:
+ * LogoutAction.cs:
+ * Orientation.cs:
+ * PagerButtons.cs:
+ * PathDirection.cs:
+ * ScrollBars.cs:
+ * SiteMapNodeItemType.cs:
+ * SiteMapNodeType.cs:
+ * SiteMapViewType.cs:
+ * SortDirection.cs:
+ * TableCaptionAlign.cs:
+ * TableHeaderScope.cs:
+ * TableViewMode.cs:
+ * TreeNodeSelectAction.cs:
+ * TreeNodeTypes.cs:
+ * TreeViewImageSet.cs:
+ * WizardStepType.cs: Added enumerations
+
+2004-08-02 Duncan Mak <duncan@ximian.com>
+
+ * ButtonType.cs:
+ * LoginFailureAction.cs:
+ * LoginTextLayout.cs: Added enumerations.
+
+2004-07-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseValidator.cs: in Validate(), when the control is not visible or
+ enabled, return inmediately after setting IsValid to true. Fixes bug
+ #61831.
+
+2004-07-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataList.cs: s/HasChildren/HasControls()/.
+
+2004-07-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataList.cs: style.
+
+2004-07-27 Alon Gazit <along@mainsoft.com>
+ * DataList.cs: Replaced foreach statement with for statement,
+ in order to improve performence.
+
+2004-07-27 Alon Gazit <along@mainsoft.com>
+ * WebControl.cs: changed RenderBeginTag()to use TagKey instead of
+ TagName.
+ * Unit.cs : changed GetTypeFromString() and GetStringFromPixel() to use
+ switch statements in order to improve performance.
+
+2004-06-10 Alon Gazit <along@mainsoft.com>
+ * WebControl.cs: fixed LoadViewState().
+ Creates new attributes state bag only when the current is null.
+
+2004-06-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs: implemented OnPreRender and HasWeekSelectors.
+
+2004-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs: set the title class attribute if we have it. Fixes bug
+ 53671.
+
+2004-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Style.cs: added SetBit.
+
+2004-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs:
+ * CompareValidator.cs:
+ * ImageButton.cs:
+ * Style.cs:
+ * WebControl.cs: Added protected missing members and attributes.
+
+2004-05-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TextBox.cs: don't save the Text if in ViewState if it's a password.
+ Save it if the control is not visible or not enabled. Fixes bug #58497.
+
+2004-05-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs: fire OnDayRender after assigning the calendar cell text.
+ Fixes bug #58097.
+
+2004-05-09 Gert Driesen (drieseng@users.sourceforge.net)
+ * Parameter.cs:
+ * SqlDataSourceCommandEventArgs:
+ * XmlDataSource.cs : removed temporary workarounds for CLS
+ compliance as System.Data is now CLS compliant
+
+2004-05-06 Alon Gazit <along@mainsoft.com>
+ * WebControl.cs: fixed LoadViewState() and SaveViewState().
+ Before the change the Enabled property wasn't updated when a postback
+ event was raised.
+ * ListControl.cs: fixed SelectedIndex property implementation.
+ Prevents throwing ArgumentOutOfRangeException (that should not be
+ thrown), when the list is empty.
+
+2004-04-28 Alon Gazit <along@mainsoft.com>
+ * WebControl.cs: fixed LoadViewState().
+ Always loading the saved attributes collection.
+
+2004-04-18 Alon Gazit <along@mainsoft.com>
+ * Repeater.cs: fixed InstantiateItem() and DataSource property.
+ The change in DataSource prevents throwing ArgumentException while
+ setting property value to null.
+ The change in InstantiateItem() prevents NullReferenceException.
+
+2004-04-07 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * BaseValidator.cs: Store Display property in the correct ViewState
+ property. Don't render anything if Display is ValidatorDisplay.None.
+
+2004-03-30 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * Xml.cs: In LoadXpathDoc(), don't use MapPathSecure with documentSource,
+ since it is already a physical path. Fixes bug #55334.
+
+2004-02-13 Jackson Harper <jackson@ximian.com>
+
+ * Calendar.cs: Match MS postback data. This allows sites that
+ parse the postback data manually to work.
+
+2004-02-04 Alon Gazit <along@mainsoft.com>
+ * EditCommandColumn.cs: fixed InitializeCell().
+ The rendered LiteralControl should contain "&nbsp;" and not " ".
+
+2004-02-01 Alon Gazit <along@mainsoft.com>
+
+ * DataGrid.cs: fixed a problem in the paging mechanism in the method
+ InitializePager().
+ the problem was when (PagerStyle.Mode == PagerMode.NumericPages),
+ while clicking the "..." link in the second page.
+
+2004-01-28 Alon Gazit <along@mainsoft.com>
+
+ * Calendar.cs: prevent NullReferenceException in RenderAllDays().
+
+2004-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs: when rendering days, add a LiteralControl containing the
+ day before OnDayRender is called. Only generate the default links for
+ days when IsSelectable is true after OnDayRender. Fixes bug #53372.
+
+2004-01-21 Martin Baulig <martin@ximian.com>
+
+ * XmlHierarchyData.cs: Make this compile with csc.
+
+ * BulletedList.cs (BulletedList.SelectedItem): Removed the `set'
+ accessor since the base class doesn't have one.
+
+2004-01-18 Alon Gazit <along@mainsoft.com>
+
+ * CheckBoxList.cs: fix problem with negative TabIndex (wasn't rendered).
+
+2004-01-18 Alon Gazit <along@mainsoft.com>
+
+ * Style.cs: CopyFrom method shouldn't copy a value that is equal to
+ Property default value.
+ * FontInfo.cs : CopyFrom method shouldn't copy a value that is equal to
+ Property default value.
+
+2004-01-15 Alon Gazit <along@mainsoft.com>
+
+ * RadioButtonList.cs: RepeatLayout property should affect the rendered
+ html.
+
+2004-01-15 Alon Gazit <along@mainsoft.com>
+ * FontInfo.cs: Add validation check to Size property.
+
+2004-01-07 Alon Gazit <along@mainsoft.com>
+ * DataGrid.cs: Fixed PrepareControlHierarchyForItem().
+ merge the column's style to the cell's style and not to
+ the item's(row) style.
+
+2004-01-04 Alon Gazit <along@mainsoft.com>
+ * RangeValidator.cs: Fixed ControlPropertiesValid().
+
+2004-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Xml.cs: mono-stylized and removed warnings.
+
+2004-1-1 Alon Gazit <along@mainsoft.com>
+ * RadioButtonList.cs: update RenderItem() so that each RadioButton
+ is enabled or disabled like the RadioButtonList.
+ * CheckBoxList.cs: update RenderItem() so that each CheckBox
+ is enabled or disabled like the CheckBoxList.
+
+2004-1-1 Alon Gazit <along@mainsoft.com>
+ * DataGrid.cs: Fixed PrepareControlHierarchyForItem().
+ The Header or Footer Style shouldn't merge with the cells Style.
+
+2004-1-1 Alon Gazit <along@mainsoft.com>
+ * DataGridColumn.cs: Headers and Footers are initialized
+ with the relevant Style object.
+
+2003-12-30 Alon Gazit <along@mainsoft.com>
+ * RepeatInfo.cs: Fixed DoVerticalRendering () and
+ DoHorizontalRendering().
+ Current implementation produces few extra html tags.
+
+2003-12-29 Alon Gazit <along@mainsoft.com>
+
+ * CheckBox.cs: change the implementation of LoadPostData.
+ Currently, while the AutoPostBack property equals true ,
+ it isn't possible to perform uncheck.
+
+2003-12-19 Jackson Harper <jackson@ximian.com>
+
+ * TableCell.cs: Setting a cells text should clear its control
+ collection as per la specification. This fixes bug #51825.
+
+2003-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGridColumn.cs: stylized LoadViewState.
+ * DataGridColumnCollection.cs: when TrackViewState is called, also
+ call it on all the existing columns. Fixes bug #52334.
+
+2003-12-18 Alon Gazit <along@mainsoft.com>
+
+ * DataGridPagerStyle.cs: merge DataGridPagerStyle properties when Style
+ is empty.
+
+2003-12-18 Alon Gazit <along@mainsoft.com>
+
+ * TableStyle.cs: merge TableStyle properties when Style is empty.
+
+2003-12-16 Alon Gazit <along@mainsoft.com>
+
+ * HyperLink.cs: Change Text property implementation. in MS when the Text
+ property is set, all the controls in the HyperLink are being deleted.
+ This fixes bug #52239.
+
+2003-12-15 Alon Gazit <along@mainsoft.com>
+ * RepeatInfo.cs: Fixed DoVerticalRendering () and
+ DoHorizontalRendering().
+ Both methods add additional empty table row in the head of each item
+ table when the variable named isTable equals true (happenes with the
+ default instantiation of RepeatInfo). These additional rows should be
+ added when isTable equals false.
+ This fixes bug #52225.
+
+2003-12-15 Alon Gazit <along@mainsoft.com>
+
+ * RepeatInfo.cs: Fixed DoVerticalRendering() and
+ DoHorizontalRendering().
+ Both methods add to rendered Header a colspan attribute according to the
+ rows count. after the change the colspan is added according to the
+ columns count.
+
+2003-12-15 Alon Gazit <along@mainsoft.com>
+ * CheckBox.cs: Disabled CheckBox does not produce same HTML as .NET.
+ In .NET if the checkbox is disabled ,its text appears disabled too.
+ In Mono the text appears enabled. the fix is in Render().
+ This fixes bug #52180.
+
+2003-12-15 Alon Gazit <along@mainsoft.com>
+ * Repeater.cs: Change the implementation of CreateControlHierarchy().
+ The current implementation renders extra Header and footer
+ without Repeater.DataSource assign.
+ This fixes bug #52179.
+
+2003-12-15 Alon Gazit <along@mainsoft.com>
+ * DataGrid.cs: Change the implementation of the property
+ BackImageUrl. The current implementation has no influence
+ on the rendered Html.
+
+2003-12-15 Alon Gazit <along@mainsoft.com>
+ * WebControl.cs: Change the implementation of the property
+ Enabled. Before the change the WebControl also looked at
+ parent.Enabled . fixed bug #52171.
+
+2003-12-11 Jackson Harper <jackson@ximian.com>
+
+ * RepeatInfo.cs: When rendering vertically figure out how many
+ colmns are not going to be filled in in the last row, and adjust
+ things accordingly. This fixes bug #51863.
+
+2003-12-10 Alon Gazit <along@mainsoft.com>
+ * TableRow.cs: Change the implementation of the properties
+ HorizontalAlign and VerticalAlign. The current implementation
+ has no influence on the rendered Html.
+
+2003-12-10 Alon Gazit <along@mainsoft.com>
+ * TableItemStyle.cs: Add setting of The WRAP flag in the Wrap
+ property's set method.
+
+2003-12-09 Jackson Harper <jackson@ximian.com>
+
+ * PagedDataSource.cs (PrivateICollectionEnumerator.MoveNext):
+ Increment counter when moving to start. Fixes bug #51926.
+
+2003-12-08 Jackson Harper <jackson@ximian.com>
+
+ * HyperLinkColumn.cs: Fix navigate url rendering. Patch by
+ Benjamin Jemlich. Fixes bug #51823.
+
+2003-12-07 Alon Gazit <along@mainsoft.com>
+ * Panel.cs: Panel doesn't render nowrap attribute while the Wrap
+ property is set to false. Fixes bug #58120.
+
+2003-12-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TableItemStyle.cs: merge TableItemStyle properties when Style is
+ empty. Fixes bug #51689. Patch by Alon Gazit <along@mainsoft.com>.
+
+2003-12-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RadioButtonList.cs: render tabindex attribute if needed. Fixes bug
+ #51648.
+
+2003-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebControl.cs: don't create the attributes when GetAttribute is
+ called.
+
+2003-12-01 Jackson Harper <jackson@ximian.com>
+
+ * WebControl.cs: Only allow access keys to be null or a single
+ char. Patch by Alon Gazit <along@mainsoft.com>.
+
+2003-11-30 Jackson Harper <jackson@ximian.com>
+
+ * CheckBoxList.cs: A checkbox will have null post data if it is
+ unselected. This fixes bug #51516.
+
+2003-11-29 Jackson Harper <jackson@ximian.com>
+
+ * DataGrid.cs: Display paging controls even when there is no
+ data. Path by Mohammad DAMT. Fixes bug #51487.
+
+2003-11-29 Jackson Harper <jackson@ximian.com>
+
+ * DataGrid.cs: Call TrackViewState when loading bound columns view
+ state. So that their state is saved. This fixes bug #51424. Also
+ set ReadOnly.
+
+2003-11-26 Jackson Harper <jackson@ximian.com>
+
+ * BaseDataList.cs: Change && to || We will call that a typo so no
+ one gets embarrased.
+
+2003-11-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseDataList.cs: allow setting null as Datasource.
+
+ * DataGrid.cs: keep autogenerated columns in the ViewState.
+
+ Patches by Alon Gazit <along@mainsoft.com>.
+
+2003-11-22 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * SqlDataSource*: Implement almost everything. Data access is
+ still missing.
+
+2003-11-22 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * Calendar.cs (SaveViewState):
+ - We were allocating a 11 item array, we only used 10 items,
+ so only allocate 10.
+ - We only need to save the selected dates if there are any.
+ * DataGrid.cs (SaveViewState):
+ * DataGridColumn.cs (SaveViewState):
+ * DataGridColumnCollection.cs (SaveViewState):
+ - Only return the array if there is anything in it
+ * Style.cs (SaveViewState):
+ - Only save the bits if there were changes.
+ * WebControl.cs (SaveViewState), (LoadViewState):
+ - Don't save Enabled into the viewstate here, we already
+ do it in the property. This just caused *EVERY* control
+ to have a non-null state, taking up lots of extra room
+ in the ViewState.
+ - The style will always be created with this control's
+ viewstate, so the style will always return null for the
+ viewstate. As such, we do not need to store it. We can
+ also reduce the triplet to a pair because of this.
+
+2003-11-22 Jackson Harper <jackson@ximian.com>
+
+ * ValidationSummary.cs: Fix number of messages and message array computation.
+
+2003-11-21 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * Xml.cs: Corrected attribute
+ * XmlBuilder.cs: Added
+
+2003-11-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Xml.cs: class status based fixes.
+
+2003-11-19 Jackson Harper <jackson@ximian.com>
+
+ * HyperLink.cs: Use ResolveUrl instead of ResolveBaseUrl.
+
+2003-11-19 Jackson Harper <jackson@ximian.com>
+
+ * HyperLink.cs: Use ResolveBaseUrl so that ~/ is interpreted as
+ teh applications base directory. This fixes bug #51092.
+
+2003-11-18 Todd Berman <tberman@gentoo.org>
+
+ * ControlParameter.cs:
+ * CookieParameter.cs:
+ * FormParameter.cs:
+ * QueryStringParameter.cs:
+ * SessionParameter.cs: added public .ctor ()
+ * Parameter.cs: added public .ctor (), internal SetOwnerCollection
+ and handling, as well as internal ParameterValue for easy access.
+ NOTE: ParameterValue doesnt respect TreatEmptyStringAsNull yet.
+ * ParameterCollection.cs: implementation redux.
+
+2003-11-18 Todd Berman <tberman@gentoo.org>
+
+ * ParameterCollection.cs: Implemented
+ * Parameter.cs: Added _owner, SetOwnerCollection and proper handling.
+ ToString () now matches asp.net
+
+2003-11-17 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * ControlParameter.cs:
+ * CookieParameter.cs:
+ * FormParameter.cs:
+ * Parameter.cs:
+ * QueryStringParameter.cs: New v2 files. Mostly
+ implemented, still need a few methods.
+
+2003-11-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListItem.cs: prevent nullrefs ni Get/SetAttribute. Thanks to Alon
+ Gazit <along@mainsoft.com>.
+
+2003-11-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RadioButton.cs: fixed RenderInputTag for negative TabIndex values.
+ Patch by Alon Gazit <along@mainsoft.com>.
+
+2003-11-09 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * DataBoundControl.cs: Implement
+ * ListControl.cs: inherit from the above.
+ * Repeater.cs, BaseDataList.cs: should reset whenever we databind.
+
+2003-11-09 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * BaseDataList.cs:
+ * DataGrid.cs:
+ * DataList.cs:
+ * Repeater.cs: add v2 databinding stuff
+ * XmlDataSource.cs: make it load the xml.
+
+2003-11-09 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * XmlDataSource.cs:
+ * XmlDataSourceView.cs:
+ * XmlHierarchicalDataSourceView.cs:
+ * XmlHierarchicalEnumerable.cs:
+ * XmlHierarchyData.cs: Implement
+
+2003-11-08 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * SiteMapDataSourceView.cs: Implement.
+
+2003-11-07 Jackson Harper <jackson@ximian.com>
+
+ * ImageButton.cs: This is a workaround for bug #49819. It appears
+ that the .x and .y values are not being posted, and only the x
+ value is being posted with the ctrl's id as the key.
+
+2003-11-07 Jackson Harper <jackson@ximian.com>
+
+ * DataGrid.cs (CreateControlHierarchy): Current page index is
+ alolowed to equal page count. This prevents an exception being
+ thrown when both are zero.
+
+2003-11-06 Jackson Harper <jackson@ximian.com>
+
+ * ValidationSummary.cs: Add Render method. Patch by Yaron Shkop.
+ * BaseValidator.cs: Disable base control so the isValid flag is
+ not reset.
+
+2003-11-03 Jackson Harper <jackson@ximian.com>
+
+ * TemplateColumn.cs: Use the same renderer for selected items as
+ normal items. This fixes bug #49744.
+
+2003-11-03 Jackson Harper <jackson@ximian.com>
+
+ * DataList.cs:
+ * WebControl.cs: Fix argument out of range exceptions on
+ properties. Patch by Yaron Shkop.
+
+2003-11-03 Jackson Harper <jackson@ximian.com>
+
+ * TemplateColumn.cs: If the item is selected but there is no
+ editItemTemplate use the itemTemplate. This matches MS behvoir.
+
+2003-11-03 Jackson Harper <jackson@ximian.com>
+
+ * Repeater.cs: Always set alternating items to the AlternatingItem
+ type, when instantiating alternating items use the itemTemplate if
+ the alternatingItem template is null. This matches MS behavoir and
+ fixes bug #50157.
+
+2003-11-03 Jackson Harper <jackson@ximian.com>
+
+ * DataGridPagerStyle.cs: Name of view state attribute is
+ PagerVisible not Visible. Call owner.OnPagerChanged when the pager
+ visibility is changed. Patch by Yaron Shkop.
+
+2003-11-03 Jackson Harper <jackson@ximian.com>
+
+ * RepeatInfo.cs: When doing horizontal rendering use the repeat
+ columns as the number of columns in a row. This fixes bug #49016.
+
+2003-11-03 Jackson Harper <jackson@ximian.com>
+
+ * PagedDataSource.cs (PageCount): Return page count of 1 if there
+ paging is disabled. Patch by Yaron Shkop.
+ * PagedDataSource.cs (CopyTo): Improve. Patch by Yaron Shkop.
+ * TableStyle.cs (AddAttributesToRender): Render border style
+ collapse. Patch by Yaron Shkop.
+ * TableStyle.cs:
+ * TableItemStyle.cs:
+ * DataGridPagerStyle.cs: Call base copy and merge even if style is of
+ the wrong type. Patch by Yaron Shkop.
+
+2003-11-03 Jackson Harper <jackson@ximian.com>
+
+ * BoundColumn.cs: Render readonly columns. Patch by Mohammad DAMT.
+
+2003-11-02 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * BulletStyle.cs:
+ * BulletedListDisplayMode.cs:
+ * BulletedListEventHandler.cs:
+ * BulletedList.cs:
+ * BulletedListEventArgs.cs: V2 controls (yay!)
+
+2003-10-30 Jackson Harper <jackson@ximian.com>
+
+ * Repeater.cs: Throw an exception if the datasource is set to
+ something that does not implement either IListSource or
+ IEnumerable. This fixes bug #50155.
+
+2003-10-30 Jackson Harper <jackson@ximian.com>
+
+ * DataGridPagerStyle.cs: Do not allow page button counts to be set
+ to less then 1. Patch by Yaron Shkop. This fixes bug #50236.
+
+2003-10-29 Jackson Harper <jackson@ximian.com>
+
+ * ButtonColumn.cs: Format string and text to format were
+ inversed. This fixes bug #50171.
+
+2003-10-29 Jackson Harper <jackson@ximian.com>
+
+ * DataGridColumn.cs: If an item style is set apply it to the
+ cell. This fixes bug #50173.
+
+2003-10-29 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * HyperLinkColumn.cs: Patch by Yaron Shkop. Fixes #50234. Remove
+ old debugging value.
+
+2003-10-29 Jackson Harper <jackson@ximian.com>
+
+ * PagedDataSource.cs:
+ * DataGrid.cs: Patch by Mohammad DAMT. Do not go past the
+ end of the last page. Fixes bug #5085.
+
+2003-10-29 Jackson Harper <jackson@ximian.com>
+
+ * CheckBox.cs: Do not change the status of a checkbox when there
+ is no post data. This fixes bug #49091.
+ * CheckBoxList.cs: Do not change the status of the checkboxes when
+ there is no post data. This fixes bug #49093.
+
+2003-10-26 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * RadioButton.cs: Patch by Yaron Shkop. Enables disabling a
+ RadioButton. Fixes #50132
+
+2003-10-25 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * PagedDataSource.cs: Patch by Ivo Haamer. Typo prevented
+ paging from working. Fixes #48814.
+
+2003-10-25 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * DataGrid.cs: A few typos kept us from viewing datagrids
+ that were based on customized collections.
+
+2003-10-24 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * DataGridCommandEventArgs.cs: typo, cmdSrc was becoming origionalArgs.
+
+2003-10-23 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * Calendar.cs: render the next month button so that aligns to the
+ right.
+
+2003-10-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseCompareValidator.cs: splitted Convert. Fixed bug #49927. The fix
+ was just changing && by || after the first Match.
+
+2003-10-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs: apply header style in RenderHeader. Fixes bug #49144.
+ Patch by Yaron Shkop.
+
+2003-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGrid.cs: applied patch from Yaron Shkop (yaronsh@mainsoft.com)
+ that fixes bug #49744. Now the selection doesn't lose its data.
+
+2003-10-21 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * EditCommandColumn.cs: Implement; fix #49736
+
+2003-10-21 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * ButtonColumn.cs: Use the DataGridLinkButton, so that we inherit
+ the forground color. bug #49738
+
+2003-10-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs: fixed bug #49727.
+
+2003-10-18 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * TableStyle.cs: fix #49740.
+
+2003-10-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SelectedDatesCollection.cs: fix by Yaron for bug #49698.
+ * ValidationSummary.cs: fixes bug #49669.
+
+2003-10-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs: apply the calendar style to the new Table, not to itself.
+ Fixes #49406.
+
+ * CheckBox.cs: render the hidden fields if AutoPostBack.
+
+ * Style.cs: don't render empty width/height. Small improvement in
+ CopyFrom.
+
+ * Table.cs: fixed condition for border width.
+
+ * TableStyle.cs:
+ (CopyFrom): always call the base class to copy other attributes. Fixes
+ bug #49408. Don't render empty 'rules' attribute.
+
+ * WebControl.cs: track viewstate when enabled. Don't overwrite source
+ control attributes in CopyBaseAttributes.
+
+ * ChangeLog: fixed dates.
+
+
+2003-10-08 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * WebControl.cs : Attributes { get; } - Is Complete.
+ * ValidationSummary.cs : AddAttributesToRender(HtmlTextWriter)
+ - Completed.
+
+2003-10-08 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * BaseValidator.cs : DetermineRenderUplevel() - Completed.
+ : RegisterValidatorCommonScript()
+ - More code, I need HELP!
+ : RegisterValidatorDeclaration()
+ - More code, I need HELP!
+
+2003-09-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CheckBoxList.cs: don't lose state when enabling/disabling. See bug
+ #48802.
+
+2003-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Repeater.cs: fixed bug #48807. It needed to use a DummyDataSource and
+ ClearViewState only called when no items.
+
+2003-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RadioButtonList.cs: fix for bug #48874 by Yaron Shkop.
+
+2003-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RadioButtonList.cs: fix for bug #48870 by Yaron Shkop.
+
+2003-09-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataList.cs: fixed bug #48217. Patch by yaronsh@mainsoft.com (Yaron
+ Shkop).
+
+2003-09-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AdRotator.cs: fixes bug #48691. Patch by yaronsh@mainsoft.com (Yaron
+ Shkop).
+
+2003-09-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CheckBox.cs: render the 'disabled' attribute in the correct tag.
+ * WebControl.cs: fixed Enabled property and save it in ViewState.
+
+ Fixes bug #48802.
+
+2003-09-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListControl.cs: fixed bug #48668. Thanks to Yaron Shkop.
+
+2003-09-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListBox.cs: patch by yaronsh@mainsoft.com (Yaron Shkop) that fixes
+ bug #48671.
+
+2003-09-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FontInfo.cs: fixed Name property as suggested by Rich Alimi
+ <rich@velvetsea.net>.
+
+2003-09-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RegularExpressionValidator.cs: fix for EvaluateIsValid by Juraj
+ Skripsky <juraj@hotfeet.ch>
+
+2003-09-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseValidator.cs: patch by Juraj Skripsky (juraj@hotfeet.ch) that
+ fixes rendering of the end tag.
+
+2003-08-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Repeater.cs: fix for Items property provided by yaronsh@mainsoft.com
+ (Yaron Shkop). Closes bug #48060.
+
+2003-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CheckBox.cs: in LoadPostData, only return
+ true when the new data is different from the one we had. Fixed
+ conditions to save Checked state. Thanks to yaronshkop@hotmail.com
+ (Yaron Shkop).
+
+2003-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Style.cs: Font.Strikeout renders as 'line-through'. Fixes bug #47871.
+
+2003-08-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebControl.cs: removed dangling ^M and unneeded fields. Keep track
+ of Enable in ViewState. Fixes bug #47865.
+
+2003-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Style.cs: the MARKED bit is not send set in ViewState unless something
+ is changed. Fixed TrackViewState condition.
+
+ * WebControl.cs: save the base ViewState *after* ControlStyle is done,
+ because it uses the same ViewState as the control. Fixes bug #47725.
+
+2003-08-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HyperLinkColumn.cs: patch from David Pickens <dsp@rci.rutgers.edu>
+ that fixes databinding when only DataTextField or DataNavigateUrlField
+ is set.
+
+2003-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListControl.cs: patch sent by Yaacov Akiba Slama <ya@slamail.org> on
+ behalf of Yaron Shkop <yaronsh@mainsoft.com> that fixes selection of
+ values before assigning a data source and other issues.
+
+2003-08-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CheckBox.cs: save viewstate when needed and correctly handle post
+ data. Fixes bug #47462.
+
+2003-08-01 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * ButtonColumn.cs: Removed additional attributes
+ * CheckBox.cs: Added attribute
+ * DataGrid.cs: Added attributes
+ * HyperLinkColumn.cs: Changed attributes, added lamespec
+ * Style.cs: Removed attributes
+ * TextBox.cs: Added/ removed attributes
+
+2003-08-01 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * AdRotator.cs: Added all attributes
+ * BaseDataList.cs: Added all attributes, added lamespec, removed additional attributes
+ * BaseValidator.cs: Added all attributes
+ * BoundColumn.cs: Added all attributes
+ * Button.cs: Added all attributes
+ * ButtonColumn.cs: Added all attributes, added lamespec
+ * Calendar.cs: Added all attributes, added error checks, throws more exceptions
+ * CheckBox.cs: Added all attributes
+ * CheckBoxList.cs: Added all attributes
+ * CompareValidator.cs: Added all attributes
+ * CustomValidator.cs: Added all attributes
+ * DataGrid.cs: Added all attributes, more verbose exceptions, fixed signature, removed additional attributes
+ * DataGridColumn.cs: Added all attributes
+ * DataGridColumnCollection.cs: Added all attributes
+ * DataGridPagerStyle.cs: Added all attributes
+ * DataGridTableInternal.cs: Made DataGridTableInternal internal
+ * DataList.cs: Added all attributes, more verbose exceptions, removed non-existing member
+ * DropDownList.cs: Added all attributes
+ * FontInfo.cs: Added all attributes
+ * HyperLink.cs: Added all attributes
+ * HyperLinkColumn.cs: Added all attributes
+ * Image.cs: Added all attributes
+ * ImageButton.cs: Added all attributes
+ * Label.cs: Added all attributes
+ * LinkButton.cs: Added all attributes
+ * ListBox.cs: Added all attributes, added error checks, throws more exceptions
+ * ListControl.cs: Added all attributes
+ * ListItem.cs: Added all attributes
+ * ListItemCollection.cs: Added attribute
+ * Literal.cs: Added all attributes
+ * Panel.cs: Added all attributes
+ * RadioButton.cs: Added all attributes
+ * RadioButtonList.cs: Added all attributes, added error checks, throws more exceptions
+ * RangeValidator.cs: Added all attributes
+ * RegularExpressionValidator.cs: Added all attributes
+ * Repeater.cs: Added all attributes
+
+2003-07-30 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * RequiredFieldValidator.cs: Added all attributes
+ * Style.cs: Added all attributes
+ * Table.cs: Added all attributes
+ * TableCell.cs: Added all attributes, added error checks, throws more exceptions
+ * TableCellCollection.cs: Added attribute
+ * TableRow.cs: Added all attributes
+ * TableRowCollection: Added attribute
+ * TableStyle.cs: Added all attributes, improved error messages
+ * TemplateColumn.cs: Added all attributes
+ * TextBox.cs: Added all attributes, added error checks, throws more exceptions
+ * ValidationSummary.cs: Added all attributes
+ * WebControl.cs: Added all attributes
+ * Xml.cs: Added all attributes
+
+2003-07-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGrid.cs: fixed signature of ItemCreated and PageIndexChanged.
+ * DataList.cs: fixed signature of ItemCreated and ItemDataBound.
+
+2003-07-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CheckBoxList.cs: fixes bug reported on the list about the state of
+ the CheckButtons not being preserved across posts.
+
+2003-07-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListControl.cs: added SelectedValue property (1.1). Closes 46412.
+
+2003-06-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AdRotator.cs: fixed bug #44271 and a few others bugs. Mono-stylized.
+
+2003-06-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListControl.cs: save viewstate data when any of the 3 values is not
+ null. Fixed condition to save selection indices. Closes bug #45493.
+
+2003-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGrid.cs: fixed bug #43823.
+
+2003-05-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGrid.cs: fixed delegate type for SortCommand.
+
+2003-05-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGridColumnCollection.cs: added missing return in RemoveAt.
+
+2003-05-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGridColumnCollection.cs: fixed LoadViewState for the columns.
+ Don't save ViewState is the number of columns is 0.
+
+2003-05-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGrid.cs: get the right item Type for the property we're reading
+ fromt the data source.
+
+2003-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Label.cs:
+ * TextBox.cs: added control builder attribute.
+
+2003-03-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGrid.cs: Fixed SaveViewState and type of ItemDataBound.
+
+2003-03-17 George Kodinov <gkodinov@openlinksw.co.uk>
+
+ * Unit.cs: Called the correct method to get the Numeric locale for the
+ double conversion
+
+2003-02-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ButtonColumn.cs: fixed a couple of infinite loop problems and render
+ correctly the header of the column.
+
+ * DataGridTableInternal.cs: don't assign a default ID to this control.
+
+ * LinkButton.cs: raise bubble event in OnCommand.
+
+ * TableCellCollection.cs: fixed the index returned by Add.
+
+ * TableRowCollection.cs: ditto.
+
+2003-02-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Xml.cs: don't call MapPathSecure when setting DocumentSource.
+
+2003-02-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RangeValidator.cs: fixed bug #37577. Thanks to Stephane Tombeur
+ for reporting the bug and providing the fix.
+
+2003-01-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGrid.cs: AutoGenerateColumns defaults to true. Fixed
+ CreateColumnSet. Set the owner of the column when auto generated.
+ In PrepareControlHierarchyForItem, fixed for loop bound.
+
+ * LinkButtonInternal.cs: fixed infinite recursion bug.
+
+ Fixes bug #37124.
+
+2003-01-22 Zdravko Tashev <ztashev@openlinksw.co.uk>
+
+ * Xml.cs: a few fixes.
+
+2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataList.cs: handle the exception when adding new keys to
+ DataKeysArray.
+
+2003-01-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseDataList.cs: what can I say for this one? I spent so many time
+ until I finally found this that I'm gonna miss this f....g bug... ;-).
+ Farewell. Now we can get events from image buttons inside Data*.
+
+ * DataList.cs: now the value stored in ViewState for item count is
+ correct.
+
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGrid.cs: default value for ShowHeaders is true. Fixed style for
+ Header and Footer.
+ * DataGridColumn.cs: added SetOwner method.
+ * DataGridColumnCollection.cs: set the owner of the column when added.
+
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BoundColumn.cs: typo.
+ * DataGrid.cs: use 'as' instead of casting. Typo.
+ * HyperLinkColumn.cs: call OnColumnChanged when any property change.
+ Mono-stylized.
+
+2003-01-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HyperLink.cs: fixes bug #36336.
+
+2003-01-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataList.cs: fixed IRepeatInfoUser.GetItemStyle.
+
+2002-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseValidator.cs: return an empty string in GetControlValidationValue
+ when GetValue returned null.
+
+ * CompareValidator.cs: fixed EvaluateIsValid.
+
+ * RegularExpressionValidator.cs: fixed EvaluateIsValid.
+
+2002-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Xml.cs: use MapPathSecure to get the path of the document.
+
+2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataList.cs: fixed header & footer.
+
+2002-12-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataList.cs: for header and footer don't use data source.
+ Instantiate in the DataListItem, not in the DataList.
+ databind-template.aspx works now.
+
+2002-11-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseDataList.cs:
+ (Render): call RenderContents (), not base.RenderContents ().
+
+ * DataList.cs: style.
+
+ But I still haven't found what i'm looking for....
+
+2002-11-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs: fixed loading/saving selected dates.
+ * SelectedDatesCollection.cs: added internal function to get the
+ underlying ArrayList.
+
+ Calendar navigation works again. Selecting dates too.
+
+2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataList.cs: added a few attributes and fixed infinite recursion.
+
+2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListItemCollection.cs: fixed LoadViewState.
+
+2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TableItemStyle.cs: TypeDescriptor.GetConverter seems to fail.
+ Commented out some code until it works.
+
+2002-10-29 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * BaseCompareValidator.cs - Fixed operator bug in
+ Compare(string, string, ...)
+ * CompareValidator.cs - EvaluateIsValid() : Implemented.
+
+2002-10-28 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * BoundColumn.cs - InitializeCell(TableCell, int, ListItemType)
+ : Implemented.
+ - All Properties : Now make use of ViewState.
+
+2002-10-28 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * BaseValidator.cs - Uncomment NotImplementedException.
+
+2002-10-28 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * BaseValidator.cs - Minor changes in TODO comments.
+
+2002-10-28 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * BaseValidator.cs - DetermineRenderUpLevel() : Uncomment
+ the NotImplementedException being thrown.
+ * DataGridPagerStyle.cs - Mode { set; } : Implemented.
+ * DataGridLinkButton.cs - Added new class (private) : Implemented.
+ * DataGrid.cs - InitializePager(DataGridItem, int,
+ PagedDataSource) : Implemented.
+
+2002-10-28 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataList.cs - PrepareControlHierarchy() : Implemented.
+
+2002-10-28 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataList.cs - RenderContents(HtmlTextWriter) : Implemented.
+ - GetItem(ListItemType, int) : Removed TODO.
+ - CreateControlHierarchy(bool) : Implemented.
+ - CreateItem(int, ListItemType) : Implemented.
+ - CreateItem(int, ListItemType,
+ bool, object) : Implemented.
+ - InitializeItem(DataItem) : Implemented.
+ * DataGrid.cs - CreateControlHierarchy(bool) : Bug fix.
+ The ViewState["_!ItemCount"],
+ ViewState["_!DataSource_ItemCount"]
+ are shared by DataList and DataGrid, and hence
+ should share the same name.
+ - ResolveDataSource(object, string)
+ : Removed. Use System.Web.UI.Utils.DataSourceHelper
+ ::GetResolvedDataSource(object, string).
+
+
+2002-09-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGrid.cs: fixed compilation
+
+2002-09-12 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * PagedDataSource.cs - FirstIndexInPage : Fixed bug.
+ * DataGrid.cs - CreateControlHierarchy(bool)
+ : working towards completion.
+ - ResolveDataSource(object, string)
+ : stubbed new method
+ - CreateItem(....)
+ : stubbed new method
+ Well. It's almost done.
+ * DataGridTableInternal.cs
+ - Added new internal class.
+
+2002-08-28 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataSourceInternal.cs - Added new class (internal).
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FontUnit.cs:
+ * HorizontalAlign.cs:
+ * Unit.cs:
+ * VerticalAlign.cs: fixes based on class status page.
+
+ * HorizontalAlignConverter.cs: implemented.
+ * VerticalAlignConverter.cs: implemented.
+
+ * FontUnitConverter.cs: implemented GetStandardValues ().
+
+ * WebColorConverter.cs: implemented ConvertFrom () and ConvertTo ().
+
+2002-08-19 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataGrid.cs - AutoCreateColumns: Bug fixes.
+
+2002-08-19 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataGrid.cs - AutoCreateColumns: completed, hopefully!
+
+2002-08-19 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataGrid.cs - Working on the undocumented protected
+ method CreateColumnSet. AutoCreateColumns method
+ stubbed. Left CreateControlHierarchy for the time
+ being, looks like I'm going insane. ;-)
+
+2002-08-19 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * Button.cs - Steffen's OnCommand bug fix.
+
+2002-08-12 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataGrid.cs - Added protected method (skeleton)
+ CreateColumnSet(PagedDataSource, bool)
+ Still trying to know how will it be used
+ and what for...
+
+2002-08-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PagedDataSource.cs: fixed compilation.
+
+2002-08-08 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataGrid.cs - Added private method
+ CreatePagedDataSource
+ - Started work on
+ CreateControlHierarchy(bool)
+ * PagedDataSource.cs - Bug fixed.
+ CurrentPageIndex is writable.
+
+2002-08-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGrid.cs: fixed typo.
+ * DataGridPagerStyle.cs: added IsPagerOnTop and IsPagerOnBottom.
+
+2002-08-06 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataGridColumn.cs - Added internal methods to get the
+ various styles (needed in DataGrid.cs)
+ * DataGrid.cs - Completed the method
+ PrepareControlHierarchy()
+
+2002-08-06 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataGrid.cs - Wokring on PrepareControlHierarchy()
+ - Added private method
+ PrepareControlHierarchyForItem()
+
+2002-08-05 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataGrid.cs - Completed method
+ OnBubbleEvent(object, EventArgs)
+
+2002-07-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Xml.cs: implemented document/transform load.
+
+2002-07-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs: added myself to the list of authors.
+ * DropDownList.cs: fixed a few properties.
+ * ListControl.cs: fixed SelectedIndex.
+
+2002-07-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs: lots of fixes. Render days. Still left to persist
+ selected days when changing month.
+
+ * Unit.cs: fixed Percentage and Pixel.
+
+ * WebControl.cs: a few properties are now using ControlStyle instead
+ of ViewState to persist.
+
+2002-07-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseValidator.cs: it works now.
+ * DataGridColumn.cs: added attribute and made it abstract.
+ * RequiredFieldValidator.cs: fixed return value in EvaluateIsValid.
+
+2002-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TextBox.cs: default for Wrap is true.
+ (OnPreRender): don't save Text if there are no listeners on TextChanged.
+
+2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DropDownList.cs:
+ (ToolTip): fixed.
+
+ * ListItem.cs:
+ (LoadViewState): fixed.
+
+ * ListItemCollection.cs:
+ (TrackViewState): use items instead of 'this' in foreach.
+
+ * Style.cs:
+ (LoadViewState): more checking of parameters.
+
+ * WebControl.cs: implemented LoadViewState and SaveViewState.
+
+
+2002-07-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListItem.cs: there was no code to unset the flags!!!
+
+2002-07-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FontUnit.cs: use a hashtable for mapping size name to value.
+ * HyperLink.cs: fixed a bug and a typo.
+ * Unit.cs: some fixes to internal constructor.
+
+2002-07-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListControl.cs: fixed a couple of range checks.
+ * WebControl.cs: MS lies! Not all WebControls must be rendered inside
+ an HtmlForm (p.e., Label).
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AdRotator.cs:
+ * Button.cs:
+ * Calendar.cs:
+ * CheckBox.cs:
+ * CheckBoxList.cs:
+ * DataList.cs:
+ * DropDownList.cs:
+ * HyperLink.cs:
+ * HyperLinkColumn.cs:
+ * Image.cs:
+ * ImageButton.cs:
+ * Label.cs:
+ * LinkButton.cs:
+ * ListBox.cs:
+ * Panel.cs:
+ * PlaceHolder.cs:
+ * RadioButton.cs:
+ * RadioButtonList.cs:
+ * Table.cs:
+ * TableRow.cs:
+ * TextBox.cs:
+ * WebControl.cs: removed attributes added by mistake (i used
+ GetCustomAttributes (true), d'oh!).
+
+ * DataListItem.cs: implemented RenderItem.
+
+ * Repeater.cs: implemented CreateItem and InitializeItem.
+
+2002-07-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseDataList.cs: a couple of fiex and added attributes.
+ * DataGrid.cs: little fixes.
+
+2002-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CheckBoxList.cs:
+ * DataGrid.cs:
+ * DataList.cs:
+ * DropDownList.cs:
+ * ListBox.cs:
+ * PlaceHolder.cs:
+ * RadioButton.cs:
+ * RadioButtonList.cs:
+ * TableRow.cs:
+ * WebControl.cs:
+ * Xml.cs: forgot to add using System.ComponentModel.
+
+ * BaseValidator.cs: use explicitly
+ System.ComponentModel.AttributeCollection as there is another class
+ with the same name under System.Web.UI.
+
+2002-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AdRotator.cs:
+ * Button.cs:
+ * Calendar.cs:
+ * CheckBox.cs:
+ * CheckBoxList.cs:
+ * DataGrid.cs:
+ * DataList.cs:
+ * DropDownList.cs:
+ * HyperLink.cs:
+ * Image.cs:
+ * ImageButton.cs:
+ * Label.cs:
+ * LinkButton.cs:
+ * ListBox.cs:
+ * Panel.cs:
+ * PlaceHolder.cs:
+ * RadioButton.cs:
+ * RadioButtonList.cs:
+ * Table.cs:
+ * TableRow.cs:
+ * TextBox.cs:
+ * WebControl.cs:
+ * Xml.cs: added/fixed all attributes used by xsp.
+
+ * BaseValidator.cs: some fixes.
+
+2002-07-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Table.cs:
+ (AddAttributesToRender): correctly default to border=1.
+
+2002-07-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AdRotator.cs:
+ (LoadAdFile): make the dictionary null after every iteration.
+
+ * LinkButton.cs:
+ * ListControl.cs:
+ * ListItem.cs: fixed warnings.
+
+Mon Jul 1 16:23:15 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Style.cs, TableRow.cs, DataListItem.cs: fix compilation.
+
+2002-06-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGridColumn.cs:
+ * DataGridPagerStyle.cs:
+ * DataList.cs:
+ * DataListItem.cs:
+ * Image.cs:
+ * LinkButton.cs:
+ * ListControl.cs:
+ * ListItem.cs:
+ * ListItemCollection.cs:
+ * Repeater.cs:
+ * ServerValidateEventArgs.cs:
+ * Style.cs:
+ * TableRow.cs:
+ * WebControl.cs:
+ * Xml.cs: more class status page based changes.
+
+2002-06-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Button.cs:
+ (.ctor): fixed to render the correct tag.
+ (IPostBAckEventHandler.RaisePostBackEvent): fixed.
+
+2002-06-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebControl.cs:
+ (AddAttributesToRender): call Page.VerifyRenderingInServerForm. All
+ WebControl derived classes should be rendered inside a HtmlForm.
+
+2002-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Repeater.cs: implemented CreateControlHierarchy. Fixed some event
+ processing methods.
+
+2002-06-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RadioButtonList.cs: implemented IRepeatInfoUser.RenderItem.
+ * RepeatInfo.cs: implemented DoHorizontalRendering.
+
+2002-06-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI.WebControls/Repeater.cs:
+ (Controls):
+ (OnDataBinding): fixed stack overflow.
+
+2002-06-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RadioButtonList.cs: implemented IRepeatInfoUser.RenderItem.
+ * RepeatInfo.cs: implemented DoHorizontalRendering.
+
+2002-06-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebControl.cs:
+ (CopyBaseAttributes): copy Attributes and don't throw exception.
+
+2002-06-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListBox.cs: mono-stylized.
+ (AddAttributesToRender): call parent class method.
+
+2002-06-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Style.cs: fixed IsEmpty and Width.
+
+ * Table.cs: mono-stylized.
+ (TableRowControlCollection.AddAt): fixed.
+ (AddAttributesToRender): fixed.
+
+ * TableCell.cs: mono-stylized.
+ (.ctor): use PreventAutoID.
+ (AddAttributesToRender): fixed.
+ (AddParsedSubObject): fixed.
+
+ * TableRow.cs: mono-stylized. Added
+ ParseChildren attribute.
+
+ * TableStyle.cs:
+ (get_GridLine): fixed.
+
+2002-06-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Panel.cs: fixed stack overflow.
+ * Unit.cs: use Int32.Parse and Single.Parse instead of Int32Converter
+ and SingleConverter.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RadioButton.cs: mono-stylized and some little fixes.
+
+ * TextBox.cs: mono-stylized.
+ (MaxLength): fixed typo.
+
+ (AddAttributesToRender): don't render the text between the tags for
+ SingleLine, use value attribute for it. Don't render the text for
+ Password.
+
+ (OnPreRender): don't throw exception and call base.OnPreRender.
+
+ (Render): for MultiLine, render the text between the opening and
+ closing tags encoded as HTML.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ImageButton.cs:
+ (AddAttributesToRender): fixer another stack overflow.
+
+ * WebControl.cs:
+ (TagName): modified to use TagKey instead of tagKey as the property
+ can be overriden.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LinkButton.cs: mono-stylized.
+ (AddParsedSubObject):
+ (RenderControls): little fixes.
+
+ * WebControl.cs:
+ (AddAttributesToRender): fixed usage of IEnumerator.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Literal.cs: beautified.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Label.cs: beautified and fixed a couple of 'classic' bugs.
+
+ * WebControl.cs: use Span as default tag when no other provided in
+ constructor. That is what MS renders.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Button.cs:
+ (AddAttributesToRender): fixed (classic) stack overflow.
+
+ * CheckBox.cs: mono-stylized.
+ (AutoPostBack): fixed stack overflow.
+ (Render): fixed alignment issues. Also set the For attribute always
+ for the label.
+
+2002-06-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AdRotator.cs: GetData does not work as it should, but now it returns
+ useful data (only the first ad in the file). Set the NavigateUrl
+ property in the hyperlink if available.
+
+ * HyperLink.cs: fixed constructor and a couple of stack overflows.
+
+ * Image.cs: added an attribute and fixed stack overflow.
+
+ * WebControl.cs:
+ (RenderBeginTag): fixed.
+ (TagName): don't call Enum.IsDefined twice.
+
+2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebControl.cs: added attributes PersistChildrenAttribute and
+ ParseChildrenAttribute.
+
+2002-05-24 Duncan Mak <duncan@ximian.com>
+
+ * DataGridItem.cs (SetItemType): Changed function signature to
+ match 1.0 spec.
+
+ * ListItemCollection.cs (this): Changes the visibility level of
+ the indexer.
+
+ * Repeater.cs (OnItemCommand):
+ (OnItemCreated):
+ (OnItemDataBound): Added necessary casts.
+
+2002-05-07 Duncan Mak <duncan@ximian.com>
+
+ * Button.cs (AddAttributesToRender):
+ * ImageButton.cs (AddAttributesToRender): Added a missing argument to the
+ GetClientValidatedEvent method.
+
+2002-03-27 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * Removed extra methods, corrected access modifiers to several
+ methods.
+
+2002-03-26 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * <SeveralFiles>.cs - Added some attributes
+ * FontUnitConverter.cs - Added stubs for GetStandardValues*(..)
+ methods. Will complete them later. Right now, busy with
+ the attributes part.
+ * RepeaterItem.cs - Completed.
+
+ Oh God! Mercy! I will die applying attributes. I look at the missing
+ part in the class-status - daemon! Kyrie eleison!
+
+2002-03-19 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ Some bug fixes
+
+ * AdRotator.cs - Added definition for Font.
+ * BaseCompareValidator.cs - Added definition for Controls.
+ * Calendar.cs - SelectMonthText definition corrected.
+ * DataList.cs - Added definition for SeparatorTemplate.
+ * BorderStyle.cs - Namespace correction. It belongs not to UI,
+ but to UI.WebControls.
+
+2002-03-17 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ Finally, I have made it. Today I did a second build for the
+ System.Web assembly. It compiled 195 classes today.
+ I am waiting eagerly for the runtime to come up so that the objects
+ may be tested to their last levels. Several of the methods are still
+ under the tag of "TODO" throwing NotImplementedException. Well, I
+ hope to remove them soon, but how far is this soon - even I don't
+ know, though I am happy to make the build a success even before
+ the vacations to come.
+
+2002-03-07 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ Yesterday and today I tried to do some building of the aseembly,
+ but was dumped with uncoutably infinite errors. ;-)
+ I have put the copies of the recent errors on my home page, want
+ to have a look at them? See:
+ http://mastergaurav.virtualave.net/mono/
+ I don't know what to do with these errors. Oh! The buggy me! How
+ will I overcome myself. Hopefully, by when my vacations over, I
+ should have made a repository where the build will not fail.
+
+2002-03-05 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ I am now going to do a build that will include the
+ System.Web.UI.WebControls namespace. Hoping that I will make it
+ soon. My exams are coming near and I have to pack up soon.
+
+
+2002-03-04 Gaurav Vaish <gvaish@iitk.ac.in>
+
+Comments:
+ And with this, ie, today's work, all the objects mentioned in the
+ namespace appear in the implementation. But it may not be worth
+ trying to go for a build because of dependence of several of the
+ internal methods that may clash with already available assembly
+ System.Web.
+
+ Also, the classes lack possible attributes, like those informing
+ about child-controls etc. But I have to first create the attribute
+ classes before I attach the attributes to the classes.
+
+ * CustomValidator.cs - Completed. In process realized that
+ I have to complete / rejuvinate BaseValidator class.
+ * BaseValidator.cs - Complete rejuvination. Completed 80%
+ of the job. All that is left is Render(HtmlTextWriter),
+ DetermineRenderUplevel(), RegisterValidatorCommonScript()
+ RegisterValidatorDeclaration()
+ * DataGridPagerStyle.cs - Completed. That adds one more missle
+ in my artillery.
+ * DataKeyCollection.cs - Completed. Petty small.
+ * Repeater.cs - Work started off. This is a quite
+ heavy class. Hooh!
+ * DataGridItemEventArgs.cs,
+ * DataGridShortCommandEventArgs.cs,
+ * DataListItemEventArgs.cs,
+ * MonthChangedEventArgs.cs,
+ * RepeaterItemEventArgs.cs,
+ * ServerValidateEventArgs.cs,
+ * DataGridPageChangedEventArgs.cs
+ - Damn, I marked them "*", while they
+ did not exist.
+ * Repeater.cs - Done all except for an undocumented
+ method CreateControlHierarchy(bool). Though the method
+ is quite clear by its name, but it will take some time
+ for me to come with some material to flush in.
+
+2002-03-03 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * SelectedDatesCollection.cs - Completed.
+ * PagedDataSource.cs - Completed. Pathetically nice class.
+ * RegularExpressionValidator.cs
+ - Completed. Ridiculously small and
+ annoyinglyc crazy-driving class, basically the method
+ EvaluateIsValid().
+ * RangeValidator.cs - Completed.
+ * DataGridColumn.cs - Completed.
+ * EditCommandColumn.cs - All is complete except for the
+ InitializeCell(TableCell, int, ListItemType) method.
+ * DataListItem.cs - All done except for a longish method
+ RenderItem(HtmlTextWriter, bool, bool)
+
+2002-03-02 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * RepeaterItemCollection.cs - Completed.
+ I love *Collection classes. I am planning to make a
+ program that will generate a *Collection class. It's so
+ simple and the same. ;-)
+ * DataGridColumnCollection.cs - Completed.
+ ... except probably for *ColumnCollection classes, where
+ you have to put in some more effort. Still, these class
+ generation can be automated.
+ * DataListItemCollection.cs - Completed.
+ See, how easily, in less than a quarter of a minute, I
+ completed this class - manually. Copy-Paste/Cut-Replace.
+
+2002-02-21 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * DataGrid.cs - Following methods implemented:
+ TrackViewState(), LoadViewState(object), SaveViewState(),
+ On* -- The event raisers.
+ OnBubbleEvent(object, EventArgs) is still incomplete.
+ * DataGridItem.cs - Initial Implementation
+ * DataGridItemCollection.cs - Completed.
+
+2002-02-08 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * DataGrid.cs - Initial Implementation. Worked
+ primarily with some properties.
+
+2002-02-07 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * ListBox.cs - Completed. Implemented
+ LoadPostData(string, NameValueCollection)
+ * RequiredFieldValidator.cs - Completed. Pretty simple class.
+
+2002-02-06 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * ListBox.cs - Implemented the following:
+ RaisePostDataChangedEvent()
+
+2002-02-02 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * ListBox.cs - Supports the following properties:
+ BorderColor, BorderStyle, BorderWidth, Rows, SelectionMode,
+ ToolTip.
+ Methods:
+ AddAttributesToRender(HtmlTextWriter), OnPreRender(EventArgs),
+ RenderContents(HtmlTextWriter)
+
+
+2002-02-01 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * TargetConverter.cs - Completed
+ * TemplateColumn.cs - Completed
+ * DataList.cs - Corrected the get-er methods for the
+ *Style objects. Corrected the get/set-er methods for ViewState
+ related objects.
+ Addded support for properties:
+ GridLines, HeaderStyle, HeaderTemplate, ItemStyle, ItemTemplate,
+ RepeatColumns, RepeatDirection, RepeatLayout, SelectedIndex,
+ SelectedItem, SelectedItemStyle, SelectedItemTemplate,
+ SeparatorStyle, SeparatorItemTemplate.
+ Events:
+ CancelCommand, DeleteCommand, EditCommand, ItemCommand,
+ ItemCreated, ItemDataBound, UpdateCommand.
+ Methods:
+ CreateControlStyle(), LoadViewState(object),
+ SaveViewState(), TrackViewState
+ Event handlers:
+ OnBubbleEvent, OnCancelCommand, OnDeleteCommand,
+ OnEditCommand, OnItemCommand, OnItemCreated,
+ OnItemDataBound, OnUpdateCommand
+ Added dummy methods for some undocumented methods:
+ CreateControlHierarchy(bool), CreateItem(int, ListItemType),
+ CreateItem(int, ListItemType, bool, object),
+ PrepareControlHierarchy(), InitializeItem(DataListItem)
+ * ListBox.cs - Started working.
+
+
+
+2002-01-31 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * RepeaterInfo.cs - Initial Implementation. Done all
+ except for RepeatDirection.Vertical
+ * TableStyle.cs - Completed
+
+2002-01-30 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * DropDownList.cs - Completed
+ * ListItemCollection.cs - Added method FindByValueInternal to
+ assist in the derived classes.
+ Discovered bug in FindByValue. Removed
+ * UnitConverter.cs - Completed
+ * PlaceHolder.cs - What can be simpler than this?
+ * PlaceHolderControlBuilder.cs
+ - Uh! Damn cool one.
+ * RadioButtonList.cs - Initial Implementation. All is done
+ except for the implementation of
+ method IRepeatInfoUser.RenderItem(...)
+ * ValidatedControlConverter.cs
+ ^^^^^^^^^^^^^^^^^^^^^^^^^ - Looks complete. Doubtful though !!
+ * ValidationSummary.cs - Initial Implementation.
+ * WebColorConverter.cs - Initial Implementation
+
+2002-01-27 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * FontNamesConverter.cs - Completed
+ * FontUnitConverter.cs - Partial Implementation
+ * ListItemControlBuilder.cs - Completed
+
+2002-01-27 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * TextBox.cs - All done except *Render* methods
+ * TextBoxControlBuilder.cs - Completed
+ * Xml.cs - Partial Implementation
+
+2002-01-26 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * RadioButton.cs - Completed
+ * TextBox.cs - Partial Implementation
+
+2002-01-25 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * Panel.cs - Completed
+ * TableItemStyle.cs - Completed
+
+2002-01-18 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * TableCellCollection.cs - Completed
+ * TableRowCollection.cs - Completed
+ * TableHeaderCell.cs - Completed
+ * TableRow.cs - Completed
+
+2002-01-09 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * TableCellControlBuilder.cs - Completed
+ * Table.cs - Completed
+ * TableCell.cs - Completed
+
+2002-01-07 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * CheckBoxList.cs - Completed
+ * ButtonColumn.cs - Completed
+ * Button.cs - Completed
+
+2001-12-28 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * HyperLink.cs - Completed
+ * Image.cs - Completed
+ * ImageButton.cs - Completed
+ * Label.cs - Completed
+ * LabelControlBuilder.cs - Completed
+ * LinkButton.cs - Completed
+ * LinkButtonControlBuilder.cs - Completed
+ * Literal.cs - Completed
+ * LieteralControlBuilder.cs - Completed
+ * FontUnit.cs - Completed
+
+
+2001-12-27 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * Calendar.cs - Completed the functions of Render*,
+ ViewStates (Track/View/Save),
+ RaisePostBackEvent.
+ Left: RenderAllDays (partially)
+
+2001-12-21 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * Calendar.cs - Added some more functions
+ * Style.cs - Completed
+ * ListItem.cs - Completed
+ * ListItemCollection.cs - Completed
+
+ Made the first successful build of System.Web.dll that included
+ System.Web.UI.WebControls!
+
+2001-12-20 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ FontInfo.cs - Complete revamp. Completed
+
+2001-12-19 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ ListItemCollection.cs - Completed
+ ListItem.cs - Initial Implementation
+ Style.cs - Initial Implementation
+
+ Right now I am in a total mood to do a successful build. Creating so many
+ classes, completing classes in System.Web System.Web.UI namespaces.
+
+2001-12-18 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ TODO - Properly added
+ CheckBox.cs - Completed
+ BaseDataList.cs - Completed
+ DayRenderEventArgs.cs - Completed
+ RepeaterItem.cs - Initial implementation
+
+2001-12-17 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ BaseCompareValidator.cs - Completed
+ AdRotator.cs - Completed
+
+2001-12-15 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ CommandEventArgs.cs - Completed
+ DataGridCommandEventArgs.cs - Completed
+ RepeaterCommandEventArgs.cs - Completed
+ DataListCommandEventArgs.cs - Completed
+ CompareValidator.cs - Partial Implementation
+
+2001-12-02 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ CheckBoxList.cs - Partial Implementation.
+ All except "Render"
+
+2001-12-01 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ ListControl.cs - Completed
+
+2001-11-30 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ CheckBox.cs - Completed
+ ListControl.cs - Initial Implementation
+ CheckBoxList.cs - Started with it, but first needed
+ ListControl. Left it.
+
+2001-11-29 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ CalendarDay.cs - Making a note that this
+ has been implemented
+ Calendar.cs - Making a note that have made some changes.
+ Unimplmented functions throw
+ NotImplementedException
+ CheckBox.cs - Can now "Render" and "LoadPostData"
+
+
+2001-11-08 Gaurav Vaish <gvaish@iitk.ac.in>
+ WebControl.cs - Total Revamp, Partial Implementation
+ AdRotator.cs - Able to load files
+ AdCreatedEventArgs.cs - Implemented
+
+2001-11-05 Gaurav Vaish <gvaish@iitk.ac.in>
+ Calendar.cs - Initial Implementation
+ ButtonColumn.cs - Initial Implementation
+ Button.cs - Initial Implementation
+ BoundColumn.cs - Initial Implementation
+ BaseCompareValidator.cs - Minor Changes
+ DataList.cs, BaseValidator.cs, BaseDataList.cs
+ - Added more functions, other changes
+
+2001-10-28 Gaurav Vaish <gvaish@iitk.ac.in>
+ WebControl.cs - Initial Implementation
+ DataList.cs - Initial Implementation
+ BaseValidator.cs - Initial Implementation
+ BaseDataList.cs - Initial Implementation
+
+2001-10-27 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ AdCreatedEventArgs.cs - Initial Implementation
+ AdCratedEventHandler.cs - Implemented
+ AdRotator.cs - Initial Implementation
+ BorderStyle.cs - Implemented
+ ButtonColumnStyle.cs - Implemented
+ CalendarSelectionMode.cs - Implemented
+ DayNameFormat.cs - Implemented
+ FirstDayOfWeek - Implemented
+ FontInfo.cs - Partial Implementation
+ FontSize.cs - Implemented
+ GridLines.cs - Implemented
+ HorizontalAlign.cs - Implemented
+ HyperLink.cs - Initial Implementation
+ ImageAlign.cs - Implemented
+ IRepeatInfoUser.cs - Implemented
+ ListItemType.cs - Implemented
+ ListSelectionMode.cs - Implemented
+ NextPrevFormat.cs - Implemented
+ PagerMode.cs - Implemented
+ PagerPosition.cs - Implemented
+ RepeatDirection.cs - Implemented
+ RepeatLayout.cs - Implemented
+ TextAlign.cs - Implemented
+ TextBoxMode.cs - Implemented
+ TitleFormat.cs - Implemented
+ UnitType.cs - Implemented
+ ValidationCompareOperator.cs
+ - Implemented
+ ValidationDataType.cs - Implemented
+ ValidationSummaryDisplayMode.cs
+ - Implemented
+ ValidatorDisplay.cs - Implemented
+ VerticalAlign.cs - Implemented
+
+
+
+i/ File Created 2001-11-13
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs
new file mode 100644
index 00000000000..5ccb2d61cc1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs
@@ -0,0 +1,487 @@
+//
+// System.Web.UI.WebControls.CheckBox.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+// Thanks to Leen Toelen (toelen@hotmail.com)'s classes that helped me
+// to write the contents of the function LoadPostData(...)
+//
+
+//
+// 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;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+
+namespace System.Web.UI.WebControls
+{
+#if NET_2_0
+ [ControlValuePropertyAttribute ("Checked")]
+#endif
+ [DefaultEvent("CheckedChanged")]
+ [DefaultProperty("Text")]
+ [DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
+ [Designer ("System.Web.UI.Design.WebControls.CheckBoxDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ public class CheckBox : WebControl, IPostBackDataHandler
+#if NET_2_0
+ , ICheckBoxControl
+#endif
+ {
+ private static readonly object CheckedChangedEvent = new object();
+ AttributeCollection commonAttrs;
+
+#if NET_2_0
+ AttributeCollection inputAttributes;
+ StateBag inputAttributesState;
+ AttributeCollection labelAttributes;
+ StateBag labelAttributesState;
+#endif
+
+ public CheckBox(): base(HtmlTextWriterTag.Input)
+ {
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (false), WebCategory ("Behavior")]
+ [WebSysDescription ("The control automatically posts back after changing the text.")]
+ public virtual bool AutoPostBack
+ {
+ get {
+ object o = ViewState ["AutoPostBack"];
+ return (o == null) ? false : (bool) o;
+ }
+
+ set { ViewState ["AutoPostBack"] = value; }
+ }
+
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (false), Bindable (true)]
+ [WebSysDescription ("Determines if the control is checked.")]
+ public virtual bool Checked
+ {
+ get {
+ object o = ViewState ["Checked"];
+ return (o == null) ? false : (bool) o;
+ }
+
+ set { ViewState ["Checked"] = value; }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#endif
+ [DefaultValue (""), Bindable (true), WebCategory ("Appearance")]
+ [WebSysDescription ("The text that this control displays.")]
+ public virtual string Text
+ {
+ get {
+ object o = ViewState ["Text"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["Text"] = value; }
+ }
+
+ private bool SaveCheckedViewState
+ {
+ get {
+ if (Events [CheckedChangedEvent] != null || !Enabled)
+ return true;
+
+ Type type = GetType ();
+ return (type != typeof (CheckBox) && type != typeof (RadioButton));
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (TextAlign), "Right"), WebCategory ("Appearance")]
+ [WebSysDescription ("The alignment of the text.")]
+ public virtual TextAlign TextAlign
+ {
+ get {
+ object o = ViewState ["TextAlign"];
+ return (o == null) ? TextAlign.Right : (TextAlign) o;
+ }
+
+ set {
+ if (!System.Enum.IsDefined (typeof (TextAlign), value))
+ throw new ArgumentException ();
+ ViewState ["TextAlign"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+ [DefaultValue (false), WebCategory ("Behavior")]
+ public bool CausesValidation
+ {
+ get
+ {
+ Object cv = ViewState["CausesValidation"];
+ if(cv!=null)
+ return (Boolean)cv;
+ return false;
+ }
+ set
+ {
+ ViewState["CausesValidation"] = value;
+ }
+ }
+
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public AttributeCollection InputAttributes
+ {
+ get {
+ if (inputAttributes == null) {
+ if (inputAttributesState == null) {
+ inputAttributesState = new StateBag (true);
+ if (IsTrackingViewState)
+ inputAttributesState.TrackViewState();
+ }
+ inputAttributes = new AttributeCollection (inputAttributesState);
+ }
+ return inputAttributes;
+ }
+ }
+
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public AttributeCollection LabelAttributes
+ {
+ get {
+ if (labelAttributes == null) {
+ if (labelAttributesState == null) {
+ labelAttributesState = new StateBag (true);
+ if (IsTrackingViewState)
+ labelAttributesState.TrackViewState();
+ }
+ labelAttributes = new AttributeCollection (labelAttributesState);
+ }
+ return labelAttributes;
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [ThemeableAttribute (false)]
+ [WebCategoryAttribute ("Behavior")]
+ public string ValidationGroup {
+ get {
+ string text = (string)ViewState["ValidationGroup"];
+ if (text!=null) return text;
+ return String.Empty;
+ }
+ set {
+ ViewState["ValidationGroup"] = value;
+ }
+ }
+
+#endif
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when the control is checked or unchecked.")]
+ public event EventHandler CheckedChanged
+ {
+ add { Events.AddHandler (CheckedChangedEvent, value); }
+ remove { Events.RemoveHandler (CheckedChangedEvent, value); }
+ }
+
+ protected virtual void OnCheckedChanged(EventArgs e)
+ {
+ if(Events != null){
+ EventHandler eh = (EventHandler) (Events [CheckedChangedEvent]);
+ if(eh != null)
+ eh (this, e);
+ }
+ }
+
+#if NET_2_0
+ protected override void TrackViewState ()
+ {
+ base.TrackViewState();
+ if (inputAttributesState != null)
+ inputAttributesState.TrackViewState ();
+ if (labelAttributesState != null)
+ labelAttributesState.TrackViewState ();
+ }
+
+ protected override object SaveViewState ()
+ {
+ object baseView = base.SaveViewState ();
+ object inputAttrView = null;
+ object labelAttrView = null;
+
+ if (inputAttributesState != null)
+ inputAttrView = inputAttributesState.SaveViewState ();
+
+ if (labelAttributesState != null)
+ labelAttrView = labelAttributesState.SaveViewState ();
+
+ if (baseView == null && inputAttrView == null && labelAttrView == null)
+ return null;
+
+ return new Triplet (baseView, inputAttrView, labelAttrView);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState == null)
+ return;
+
+ Triplet saved = (Triplet) savedState;
+ base.LoadViewState (saved.First);
+
+ if (saved.Second != null) {
+ if (inputAttributesState == null) {
+ inputAttributesState = new StateBag(true);
+ inputAttributesState.TrackViewState ();
+ }
+ inputAttributesState.LoadViewState (saved.Second);
+ }
+
+ if (saved.Third != null) {
+ if (labelAttributesState == null) {
+ labelAttributesState = new StateBag(true);
+ labelAttributesState.TrackViewState ();
+ }
+ labelAttributesState.LoadViewState (saved.Third);
+ }
+ }
+#endif
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ if (Page != null && Enabled) {
+ Page.RegisterRequiresPostBack (this);
+ if (AutoPostBack)
+ Page.RequiresPostBackScript ();
+ }
+
+ if (!SaveCheckedViewState)
+ ViewState.SetItemDirty ("Checked", false);
+ }
+
+ static bool IsInputOrCommonAttr (string attname)
+ {
+ switch (attname) {
+ case "VALUE":
+ case "CHECKED":
+ case "SIZE":
+ case "MAXLENGTH":
+ case "SRC":
+ case "ALT":
+ case "USEMAP":
+ case "DISABLED":
+ case "READONLY":
+ case "ACCEPT":
+ case "ACCESSKEY":
+ case "TABINDEX":
+ case "ONFOCUS":
+ case "ONBLUR":
+ case "ONSELECT":
+ case "ONCHANGE":
+ case "ONCLICK":
+ case "ONDBLCLICK":
+ case "ONMOUSEDOWN":
+ case "ONMOUSEUP":
+ case "ONMOUSEOVER":
+ case "ONMOUSEMOVE":
+ case "ONMOUSEOUT":
+ case "ONKEYPRESS":
+ case "ONKEYDOWN":
+ case "ONKEYUP":
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ void AddAttributesForSpan (HtmlTextWriter writer)
+ {
+ ICollection k = Attributes.Keys;
+ string [] keys = new string [k.Count];
+ k.CopyTo (keys, 0);
+ foreach (string key in keys) {
+ if (!IsInputOrCommonAttr (key.ToUpper ()))
+ continue;
+
+ if (commonAttrs == null)
+ commonAttrs = new AttributeCollection (new StateBag ());
+
+ commonAttrs [key] = Attributes [key];
+ Attributes.Remove (key);
+ }
+
+ Attributes.AddAttributes (writer);
+ }
+
+#if NET_2_0
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender (writer);
+ }
+#endif
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ bool hasBeginRendering = false;
+ if(ControlStyleCreated && !ControlStyle.IsEmpty){
+ hasBeginRendering = true;
+ ControlStyle.AddAttributesToRender (writer, this);
+ }
+
+ if (!Enabled)
+ {
+ hasBeginRendering = true;
+ writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
+ }
+
+ if (ToolTip.Length > 0){
+ hasBeginRendering = true;
+ writer.AddAttribute (HtmlTextWriterAttribute.Title, ToolTip);
+ }
+
+ if (Attributes.Count > 0){
+ hasBeginRendering = true;
+ AddAttributesForSpan (writer);
+ }
+
+ if (hasBeginRendering)
+ writer.RenderBeginTag (HtmlTextWriterTag.Span);
+
+ if (Text.Length > 0){
+ TextAlign ta = TextAlign;
+ if(ta == TextAlign.Right) {
+ if (commonAttrs != null)
+ commonAttrs.AddAttributes (writer);
+ RenderInputTag (writer, ClientID);
+ }
+#if NET_2_0
+ if (labelAttributes != null)
+ labelAttributes.AddAttributes (writer);
+#endif
+ writer.AddAttribute (HtmlTextWriterAttribute.For, ClientID);
+ writer.RenderBeginTag (HtmlTextWriterTag.Label);
+ writer.Write (Text);
+ writer.RenderEndTag ();
+ if(ta == TextAlign.Left) {
+ if (commonAttrs != null)
+ commonAttrs.AddAttributes (writer);
+ RenderInputTag (writer, ClientID);
+ }
+ } else {
+ if (commonAttrs != null)
+ commonAttrs.AddAttributes (writer);
+ RenderInputTag (writer, ClientID);
+ }
+
+ if (hasBeginRendering)
+ writer.RenderEndTag ();
+ }
+
+ internal virtual void RenderInputTag (HtmlTextWriter writer, string clientId)
+ {
+#if NET_2_0
+ if (inputAttributes != null)
+ inputAttributes.AddAttributes (writer);
+#endif
+ if (!Enabled)
+ writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+
+ writer.AddAttribute (HtmlTextWriterAttribute.Id, clientId);
+ writer.AddAttribute( HtmlTextWriterAttribute.Type, "checkbox");
+ writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
+ if (Checked)
+ writer.AddAttribute (HtmlTextWriterAttribute.Checked, "checked");
+
+ if (AutoPostBack){
+ writer.AddAttribute (HtmlTextWriterAttribute.Onclick,
+ Page.ClientScript.GetPostBackClientEvent (this, String.Empty));
+ writer.AddAttribute ("language", "javascript");
+ }
+
+ if (AccessKey.Length > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Accesskey, AccessKey);
+
+ if (TabIndex != 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Tabindex,
+ TabIndex.ToString (NumberFormatInfo.InvariantInfo));
+
+ writer.RenderBeginTag (HtmlTextWriterTag.Input);
+ writer.RenderEndTag ();
+ }
+
+#if NET_2_0
+ bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+ {
+ return LoadPostData (postDataKey, postCollection);
+ }
+
+ protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
+#else
+ bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+#endif
+ {
+ if (!Enabled) return false;
+
+ string postedVal = postCollection [postDataKey];
+ bool haveData = ((postedVal != null)&& (postedVal.Length > 0));
+ bool diff = (haveData != Checked);
+ Checked = haveData;
+ return diff ;
+ }
+
+#if NET_2_0
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ RaisePostDataChangedEvent ();
+ }
+
+ protected virtual void RaisePostDataChangedEvent()
+ {
+ if (CausesValidation)
+ Page.Validate (ValidationGroup);
+
+ OnCheckedChanged (EventArgs.Empty);
+ }
+#else
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ OnCheckedChanged (EventArgs.Empty);
+ }
+#endif
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxField.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxField.cs
new file mode 100644
index 00000000000..182c6dd04e4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxField.cs
@@ -0,0 +1,143 @@
+//
+// System.Web.UI.WebControls.CheckBoxField.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Security.Permissions;
+
+namespace System.Web.UI.WebControls {
+
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public class CheckBoxField : BoundField
+ {
+ [EditorBrowsableAttribute (EditorBrowsableState.Never)]
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public override bool ConvertEmptyStringToNull {
+ get { throw GetNotSupportedPropException ("ConvertEmptyStringToNull"); }
+ set { throw GetNotSupportedPropException ("ConvertEmptyStringToNull"); }
+ }
+
+ [EditorBrowsableAttribute (EditorBrowsableState.Never)]
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public override string DataFormatString {
+ get { throw GetNotSupportedPropException ("DataFormatString"); }
+ set { throw GetNotSupportedPropException ("DataFormatString"); }
+ }
+
+ [EditorBrowsableAttribute (EditorBrowsableState.Never)]
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public override bool HtmlEncode {
+ get { throw GetNotSupportedPropException ("HtmlEncode"); }
+ set { throw GetNotSupportedPropException ("HtmlEncode"); }
+ }
+
+ [EditorBrowsableAttribute (EditorBrowsableState.Never)]
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public override string NullDisplayText {
+ get { throw GetNotSupportedPropException ("NullDisplayText"); }
+ set { throw GetNotSupportedPropException ("NullDisplayText"); }
+ }
+
+ protected override bool SupportsHtmlEncode {
+ get { return false; }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [LocalizableAttribute (true)]
+ [DefaultValueAttribute ("")]
+ public virtual string Text {
+ get {
+ object ob = ViewState ["Text"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["Text"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ public override void InitializeDataCell (DataControlFieldCell cell, DataControlRowState rowState)
+ {
+ bool editable = (rowState & (DataControlRowState.Edit | DataControlRowState.Insert)) != 0;
+ CheckBox box = new CheckBox ();
+ box.Enabled = editable && !ReadOnly;
+ cell.Controls.Add (box);
+ }
+
+ public override void ExtractValuesFromCell (IOrderedDictionary dictionary,
+ DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
+ {
+ CheckBox box = (CheckBox) cell.Controls [0];
+ dictionary [DataField] = box.Checked;
+ }
+
+ protected override void OnDataBindField (object sender, EventArgs e)
+ {
+ DataControlFieldCell cell = (DataControlFieldCell) sender;
+ CheckBox box = (CheckBox) cell.Controls [0];
+ object val = GetValue (cell.BindingContainer);
+ if (val != null) {
+ box.Checked = (bool)val;
+ if (!box.Visible)
+ box.Visible = true;
+ }
+ else
+ box.Visible = false;
+ }
+
+ protected override object GetDesignTimeValue ()
+ {
+ return true;
+ }
+
+ protected override DataControlField CreateField ()
+ {
+ return new CheckBoxField ();
+ }
+
+ protected override void CopyProperties (DataControlField newField)
+ {
+ CheckBoxField field = (CheckBoxField) newField;
+ field.DataField = DataField;
+ field.ReadOnly = ReadOnly;
+ field.Text = Text;
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs
new file mode 100644
index 00000000000..ed4f25a4b78
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs
@@ -0,0 +1,381 @@
+//
+// System.Web.UI.WebControls.CheckBoxList.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class CheckBoxList: ListControl, IRepeatInfoUser, INamingContainer, IPostBackDataHandler
+ {
+ CheckBox checkBoxRepeater;
+ bool isChangeNotified;
+
+ public CheckBoxList()
+ {
+ checkBoxRepeater = new CheckBox();
+ checkBoxRepeater.ID = "0";
+ checkBoxRepeater.EnableViewState = false;
+ Controls.Add (checkBoxRepeater);
+ isChangeNotified = false;
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (-1), WebCategory ("Layout")]
+ [WebSysDescription ("The border left within a CheckBox.")]
+ public virtual int CellPadding
+ {
+ get
+ {
+ return (ControlStyleCreated ? ((TableStyle)ControlStyle).CellPadding : -1);
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellPadding = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (-1), WebCategory ("Layout")]
+ [WebSysDescription ("The border left between CheckBoxes.")]
+ public virtual int CellSpacing
+ {
+ get
+ {
+ return (ControlStyleCreated ? ((TableStyle)ControlStyle).CellSpacing : -1);
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellSpacing = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (0), WebCategory ("Layout")]
+ [WebSysDescription ("The number of columns that should be used to display the CheckBoxes.")]
+ public virtual int RepeatColumns
+ {
+ get
+ {
+ object o = ViewState["RepeatColumns"];
+ if(o!=null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ if(value < 0)
+ throw new ArgumentOutOfRangeException();
+ ViewState["RepeatColumns"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (RepeatDirection), "Vertical"), WebCategory ("Layout")]
+ [WebSysDescription ("The direction that is followed when doing the layout.")]
+ public virtual RepeatDirection RepeatDirection
+ {
+ get
+ {
+ object o = ViewState["RepeatDirection"];
+ if(o!=null)
+ return (RepeatDirection)o;
+ return RepeatDirection.Vertical;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(RepeatDirection),value))
+ throw new ArgumentException();
+ ViewState["RepeatDirection"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (RepeatLayout), "Table"), WebCategory ("Layout")]
+ [WebSysDescription ("The method used to create the layout.")]
+ public virtual RepeatLayout RepeatLayout
+ {
+ get
+ {
+ object o = ViewState["RepeatLayout"];
+ if(o!=null)
+ return (RepeatLayout)o;
+ return RepeatLayout.Table;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(RepeatLayout), value))
+ throw new ArgumentException();
+ ViewState["RepeatLayout"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (TextAlign), "Right"), WebCategory ("Appearance")]
+ [WebSysDescription ("The alignment of the CheckBox text.")]
+ public virtual TextAlign TextAlign
+ {
+ get
+ {
+ object o = ViewState["TextAlign"];
+ if(o!=null)
+ return (TextAlign)o;
+ return TextAlign.Right;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(TextAlign), value))
+ throw new ArgumentException();
+ ViewState["TextAlign"] = value;
+ }
+ }
+
+ protected override Style CreateControlStyle()
+ {
+ return new TableStyle(ViewState);
+ }
+
+ protected override Control FindControl(string id, int pathOffset)
+ {
+ return this;
+ }
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ checkBoxRepeater.AutoPostBack = AutoPostBack;
+ if(Page!=null)
+ {
+ for(int i=0; i < Items.Count; i++)
+ {
+ if(Items[i].Selected)
+ {
+ checkBoxRepeater.ID = i.ToString(NumberFormatInfo.InvariantInfo);
+ Page.RegisterRequiresPostBack(checkBoxRepeater);
+ }
+ }
+ }
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ RepeatInfo ri = new RepeatInfo();
+ checkBoxRepeater.TabIndex = TabIndex;
+ bool dirtyFlag = false;
+ short tTabIndex = TabIndex;
+ Style s = (ControlStyleCreated ? ControlStyle : null);
+ if(TabIndex != 0)
+ {
+ if(!ViewState.IsItemDirty("TabIndex"))
+ dirtyFlag = true;
+ TabIndex = 0;
+ }
+ ri.RepeatColumns = RepeatColumns;
+ ri.RepeatLayout = RepeatLayout;
+ ri.RepeatDirection = RepeatDirection;
+ ri.RenderRepeater(writer, this, s, this);
+ if(tTabIndex != 0)
+ {
+ TabIndex = tTabIndex;
+ }
+ if(dirtyFlag)
+ {
+ ViewState.SetItemDirty("TabIndex", false);
+ }
+ }
+
+#if NET_2_0
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ return LoadPostData (postDataKey, postCollection);
+ }
+
+ protected virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection)
+#else
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+#endif
+ {
+ if (!Enabled)
+ return false;
+
+ int index = Int32.Parse(postDataKey.Substring(UniqueID.Length + 1));
+ if(index >= 0 && index < Items.Count)
+ {
+ string v = postCollection [postDataKey];
+ bool exists = (v != null);
+ if(Items[index].Selected != exists)
+ {
+ Items[index].Selected = exists;
+ if(!isChangeNotified)
+ {
+ isChangeNotified = true;
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+#if NET_2_0
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ RaisePostDataChangedEvent ();
+ }
+
+ protected virtual void RaisePostDataChangedEvent ()
+ {
+ if (CausesValidation)
+ Page.Validate (ValidationGroup);
+
+ OnSelectedIndexChanged (EventArgs.Empty);
+ }
+#else
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnSelectedIndexChanged (EventArgs.Empty);
+ }
+#endif
+
+
+#if NET_2_0
+ bool IRepeatInfoUser.HasFooter {
+ get { return HasFooter; }
+ }
+
+ protected virtual bool HasFooter
+#else
+ bool IRepeatInfoUser.HasFooter
+#endif
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+#if NET_2_0
+ bool IRepeatInfoUser.HasHeader {
+ get { return HasHeader; }
+ }
+
+ protected virtual bool HasHeader
+#else
+ bool IRepeatInfoUser.HasHeader
+#endif
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+#if NET_2_0
+ bool IRepeatInfoUser.HasSeparators {
+ get { return HasSeparators; }
+ }
+
+ protected virtual bool HasSeparators
+#else
+ bool IRepeatInfoUser.HasSeparators
+#endif
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+#if NET_2_0
+ int IRepeatInfoUser.RepeatedItemCount {
+ get { return RepeatedItemCount; }
+ }
+
+ protected virtual int RepeatedItemCount
+#else
+ int IRepeatInfoUser.RepeatedItemCount
+#endif
+ {
+ get
+ {
+ return Items.Count;
+ }
+ }
+
+#if NET_2_0
+ Style IRepeatInfoUser.GetItemStyle(ListItemType itemType, int repeatIndex)
+ {
+ return GetItemStyle (itemType, repeatIndex);
+ }
+
+ protected virtual Style GetItemStyle(ListItemType itemType, int repeatIndex)
+#else
+ Style IRepeatInfoUser.GetItemStyle(ListItemType itemType, int repeatIndex)
+#endif
+ {
+ return null;
+ }
+
+#if NET_2_0
+ void IRepeatInfoUser.RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
+ {
+ RenderItem (itemType, repeatIndex, repeatInfo, writer);
+ }
+
+ protected virtual void RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
+#else
+ void IRepeatInfoUser.RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
+#endif
+ {
+ checkBoxRepeater.ID = repeatIndex.ToString(NumberFormatInfo.InvariantInfo);
+ checkBoxRepeater.Text = Items[repeatIndex].Text;
+ checkBoxRepeater.TextAlign = TextAlign;
+ checkBoxRepeater.Checked = Items[repeatIndex].Selected;
+ checkBoxRepeater.Enabled = Enabled;
+ checkBoxRepeater.RenderControl(writer);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ChildTable.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ChildTable.cs
new file mode 100644
index 00000000000..7a276d5529e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ChildTable.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.UI.WebControls.ChildTable.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class ChildTable: Table
+ {
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CollectionDataSource.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CollectionDataSource.cs
new file mode 100644
index 00000000000..8b22f01dbb5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CollectionDataSource.cs
@@ -0,0 +1,84 @@
+//
+// System.Web.UI.WebControls.CollectionDataSource
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 Novell, Inc.
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Xml;
+using System.Xml.Xsl;
+using System.ComponentModel;
+using System.IO;
+
+namespace System.Web.UI.WebControls
+{
+ internal class CollectionDataSource : IDataSource
+ {
+ static readonly string[] names = new string [0];
+ IEnumerable collection;
+
+ public CollectionDataSource (IEnumerable collection)
+ {
+ this.collection = collection;
+ }
+
+ public event EventHandler DataSourceChanged {
+ add {}
+ remove {}
+ }
+
+ public DataSourceView GetView (string viewName)
+ {
+ return new CollectionDataSourceView (collection);
+ }
+
+ public ICollection GetViewNames ()
+ {
+ return names;
+ }
+ }
+
+ internal class CollectionDataSourceView: DataSourceView
+ {
+ IEnumerable collection;
+
+ public CollectionDataSourceView (IEnumerable collection)
+ {
+ this.collection = collection;
+ }
+
+ protected internal override IEnumerable ExecuteSelect (DataSourceSelectArguments arguments)
+ {
+ return collection;
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventArgs.cs
new file mode 100644
index 00000000000..293f23339ba
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventArgs.cs
@@ -0,0 +1,71 @@
+
+//
+// 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.
+//
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: CommandEventArgs
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class CommandEventArgs : EventArgs
+ {
+ private string cmdName;
+ private object cmdArg;
+
+ public CommandEventArgs(CommandEventArgs e) : this(e.CommandName, e.CommandArgument)
+ {
+ }
+
+ public CommandEventArgs(string commandName, object argument)
+ {
+ cmdName = commandName;
+ cmdArg = argument;
+ }
+
+ public string CommandName
+ {
+ get
+ {
+ return cmdName;
+ }
+ }
+
+ public object CommandArgument
+ {
+ get
+ {
+ return cmdArg;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventHandler.cs
new file mode 100644
index 00000000000..3387f457dca
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventHandler.cs
@@ -0,0 +1,38 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: CommandEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void CommandEventHandler(object sender, CommandEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CommandField.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CommandField.cs
new file mode 100644
index 00000000000..5cddf72f3f9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CommandField.cs
@@ -0,0 +1,405 @@
+//
+// System.Web.UI.WebControls.CommandField.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Security.Permissions;
+
+namespace System.Web.UI.WebControls {
+
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public class CommandField : ButtonFieldBase
+ {
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [WebCategoryAttribute ("Appearance")]
+ [UrlPropertyAttribute]
+ [DefaultValueAttribute ("")]
+ public virtual string CancelImageUrl {
+ get {
+ object ob = ViewState ["CancelImageUrl"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["CancelImageUrl"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [LocalizableAttribute (true)]
+ public virtual string CancelText {
+ get {
+ object ob = ViewState ["CancelText"];
+ if (ob != null) return (string) ob;
+ return "Cancel";
+ }
+ set {
+ ViewState ["CancelText"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [WebCategoryAttribute ("Appearance")]
+ [UrlPropertyAttribute]
+ [DefaultValueAttribute ("")]
+ public virtual string DeleteImageUrl {
+ get {
+ object ob = ViewState ["DeleteImageUrl"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["DeleteImageUrl"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [LocalizableAttribute (true)]
+ public virtual string DeleteText {
+ get {
+ object ob = ViewState ["DeleteText"];
+ if (ob != null) return (string) ob;
+ return "Delete";
+ }
+ set {
+ ViewState ["DeleteText"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [WebCategoryAttribute ("Appearance")]
+ [UrlPropertyAttribute]
+ [DefaultValueAttribute ("")]
+ public virtual string EditImageUrl {
+ get {
+ object ob = ViewState ["EditImageUrl"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["EditImageUrl"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [LocalizableAttribute (true)]
+ public virtual string EditText {
+ get {
+ object ob = ViewState ["EditText"];
+ if (ob != null) return (string) ob;
+ return "Edit";
+ }
+ set {
+ ViewState ["EditText"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [WebCategoryAttribute ("Appearance")]
+ [UrlPropertyAttribute]
+ [DefaultValueAttribute ("")]
+ public virtual string InsertImageUrl {
+ get {
+ object ob = ViewState ["InsertImageUrl"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["InsertImageUrl"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [LocalizableAttribute (true)]
+ public virtual string InsertText {
+ get {
+ object ob = ViewState ["InsertText"];
+ if (ob != null) return (string) ob;
+ return "Insert";
+ }
+ set {
+ ViewState ["InsertText"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [WebCategoryAttribute ("Appearance")]
+ [UrlPropertyAttribute]
+ [DefaultValueAttribute ("")]
+ public virtual string NewImageUrl {
+ get {
+ object ob = ViewState ["NewImageUrl"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["NewImageUrl"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [LocalizableAttribute (true)]
+ public virtual string NewText {
+ get {
+ object ob = ViewState ["NewText"];
+ if (ob != null) return (string) ob;
+ return "New";
+ }
+ set {
+ ViewState ["NewText"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [WebCategoryAttribute ("Appearance")]
+ [UrlPropertyAttribute]
+ [DefaultValueAttribute ("")]
+ public virtual string SelectImageUrl {
+ get {
+ object ob = ViewState ["SelectImageUrl"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["SelectImageUrl"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [LocalizableAttribute (true)]
+ public virtual string SelectText {
+ get {
+ object ob = ViewState ["SelectText"];
+ if (ob != null) return (string) ob;
+ return "Select";
+ }
+ set {
+ ViewState ["SelectText"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValueAttribute (true)]
+ [WebCategoryAttribute ("Behavior")]
+ public virtual bool ShowCancelButton {
+ get {
+ object ob = ViewState ["ShowCancelButton"];
+ if (ob != null) return (bool) ob;
+ return true;
+ }
+ set {
+ ViewState ["ShowCancelButton"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValueAttribute (false)]
+ [WebCategoryAttribute ("Behavior")]
+ public virtual bool ShowDeleteButton {
+ get {
+ object ob = ViewState ["ShowDeleteButton"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["ShowDeleteButton"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValueAttribute (false)]
+ [WebCategoryAttribute ("Behavior")]
+ public virtual bool ShowEditButton {
+ get {
+ object ob = ViewState ["ShowEditButton"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["ShowEditButton"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValueAttribute (false)]
+ [WebCategoryAttribute ("Behavior")]
+ public virtual bool ShowSelectButton {
+ get {
+ object ob = ViewState ["ShowSelectButton"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["ShowSelectButton"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValueAttribute (false)]
+ [WebCategoryAttribute ("Behavior")]
+ public virtual bool ShowInsertButton {
+ get {
+ object ob = ViewState ["ShowInsertButton"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["ShowInsertButton"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [WebCategoryAttribute ("Appearance")]
+ [UrlPropertyAttribute]
+ [DefaultValueAttribute ("")]
+ public virtual string UpdateImageUrl {
+ get {
+ object ob = ViewState ["UpdateImageUrl"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["UpdateImageUrl"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [LocalizableAttribute (true)]
+ public virtual string UpdateText {
+ get {
+ object ob = ViewState ["UpdateText"];
+ if (ob != null) return (string) ob;
+ return "Update";
+ }
+ set {
+ ViewState ["UpdateText"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ public override void InitializeCell (DataControlFieldCell cell,
+ DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
+ {
+ string index = rowIndex.ToString ();
+
+ if (cellType == DataControlCellType.DataCell)
+ {
+ if ((rowState & DataControlRowState.Edit) != 0) {
+ cell.Controls.Add (new DataControlButton (Control, UpdateText, UpdateImageUrl, "Update", index, false));
+ if (ShowCancelButton) {
+ AddSeparator (cell);
+ cell.Controls.Add (new DataControlButton (Control, CancelText, CancelImageUrl, "Cancel", index, false));
+ }
+ } else if ((rowState & DataControlRowState.Insert) != 0) {
+ cell.Controls.Add (new DataControlButton (Control, InsertText, InsertImageUrl, "Insert", index, false));
+ if (ShowCancelButton) {
+ AddSeparator (cell);
+ cell.Controls.Add (new DataControlButton (Control, CancelText, CancelImageUrl, "Cancel", index, false));
+ }
+ } else {
+ if (ShowEditButton) {
+ AddSeparator (cell);
+ cell.Controls.Add (new DataControlButton (Control, EditText, EditImageUrl, "Edit", index, false));
+ }
+ if (ShowDeleteButton) {
+ AddSeparator (cell);
+ cell.Controls.Add (new DataControlButton (Control, DeleteText, DeleteImageUrl, "Delete", index, false));
+ }
+ if (ShowSelectButton) {
+ AddSeparator (cell);
+ cell.Controls.Add (new DataControlButton (Control, SelectText, SelectImageUrl, "Select", index, false));
+ }
+ if (ShowInsertButton) {
+ AddSeparator (cell);
+ cell.Controls.Add (new DataControlButton (Control, NewText, NewImageUrl, "New", index, false));
+ }
+ }
+ } else
+ base.InitializeCell (cell, cellType, rowState, rowIndex);
+ }
+
+ void AddSeparator (DataControlFieldCell cell)
+ {
+ if (cell.Controls.Count > 0) {
+ Literal lit = new Literal ();
+ lit.Text = "&nbsp;";
+ cell.Controls.Add (lit);
+ }
+ }
+
+ protected override DataControlField CreateField ()
+ {
+ return new CommandField ();
+ }
+
+ protected override void CopyProperties (DataControlField newField)
+ {
+ base.CopyProperties (newField);
+ CommandField field = (CommandField) newField;
+ field.CancelImageUrl = CancelImageUrl;
+ field.CancelText = CancelText;
+ field.DeleteImageUrl = DeleteImageUrl;
+ field.DeleteText = DeleteText;
+ field.EditImageUrl = EditImageUrl;
+ field.EditText = EditText;
+ field.InsertImageUrl = InsertImageUrl;
+ field.InsertText = InsertText;
+ field.NewImageUrl = NewImageUrl;
+ field.NewText = NewText;
+ field.SelectImageUrl = SelectImageUrl;
+ field.SelectText = SelectText;
+ field.ShowCancelButton = ShowCancelButton;
+ field.ShowDeleteButton = ShowDeleteButton;
+ field.ShowEditButton = ShowEditButton;
+ field.ShowSelectButton = ShowSelectButton;
+ field.ShowInsertButton = ShowInsertButton;
+ field.UpdateImageUrl = UpdateImageUrl;
+ field.UpdateText = UpdateText;
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CompareValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CompareValidator.cs
new file mode 100644
index 00000000000..222cf98c3b7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CompareValidator.cs
@@ -0,0 +1,146 @@
+//
+// System.Web.UI.WebControls.CompareValidator.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxData("<{0}:CompareValidator runat=\"server\""
+ + "ErrorMessage=\"CompareValidator\"></{0}:CompareValidator>")]
+ public class CompareValidator: BaseCompareValidator
+#if NET_2_0
+ , IStaticTextControl
+#endif
+ {
+ public CompareValidator()
+ {
+ // Intitalize();
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (""), WebCategory ("Behavior")]
+ [TypeConverter (typeof (ValidatedControlConverter))]
+ [WebSysDescription ("The ID of a control that is compared.")]
+ public string ControlToCompare
+ {
+ get
+ {
+ object o = ViewState["ControlToCompare"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+
+ set
+ {
+ ViewState["ControlToCompare"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (typeof (ValidationCompareOperator), "Equal"), WebCategory ("Behavior")]
+ [WebSysDescription ("The operator that is used for comparison.")]
+ public ValidationCompareOperator Operator
+ {
+ get
+ {
+ object o = ViewState["Operator"];
+ if(o!=null)
+ return (ValidationCompareOperator)o;
+ return ValidationCompareOperator.Equal;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(ValidationCompareOperator), value))
+ throw new ArgumentException();
+ ViewState["Operator"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Behavior")]
+ [WebSysDescription ("The value that is compared to.")]
+ public string ValueToCompare
+ {
+ get
+ {
+ object o = ViewState["ValueToCompare"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ValueToCompare"] = value;
+ }
+ }
+
+ protected override bool EvaluateIsValid ()
+ {
+ string ctrl = GetControlValidationValue (ControlToValidate);
+ if (ctrl == null || ctrl.Length == 0)
+ return true;
+
+ string cmp;
+ if (ControlToCompare.Length > 0) {
+ cmp = GetControlValidationValue (ControlToCompare);
+ } else {
+ cmp = ValueToCompare;
+ }
+
+ return Compare (ctrl, cmp, Operator, Type);
+ }
+
+ [MonoTODO]
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender (writer);
+ }
+
+ [MonoTODO]
+ protected override bool ControlPropertiesValid ()
+ {
+ return base.ControlPropertiesValid ();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CompositeControl.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CompositeControl.cs
new file mode 100644
index 00000000000..7e1ad009fb9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CompositeControl.cs
@@ -0,0 +1,68 @@
+//
+// System.Web.UI.WebControls.CompositeControl.cs
+//
+// Authors:
+// Gaurav Vaish (gaurav.vaish@gmail.com)
+//
+// (C) 2004 Gaurav Vaish (http://www.mastergaurav.net)
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace System.Web.UI.WebControls
+{
+ public abstract class CompositeControl : WebControl, INamingContainer, ICompositeControlDesignerAccessor
+ {
+ protected CompositeControl()
+ {
+ }
+
+ public override ControlCollection Controls
+ {
+ get {
+ EnsureChildControls();
+ return base.Controls;
+ }
+ }
+
+ public override void DataBind()
+ {
+ OnDataBinding(EventArgs.Empty);
+ EnsureChildControls();
+ DataBindChildren();
+ }
+
+ void ICompositeControlDesignerAccessor.RecreateChildControls ()
+ {
+ if (ChildControlsCreated) {
+ ChildControlsCreated = false;
+ EnsureChildControls ();
+ }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CompositeDataBoundControl.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CompositeDataBoundControl.cs
new file mode 100644
index 00000000000..979d3e58777
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CompositeDataBoundControl.cs
@@ -0,0 +1,71 @@
+//
+// System.Web.UI.WebControls.CompositeDataBoundControl.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+
+namespace System.Web.UI.WebControls
+{
+ public abstract class CompositeDataBoundControl : DataBoundControl, INamingContainer
+ {
+ protected CompositeDataBoundControl ()
+ {
+ }
+
+ public override ControlCollection Controls
+ {
+ get {
+ EnsureChildControls();
+ return base.Controls;
+ }
+ }
+
+ protected override void CreateChildControls ()
+ {
+ base.CreateChildControls ();
+
+ if (Page.IsPostBack) {
+ object[] data = new object [(int)ViewState ["_ItemCount"]];
+ ViewState ["_ItemCount"] = CreateChildControls (data, false);
+ }
+ }
+
+ protected override void PerformDataBinding (IEnumerable data)
+ {
+ ViewState ["_ItemCount"] = CreateChildControls (data, true);
+ }
+
+ protected abstract int CreateChildControls (IEnumerable dataSource, bool dataBinding);
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Content.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Content.cs
new file mode 100644
index 00000000000..bdc0c126e1c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Content.cs
@@ -0,0 +1,56 @@
+//
+// System.Web.UI.WebControls.Content.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 Novell, Inc.
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxDataAttribute ("<{0}:Content runat='server'></{0}:Content>")]
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.ContentDesigner, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+ [ControlBuilder(typeof(ContentControlBuilder))]
+ public class Content: Control, INamingContainer
+ {
+ string placeHolderId;
+
+ [ThemeableAttribute (false)]
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Behavior")]
+ [IDReferencePropertyAttribute (typeof(ContentPlaceHolder))]
+ public string ContentPlaceHolderID {
+ get { return placeHolderId; }
+ set { placeHolderId = value; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ContentControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ContentControlBuilder.cs
new file mode 100644
index 00000000000..ca31d83b974
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ContentControlBuilder.cs
@@ -0,0 +1,60 @@
+//
+// System.Web.UI.WebControls.Content.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 Novell, Inc.
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI
+{
+ internal class ContentControlBuilder: TemplateBuilder
+ {
+ string placeHolderID;
+
+ public override void Init (TemplateParser parser,
+ ControlBuilder parentBuilder,
+ Type type,
+ string tagName,
+ string ID,
+ IDictionary attribs)
+ {
+ base.Init (parser, parentBuilder, type, tagName, ID, attribs);
+ placeHolderID = attribs ["ContentPlaceHolderID"] as string;
+ }
+
+ public string ContentPlaceHolderID {
+ get { return placeHolderID; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ContentDirection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ContentDirection.cs
new file mode 100644
index 00000000000..b9566b9d230
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ContentDirection.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.ContentDirection.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum ContentDirection {
+ NotSet = 0,
+ LeftToRight = 1,
+ RightToLeft = 2
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ContentPlaceHolder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ContentPlaceHolder.cs
new file mode 100644
index 00000000000..0b665b9fd2a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ContentPlaceHolder.cs
@@ -0,0 +1,49 @@
+//
+// System.Web.UI.WebControls.ContentPlaceholder.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 Novell, Inc.
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxItemFilterAttribute ("Microsoft.VisualStudio.Web.WebForms.MasterPageWebFormDesigner", ToolboxItemFilterType.Require)]
+ [ToolboxItemFilterAttribute ("System.Web.UI", ToolboxItemFilterType.Allow)]
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.ContentPlaceHolderDesigner, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+ [ToolboxDataAttribute ("<{0}:ContentPlaceHolder runat='server'></{0}:ContentPlaceHolder>")]
+ [ControlBuilder(typeof(ContentPlaceHolderBuilder))]
+ public class ContentPlaceHolder: Control, INamingContainer
+ {
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ContentPlaceHolderBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ContentPlaceHolderBuilder.cs
new file mode 100644
index 00000000000..c5d6a1b5b5d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ContentPlaceHolderBuilder.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.UI.WebControls.ContentPlaceHolderBuilder.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 Novell, Inc.
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI
+{
+ internal class ContentPlaceHolderBuilder: ControlBuilder
+ {
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ControlIDConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ControlIDConverter.cs
new file mode 100644
index 00000000000..1173d63b5ed
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ControlIDConverter.cs
@@ -0,0 +1,101 @@
+//
+// System.Web.UI.WebControls.ControlIDConverter.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+using System.ComponentModel;
+using System.Collections;
+
+namespace System.Web.UI.WebControls
+{
+ public class ControlIDConverter : StringConverter
+
+ {
+ public ControlIDConverter ()
+ { }
+
+ protected virtual bool FilterControl (Control control)
+ {
+ return true;
+ }
+
+ /*public ICollection GetStandardValues ()
+ {
+ return null;
+ }*/
+
+ public override TypeConverter.StandardValuesCollection GetStandardValues
+ (ITypeDescriptorContext context)
+ {
+ if (context == null)
+ return null;
+
+ IContainer container = context.Container;
+
+ if (container == null)
+ return null;
+
+ ComponentCollection ctrlCollection = container.Components;
+ ArrayList arrayList = new ArrayList (0);
+
+ foreach (Control control in ctrlCollection) {
+ if (FilterControl(control))
+ arrayList.Add (control.ID);
+ }
+ return new StandardValuesCollection (arrayList);
+ }
+
+ /*public bool GetStandardValuesExclusive ()
+ {
+ return false;
+ }*/
+
+ public override bool GetStandardValuesExclusive
+ (ITypeDescriptorContext context)
+ {
+ return false;
+ }
+
+ /*public bool GetStandardValuesSupported ()
+ {
+ return false;
+ }*/
+
+ public override bool GetStandardValuesSupported (ITypeDescriptorContext context)
+ {
+ if (context == null)
+ return false;
+
+ return true;
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ControlParameter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ControlParameter.cs
new file mode 100644
index 00000000000..5e6bae48d16
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ControlParameter.cs
@@ -0,0 +1,132 @@
+//
+// System.Web.UI.WebControls.ControlParameter
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls {
+
+ [DefaultPropertyAttribute ("ControlID")]
+ public class ControlParameter : Parameter {
+
+ public ControlParameter () : base ()
+ {
+ }
+
+ protected ControlParameter (ControlParameter original) : base (original)
+ {
+ this.ControlID = original.ControlID;
+ this.PropertyName = original.PropertyName;
+ }
+
+ public ControlParameter (string name, string controlID) : base (name)
+ {
+ ControlID = controlID;
+ }
+
+ public ControlParameter (string name, string controlID, string propertyName) : base (name)
+ {
+ ControlID = controlID;
+ PropertyName = propertyName;
+ }
+
+ public ControlParameter (string name, TypeCode type, string controlID, string propertyName) : base (name, type)
+ {
+ ControlID = controlID;
+ PropertyName = propertyName;
+ }
+
+ protected override Parameter Clone ()
+ {
+ return new ControlParameter (this);
+ }
+
+ protected override object Evaluate (HttpContext ctx, Control control)
+ {
+ if (control == null) return null;
+ if (control.Page == null) return null;
+
+ Control c = control.Page.FindControl (ControlID);
+ if (c == null) throw new HttpException ("Control '" + ControlID + "' not found.");
+
+ PropertyInfo prop = c.GetType().GetProperty (PropertyName);
+ if (prop == null) throw new HttpException ("Property '" + PropertyName + "' not found in type '" + c.GetType() + "'.");
+
+ return prop.GetValue (c, null);
+ }
+
+ [WebCategoryAttribute ("Control")]
+ [RefreshPropertiesAttribute (RefreshProperties.All)]
+ [TypeConverterAttribute (typeof (ControlIDConverter))]
+ [DefaultValueAttribute ("")]
+ [IDReferencePropertyAttribute (typeof(System.Web.UI.Control))]
+ public string ControlID {
+ get {
+ string s = ViewState ["ControlID"] as string;
+ if (s != null)
+ return s;
+
+ return "";
+ }
+ set {
+ if (ControlID != value) {
+ ViewState ["ControlID"] = value;
+ OnParameterChanged ();
+ }
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [TypeConverterAttribute (typeof (ControlPropertyNameConverter))]
+ [WebCategoryAttribute ("Control")]
+ public string PropertyName {
+ get {
+ string s = ViewState ["PropertyName"] as string;
+ if (s != null)
+ return s;
+
+ return "";
+ }
+ set {
+
+ if (PropertyName != value) {
+ ViewState ["PropertyName"] = value;
+ OnParameterChanged ();
+ }
+ }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ControlPropertyNameConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ControlPropertyNameConverter.cs
new file mode 100644
index 00000000000..7a418585e56
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ControlPropertyNameConverter.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.WebControls.ControlPropertyNameConverter.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class ControlPropertyNameConverter: StringConverter
+ {
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CookieParameter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CookieParameter.cs
new file mode 100644
index 00000000000..21d09877c0d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CookieParameter.cs
@@ -0,0 +1,99 @@
+//
+// System.Web.UI.WebControls.CookieParameter
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+
+ [DefaultPropertyAttribute ("CookieName")]
+ public class CookieParameter : Parameter {
+
+ public CookieParameter () : base ()
+ {
+ }
+
+ protected CookieParameter (CookieParameter original) : base (original)
+ {
+ this.CookieName = original.CookieName;
+ }
+
+ public CookieParameter (string name, string cookieName) : base (name)
+ {
+ CookieName = cookieName;
+ }
+
+ public CookieParameter (string name, TypeCode type, string cookieName) : base (name, type)
+ {
+ CookieName = cookieName;
+ }
+
+ protected override Parameter Clone()
+ {
+ return new CookieParameter (this);
+ }
+
+ protected override object Evaluate (HttpContext ctx, Control control)
+ {
+ if (control == null || ctx.Request == null)
+ return null;
+
+ HttpCookie c = ctx.Request.Cookies [CookieName];
+ if (c == null)
+ return null;
+
+ return c.Value;
+ }
+
+ [DefaultValueAttribute ("")]
+ public string CookieName {
+ get {
+ string s = ViewState ["CookieName"] as string;
+ if (s != null)
+ return s;
+
+ return "";
+ }
+ set {
+ if (CookieName != value) {
+ ViewState ["CookieName"] = value;
+ OnParameterChanged ();
+ }
+ }
+ }
+
+
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CreateUserErrorEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CreateUserErrorEventArgs.cs
new file mode 100644
index 00000000000..900f36ecbba
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CreateUserErrorEventArgs.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.UI.WebControls.CreateUserErrorEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+
+using System.Web.Security;
+
+namespace System.Web.UI.WebControls {
+ public class CreateUserErrorEventArgs : EventArgs
+ {
+ MembershipCreateStatus status;
+
+ public CreateUserErrorEventArgs (MembershipCreateStatus status)
+ {
+ this.status = status;
+ }
+
+ public MembershipCreateStatus CreateUserError {
+ get { return status; }
+ set { status = value; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CreateUserErrorEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CreateUserErrorEventHandler.cs
new file mode 100644
index 00000000000..5bfd7e652ba
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CreateUserErrorEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.CreateUserErrorEventHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void CreateUserErrorEventHandler (object sender, CreateUserErrorEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs
new file mode 100644
index 00000000000..80d373588f4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs
@@ -0,0 +1,141 @@
+//
+// System.Web.UI.WebControls.CustomValidator.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("ServerValidate")]
+ [ToolboxData("<{0}:CustomValidator runat=\"server\""
+ + "ErrorMessage=\"CustomValidator\">"
+ + "</{0}:CustomValidator>")]
+ public class CustomValidator : BaseValidator
+#if NET_2_0
+ , IStaticTextControl
+#endif
+ {
+ private static readonly object ServerValidateEvent = new object();
+
+ public CustomValidator()
+ {
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (""), WebCategory ("Behavior")]
+ [WebSysDescription ("A client script that performs the validation.")]
+ public string ClientValidationFunction
+ {
+ get
+ {
+ object o = ViewState["ClientValidationFunction"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ClientValidationFunction"] = value;
+ }
+ }
+
+ [WebSysDescription ("Raised for validation on the server.")]
+ public event ServerValidateEventHandler ServerValidate
+ {
+ add
+ {
+ Events.AddHandler(ServerValidateEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ServerValidateEvent, value);
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(RenderUplevel)
+ {
+ writer.AddAttribute("evaluationfunction", "CustomValidatorEvaluateIsValid");
+ if(ClientValidationFunction.Length > 0)
+ {
+ writer.AddAttribute("clientvalidationfunction", ClientValidationFunction);
+ }
+ }
+ }
+
+ protected override bool ControlPropertiesValid()
+ {
+ if(ControlToValidate.Length > 0)
+ {
+ CheckControlValidationProperty(ControlToValidate, "ControlToValidate");
+ }
+ return true;
+ }
+
+ protected virtual bool OnServerValidate(string value)
+ {
+ if(Events != null)
+ {
+ ServerValidateEventHandler sveh = (ServerValidateEventHandler)(Events[ServerValidateEvent]);
+ if(sveh != null)
+ {
+ ServerValidateEventArgs args = new ServerValidateEventArgs(value, true);
+ sveh(this, args);
+ return args.IsValid;
+ }
+ }
+ return true;
+ }
+
+ protected override bool EvaluateIsValid()
+ {
+ string ctrl = ControlToValidate;
+ if(ctrl.Length > 0)
+ {
+ ctrl = GetControlValidationValue(ctrl);
+ if(ctrl== null || ctrl.Length == 0)
+ {
+ return true;
+ }
+ }
+ return OnServerValidate(ctrl);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataBoundControl.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataBoundControl.cs
new file mode 100644
index 00000000000..c841a7a6df8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataBoundControl.cs
@@ -0,0 +1,203 @@
+//
+// System.Web.UI.WebControls.DataBoundControl
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2003 Ben Maurer
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Web.Util;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.HierarchicalDataBoundControlDesigner, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+ public abstract class DataBoundControl : BaseDataBoundControl
+ {
+ DataSourceSelectArguments selectArguments;
+ DataSourceView currentView;
+
+ protected DataBoundControl ()
+ {
+ }
+
+ protected IDataSource GetDataSource ()
+ {
+ if (IsBoundUsingDataSourceID) {
+ Control ctrl = NamingContainer.FindControl (DataSourceID);
+ if (ctrl == null)
+ throw new HttpException (string.Format ("A control with ID '{0}' could not be found.", DataSourceID));
+ if (!(ctrl is IDataSource))
+ throw new HttpException (string.Format ("The control with ID '{0}' is not a control of type IDataSource.", DataSourceID));
+ return (IDataSource) ctrl;
+ }
+
+ if (DataSource == null) return null;
+
+ IDataSource ds = DataSource as IDataSource;
+ if (ds != null) return ds;
+
+ IEnumerable ie = DataSourceHelper.GetResolvedDataSource (DataSource, DataMember);
+ if (ie != null) return new CollectionDataSource (ie);
+
+ throw new HttpException (string.Format ("Unexpected data source type: {0}", DataSource.GetType()));
+ }
+
+ protected DataSourceView GetData ()
+ {
+ if (currentView == null)
+ UpdateViewData ();
+ return currentView;
+ }
+
+ DataSourceView InternalGetData ()
+ {
+ if (DataSource != null && IsBoundUsingDataSourceID)
+ throw new HttpException ("Control bound using both DataSourceID and DataSource properties.");
+
+ IDataSource ds = GetDataSource ();
+ if (ds != null)
+ return ds.GetView (DataMember);
+ else
+ return null;
+ }
+
+ protected override void OnDataPropertyChanged ()
+ {
+ base.OnDataPropertyChanged ();
+ UpdateViewData ();
+ }
+
+ protected virtual void OnDataSourceViewChanged (object sender, EventArgs e)
+ {
+ RequiresDataBinding = true;
+ }
+
+ protected override void OnPagePreLoad (object sender, EventArgs e)
+ {
+ base.OnPagePreLoad (sender, e);
+ UpdateViewData ();
+ }
+
+ void UpdateViewData ()
+ {
+ DataSourceView view = InternalGetData ();
+ if (view == currentView) return;
+
+ if (currentView != null)
+ currentView.DataSourceViewChanged -= new EventHandler (OnDataSourceViewChanged);
+
+ currentView = view;
+
+ if (view != null)
+ view.DataSourceViewChanged += new EventHandler (OnDataSourceViewChanged);
+ }
+
+ // should be `internal protected' (why, oh WHY did they do that !?!)
+ protected override void OnLoad (EventArgs e)
+ {
+ if (IsBoundUsingDataSourceID && (!Page.IsPostBack || !EnableViewState))
+ RequiresDataBinding = true;
+
+ base.OnLoad(e);
+ }
+
+ protected virtual void PerformDataBinding (IEnumerable data)
+ {
+ OnDataBinding (EventArgs.Empty);
+ }
+
+ protected override void ValidateDataSource (object dataSource)
+ {
+ if (dataSource is IListSource || dataSource is IEnumerable || dataSource is IDataSource)
+ return;
+ throw new ArgumentException ("Invalid data source source type. The data source must be of type IListSource, IEnumerable or IDataSource.");
+ }
+
+ [ThemeableAttribute (false)]
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Data")]
+ public string DataMember
+ {
+ get {
+ object o = ViewState["DataMember"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set {
+ ViewState["DataMember"] = value;
+ }
+ }
+
+ [IDReferencePropertyAttribute (typeof(HierarchicalDataSourceControl))]
+ public override string DataSourceID {
+ get {
+ object o = ViewState ["DataSourceID"];
+ if (o != null)
+ return (string)o;
+
+ return String.Empty;
+ }
+ set {
+ ViewState ["DataSourceID"] = value;
+ base.DataSourceID = value;
+ }
+ }
+
+ protected override void PerformSelect ()
+ {
+ DataSourceView view = GetData ();
+ if (view != null)
+ view.Select (SelectArguments, new DataSourceViewSelectCallback (OnSelect));
+ }
+
+ void OnSelect (IEnumerable data)
+ {
+ PerformDataBinding (data);
+ }
+
+ protected virtual DataSourceSelectArguments CreateDataSourceSelectArguments ()
+ {
+ return DataSourceSelectArguments.Empty;
+ }
+
+ protected DataSourceSelectArguments SelectArguments {
+ get {
+ if (selectArguments == null)
+ selectArguments = CreateDataSourceSelectArguments ();
+ return selectArguments;
+ }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataControlButton.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataControlButton.cs
new file mode 100644
index 00000000000..fa652e864be
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataControlButton.cs
@@ -0,0 +1,170 @@
+//
+// System.Web.UI.WebControls.DataControlButton.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+
+namespace System.Web.UI.WebControls
+{
+ internal class DataControlButton: Button
+ {
+ Control container;
+
+ public DataControlButton (Control container)
+ {
+ this.container = container;
+ }
+
+ public DataControlButton (Control container, string text, string image, string command, string commandArg, bool allowCallback)
+ {
+ this.container = container;
+ Text = text;
+ ImageUrl = image;
+ CommandName = command;
+ CommandArgument = commandArg;
+ AllowCallback = allowCallback;
+ }
+
+ public string ImageUrl {
+ get {
+ object o = ViewState["iu"];
+ if (o != null) return (string) o;
+ return String.Empty;
+ }
+ set {
+ ViewState["iu"] = value;
+ }
+ }
+
+ public bool AllowCallback {
+ get {
+ object o = ViewState["ac"];
+ if (o != null) return (bool) o;
+ return true;
+ }
+ set {
+ ViewState["ac"] = value;
+ }
+ }
+
+ public virtual ButtonType ButtonType {
+ get {
+ object ob = ViewState ["ButtonType"];
+ if (ob != null) return (ButtonType) ob;
+ return ButtonType.Link;
+ }
+ set {
+ ViewState ["ButtonType"] = value;
+ }
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ if (CommandName.Length > 0 || ButtonType == ButtonType.Button)
+ {
+ string postScript = null;
+ string callScript = null;
+
+ IPostBackContainer pcner = container as IPostBackContainer;
+ if (pcner != null) {
+ PostBackOptions ops = pcner.GetPostBackOptions (this);
+ postScript = container.Page.ClientScript.GetPostBackEventReference (ops);
+ } else
+ postScript = Page.ClientScript.GetPostBackClientEvent (this, "");
+
+ if (CausesValidation && Page.Validators.Count > 0) {
+ postScript = Utils.GetClientValidatedEvent (Page) + postScript;
+ }
+
+ if (AllowCallback) {
+ ICallbackContainer ccner = container as ICallbackContainer;
+ if (ccner != null)
+ callScript = ccner.GetCallbackScript (this, CommandName + "$" + CommandArgument);
+ }
+
+ if (ButtonType == ButtonType.Link || ButtonType == ButtonType.Image)
+ {
+ if (ImageUrl.Length > 0) {
+ writer.AddAttribute (HtmlTextWriterAttribute.Type, "image");
+ writer.AddAttribute (HtmlTextWriterAttribute.Src, ResolveUrl (ImageUrl));
+ if (callScript != null)
+ writer.AddAttribute (HtmlTextWriterAttribute.Onclick, callScript);
+ else
+ writer.AddAttribute (HtmlTextWriterAttribute.Onclick, postScript);
+ if (Text.Length > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Alt, Text);
+ writer.RenderBeginTag (HtmlTextWriterTag.Input);
+ writer.RenderEndTag ();
+ }
+ else {
+ if (callScript != null) {
+ writer.AddAttribute (HtmlTextWriterAttribute.Onclick, callScript);
+ writer.AddAttribute (HtmlTextWriterAttribute.Href, "javascript:");
+ }
+ else
+ writer.AddAttribute (HtmlTextWriterAttribute.Href, "javascript:" + postScript);
+ writer.RenderBeginTag (HtmlTextWriterTag.A);
+ writer.Write (Text);
+ writer.RenderEndTag ();
+ }
+ }
+ else if (ButtonType == ButtonType.Button)
+ {
+ if (callScript != null)
+ writer.AddAttribute (HtmlTextWriterAttribute.Onclick, callScript);
+ else
+ writer.AddAttribute (HtmlTextWriterAttribute.Onclick, postScript);
+
+ writer.AddAttribute (HtmlTextWriterAttribute.Type, "submit");
+ writer.AddAttribute (HtmlTextWriterAttribute.Name, ClientID);
+ writer.AddAttribute (HtmlTextWriterAttribute.Value, Text);
+ writer.RenderBeginTag (HtmlTextWriterTag.Input);
+ writer.RenderEndTag ();
+ }
+ } else {
+ if (ImageUrl.Length > 0) {
+ writer.AddAttribute (HtmlTextWriterAttribute.Src, ResolveUrl (ImageUrl));
+ if (Text.Length > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Alt, Text);
+ writer.RenderBeginTag (HtmlTextWriterTag.Img);
+ writer.RenderEndTag ();
+ }
+ else {
+ writer.Write (Text);
+ }
+ }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataControlCellType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataControlCellType.cs
new file mode 100644
index 00000000000..a7c2f4c58df
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataControlCellType.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.DataControlCellType.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum DataControlCellType {
+ Header = 0,
+ Footer = 1,
+ DataCell = 2
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataControlField.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataControlField.cs
new file mode 100644
index 00000000000..68f05a0451d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataControlField.cs
@@ -0,0 +1,402 @@
+//
+// System.Web.UI.WebControls.DataControlField.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Security.Permissions;
+
+namespace System.Web.UI.WebControls {
+
+ [DefaultPropertyAttribute ("HeaderText")]
+ [TypeConverterAttribute (typeof(ExpandableObjectConverter))]
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public abstract class DataControlField : IStateManager, IDataSourceViewSchemaAccessor
+ {
+ bool tracking = false;
+ StateBag viewState;
+ Control control;
+ Style controlStyle;
+ TableItemStyle footerStyle;
+ TableItemStyle headerStyle;
+ TableItemStyle itemStyle;
+ bool sortingEnabled;
+
+ protected DataControlField()
+ {
+ viewState = new StateBag ();
+ }
+
+ internal void SetDirty ()
+ {
+ viewState.SetDirty ();
+ }
+
+ protected StateBag ViewState {
+ get { return viewState; }
+ }
+
+ public virtual void ExtractValuesFromCell (IOrderedDictionary dictionary,
+ DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
+ {
+ }
+
+ public virtual bool Initialize (bool sortingEnabled, Control control)
+ {
+ this.sortingEnabled = sortingEnabled;
+ this.control = control;
+ return true;
+ }
+
+ public virtual void InitializeCell (DataControlFieldCell cell,
+ DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
+ {
+ if (cellType == DataControlCellType.Header && ShowHeader)
+ {
+ if (HeaderText.Length > 0 || HeaderImageUrl.Length > 0) {
+ if (sortingEnabled && SortExpression.Length > 0)
+ cell.Controls.Add (new DataControlButton (control, HeaderText, HeaderImageUrl, "Sort", SortExpression, true));
+ else
+ cell.Controls.Add (new DataControlButton (control, HeaderText, HeaderImageUrl, string.Empty, string.Empty, true));
+ }
+ }
+ else if (cellType == DataControlCellType.Footer) {
+ cell.Text = FooterText;
+ }
+ }
+
+ protected internal DataControlField CloneField ()
+ {
+ DataControlField field = CreateField ();
+ CopyProperties (field);
+ return field;
+ }
+
+ protected abstract DataControlField CreateField ();
+
+ protected virtual void CopyProperties (DataControlField newField)
+ {
+ newField.AccessibleHeaderText = AccessibleHeaderText;
+ newField.ControlStyle.CopyFrom (ControlStyle);
+ newField.FooterStyle.CopyFrom (FooterStyle);
+ newField.FooterText = FooterText;
+ newField.HeaderImageUrl = HeaderImageUrl;
+ newField.HeaderStyle.CopyFrom (HeaderStyle);
+ newField.HeaderText = HeaderText;
+ newField.InsertVisible = InsertVisible;
+ newField.ItemStyle.CopyFrom (ItemStyle);
+ newField.ShowHeader = ShowHeader;
+ newField.SortExpression = SortExpression;
+ newField.Visible = Visible;
+ }
+
+ protected virtual void OnFieldChanged ()
+ {
+ if (FieldChanged != null)
+ FieldChanged (this, EventArgs.Empty);
+ }
+
+ protected virtual void LoadViewState (object savedState)
+ {
+ if (savedState == null)
+ return;
+
+ object [] states = (object []) savedState;
+ viewState.LoadViewState (states[0]);
+
+ if (states[1] != null)
+ ((IStateManager)controlStyle).LoadViewState (states[1]);
+ if (states[2] != null)
+ ((IStateManager)footerStyle).LoadViewState (states[2]);
+ if (states[3] != null)
+ ((IStateManager)headerStyle).LoadViewState (states[3]);
+ if (states[4] != null)
+ ((IStateManager)itemStyle).LoadViewState (states[4]);
+ }
+
+ protected virtual object SaveViewState()
+ {
+ object[] state = new object [5];
+ state [0] = viewState.SaveViewState ();
+ if (controlStyle != null)
+ state [1] = ((IStateManager) controlStyle).SaveViewState ();
+ if (footerStyle != null)
+ state [2] = ((IStateManager) footerStyle).SaveViewState ();
+ if (headerStyle != null)
+ state [3] = ((IStateManager) headerStyle).SaveViewState ();
+ if (itemStyle != null)
+ state [4] = ((IStateManager) itemStyle).SaveViewState ();
+
+ if (state [0] == null && state [1] == null && state [2] == null &&
+ state [3] == null && state [4] == null)
+ return null;
+
+ return state;
+ }
+
+ protected virtual void TrackViewState()
+ {
+ if (controlStyle != null) ((IStateManager) controlStyle).TrackViewState ();
+ if (footerStyle != null) ((IStateManager) footerStyle).TrackViewState ();
+ if (headerStyle != null) ((IStateManager) headerStyle).TrackViewState ();
+ if (itemStyle != null) ((IStateManager) itemStyle).TrackViewState ();
+ viewState.TrackViewState ();
+ tracking = true;
+ }
+
+ public virtual void ValidateSupportsCallback ()
+ {
+ throw new NotSupportedException ("Callback not supported");
+ }
+
+ void IStateManager.LoadViewState(object savedState)
+ {
+ LoadViewState(savedState);
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ return SaveViewState();
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ TrackViewState();
+ }
+
+ internal Exception GetNotSupportedPropException (string propName)
+ {
+ return new System.NotSupportedException ("The property '" + propName + "' is not supported in " + GetType().Name);
+ }
+
+ [MonoTODO ("Render this")]
+ [DefaultValueAttribute ("")]
+ [LocalizableAttribute (true)]
+ [WebCategoryAttribute ("Accessibility")]
+ public virtual string AccessibleHeaderText {
+ get {
+ object val = viewState ["accessibleHeaderText"];
+ return val != null ? (string) val : "";
+ }
+ set {
+ viewState ["accessibleHeaderText"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ protected Control Control {
+ get { return control; }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [DefaultValueAttribute (null)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Content)]
+ public virtual Style ControlStyle {
+ get {
+ if (controlStyle == null) {
+ controlStyle = new Style ();
+ if (IsTrackingViewState)
+ controlStyle.TrackViewState();
+ }
+ return controlStyle;
+ }
+ }
+
+ protected bool DesignMode {
+ get { return control != null && control.Site != null ? control.Site.DesignMode : false; }
+ }
+
+ [DefaultValueAttribute (null)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Content)]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [WebCategoryAttribute ("Styles")]
+ public virtual TableItemStyle FooterStyle {
+ get {
+ if (footerStyle == null) {
+ footerStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ footerStyle.TrackViewState();
+ }
+ return footerStyle;
+ }
+ }
+
+ [LocalizableAttribute (true)]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValue ("")]
+ public virtual string FooterText {
+ get {
+ object val = viewState ["footerText"];
+ return val != null ? (string) val : "";
+ }
+ set {
+ viewState ["footerText"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [UrlPropertyAttribute]
+ [DefaultValueAttribute ("")]
+ [EditorAttribute ("System.Web.UI.Design.UrlEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [WebCategoryAttribute ("Appearance")]
+ public virtual string HeaderImageUrl {
+ get {
+ object val = viewState ["headerImageUrl"];
+ return val != null ? (string) val : "";
+ }
+ set {
+ viewState ["headerImageUrl"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [DefaultValueAttribute (null)]
+ public virtual TableItemStyle HeaderStyle {
+ get {
+ if (headerStyle == null) {
+ headerStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ headerStyle.TrackViewState();
+ }
+ return headerStyle;
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [LocalizableAttribute (true)]
+ [WebCategoryAttribute ("Appearance")]
+ public virtual string HeaderText {
+ get {
+ object val = viewState ["headerText"];
+ return val != null ? (string) val : "";
+ }
+ set {
+ viewState ["headerText"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (true)]
+ public virtual bool InsertVisible {
+ get {
+ object val = viewState ["InsertVisible"];
+ return val != null ? (bool) val : true;
+ }
+ set {
+ viewState ["InsertVisible"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [WebCategoryAttribute ("Styles")]
+ [DefaultValueAttribute (null)]
+ public virtual TableItemStyle ItemStyle {
+ get {
+ if (itemStyle == null) {
+ itemStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ itemStyle.TrackViewState();
+ }
+ return itemStyle;
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (true)]
+ public virtual bool ShowHeader {
+ get {
+ object val = viewState ["showHeader"];
+ return val != null ? (bool) val : true;
+ }
+ set {
+ viewState ["showHeader"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+// [TypeConverterAttribute ("System.Web.UI.Design.DataSourceViewSchemaConverter, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [WebCategoryAttribute ("Behavior")]
+ public virtual string SortExpression {
+ get {
+ object val = viewState ["sortExpression"];
+ return val != null ? (string) val : "";
+ }
+ set {
+ viewState ["sortExpression"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (true)]
+ public bool Visible {
+ get {
+ object val = viewState ["visible"];
+ return val != null ? (bool) val : true;
+ }
+ set {
+ viewState ["visible"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ protected bool IsTrackingViewState
+ {
+ get { return tracking; }
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get { return IsTrackingViewState; }
+ }
+
+ object IDataSourceViewSchemaAccessor.DataSourceViewSchema {
+ get { return viewState ["dataSourceViewSchema"]; }
+ set {
+ viewState ["dataSourceViewSchema"] = value;
+ }
+ }
+
+ internal event EventHandler FieldChanged;
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldCell.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldCell.cs
new file mode 100644
index 00000000000..2bdf6b39ef8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldCell.cs
@@ -0,0 +1,56 @@
+//
+// System.Web.UI.WebControls.DataControlFieldCell.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class DataControlFieldCell : TableCell
+ {
+ DataControlField containerField;
+
+ public DataControlFieldCell (DataControlField containerField) : this (HtmlTextWriterTag.Td, containerField)
+ {
+ }
+
+ protected DataControlFieldCell (HtmlTextWriterTag tagKey, DataControlField containerField) : base (tagKey)
+ {
+ this.containerField = containerField;
+ }
+
+ public DataControlField ContainingField {
+ get { return containerField; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldCollection.cs
new file mode 100644
index 00000000000..d35e8145f73
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldCollection.cs
@@ -0,0 +1,152 @@
+//
+// System.Web.UI.WebControls.DataControlFieldCollection.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataControlFieldCollection: StateManagedCollection
+ {
+ static readonly Type[] fieldTypes = new Type [] {
+ typeof(BoundField), typeof(HyperLinkField), typeof(ImageField),
+ typeof(TemplateField), typeof(AutoGeneratedField), typeof(CheckBoxField),
+ typeof(ButtonField), typeof(CommandField)
+ };
+
+ public DataControlFieldCollection CloneFields ()
+ {
+ DataControlFieldCollection col = new DataControlFieldCollection ();
+ foreach (DataControlField field in this)
+ col.Add (field.CloneField ());
+ return col;
+ }
+
+ public void Add (DataControlField field)
+ {
+ ((IList)this).Add (field);
+ OnInsertField (field);
+ }
+
+ public bool Contains (DataControlField field)
+ {
+ return ((IList)this).Contains (field);
+ }
+
+ public void CopyTo (DataControlField[] array, int index)
+ {
+ ((IList)this).CopyTo (array, index);
+ }
+
+ public int IndexOf (DataControlField field)
+ {
+ return ((IList)this).IndexOf (field);
+ }
+
+ public void Insert (int index, DataControlField field)
+ {
+ ((IList)this).Insert (index, field);
+ OnInsertField (field);
+ }
+
+ public void Remove (DataControlField field)
+ {
+ ((IList)this).Remove (field);
+ OnRemoveField (field);
+ }
+
+ public void RemoveAt (int index)
+ {
+ DataControlField field = this [index];
+ ((IList)this).RemoveAt (index);
+ OnRemoveField (field);
+ }
+
+ [Browsable (false)]
+ public DataControlField this [int i] {
+ get { return (DataControlField) ((IList)this) [i]; }
+ }
+
+ void OnInsertField (DataControlField field)
+ {
+ field.FieldChanged += new EventHandler (OnFieldChanged);
+ OnFieldsChanged ();
+ }
+
+ void OnRemoveField (DataControlField field)
+ {
+ field.FieldChanged -= new EventHandler (OnFieldChanged);
+ OnFieldsChanged ();
+ }
+
+ void OnFieldChanged (object sender, EventArgs args)
+ {
+ OnFieldsChanged ();
+ }
+
+ void OnFieldsChanged ()
+ {
+ if (FieldsChanged != null) FieldsChanged (this, EventArgs.Empty);
+ }
+
+ protected override void SetDirtyObject (object o)
+ {
+ ((DataControlField)o).SetDirty ();
+ }
+
+ protected override object CreateKnownType (int index)
+ {
+ switch (index) {
+ case 0: return new BoundField ();
+ case 1: return new HyperLinkField ();
+ case 2: return new ImageField ();
+ case 3: return new TemplateField ();
+ case 4: return new AutoGeneratedField ();
+ case 5: return new CheckBoxField ();
+ case 6: return new ButtonField ();
+ case 7: return new CommandField ();
+ }
+ return null;
+ }
+
+ protected override Type [] GetKnownTypes ()
+ {
+ return fieldTypes;
+ }
+
+ public event EventHandler FieldsChanged;
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldHeaderCell.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldHeaderCell.cs
new file mode 100644
index 00000000000..084fd852d48
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldHeaderCell.cs
@@ -0,0 +1,87 @@
+//
+// System.Web.UI.WebControls.DataControlFieldHeaderCell.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class DataControlFieldHeaderCell : DataControlFieldCell
+ {
+ TableHeaderScope scope;
+
+ public DataControlFieldHeaderCell (DataControlField containerField): base (HtmlTextWriterTag.Th, containerField)
+ {
+ }
+
+ internal DataControlFieldHeaderCell (DataControlField containerField, TableHeaderScope scope): this (containerField)
+ {
+ this.scope = scope;
+ }
+
+ public TableHeaderScope Scope {
+ get {
+ object ob = ViewState ["Scope"];
+ if (ob != null) return (TableHeaderScope) ob;
+ else return TableHeaderScope.NotSet;
+ }
+ set {
+ ViewState ["Scope"] = value;
+ }
+ }
+
+ public virtual string AbbreviatedText {
+ get {
+ object ob = ViewState ["AbbreviatedText"];
+ if (ob != null) return (string) ob;
+ else return string.Empty;
+ }
+ set {
+ ViewState ["AbbreviatedText"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender (writer);
+ switch (scope) {
+ case TableHeaderScope.Column:
+ writer.AddAttribute (HtmlTextWriterAttribute.Scope, "col");
+ break;
+ case TableHeaderScope.Row:
+ writer.AddAttribute (HtmlTextWriterAttribute.Scope, "row");
+ break;
+ }
+ if (AbbreviatedText.Length > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Abbr, AbbreviatedText);
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataControlRowState.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataControlRowState.cs
new file mode 100644
index 00000000000..e94e5a682d6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataControlRowState.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.UI.WebControls.DataControlRowState.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ [FlagsAttribute]
+ public enum DataControlRowState {
+ Normal = 0,
+ Alternate = 1,
+ Selected = 2,
+ Edit = 4,
+ Insert = 8
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataControlRowType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataControlRowType.cs
new file mode 100644
index 00000000000..293269dbb47
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataControlRowType.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.UI.WebControls.DataControlRowType.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum DataControlRowType {
+ Header = 0,
+ Footer = 1,
+ DataRow = 2,
+ Separator = 3,
+ Pager = 4,
+ EmptyDataRow = 5
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs
new file mode 100644
index 00000000000..eb3549a9baa
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs
@@ -0,0 +1,1607 @@
+//
+// System.Web.UI.WebControls.DataGrid.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Collections;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.Web.Util;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls
+{
+ [Designer ("System.Web.UI.Design.WebControls.DataGridDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ [Editor ("System.Web.UI.Design.WebControls.DataGridComponentEditor, " + Consts.AssemblySystem_Design, typeof (ComponentEditor))]
+ public class DataGrid : BaseDataList, INamingContainer
+ {
+ public const string CancelCommandName = "Cancel";
+ public const string DeleteCommandName = "Delete";
+ public const string EditCommandName = "Edit";
+ public const string NextPageCommandArgument = "Next";
+ public const string PageCommandName = "Page";
+ public const string PrevPageCommandArgument = "Prev";
+ public const string SelectCommandName = "Select";
+ public const string SortCommandName = "Sort";
+ public const string UpdateCommandName = "Update";
+
+ private TableItemStyle alternatingItemStyle;
+ private TableItemStyle editItemStyle;
+ private TableItemStyle headerStyle;
+ private TableItemStyle footerStyle;
+ private TableItemStyle itemStyle;
+ private TableItemStyle selectedItemStyle;
+ private DataGridPagerStyle pagerStyle;
+
+ private DataGridColumnCollection columns;
+ private ArrayList columnsArrayList;
+ private DataGridItemCollection items;
+ private ArrayList itemsArrayList;
+ private PagedDataSource pagedDataSource;
+
+ private ArrayList autoGenColsArrayList;
+ private IEnumerator storedData;
+ private object storedDataFirst;
+ private bool storedDataValid;
+
+ private static readonly object CancelCommandEvent = new object();
+ private static readonly object DeleteCommandEvent = new object();
+ private static readonly object EditCommandEvent = new object();
+ private static readonly object ItemCommandEvent = new object();
+ private static readonly object ItemCreatedEvent = new object();
+ private static readonly object ItemDataBoundEvent = new object();
+ private static readonly object PageIndexChangedEvent = new object();
+ private static readonly object SortCommandEvent = new object();
+ private static readonly object UpdateCommandEvent = new object();
+
+ public DataGrid(): base()
+ {
+ }
+
+ [DefaultValue (false), WebCategory ("Paging")]
+ [WebSysDescription ("Allows custom paging.")]
+ public virtual bool AllowCustomPaging
+ {
+ get
+ {
+ object o = ViewState["AllowCustomPaging"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["AllowCustomPaging"] = value;
+ }
+ }
+
+ [DefaultValue (false), WebCategory ("Paging")]
+ [WebSysDescription ("Allow using multiple pages.")]
+ public virtual bool AllowPaging
+ {
+ get
+ {
+ object o = ViewState["AllowPaging"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["AllowPaging"] = value;
+ }
+ }
+
+ [DefaultValue (false), WebCategory ("Behavior")]
+ [WebSysDescription ("Allows the user to sort the table by clicking on column headers.")]
+ public virtual bool AllowSorting
+ {
+ get
+ {
+ object o = ViewState["AllowSorting"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["AllowSorting"] = value;
+ }
+ }
+
+ [NotifyParentProperty (true), WebCategory ("Style")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to alternating items.")]
+ public virtual TableItemStyle AlternatingItemStyle
+ {
+ get
+ {
+ if(alternatingItemStyle == null)
+ {
+ alternatingItemStyle = new TableItemStyle();
+ }
+ if(IsTrackingViewState)
+ {
+ alternatingItemStyle.TrackViewState();
+ }
+ return alternatingItemStyle;
+ }
+ }
+
+ [DefaultValue (true), WebCategory ("Behavior")]
+ [WebSysDescription ("Automatically generate columns at runtime for each field found in the datasource.")]
+ public virtual bool AutoGenerateColumns
+ {
+ get
+ {
+ object o = ViewState["AutoGenerateColumns"];
+ if(o != null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["AutoGenerateColumns"] = value;
+ }
+ }
+
+#if NET_2_0
+ [UrlProperty]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Appearance")]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [WebSysDescription ("The URL to the image file used as background.")]
+ public virtual string BackImageUrl
+ {
+ get
+ {
+ if (!ControlStyleCreated)
+ return string.Empty;
+ return ((TableStyle) base.ControlStyle).BackImageUrl;
+ }
+ set
+ {
+ ((TableStyle) base.ControlStyle).BackImageUrl = value;
+ }
+ }
+
+ [DefaultValue (true), WebCategory ("Behavior")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [MergableProperty (false)]
+ [Editor ("System.Web.UI.Design.WebControls.DataGridColumnCollectionEditor, " + Consts.AssemblySystem_Design, typeof (ComponentEditor))]
+ [WebSysDescription ("Automatically generate columns at runtime for each field found in the datasource.")]
+ public virtual DataGridColumnCollection Columns
+ {
+ get
+ {
+ if(columns == null)
+ {
+ columnsArrayList = new ArrayList();
+ columns = new DataGridColumnCollection(this, columnsArrayList);
+ if(IsTrackingViewState)
+ {
+ ((IStateManager)columns).TrackViewState();
+ }
+ }
+ return columns;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The index number for the currently selected page.")]
+ public int CurrentPageIndex
+ {
+ get
+ {
+ object o = ViewState["CurrentPageIndex"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ if(value < 0)
+ throw new ArgumentOutOfRangeException ("value", "CurrentPageIndex value has to be 0 for 'not set' or > 0.");
+ ViewState["CurrentPageIndex"] = value;
+ }
+ }
+
+
+ [DefaultValue (-1), WebCategory ("Misc")]
+ [WebSysDescription ("The index number for the currently edited item.")]
+ public virtual int EditItemIndex
+ {
+ get
+ {
+ object o = ViewState["EditItemIndex"];
+ if(o != null)
+ return (int)o;
+ return -1;
+ }
+ set
+ {
+ if(value < -1)
+ throw new ArgumentOutOfRangeException ("value", "EditItemIndex value has to be -1 for 'not set' or > -1.");
+ ViewState["EditItemIndex"] = value;
+ }
+ }
+
+ [NotifyParentProperty (true), WebCategory ("Style")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to items that are currently being edited.")]
+ public virtual TableItemStyle EditItemStyle
+ {
+ get
+ {
+ if(editItemStyle == null)
+ {
+ editItemStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ editItemStyle.TrackViewState();
+ }
+ }
+ return editItemStyle;
+ }
+ }
+
+ [DefaultValue (null), NotifyParentProperty (true), WebCategory ("Style")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to the footer.")]
+ public virtual TableItemStyle FooterStyle
+ {
+ get
+ {
+ if(footerStyle == null)
+ {
+ footerStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ footerStyle.TrackViewState();
+ }
+ }
+ return footerStyle;
+ }
+ }
+
+ [DefaultValue (null), NotifyParentProperty (true), WebCategory ("Style")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to the header.")]
+ public virtual TableItemStyle HeaderStyle
+ {
+ get
+ {
+ if(headerStyle == null)
+ {
+ headerStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ headerStyle.TrackViewState();
+ }
+ }
+ return headerStyle;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("A collection containing all items.")]
+ public virtual DataGridItemCollection Items
+ {
+ get
+ {
+ if(items == null)
+ {
+ if(itemsArrayList == null)
+ EnsureChildControls();
+ if(itemsArrayList == null)
+ {
+ itemsArrayList = new ArrayList();
+ }
+ items = new DataGridItemCollection(itemsArrayList);
+ }
+ return items;
+ }
+ }
+
+ [NotifyParentProperty (true), WebCategory ("Style")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to items.")]
+ public virtual TableItemStyle ItemStyle
+ {
+ get
+ {
+ if(itemStyle == null)
+ {
+ itemStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ itemStyle.TrackViewState();
+ }
+ }
+ return itemStyle;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The number of pages.")]
+ public int PageCount
+ {
+ get
+ {
+ if(pagedDataSource != null)
+ {
+ return pagedDataSource.PageCount;
+ }
+ object o = ViewState["PageCount"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ }
+
+ [NotifyParentProperty (true), WebCategory ("Style")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to the pager.")]
+ public virtual DataGridPagerStyle PagerStyle
+ {
+ get
+ {
+ if(pagerStyle == null)
+ {
+ pagerStyle = new DataGridPagerStyle(this);
+ if(IsTrackingViewState)
+ {
+ pagerStyle.TrackViewState();
+ }
+ }
+ return pagerStyle;
+ }
+ }
+
+ [DefaultValue (10), WebCategory ("Paging")]
+ [WebSysDescription ("The maximum number of entries that are created per page.")]
+ public virtual int PageSize
+ {
+ get
+ {
+ object o = ViewState["PageSize"];
+ if(o != null)
+ return (int)o;
+ return 10;
+ }
+ set
+ {
+ if(value < 1)
+ throw new ArgumentOutOfRangeException();
+ ViewState["PageSize"] = value;
+ }
+ }
+
+ [DefaultValue (-1), Bindable (true)]
+ [WebSysDescription ("The index number for the currently selected item.")]
+ public virtual int SelectedIndex
+ {
+ get
+ {
+ object o = ViewState["SelectedIndex"];
+ if(o != null)
+ return (int)o;
+ return -1;
+ }
+ set
+ {
+ if(value < -1)
+ throw new ArgumentOutOfRangeException();
+ int prevVal = SelectedIndex;
+ ViewState["SelectedIndex"] = value;
+ if (itemsArrayList != null) {
+ if (prevVal !=-1 && prevVal < itemsArrayList.Count) {
+ DataGridItem prev = (DataGridItem)itemsArrayList[prevVal];
+ if(prev.ItemType != ListItemType.EditItem)
+ {
+ ListItemType newType = ListItemType.Item;
+ if( (prevVal % 2) != 0)
+ {
+ newType = ListItemType.AlternatingItem;
+ }
+ prev.SetItemType(newType);
+ }
+ }
+
+ if (value != -1 && itemsArrayList.Count > value) {
+ DataGridItem itemToSelect = (DataGridItem) itemsArrayList [value];
+ if (itemToSelect.ItemType != ListItemType.EditItem) {
+ itemToSelect.SetItemType (ListItemType.SelectedItem);
+ }
+ }
+ }
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The currently selected item.")]
+ public virtual DataGridItem SelectedItem
+ {
+ get
+ {
+ if(SelectedIndex == -1)
+ return null;
+ return Items[SelectedIndex];
+ }
+ }
+
+ [NotifyParentProperty (true), WebCategory ("Style")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to the currently selected item.")]
+ public virtual TableItemStyle SelectedItemStyle
+ {
+ get
+ {
+ if(selectedItemStyle == null)
+ {
+ selectedItemStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ selectedItemStyle.TrackViewState();
+ }
+ }
+ return selectedItemStyle;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (false), WebCategory ("Appearance")]
+ [WebSysDescription ("Determines if the footer should be shown.")]
+ public virtual bool ShowFooter
+ {
+ get
+ {
+ object o = ViewState["ShowFooter"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["ShowFooter"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (false), WebCategory ("Appearance")]
+ [WebSysDescription ("Determines if the header should be shown.")]
+ public virtual bool ShowHeader
+ {
+ get
+ {
+ object o = ViewState["ShowHeader"];
+ if(o != null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["ShowHeader"] = value;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The number of items that are visible.")]
+ public virtual int VirtualItemCount
+ {
+ get
+ {
+ object o = ViewState["VirtualItemCount"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ if(value < 0)
+ throw new ArgumentOutOfRangeException ("value", "VirtualItemCount value has to be >= 0.");
+ ViewState["VirtualItemCount"] = value;
+ }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when a cancel command is generated.")]
+ public event DataGridCommandEventHandler CancelCommand
+ {
+ add
+ {
+ Events.AddHandler(CancelCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(CancelCommandEvent, value);
+ }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when a delete command is generated.")]
+ public event DataGridCommandEventHandler DeleteCommand
+ {
+ add
+ {
+ Events.AddHandler(DeleteCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(DeleteCommandEvent, value);
+ }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when an edit command is generated.")]
+ public event DataGridCommandEventHandler EditCommand
+ {
+ add
+ {
+ Events.AddHandler(EditCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(EditCommandEvent, value);
+ }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when an item command is generated.")]
+ public event DataGridCommandEventHandler ItemCommand
+ {
+ add
+ {
+ Events.AddHandler(ItemCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemCommandEvent, value);
+ }
+ }
+
+ [WebCategory ("Behavior")]
+ [WebSysDescription ("Raised when a new item is created.")]
+ public event DataGridItemEventHandler ItemCreated
+ {
+ add
+ {
+ Events.AddHandler(ItemCreatedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemCreatedEvent, value);
+ }
+ }
+
+ [WebCategory ("Behavior")]
+ [WebSysDescription ("Raised when a item gets data-bound.")]
+ public event DataGridItemEventHandler ItemDataBound
+ {
+ add
+ {
+ Events.AddHandler(ItemDataBoundEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemDataBoundEvent, value);
+ }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when the currently selected page changes.")]
+ public event DataGridPageChangedEventHandler PageIndexChanged
+ {
+ add
+ {
+ Events.AddHandler(PageIndexChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(PageIndexChangedEvent, value);
+ }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when a sort command is generated.")]
+ public event DataGridSortCommandEventHandler SortCommand
+ {
+ add
+ {
+ Events.AddHandler(SortCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(SortCommandEvent, value);
+ }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when an update command is generated.")]
+ public event DataGridCommandEventHandler UpdateCommand
+ {
+ add
+ {
+ Events.AddHandler(UpdateCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(UpdateCommandEvent, value);
+ }
+ }
+
+ protected override Style CreateControlStyle()
+ {
+ TableStyle style = new TableStyle(ViewState);
+ style.GridLines = GridLines.Both;
+ style.CellSpacing = 0;
+ return style;
+ }
+
+ protected override void LoadViewState(object savedState)
+ {
+ if (savedState == null)
+ return;
+
+ object [] states = (object []) savedState;
+ base.LoadViewState (states[0]);
+ if(columns != null)
+ ((IStateManager)columns).LoadViewState(states[1]);
+ if(pagerStyle != null)
+ pagerStyle.LoadViewState(states[2]);
+ if(headerStyle != null)
+ headerStyle.LoadViewState(states[3]);
+ if(footerStyle != null)
+ footerStyle.LoadViewState(states[4]);
+ if(itemStyle != null)
+ itemStyle.LoadViewState(states[5]);
+ if(alternatingItemStyle != null)
+ alternatingItemStyle.LoadViewState(states[6]);
+ if(selectedItemStyle != null)
+ selectedItemStyle.LoadViewState(states[7]);
+ if(editItemStyle != null)
+ editItemStyle.LoadViewState(states[8]);
+
+ if (states [9] != null) {
+ object[] array = ((object[]) states [9]);
+ if (array.Length != 0)
+ this.autoGenColsArrayList = new ArrayList ();
+ else
+ this.autoGenColsArrayList = null;
+
+ for (int i = 0; i < array.Length; i++) {
+ BoundColumn column1 = new BoundColumn ();
+ ((IStateManager)column1).TrackViewState ();
+ ((IStateManager)column1).LoadViewState (array [i]);
+ column1.SetOwner (this);
+ this.autoGenColsArrayList.Add (column1);
+ }
+ }
+ }
+
+ protected override object SaveViewState()
+ {
+ object[] states = new object [10];
+ states[0] = base.SaveViewState();
+ states[1] = (columns == null ? null : ((IStateManager)columns).SaveViewState());
+ states[2] = (pagerStyle == null ? null : pagerStyle.SaveViewState());
+ states[3] = (headerStyle == null ? null : headerStyle.SaveViewState());
+ states[4] = (footerStyle == null ? null : footerStyle.SaveViewState());
+ states[5] = (itemStyle == null ? null : itemStyle.SaveViewState());
+ states[6] = (alternatingItemStyle == null ? null : alternatingItemStyle.SaveViewState());
+ states[7] = (selectedItemStyle == null ? null : selectedItemStyle.SaveViewState());
+ states[8] = (editItemStyle == null ? null : editItemStyle.SaveViewState());
+
+ object [] array = null;
+ if ((this.autoGenColsArrayList != null) && (this.autoGenColsArrayList.Count != 0)) {
+ array = new object [((uint) this.autoGenColsArrayList.Count)];
+ for (int i = 0; i < array.Length; i++)
+ array [i] = ((IStateManager) this.autoGenColsArrayList [i]).SaveViewState ();
+ }
+
+ states [9] = array;
+
+ for (int i = states.Length - 1; i >= 0; i--) {
+ if (states [i] != null)
+ return states;
+ }
+
+ return null;
+ }
+
+ protected override void TrackViewState()
+ {
+ base.TrackViewState();
+ if(alternatingItemStyle != null)
+ {
+ alternatingItemStyle.TrackViewState();
+ }
+ if(editItemStyle != null)
+ {
+ editItemStyle.TrackViewState();
+ }
+ if(headerStyle != null)
+ {
+ headerStyle.TrackViewState();
+ }
+ if(footerStyle != null)
+ {
+ footerStyle.TrackViewState();
+ }
+ if(itemStyle != null)
+ {
+ itemStyle.TrackViewState();
+ }
+ if(selectedItemStyle != null)
+ {
+ selectedItemStyle.TrackViewState();
+ }
+ if(pagerStyle != null)
+ {
+ pagerStyle.TrackViewState();
+ }
+
+ if(columns != null)
+ {
+ ((IStateManager)columns).TrackViewState();
+ }
+ }
+
+ protected override bool OnBubbleEvent(object source, EventArgs e)
+ {
+ bool retVal = false;
+ if(e is DataGridCommandEventArgs)
+ {
+ DataGridCommandEventArgs ea = (DataGridCommandEventArgs)e;
+ retVal = true;
+ OnItemCommand(ea);
+ string cmd = ea.CommandName;
+ if(String.Compare(cmd, "select", true) == 0)
+ {
+ SelectedIndex = ea.Item.ItemIndex;
+ OnSelectedIndexChanged(EventArgs.Empty);
+ } else if(String.Compare(cmd,"page", true) == 0)
+ {
+ int cIndex = CurrentPageIndex;
+ string cea = (string) ea.CommandArgument;
+ if(String.Compare(cea, "prev", true) == 0)
+ {
+ cIndex--;
+ } else if(String.Compare(cea, "next", true) == 0)
+ {
+ cIndex++;
+ } else {
+ cIndex = Convert.ToInt32 (cea) - 1;
+ }
+
+ OnPageIndexChanged(new DataGridPageChangedEventArgs(source, cIndex));
+ } else if(String.Compare(cmd, "sort", true) == 0)
+ {
+ OnSortCommand(new DataGridSortCommandEventArgs(source, ea));
+ } else if(String.Compare(cmd, "edit", true) == 0)
+ {
+ OnEditCommand(ea);
+ } else if(String.Compare(cmd, "update", true) == 0)
+ {
+ OnUpdateCommand(ea);
+ } else if(String.Compare(cmd, "cancel", true) == 0)
+ {
+ OnCancelCommand(ea);
+ } else if(String.Compare(cmd, "delete", true) == 0)
+ {
+ OnDeleteCommand(ea);
+ }
+ }
+ return retVal;
+ }
+
+ protected virtual void OnCancelCommand(DataGridCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridCommandEventHandler dceh = (DataGridCommandEventHandler)(Events[CancelCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnDeleteCommand(DataGridCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridCommandEventHandler dceh = (DataGridCommandEventHandler)(Events[DeleteCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnEditCommand(DataGridCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridCommandEventHandler dceh = (DataGridCommandEventHandler)(Events[EditCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnItemCommand(DataGridCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridCommandEventHandler dceh = (DataGridCommandEventHandler)(Events[ItemCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnItemCreated(DataGridItemEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridItemEventHandler dceh = (DataGridItemEventHandler)(Events[ItemCreatedEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnItemDataBound(DataGridItemEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridItemEventHandler dceh = (DataGridItemEventHandler)(Events[ItemDataBoundEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnPageIndexChanged(DataGridPageChangedEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridPageChangedEventHandler dceh = (DataGridPageChangedEventHandler)(Events[PageIndexChangedEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnSortCommand(DataGridSortCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridSortCommandEventHandler dceh = (DataGridSortCommandEventHandler)(Events[SortCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnUpdateCommand(DataGridCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridCommandEventHandler dceh = (DataGridCommandEventHandler)(Events[UpdateCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected override void PrepareControlHierarchy()
+ {
+ if (Controls.Count == 0)
+ return;
+
+ Table display = (Table) Controls [0];
+ display.CopyBaseAttributes (this);
+ if (ControlStyleCreated) {
+ display.ApplyStyle (ControlStyle);
+ } else {
+ display.GridLines = GridLines.Both;
+ display.CellSpacing = 0;
+ }
+
+ TableRowCollection rows = display.Rows;
+ if (rows.Count == 0)
+ return;
+
+ int nCols = Columns.Count;
+ DataGridColumn [] cols = new DataGridColumn [nCols];
+ Style deployStyle = null;
+
+ if (nCols > 0)
+ Columns.CopyTo (cols, 0);
+
+ if (alternatingItemStyle != null) {
+ deployStyle = new TableItemStyle ();
+ deployStyle.CopyFrom (itemStyle);
+ deployStyle.CopyFrom (alternatingItemStyle);
+ } else {
+ deployStyle = itemStyle;
+ }
+
+ int nrows = rows.Count;
+ for (int counter = 0; counter < nrows; counter++)
+ PrepareControlHierarchyForItem (cols,
+ (DataGridItem) rows [counter],
+ counter,
+ deployStyle);
+ }
+
+ private void PrepareControlHierarchyForItem (DataGridColumn [] cols,
+ DataGridItem item,
+ int index,
+ Style deployStyle)
+ {
+ switch (item.ItemType) {
+ case ListItemType.Header:
+ if (!ShowHeader) {
+ item.Visible = false;
+ break;
+ }
+
+ if (headerStyle != null)
+ item.MergeStyle (headerStyle);
+
+ goto case ListItemType.Separator;
+ case ListItemType.Footer:
+ if (!ShowFooter) {
+ item.Visible = false;
+ break;
+ }
+
+ if (footerStyle != null)
+ item.MergeStyle (footerStyle);
+
+ goto case ListItemType.Separator;
+ case ListItemType.Item :
+ item.MergeStyle (itemStyle);
+ goto case ListItemType.Separator;
+ case ListItemType.AlternatingItem:
+ item.MergeStyle (deployStyle);
+ goto case ListItemType.Separator;
+ case ListItemType.SelectedItem:
+ Style selStyle = new TableItemStyle ();
+ if ((item.ItemIndex % 2) == 0) {
+ selStyle.CopyFrom (itemStyle);
+ } else {
+ selStyle.CopyFrom (deployStyle);
+ }
+
+ selStyle.CopyFrom (selectedItemStyle);
+ item.MergeStyle (selStyle);
+ goto case ListItemType.Separator;
+ case ListItemType.EditItem:
+ Style edStyle = new TableItemStyle ();
+ if ((item.ItemIndex % 2) == 0) {
+ edStyle.CopyFrom (itemStyle);
+ } else {
+ edStyle.CopyFrom (deployStyle);
+ }
+
+ edStyle.CopyFrom (editItemStyle);
+ item.MergeStyle (edStyle);
+ goto case ListItemType.Separator;
+ case ListItemType.Pager:
+ if (pagerStyle == null)
+ break;
+
+ if (!pagerStyle.Visible)
+ item.Visible = false;
+
+ if (index == 0) {
+ if (!pagerStyle.IsPagerOnTop) {
+ item.Visible = false;
+ break;
+ }
+ } else if (!pagerStyle.IsPagerOnBottom) {
+ item.Visible = false;
+ break;
+ }
+
+ item.MergeStyle (pagerStyle);
+ goto case ListItemType.Separator;
+ case ListItemType.Separator:
+ TableCellCollection cells = item.Cells;
+ int cellCount = cells.Count;
+ if (cellCount > cols.Length)
+ cellCount = cols.Length;
+
+ if (cellCount > 0 && item.ItemType != ListItemType.Pager) {
+ for (int i = 0; i < cellCount; i++) {
+ Style colStyle = null;
+ if (cols [i].Visible) {
+ switch (item.ItemType) {
+ case ListItemType.Header:
+ colStyle = cols [i].HeaderStyleInternal;
+ break;
+ case ListItemType.Footer:
+ colStyle = cols [i].FooterStyleInternal;
+ break;
+ default:
+ colStyle = cols [i].ItemStyleInternal;
+ break;
+ }
+ cells[i].MergeStyle (colStyle);
+ } else {
+ cells [i].Visible = false;
+ }
+ }
+ }
+ break;
+ default:
+ goto case ListItemType.Separator;
+ }
+ }
+
+ protected override void CreateControlHierarchy(bool useDataSource)
+ {
+ IEnumerator pageSourceEnumerator;
+ int itemCount;
+ ArrayList dataKeys;
+ ArrayList columns;
+ IEnumerable resolvedDS;
+ ICollection collResolvedDS;
+ int pageDSCount;
+ int colCount;
+ DataGridColumn[] cols;
+ Table deployTable;
+ TableRowCollection deployRows;
+ ListItemType deployType;
+ int indexCounter;
+ string dkField;
+ bool dsUse;
+ bool pgEnabled;
+ int editIndex;
+ int selIndex;
+
+ pagedDataSource = CreatePagedDataSource();
+ pageSourceEnumerator = null;
+ itemCount = -1;
+ dataKeys = DataKeysArray;
+ columns = null;
+ if(itemsArrayList != null)
+ {
+ itemsArrayList.Clear();
+ } else
+ {
+ itemsArrayList = new ArrayList();
+ }
+ if(!useDataSource)
+ {
+ itemCount = (int) ViewState["_!ItemCount"];
+ pageDSCount = (int) ViewState["_!DataSource_ItemCount"];
+ if(itemCount != -1)
+ {
+ if(pagedDataSource.IsCustomPagingEnabled)
+ {
+ pagedDataSource.DataSource = new DataSourceInternal(itemCount);
+ } else
+ {
+ pagedDataSource.DataSource = new DataSourceInternal(pageDSCount);
+ }
+ pageSourceEnumerator = pagedDataSource.GetEnumerator();
+ columns = CreateColumnSet(null, false);
+ itemsArrayList.Capacity = itemCount;
+ }
+ } else
+ {
+ dataKeys.Clear();
+ resolvedDS = GetResolvedDataSource ();
+ if(resolvedDS != null)
+ {
+ collResolvedDS = resolvedDS as ICollection;
+ if(pagedDataSource.IsPagingEnabled && !pagedDataSource.IsCustomPagingEnabled
+ && collResolvedDS == null)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("DataGrid_Missing_VirtualItemCount", ID));
+ }
+ pagedDataSource.DataSource = resolvedDS;
+ if(pagedDataSource.IsPagingEnabled && (pagedDataSource.CurrentPageIndex < 0 ||
+ pagedDataSource.PageCount < pagedDataSource.CurrentPageIndex))
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("DataGrid_Invalid_Current_PageIndex", ID));
+ }
+ columns = CreateColumnSet(pagedDataSource, useDataSource);
+
+ if(storedDataValid)
+ {
+ pageSourceEnumerator = storedData;
+ } else
+ {
+ pageSourceEnumerator = pagedDataSource.GetEnumerator();
+ }
+ if(collResolvedDS != null)
+ {
+ pageDSCount = pagedDataSource.Count;
+ dataKeys.Capacity = pageDSCount;
+ itemsArrayList.Capacity = pageDSCount;
+ }
+ }
+ }
+
+ colCount = 0;
+ if(columns != null)
+ colCount = columns.Count;
+ int currentSourceIndex;
+ if(colCount > 0)
+ {
+ cols = (DataGridColumn []) columns.ToArray (typeof (DataGridColumn));
+ foreach(DataGridColumn current in cols)
+ {
+ current.Initialize();
+ }
+ deployTable = new DataGridTableInternal();
+ Controls.Add(deployTable);
+ deployRows = deployTable.Rows;
+
+ indexCounter = 0;
+ currentSourceIndex = 0;
+ dkField = DataKeyField;
+
+ dsUse = (useDataSource) ? (dkField.Length > 0) : false;
+ pgEnabled = pagedDataSource.IsPagingEnabled;
+ editIndex = EditItemIndex;
+ selIndex = SelectedIndex;
+ if(pgEnabled)
+ {
+ currentSourceIndex = pagedDataSource.FirstIndexInPage;
+ CreateItem(-1, -1, ListItemType.Pager, false, null,
+ cols, deployRows, pagedDataSource);
+ }
+ itemCount = 0;
+ CreateItem(-1, -1, ListItemType.Header, useDataSource, null,
+ cols, deployRows, null);
+
+ if(storedDataValid && storedDataFirst != null)
+ {
+ if(dsUse)
+ {
+ dataKeys.Add(DataBinder.GetPropertyValue(storedDataFirst, dkField));
+ }
+ if (indexCounter == editIndex) {
+ deployType = ListItemType.EditItem;
+ } else if (indexCounter == selIndex) {
+ deployType = ListItemType.SelectedItem;
+ } else {
+ deployType = ListItemType.Item;
+ }
+
+ itemsArrayList.Add(CreateItem(0, currentSourceIndex, deployType,
+ useDataSource, storedDataFirst,
+ cols, deployRows, null));
+ itemCount++;
+ indexCounter++;
+ currentSourceIndex++;
+ storedDataValid = false;
+ storedDataFirst = null;
+ }
+
+ while(pageSourceEnumerator.MoveNext())
+ {
+ object current = pageSourceEnumerator.Current;
+ if(dsUse)
+ {
+ dataKeys.Add(DataBinder.GetPropertyValue(current, dkField));
+ }
+
+ if (indexCounter == editIndex) {
+ deployType = ListItemType.EditItem;
+ } else if (indexCounter == selIndex) {
+ deployType = ListItemType.SelectedItem;
+ } else if ((indexCounter % 2) == 1) {
+ deployType = ListItemType.AlternatingItem;
+ } else {
+ deployType = ListItemType.Item;
+ }
+
+ itemsArrayList.Add(CreateItem(indexCounter, currentSourceIndex,
+ deployType, useDataSource, current,
+ cols, deployRows, null));
+ itemCount++;
+ indexCounter++;
+ currentSourceIndex++;
+ }
+
+ CreateItem(-1, -1, ListItemType.Footer, useDataSource, null,
+ cols, deployRows, null);
+
+ if(pgEnabled)
+ {
+ CreateItem(-1, -1, ListItemType.Pager, false, null, cols, deployRows,
+ pagedDataSource);
+ }
+ }
+
+ if(useDataSource)
+ {
+ if(pageSourceEnumerator != null)
+ {
+ ViewState["_!ItemCount"] = itemCount;
+ if(pagedDataSource.IsPagingEnabled)
+ {
+ ViewState["PageCount"] = pagedDataSource.PageCount;
+ ViewState["_!DataSource_ItemCount"] = pagedDataSource.DataSourceCount;
+ } else
+ {
+ ViewState["PageCount"] = 1;
+ ViewState["_!DataSource_ItemCount"] = itemCount;
+ }
+ } else
+ {
+ ViewState["_!ItemCount"] = -1;
+ ViewState["_!DataSource_ItemCount"] = -1;
+ ViewState["PageCount"] = 0;
+ }
+ }
+ pagedDataSource = null;
+ }
+
+ private DataGridItem CreateItem(int itemIndex, int dsIndex, ListItemType type,
+ bool bind, object item, DataGridColumn[] columns,
+ TableRowCollection rows, PagedDataSource dataSrc)
+
+ {
+ DataGridItem retVal;
+ DataGridItemEventArgs args;
+
+ retVal = CreateItem(itemIndex, dsIndex, type);
+ args = new DataGridItemEventArgs(retVal);
+
+ if(type != ListItemType.Pager)
+ {
+ InitializeItem(retVal, columns);
+ if(bind)
+ {
+ retVal.DataItem = item;
+ }
+ OnItemCreated(args);
+ rows.Add(retVal);
+ if(bind)
+ {
+ retVal.DataBind();
+ OnItemDataBound(args);
+ retVal.DataItem = null;
+ }
+ } else
+ {
+ InitializePager(retVal, columns.Length, dataSrc);
+ OnItemCreated(args);
+ rows.Add(retVal);
+ }
+ return retVal;
+ }
+
+ protected virtual DataGridItem CreateItem(int itemIndex, int dataSourceIndex, ListItemType itemType)
+ {
+ return new DataGridItem(itemIndex, dataSourceIndex, itemType);
+ }
+
+ protected virtual void InitializeItem(DataGridItem item, DataGridColumn[] columns)
+ {
+ TableCellCollection cells = item.Cells;
+ TableCell cCell;
+
+ for(int i = 0; i < columns.Length; i++)
+ {
+ cCell = new TableCell();
+ columns[i].InitializeCell(cCell, i, item.ItemType);
+ cells.Add(cCell);
+ }
+ }
+
+ protected virtual void InitializePager(DataGridItem item,
+ int columnSpan, PagedDataSource pagedDataSource)
+ {
+ TableCell toAdd = new TableCell();
+ toAdd.ColumnSpan = columnSpan;
+
+ if(PagerStyle.Mode == PagerMode.NextPrev)
+ {
+ if(!pagedDataSource.IsFirstPage)
+ {
+ LinkButton link = new DataGridLinkButton();
+ link.Text = PagerStyle.PrevPageText;
+ link.CommandName = "Page";
+ link.CommandArgument = "Prev";
+ link.CausesValidation = false;
+ toAdd.Controls.Add(link);
+ } else
+ {
+ Label label = new Label();
+ label.Text = PagerStyle.PrevPageText;
+ toAdd.Controls.Add(label);
+ }
+ toAdd.Controls.Add(new LiteralControl("&nbsp;"));
+
+ if (pagedDataSource.PageCount == 0) {
+ Label label = new Label();
+ label.Text = PagerStyle.NextPageText;
+ toAdd.Controls.Add(label);
+ } else {
+ if(!pagedDataSource.IsLastPage)
+ {
+ LinkButton link = new DataGridLinkButton();
+ link.Text = PagerStyle.NextPageText;
+ link.CommandName = "Page";
+ link.CommandArgument = "Next";
+ link.CausesValidation = false;
+ toAdd.Controls.Add(link);
+ } else
+ {
+ Label label = new Label();
+ label.Text = PagerStyle.NextPageText;
+ toAdd.Controls.Add(label);
+ }
+ }
+ } else
+ {
+ int pageCount = pagedDataSource.PageCount;
+ int currPage = pagedDataSource.CurrentPageIndex + 1;
+ int btnCount = PagerStyle.PageButtonCount;
+ int numberOfPages = btnCount;
+ if(numberOfPages > pageCount)
+ numberOfPages = pageCount;
+ int firstPageNumber = 1; // 10
+ int lastPageNumber = numberOfPages; // 11
+
+ if(currPage > lastPageNumber)
+ {
+ firstPageNumber = (pagedDataSource.CurrentPageIndex / btnCount) * btnCount + 1;
+ lastPageNumber = firstPageNumber + btnCount - 1;
+ if(lastPageNumber > pageCount)
+ lastPageNumber = pageCount;
+ if((lastPageNumber - firstPageNumber + 1) < btnCount)
+ firstPageNumber = Math.Max(1, lastPageNumber - btnCount + 1);
+ }
+ if(firstPageNumber != 1)
+ {
+ LinkButton toAddBtn = new DataGridLinkButton();
+ toAddBtn.Text = "...";
+ toAddBtn.CommandName = "Page";
+ toAddBtn.CommandArgument = (firstPageNumber - 1).ToString(NumberFormatInfo.InvariantInfo);
+ toAddBtn.CausesValidation = false;
+ toAdd.Controls.Add(toAddBtn);
+ toAdd.Controls.Add(new LiteralControl("&nbsp;"));
+ }
+ if (lastPageNumber == 0) {
+ Label cPageLabel = new Label();
+ cPageLabel.Text = "1";
+ toAdd.Controls.Add(cPageLabel);
+ } else {
+ for(int i = firstPageNumber; i <= lastPageNumber; i++)
+ {
+ string argText = i.ToString(NumberFormatInfo.InvariantInfo);
+ if(i == currPage)
+ {
+ Label cPageLabel = new Label();
+ cPageLabel.Text = argText;
+ toAdd.Controls.Add(cPageLabel);
+ } else
+ {
+ LinkButton indexButton = new DataGridLinkButton();
+ indexButton.Text = argText;
+ indexButton.CommandName = "Page";
+ indexButton.CommandArgument = argText;
+ indexButton.CausesValidation = false;
+ toAdd.Controls.Add(indexButton);
+ }
+ if(i < lastPageNumber)
+ toAdd.Controls.Add(new LiteralControl("&nbsp;"));
+ }
+ }
+ if(pageCount > lastPageNumber)
+ {
+ toAdd.Controls.Add(new LiteralControl("&nbsp;"));
+ LinkButton contLink = new DataGridLinkButton();
+ contLink.Text = "...";
+ contLink.CommandName = "Page";
+ contLink.CommandArgument = (lastPageNumber + 1).ToString(NumberFormatInfo.InvariantInfo);
+ contLink.CausesValidation = false;
+ toAdd.Controls.Add(contLink);
+ }
+ }
+ item.Cells.Add(toAdd);
+ }
+
+ private PagedDataSource CreatePagedDataSource()
+ {
+ PagedDataSource retVal;
+
+ retVal = new PagedDataSource();
+ retVal.CurrentPageIndex = CurrentPageIndex;
+ retVal.PageSize = PageSize;
+ retVal.AllowPaging = AllowPaging;
+ retVal.AllowCustomPaging = AllowCustomPaging;
+ retVal.VirtualCount = VirtualItemCount;
+
+ return retVal;
+ }
+
+ ///<summary>
+ /// UnDocumented method
+ /// </summary>
+ protected virtual ArrayList CreateColumnSet(PagedDataSource source, bool useDataSource)
+ {
+ DataGridColumn[] cols = new DataGridColumn [Columns.Count];
+ Columns.CopyTo (cols, 0);
+ ArrayList l_columns = new ArrayList ();
+
+ foreach (DataGridColumn current in cols)
+ l_columns.Add (current);
+
+ if (AutoGenerateColumns) {
+ ArrayList auto_columns = null;
+ if (useDataSource) {
+ auto_columns = AutoCreateColumns (source);
+ autoGenColsArrayList = auto_columns;
+ } else {
+ auto_columns = autoGenColsArrayList;
+ }
+
+ if (auto_columns != null && auto_columns.Count > 0)
+ l_columns.AddRange (auto_columns);
+ }
+
+ return l_columns;
+ }
+
+ /// <summary>
+ /// Generates the columns when AutoGenerateColumns is true.
+ /// This method is called by CreateColumnSet when dataSource
+ /// is to be used and columns need to be generated automatically.
+ /// </summary>
+ private ArrayList AutoCreateColumns(PagedDataSource source)
+ {
+ if(source != null)
+ {
+ ArrayList retVal = new ArrayList();
+ PropertyDescriptorCollection props = source.GetItemProperties(new PropertyDescriptor[0]);
+ Type prop_type;
+ BoundColumn b_col;
+ if(props == null)
+ {
+ object fitem = null;
+ prop_type = null;
+ PropertyInfo prop_item = source.DataSource.GetType().GetProperty("Item",
+ BindingFlags.Instance | BindingFlags.Static |
+ BindingFlags.Public, null, null,
+ new Type[] { typeof(int) }, null);
+
+ if(prop_item != null)
+ {
+ prop_type = prop_item.PropertyType;
+ }
+ if(prop_type == null || prop_type == typeof(object))
+ {
+
+ IEnumerator en = source.GetEnumerator();
+ if(en.MoveNext())
+ fitem = en.Current;
+ if(fitem != null)
+ {
+ prop_type = fitem.GetType();
+ }
+ StoreEnumerator(en, fitem);
+ }
+
+ if(fitem != null && fitem is ICustomTypeDescriptor)
+ {
+ props = TypeDescriptor.GetProperties(fitem);
+ } else if(prop_type != null) {
+ if(IsBindableType(prop_type))
+ {
+ b_col = new BoundColumn();
+ ((IStateManager)b_col).TrackViewState();
+ b_col.HeaderText = "Item";
+ b_col.SortExpression = "Item";
+ b_col.DataField = BoundColumn.thisExpr;
+ b_col.SetOwner(this);
+ retVal.Add(b_col);
+ } else
+ {
+ props = TypeDescriptor.GetProperties(prop_type);
+ }
+ }
+
+ }
+ if(props != null && props.Count > 0)
+ {
+ //IEnumerable p_en = props.GetEnumerator();
+ try
+ {
+ foreach(PropertyDescriptor current in props)
+ {
+ if(IsBindableType(current.PropertyType))
+ {
+ b_col = new BoundColumn();
+ ((IStateManager)b_col).TrackViewState();
+ b_col.HeaderText = current.Name;
+ b_col.SortExpression = current.Name;
+ b_col.DataField = current.Name;
+ b_col.ReadOnly = current.IsReadOnly;
+ b_col.SetOwner(this);
+ retVal.Add(b_col);
+ }
+ }
+ } finally
+ {
+ if(props is IDisposable)
+ ((IDisposable)props).Dispose();
+ }
+ }
+ if(retVal.Count > 0)
+ {
+ return retVal;
+ }
+ throw new HttpException(HttpRuntime.FormatResourceString("DataGrid_NoAutoGenColumns", ID));
+ }
+ return null;
+ }
+
+ internal void StoreEnumerator(IEnumerator source, object firstItem)
+ {
+ storedData = source;
+ storedDataFirst = firstItem;
+ storedDataValid = true;
+ }
+
+ internal void OnColumnsChanged()
+ {
+ }
+
+ internal void OnPagerChanged()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumn.cs
new file mode 100644
index 00000000000..05a4dd24e0c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumn.cs
@@ -0,0 +1,460 @@
+//
+// System.Web.UI.WebControls.DataGridColumn.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public abstract class DataGridColumn : IStateManager
+ {
+ private StateBag viewState;
+ private bool marked;
+ private TableItemStyle footerStyle;
+ private TableItemStyle headerStyle;
+ private TableItemStyle itemStyle;
+
+ private DataGrid owner;
+ private bool designMode;
+
+ public DataGridColumn()
+ {
+ viewState = new StateBag();
+ }
+
+ internal TableItemStyle FooterStyleInternal
+ {
+ get
+ {
+ return footerStyle;
+ }
+ }
+
+ internal TableItemStyle HeaderStyleInternal
+ {
+ get
+ {
+ return headerStyle;
+ }
+ }
+
+ internal TableItemStyle ItemStyleInternal
+ {
+ get
+ {
+ return itemStyle;
+ }
+ }
+
+ [DefaultValue (null), WebCategory ("Misc")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to the footer of this column.")]
+ public virtual TableItemStyle FooterStyle
+ {
+ get
+ {
+ if(footerStyle == null)
+ {
+ footerStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ footerStyle.TrackViewState();
+ }
+ }
+ return footerStyle;
+ }
+ }
+
+ [DefaultValue (null), WebCategory ("Misc")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to the header of this column.")]
+ public virtual TableItemStyle HeaderStyle
+ {
+ get
+ {
+ if(headerStyle == null)
+ {
+ headerStyle= new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ headerStyle.TrackViewState();
+ }
+ }
+ return headerStyle;
+ }
+ }
+
+ [DefaultValue (null), WebCategory ("Misc")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to the rows of this column.")]
+ public virtual TableItemStyle ItemStyle
+ {
+ get
+ {
+ if(itemStyle == null)
+ {
+ itemStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ itemStyle.TrackViewState();
+ }
+ }
+ return itemStyle;
+ }
+ }
+
+ [DefaultValue (""), WebCategory ("Misc")]
+ [WebSysDescription ("The text within the footer of this column.")]
+ public virtual string FooterText
+ {
+ get
+ {
+ object o = ViewState["FooterText"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["FooterText"] = value;
+ OnColumnChanged();
+ }
+ }
+
+#if NET_2_0
+ [UrlProperty]
+#endif
+ [DefaultValue (""), WebCategory ("Misc")]
+ [WebSysDescription ("The URL to an image that is displayed in the header of this column.")]
+ public virtual string HeaderImageUrl
+ {
+ get
+ {
+ object o = ViewState["HeaderImageUrl"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["HeaderImageUrl"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ [DefaultValue (""), WebCategory ("Misc")]
+ [WebSysDescription ("The text within the header of this column.")]
+ public virtual string HeaderText
+ {
+ get
+ {
+ object o = ViewState["HeaderText"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["HeaderText"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ [DefaultValue (""), WebCategory ("Misc")]
+ [WebSysDescription ("An expression that determines how the colum should be sorted.")]
+ public virtual string SortExpression
+ {
+ get
+ {
+ object o = ViewState["SortExpression"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["SortExpression"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ [DefaultValue (true), WebCategory ("Misc")]
+ [WebSysDescription ("The visibility of this column.")]
+ public bool Visible
+ {
+ get
+ {
+ object o = ViewState["Visible"];
+ if(o != null)
+ {
+ return (bool)o;
+ }
+ return true;
+ }
+ set
+ {
+ ViewState["Visible"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual void Initialize()
+ {
+ if(owner != null && owner.Site != null)
+ {
+ designMode = owner.Site.DesignMode;
+ }
+ }
+
+ public virtual void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ switch(itemType)
+ {
+ case ListItemType.Header : InitializeCellHeader(cell, columnIndex);
+ break;
+ case ListItemType.Footer : InitializeCellFooter(cell, columnIndex);
+ break;
+ default : if (ItemStyleInternal != null)
+ cell.ApplyStyle (ItemStyleInternal);
+ return;
+ }
+ }
+
+ private void InitializeCellHeader(TableCell cell, int columnIndex)
+ {
+ WebControl ctrl = null;
+ bool sort = true;
+ string sortExpr = "";
+ ImageButton headButton;
+ Image headImage;
+ LinkButtonInternal link;
+
+ if(owner != null)
+ {
+ sort = owner.AllowSorting;
+ }
+ if(sort)
+ {
+ sortExpr = SortExpression;
+ if(sortExpr.Length == 0)
+ {
+ sort = false;
+ }
+ }
+ if(HeaderImageUrl.Length > 0)
+ {
+ if(sort)
+ {
+ headButton = new ImageButton();
+ headButton.ImageUrl = HeaderImageUrl;
+ headButton.CommandName = "Sort";
+ headButton.CommandArgument = sortExpr;
+ headButton.CausesValidation = false;
+ ctrl = headButton;
+ } else
+ {
+ headImage = new Image();
+ headImage.ImageUrl = HeaderImageUrl;
+ ctrl = headImage;
+ }
+ } else
+ {
+ if(sort)
+ {
+ link = new LinkButtonInternal();
+ link.Text = HeaderText;
+ link.CommandName = "Sort";
+ link.CommandArgument = sortExpr;
+ link.CausesValidation = false;
+ ctrl = link;
+ } else
+ {
+ if(HeaderText.Length > 0)
+ {
+ cell.Text = HeaderText;
+ } else
+ {
+ cell.Text = "&nbsp;";
+ }
+ }
+ }
+ if(ctrl != null)
+ {
+ cell.Controls.Add(ctrl);
+ }
+ if (HeaderStyleInternal != null)
+ cell.ApplyStyle (HeaderStyleInternal);
+ }
+
+ private void InitializeCellFooter(TableCell cell, int columnIndex)
+ {
+ cell.Text = (FooterText.Length > 0 ? FooterText : "&nbsp;");
+ if (FooterStyleInternal != null)
+ cell.ApplyStyle (FooterStyleInternal);
+ }
+
+ public override string ToString()
+ {
+ return String.Empty;
+ }
+
+ protected bool DesignMode
+ {
+ get
+ {
+ return designMode;
+ }
+ }
+
+ protected DataGrid Owner
+ {
+ get
+ {
+ return owner;
+ }
+ }
+
+ protected StateBag ViewState
+ {
+ get
+ {
+ return viewState;
+ }
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected virtual void OnColumnChanged()
+ {
+ if(owner != null)
+ {
+ owner.OnColumnsChanged();
+ }
+ }
+
+ internal void SetOwner (DataGrid datagrid)
+ {
+ owner = datagrid;
+ }
+
+ protected virtual object SaveViewState()
+ {
+ object[] states = new object[4];
+ states[0] = ViewState.SaveViewState();
+ states[1] = (footerStyle == null ? null : footerStyle.SaveViewState());
+ states[2] = (headerStyle == null ? null : headerStyle.SaveViewState());
+ states[3] = (itemStyle == null ? null : itemStyle.SaveViewState());
+
+ for (int i = 0; i < states.Length; i++) {
+ if (states [i] != null)
+ return states;
+ }
+ return null;
+ }
+
+ protected virtual void LoadViewState(object savedState)
+ {
+ if (savedState == null)
+ return;
+
+ object[] states = (object[]) savedState;
+ ViewState.LoadViewState (states [0]);
+ FooterStyle.LoadViewState (states [1]);
+ HeaderStyle.LoadViewState (states [2]);
+ ItemStyle.LoadViewState (states [3]);
+ }
+
+ protected virtual void TrackViewState()
+ {
+ marked = true;
+ ViewState.TrackViewState();
+ if(footerStyle != null)
+ {
+ footerStyle.TrackViewState();
+ }
+ if(headerStyle != null)
+ {
+ headerStyle.TrackViewState();
+ }
+ if(itemStyle != null)
+ {
+ itemStyle.TrackViewState();
+ }
+ }
+
+ protected bool IsTrackingViewState
+ {
+ get
+ {
+ return marked;
+ }
+ }
+
+ void IStateManager.LoadViewState(object savedState)
+ {
+ LoadViewState(savedState);
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ return SaveViewState();
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ TrackViewState();
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get
+ {
+ return IsTrackingViewState;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumnCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumnCollection.cs
new file mode 100644
index 00000000000..8b8ccc2a483
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumnCollection.cs
@@ -0,0 +1,230 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridColumnCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataGridColumnCollection : ICollection, IEnumerable, IStateManager
+ {
+ private DataGrid owner;
+ private ArrayList columns;
+ private bool trackViewState;
+
+ public DataGridColumnCollection(DataGrid owner, ArrayList columns)
+ {
+ this.owner = owner;
+ this.columns = columns;
+ }
+
+ [Browsable (false)]
+ public int Count
+ {
+ get
+ {
+ return columns.Count;
+ }
+ }
+
+ [Browsable (false)]
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ [Browsable (false)]
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ [Browsable (false)]
+ public DataGridColumn this[int index]
+ {
+ get
+ {
+ return (DataGridColumn)(columns[index]);
+ }
+ }
+
+ [Browsable (false)]
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void Add(DataGridColumn column)
+ {
+ AddAt(-1, column);
+ }
+
+ public void AddAt(int index, DataGridColumn column)
+ {
+ if(index == -1)
+ {
+ columns.Add(column);
+ } else
+ {
+ columns.Insert(index, column);
+ }
+
+ column.SetOwner (owner);
+ if(trackViewState)
+ {
+ ((IStateManager)column).TrackViewState();
+ }
+ OnColumnsChanged();
+ }
+
+ internal void OnColumnsChanged()
+ {
+ if(owner != null)
+ {
+ owner.OnColumnsChanged();
+ }
+ }
+
+ public void Clear()
+ {
+ columns.Clear();
+ OnColumnsChanged();
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(DataGridColumn current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return columns.GetEnumerator();
+ }
+
+ public int IndexOf(DataGridColumn column)
+ {
+ if(column != null)
+ {
+ return columns.IndexOf(column);
+ }
+ return -1;
+ }
+
+ public void Remove(DataGridColumn column)
+ {
+ if(column != null)
+ {
+ RemoveAt(IndexOf(column));
+ }
+ }
+
+ public void RemoveAt(int index)
+ {
+ if(index >= 0 && index < columns.Count)
+ {
+ columns.RemoveAt(index);
+ OnColumnsChanged();
+ return;
+ }
+ //This exception is not documented, but thrown
+ throw new ArgumentOutOfRangeException("string");
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ if (columns.Count == 0)
+ return null;
+
+ ArrayList retVal = new ArrayList (columns.Count);
+ bool found = false;
+ foreach (IStateManager current in columns) {
+ object o = current.SaveViewState ();
+ retVal.Add (o);
+ if (o != null)
+ found = true;
+ }
+
+ if (!found)
+ return null;
+
+ return retVal;
+ }
+
+ void IStateManager.LoadViewState(object savedState)
+ {
+ if (savedState == null || !(savedState is ArrayList))
+ return;
+
+ ArrayList list = (ArrayList) savedState;
+ int end = list.Count;
+ if (end != columns.Count)
+ return;
+
+ for (int i = 0; i < end; i++) {
+ IStateManager col = (IStateManager) columns [i];
+ col.LoadViewState (list [i]);
+ }
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ trackViewState = true;
+ foreach (IStateManager col in columns)
+ col.TrackViewState ();
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get
+ {
+ return trackViewState;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventArgs.cs
new file mode 100644
index 00000000000..3eced19102e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventArgs.cs
@@ -0,0 +1,70 @@
+
+//
+// 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.
+//
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: DataGridCommandEventArgs
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+#if !NET_2_0
+ sealed
+#endif
+ public class DataGridCommandEventArgs : CommandEventArgs
+ {
+ DataGridItem dgItem;
+ object cmdSrc;
+
+ public DataGridCommandEventArgs(DataGridItem item, object commandSource, CommandEventArgs originalArgs): base(originalArgs)
+ {
+ dgItem = item;
+ cmdSrc = commandSource;
+ }
+
+ public object CommandSource
+ {
+ get
+ {
+ return cmdSrc;
+ }
+ }
+
+ public DataGridItem Item
+ {
+ get
+ {
+ return dgItem;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventHandler.cs
new file mode 100644
index 00000000000..e003a064ca1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventHandler.cs
@@ -0,0 +1,38 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: DataGridCommandEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataGridCommandEventHandler(object sender, DataGridCommandEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItem.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItem.cs
new file mode 100644
index 00000000000..a56266e016e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItem.cs
@@ -0,0 +1,110 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridItem
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class DataGridItem : TableRow, INamingContainer
+#if NET_2_0
+ , IDataItemContainer
+#endif
+ {
+ private int itemIndex;
+ private int dataSetIndex;
+ private ListItemType itemType;
+ private object dataItem;
+
+ public DataGridItem(int itemIndex, int dataSetIndex, ListItemType itemType): base()
+ {
+ this.itemIndex = itemIndex;
+ this.dataSetIndex = dataSetIndex;
+ this.itemType = itemType;
+ }
+
+ public virtual object DataItem
+ {
+ get
+ {
+ return dataItem;
+ }
+ set
+ {
+ dataItem = value;
+ }
+ }
+
+ public virtual int DataSetIndex
+ {
+ get
+ {
+ return dataSetIndex;
+ }
+ }
+
+ public virtual int ItemIndex
+ {
+ get
+ {
+ return itemIndex;
+ }
+ }
+
+ public virtual ListItemType ItemType
+ {
+ get
+ {
+ return itemType;
+ }
+ }
+
+ protected override bool OnBubbleEvent(object source, EventArgs e)
+ {
+ if(e is CommandEventArgs)
+ {
+ DataGridCommandEventArgs args = new DataGridCommandEventArgs(this, source, (CommandEventArgs)e);
+ RaiseBubbleEvent(this, args);
+ return true;
+ }
+ return false;
+ }
+
+ protected internal virtual void SetItemType(ListItemType itemType)
+ {
+ this.itemType = itemType;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemCollection.cs
new file mode 100644
index 00000000000..4cb43d24a7d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemCollection.cs
@@ -0,0 +1,104 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridItemCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class DataGridItemCollection : ICollection, IEnumerable
+ {
+ private ArrayList items;
+
+ public DataGridItemCollection(ArrayList items)
+ {
+ this.items = items;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return items.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public DataGridItem this[int index]
+ {
+ get
+ {
+ return (DataGridItem)(items[index]);
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(DataGridItem current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return items.GetEnumerator();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventArgs.cs
new file mode 100644
index 00000000000..ff719d1f9eb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventArgs.cs
@@ -0,0 +1,58 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridItemEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class DataGridItemEventArgs : EventArgs
+ {
+ DataGridItem item;
+
+ public DataGridItemEventArgs(DataGridItem item)
+ {
+ this.item = item;
+ }
+
+ public DataGridItem Item
+ {
+ get
+ {
+ return item;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventHandler.cs
new file mode 100644
index 00000000000..61e7f76f9cd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventHandler.cs
@@ -0,0 +1,38 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: DataGridItemEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataGridItemEventHandler(object sender, DataGridItemEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridLinkButton.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridLinkButton.cs
new file mode 100755
index 00000000000..13d9a8acc65
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridLinkButton.cs
@@ -0,0 +1,75 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridLinkButton
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ * Contact: <gvaish_mono@lycos.com>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Drawing;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ class DataGridLinkButton : LinkButton
+ {
+ public DataGridLinkButton() : base()
+ {
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ SetForeColor();
+ base.Render(writer);
+ }
+
+ private void SetForeColor()
+ {
+ if(!ControlStyle.IsSet(System.Web.UI.WebControls.Style.FORECOLOR))
+ {
+ Control ctrl = this;
+ int level = 0;
+ while(level < 3)
+ {
+ ctrl = ctrl.Parent;
+ Color foreColor = ((WebControl)ctrl).ForeColor;
+ if(foreColor != Color.Empty)
+ {
+ ForeColor = foreColor;
+ return;
+ }
+ level++;
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventArgs.cs
new file mode 100644
index 00000000000..39d14d2b1a4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventArgs.cs
@@ -0,0 +1,71 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridPageChangedEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+#if !NET_2_0
+ sealed
+#endif
+ public class DataGridPageChangedEventArgs : EventArgs
+ {
+ private object source;
+ private int npIndex;
+
+ public DataGridPageChangedEventArgs(object commandSource, int newPageIndex)
+ {
+ source = commandSource;
+ npIndex = newPageIndex;
+ }
+
+ public object CommandSource
+ {
+ get
+ {
+ return source;
+ }
+ }
+
+ public int NewPageIndex
+ {
+ get
+ {
+ return npIndex;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventHandler.cs
new file mode 100644
index 00000000000..373c1276548
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventHandler.cs
@@ -0,0 +1,37 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataGridPageChangedEventHandler(object sender, DataGridPageChangedEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPagerStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPagerStyle.cs
new file mode 100644
index 00000000000..3d239f17b2f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPagerStyle.cs
@@ -0,0 +1,334 @@
+//
+// System.Web.UI.WebControls.DataGridPagerStyle.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataGridPagerStyle : TableItemStyle
+ {
+ DataGrid owner;
+
+ private static int MODE = (0x01 << 19);
+ private static int NEXT_PG_TEXT = (0x01 << 20);
+ private static int PG_BTN_COUNT = (0x01 << 21);
+ private static int POSITION = (0x01 << 22);
+ private static int VISIBLE = (0x01 << 23);
+ private static int PREV_PG_TEXT = (0x01 << 24);
+
+ internal DataGridPagerStyle(DataGrid owner): base()
+ {
+ this.owner = owner;
+ }
+
+ internal bool IsPagerOnTop
+ {
+ get {
+ PagerPosition p = Position;
+ return (p == PagerPosition.Top || p == PagerPosition.TopAndBottom);
+ }
+ }
+
+ internal bool IsPagerOnBottom
+ {
+ get {
+ PagerPosition p = Position;
+ return (p == PagerPosition.Bottom || p == PagerPosition.TopAndBottom);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (PagerMode), "NextPrev"), WebCategory ("Misc")]
+ [NotifyParentProperty (true)]
+ [WebSysDescription ("The mode used for displaying multiple pages.")]
+ public PagerMode Mode
+ {
+ get
+ {
+ if(IsSet(MODE))
+ {
+ return (PagerMode)ViewState["Mode"];
+ }
+ return PagerMode.NextPrev;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(PagerMode), value))
+ {
+ throw new ArgumentOutOfRangeException("value");
+ }
+ ViewState["Mode"] = value;
+ Set(MODE);
+ }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (">"), WebCategory ("Misc")]
+ [NotifyParentProperty (true)]
+ [WebSysDescription ("The text for the 'next page' button.")]
+ public string NextPageText
+ {
+ get
+ {
+ if(IsSet(NEXT_PG_TEXT))
+ {
+ return (string)ViewState["NextPageText"];
+ }
+ return "&gt;";
+ }
+ set
+ {
+ ViewState["NextPageText"] = value;
+ Set(NEXT_PG_TEXT);
+ }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue ("<"), WebCategory ("Misc")]
+ [NotifyParentProperty (true)]
+ [WebSysDescription ("The text for the 'previous page' button.")]
+ public string PrevPageText
+ {
+ get
+ {
+ if(IsSet(PREV_PG_TEXT))
+ {
+ return (string)ViewState["PrevPageText"];
+ }
+ return "&lt;";
+ }
+ set
+ {
+ ViewState["PrevPageText"] = value;
+ Set(PREV_PG_TEXT);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (10), WebCategory ("Misc")]
+ [NotifyParentProperty (true)]
+ [WebSysDescription ("The maximum number of pages to show as direct links.")]
+ public int PageButtonCount
+ {
+ get
+ {
+ if(IsSet(PG_BTN_COUNT))
+ {
+ return (int)ViewState["PageButtonCount"];
+ }
+ return 10;
+ }
+ set
+ {
+ if (value < 1)
+ throw new ArgumentOutOfRangeException("value");
+
+ ViewState["PageButtonCount"] = value;
+ Set(PG_BTN_COUNT);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (PagerPosition), "Bottom"), WebCategory ("Misc")]
+ [NotifyParentProperty (true)]
+ [WebSysDescription ("The position for the page display.")]
+ public PagerPosition Position
+ {
+ get
+ {
+ if(IsSet(POSITION))
+ {
+ return (PagerPosition)ViewState["Position"];
+ }
+ return PagerPosition.Bottom;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(PagerPosition), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["Position"] = value;
+ Set(POSITION);
+ }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (true), WebCategory ("Misc")]
+ [NotifyParentProperty (true)]
+ [WebSysDescription ("Determines if paging functionallity is visible to the user.")]
+ public bool Visible
+ {
+ get
+ {
+ if(IsSet(VISIBLE))
+ {
+ return (bool)ViewState["PagerVisible"];
+ }
+ return true;
+ }
+ set
+ {
+ ViewState["PagerVisible"] = value;
+ Set(VISIBLE);
+ owner.OnPagerChanged();
+ }
+ }
+
+ public override void CopyFrom(Style s)
+ {
+ if(s != null && !s.IsEmpty)
+ {
+ base.CopyFrom(s);
+ if(!(s is DataGridPagerStyle)) return;
+
+ DataGridPagerStyle from = (DataGridPagerStyle)s;
+ if(from.IsSet(MODE))
+ {
+ Mode = from.Mode;
+ }
+ if(from.IsSet(NEXT_PG_TEXT))
+ {
+ NextPageText = from.NextPageText;
+ }
+ if(from.IsSet(PG_BTN_COUNT))
+ {
+ PageButtonCount = from.PageButtonCount;
+ }
+ if(from.IsSet(POSITION))
+ {
+ Position = from.Position;
+ }
+ if(from.IsSet(VISIBLE))
+ {
+ Visible = from.Visible;
+ }
+ if(from.IsSet(PREV_PG_TEXT))
+ {
+ PrevPageText = from.PrevPageText;
+ }
+ }
+ }
+
+ public override void MergeWith(Style s)
+ {
+ if(s != null && !s.IsEmpty)
+ {
+ if(IsEmpty)
+ {
+ CopyFrom(s);
+ return;
+ }
+
+ base.MergeWith(s);
+
+ if(!(s is DataGridPagerStyle)) return;
+
+ DataGridPagerStyle with = (DataGridPagerStyle)s;
+ if(with.IsSet(MODE) && !IsSet(MODE))
+ {
+ Mode = with.Mode;
+ }
+ if(with.IsSet(NEXT_PG_TEXT) && !IsSet(NEXT_PG_TEXT))
+ {
+ NextPageText = with.NextPageText;
+ }
+ if(with.IsSet(PG_BTN_COUNT) && !IsSet(PG_BTN_COUNT))
+ {
+ PageButtonCount = with.PageButtonCount;
+ }
+ if(with.IsSet(POSITION) && !IsSet(POSITION))
+ {
+ Position = with.Position;
+ }
+ if(with.IsSet(VISIBLE) && !IsSet(VISIBLE))
+ {
+ Visible = with.Visible;
+ }
+ if(with.IsSet(PREV_PG_TEXT) && !IsSet(PREV_PG_TEXT))
+ {
+ PrevPageText = with.PrevPageText;
+ }
+ }
+ }
+
+ public override void Reset()
+ {
+ if(IsSet(MODE))
+ {
+ ViewState.Remove("Mode");
+ }
+ if(IsSet(NEXT_PG_TEXT))
+ {
+ ViewState.Remove("NextPageText");
+ }
+ if(IsSet(PG_BTN_COUNT))
+ {
+ ViewState.Remove("PageButtonCount");
+ }
+ if(IsSet(POSITION))
+ {
+ ViewState.Remove("Position");
+ }
+ if(IsSet(VISIBLE))
+ {
+ ViewState.Remove("PagerVisible");
+ }
+ if(IsSet(PREV_PG_TEXT))
+ {
+ ViewState.Remove("PrevPageText");
+ }
+ base.Reset();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventArgs.cs
new file mode 100644
index 00000000000..7016e11bfa3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventArgs.cs
@@ -0,0 +1,71 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridSortCommandEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+#if !NET_2_0
+ sealed
+#endif
+ public class DataGridSortCommandEventArgs : EventArgs
+ {
+ private object source;
+ private string sortExpr;
+
+ public DataGridSortCommandEventArgs(object commandSource, DataGridCommandEventArgs dce)
+ {
+ source = commandSource;
+ sortExpr = (string)dce.CommandArgument;
+ }
+
+ public object CommandSource
+ {
+ get
+ {
+ return source;
+ }
+ }
+
+ public string SortExpression
+ {
+ get
+ {
+ return sortExpr;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventHandler.cs
new file mode 100644
index 00000000000..51047c95140
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventHandler.cs
@@ -0,0 +1,37 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataGridSortCommandEventHandler(object sender, DataGridSortCommandEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridTableInternal.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridTableInternal.cs
new file mode 100755
index 00000000000..22df6d09113
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridTableInternal.cs
@@ -0,0 +1,53 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridTableInternal
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ internal class DataGridTableInternal : Table
+ {
+ public DataGridTableInternal() : base()
+ {
+ PreventAutoID ();
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(ID == null)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Id, Parent.ClientID);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataKey.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataKey.cs
new file mode 100644
index 00000000000..38baee635b7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataKey.cs
@@ -0,0 +1,147 @@
+//
+// System.Web.UI.WebControls.DataKey.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+ public class DataKey : IStateManager
+ {
+ IOrderedDictionary keyTable;
+ string[] keyNames;
+ bool trackViewState;
+ IOrderedDictionary readonlyKeyTable;
+
+ public DataKey (IOrderedDictionary keyTable)
+ {
+ this.keyTable = keyTable;
+ }
+
+ public DataKey (IOrderedDictionary keyTable, string[] keyNames)
+ {
+ this.keyTable = keyTable;
+ this.keyNames = keyNames;
+ }
+
+ public virtual object this [int index] {
+ get { return keyTable [index]; }
+ }
+
+ public virtual object this [string name] {
+ get { return keyTable [name]; }
+ }
+
+ public virtual object Value {
+ get { return keyTable [0]; }
+ }
+
+ public virtual IOrderedDictionary Values {
+ get {
+ if (readonlyKeyTable == null) {
+ if (keyTable is OrderedDictionary)
+ readonlyKeyTable = ((OrderedDictionary)keyTable).AsReadOnly ();
+ else
+ readonlyKeyTable = keyTable;
+ }
+ return readonlyKeyTable;
+ }
+ }
+
+ protected virtual void LoadViewState (object savedState)
+ {
+ if (savedState is Pair) {
+ Pair p = (Pair) savedState;
+ object[] akeys = (object[]) p.First;
+ object[] avals = (object[]) p.Second;
+ for (int n=0; n<akeys.Length; n++) {
+ keyTable [akeys[n]] = avals [n];
+ }
+ } else if (savedState is object[]) {
+ object[] avals = (object[]) savedState;
+ for (int n=0; n<avals.Length; n++)
+ keyTable [keyNames[n]] = avals [n];
+ }
+ }
+
+ protected virtual object SaveViewState ()
+ {
+ if (keyTable.Count == 0) return null;
+
+ if (keyNames != null) {
+ object[] avals = new object [keyTable.Count];
+ int n=0;
+ foreach (object val in keyTable.Values)
+ avals [n++] = val;
+ return avals;
+ } else {
+ object[] avals = new object [keyTable.Count];
+ object[] akeys = new object [keyTable.Count];
+ int n=0;
+ foreach (DictionaryEntry de in keyTable) {
+ akeys [n] = de.Key;
+ avals [n++] = de.Value;
+ }
+ return new Pair (akeys, avals);
+ }
+ }
+
+ protected virtual void TrackViewState ()
+ {
+ trackViewState = true;
+ }
+
+ protected virtual bool IsTrackingViewState {
+ get { return trackViewState; }
+ }
+
+ void IStateManager.LoadViewState (object savedState)
+ {
+ LoadViewState (savedState);
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ return SaveViewState ();
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ TrackViewState ();
+ }
+
+ bool IStateManager.IsTrackingViewState {
+ get { return IsTrackingViewState; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataKeyArray.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataKeyArray.cs
new file mode 100644
index 00000000000..fa2d126c16b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataKeyArray.cs
@@ -0,0 +1,117 @@
+//
+// System.Web.UI.WebControls.DataKey.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataKeyArray : ICollection, IEnumerable, IStateManager
+ {
+ private ArrayList keys;
+ bool trackViewState;
+
+ public DataKeyArray (ArrayList keys)
+ {
+ this.keys = keys;
+ }
+
+ public int Count {
+ get { return keys.Count; }
+ }
+
+ public bool IsReadOnly {
+ get { return false; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public DataKey this [int index] {
+ get { return (DataKey) keys [index]; }
+ }
+
+ public object SyncRoot {
+ get { return keys.SyncRoot; }
+ }
+
+ public void CopyTo (DataKey[] array, int index)
+ {
+ foreach (DataKey current in this)
+ array [index++] = current;
+ }
+
+ void ICollection.CopyTo(Array array, int index)
+ {
+ foreach(object current in this)
+ array.SetValue(current, index++);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return keys.GetEnumerator();
+ }
+
+ void IStateManager.LoadViewState (object savedState)
+ {
+ if (savedState == null) return;
+ object[] data = (object[]) savedState;
+ for (int n=0; n<data.Length && n<keys.Count; n++)
+ ((IStateManager)keys[n]).LoadViewState (data [n]);
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ if (keys.Count == 0) return null;
+ object[] data = new object [keys.Count];
+ for (int n=0; n<keys.Count; n++)
+ data [n] = ((IStateManager)keys[n]).SaveViewState ();
+ return data;
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ trackViewState = true;
+ foreach (IStateManager k in keys)
+ k.TrackViewState ();
+ }
+
+ bool IStateManager.IsTrackingViewState {
+ get { return trackViewState; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataKeyCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataKeyCollection.cs
new file mode 100644
index 00000000000..62ea7b6476a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataKeyCollection.cs
@@ -0,0 +1,104 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataKeyCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataKeyCollection : ICollection, IEnumerable
+ {
+ private ArrayList keys;
+
+ public DataKeyCollection(ArrayList keys)
+ {
+ this.keys = keys;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return keys.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public object this[int index]
+ {
+ get
+ {
+ return keys[index];
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(object current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return keys.GetEnumerator();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs
new file mode 100755
index 00000000000..7832cfd36ee
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs
@@ -0,0 +1,1063 @@
+//
+// System.Web.UI.WebControls.DataList.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Web;
+using System.Web.UI;
+using System.Web.Util;
+
+namespace System.Web.UI.WebControls
+{
+#if NET_2_0
+ [ControlValueProperty ("SelectedValue")]
+#endif
+ [Designer("System.Web.UI.Design.WebControls.DataListDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ [Editor ("System.Web.UI.Design.WebControls.DataListComponentEditor, " + Consts.AssemblySystem_Design, typeof (ComponentEditor))]
+ public class DataList: BaseDataList, INamingContainer, IRepeatInfoUser
+ {
+ public const string CancelCommandName = "Cancel";
+ public const string DeleteCommandName = "Delete";
+ public const string EditCommandName = "Edit";
+ public const string SelectCommandName = "Select";
+ public const string UpdateCommandName = "Update";
+
+ static readonly object CancelCommandEvent = new object ();
+ static readonly object DeleteCommandEvent = new object ();
+ static readonly object EditCommandEvent = new object ();
+ static readonly object ItemCommandEvent = new object ();
+ static readonly object ItemCreatedEvent = new object ();
+ static readonly object ItemDataBoundEvent = new object ();
+ static readonly object UpdateCommandEvent = new object ();
+
+ TableItemStyle alternatingItemStyle;
+ TableItemStyle editItemStyle;
+ TableItemStyle footerStyle;
+ TableItemStyle headerStyle;
+ TableItemStyle itemStyle;
+ TableItemStyle selectedItemStyle;
+ TableItemStyle separatorStyle;
+
+ ITemplate alternatingItemTemplate;
+ ITemplate editItemTemplate;
+ ITemplate footerTemplate;
+ ITemplate headerTemplate;
+ ITemplate itemTemplate;
+ ITemplate selectedItemTemplate;
+ ITemplate separatorTemplate;
+
+ ArrayList itemsArray;
+ DataListItemCollection items;
+
+ bool extractTemplateRows;
+
+#if NET_2_0
+ int selectedIndex = -1;
+#endif
+
+ public DataList ()
+ {
+ }
+
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [NotifyParentProperty (true)]
+ [WebCategory ("Style")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to alternating items.")]
+ public virtual TableItemStyle AlternatingItemStyle {
+ get {
+ if (alternatingItemStyle == null) {
+ alternatingItemStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ alternatingItemStyle.TrackViewState ();
+ }
+
+ return alternatingItemStyle;
+ }
+ }
+
+ [Browsable (false)]
+ [DefaultValue (null)]
+ [TemplateContainer (typeof (DataListItem))]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The template used for alternating items.")]
+ public virtual ITemplate AlternatingItemTemplate {
+ get { return alternatingItemTemplate; }
+ set { alternatingItemTemplate = value; }
+ }
+
+ [DefaultValue (-1)]
+ [WebCategory ("Misc")]
+ [WebSysDescription ("The index of the item shown in edit mode.")]
+ public virtual int EditItemIndex {
+ get {
+ object o = ViewState ["EditItemIndex"];
+ if (o != null)
+ return (int) o;
+
+ return -1;
+ }
+
+ set {
+ if (value < -1)
+ throw new ArgumentOutOfRangeException("value");
+
+ ViewState ["EditItemIndex"] = value;
+ }
+ }
+
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [NotifyParentProperty (true)]
+ [WebCategory ("Style")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to items in edit mode.")]
+ public virtual TableItemStyle EditItemStyle {
+ get {
+ if (editItemStyle == null) {
+ editItemStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ editItemStyle.TrackViewState ();
+ }
+
+ return editItemStyle;
+ }
+ }
+
+ [Browsable (false)]
+ [DefaultValue (null)]
+ [TemplateContainer (typeof (DataListItem))]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The template used for items in edit mode.")]
+ public virtual ITemplate EditItemTemplate {
+ get { return editItemTemplate; }
+ set { editItemTemplate = value; }
+ }
+
+
+ [DefaultValue (false), WebCategory ("Misc")]
+ [WebSysDescription ("Extract rows in the template.")]
+ public virtual bool ExtractTemplateRows {
+ get {
+ object o = ViewState ["ExtractTemplateRows"];
+ if (o != null)
+ return (bool) o;
+
+ return false;
+ }
+
+ set { ViewState ["ExtractTemplateRows"] = value; }
+ }
+
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [NotifyParentProperty (true)]
+ [WebCategory ("Style")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to the footer.")]
+ public virtual TableItemStyle FooterStyle {
+ get {
+ if (footerStyle == null) {
+ footerStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ footerStyle.TrackViewState ();
+ }
+
+ return footerStyle;
+ }
+ }
+
+ [Browsable (false)]
+ [DefaultValue (null)]
+ [TemplateContainer (typeof (DataListItem))]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The template used for the footer.")]
+ public virtual ITemplate FooterTemplate {
+ get { return footerTemplate; }
+ set { footerTemplate = value; }
+ }
+
+ [DefaultValue (typeof (GridLines), "None")]
+ public override GridLines GridLines {
+ get { return base.GridLines; }
+ set { base.GridLines = value; }
+ }
+
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [NotifyParentProperty (true)]
+ [WebCategory ("Style")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to the header.")]
+ public virtual TableItemStyle HeaderStyle {
+ get {
+ if (headerStyle == null) {
+ headerStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ headerStyle.TrackViewState ();
+ }
+
+ return headerStyle;
+ }
+ }
+
+ [Browsable (false)]
+ [DefaultValue (null)]
+ [TemplateContainer (typeof (DataListItem))]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The template used for the header.")]
+ public virtual ITemplate HeaderTemplate {
+ get { return headerTemplate; }
+ set { headerTemplate = value; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("A colletion containing all items.")]
+ public virtual DataListItemCollection Items {
+ get {
+ if (items == null) {
+ if (itemsArray == null) {
+ EnsureChildControls ();
+ itemsArray = new ArrayList ();
+ }
+ items = new DataListItemCollection (itemsArray);
+ }
+
+ return items;
+ }
+ }
+
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [NotifyParentProperty (true)]
+ [WebCategory ("Style")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to items.")]
+ public virtual TableItemStyle ItemStyle {
+ get {
+ if (itemStyle == null) {
+ itemStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ itemStyle.TrackViewState ();
+ }
+
+ return itemStyle;
+ }
+ }
+
+ [Browsable (false)]
+ [DefaultValue (null)]
+ [TemplateContainer (typeof (DataListItem))]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The template used for items.")]
+ public virtual ITemplate ItemTemplate {
+ get { return itemTemplate; }
+ set { itemTemplate = value; }
+ }
+
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (0), WebCategory ("Layout")]
+ [WebSysDescription ("The number of columns that should be used.")]
+ public virtual int RepeatColumns {
+ get {
+ object o = ViewState ["RepeatColumns"];
+ if (o != null)
+ return (int) o;
+
+ return 0;
+ }
+ set {
+ if (value < 0)
+ throw new ArgumentOutOfRangeException ("value", "RepeatColumns value has to be 0 for 'not set' or > 0.");
+
+ ViewState ["RepeatColumns"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (RepeatDirection), "Vertical"), WebCategory ("Layout")]
+ [WebSysDescription ("Which direction should be used when filling the columns.")]
+ public virtual RepeatDirection RepeatDirection {
+ get {
+ object o = ViewState ["RepeatDirection"];
+ if (o != null)
+ return (RepeatDirection) o;
+
+ return RepeatDirection.Vertical;
+ }
+ set {
+ if (!Enum.IsDefined (typeof (RepeatDirection), value))
+ throw new ArgumentOutOfRangeException ("value", "Only valid enumeration members are allowed");
+
+ ViewState ["RepeatDirection"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (RepeatLayout), "Table"), WebCategory ("Layout")]
+ [WebSysDescription ("The type of layout - mechanism that is used.")]
+ public virtual RepeatLayout RepeatLayout {
+ get {
+ object o = ViewState ["RepeatLayout"];
+ if (o != null)
+ return (RepeatLayout) o;
+
+ return RepeatLayout.Table;
+ }
+ set {
+ if (!Enum.IsDefined (typeof (RepeatLayout), value))
+ throw new ArgumentOutOfRangeException ("value", "Only valid enumeration members are allowed");
+
+ ViewState ["RepeatLayout"] = value;
+ }
+ }
+
+ [DefaultValue (-1), Bindable (true)]
+ [WebSysDescription ("The currently selected item index number.")]
+ public virtual int SelectedIndex {
+ get {
+#if NET_2_0
+ return selectedIndex;
+#else
+ object o = ViewState ["SelectedIndex"];
+ if (o != null)
+ return (int) o;
+
+ return -1;
+#endif
+ }
+ set {
+ //FIXME: Looks like a bug in Microsoft's specs.
+ // Exception is missing in document. I haven't tested the case
+ // But I think exception should follow
+ if (value < -1)
+ throw new ArgumentOutOfRangeException("value");
+
+ int prevSel = SelectedIndex;
+#if NET_2_0
+ selectedIndex = value;
+#else
+ ViewState ["SelectedIndex"] = value;
+#endif
+ DataListItem prevSelItem;
+ ListItemType liType;
+
+ if (itemsArray != null) {
+ if (prevSel >= 0 && prevSel < itemsArray.Count) {
+ prevSelItem = (DataListItem) itemsArray [prevSel];
+ if (prevSelItem.ItemType != ListItemType.EditItem) {
+ liType = ((prevSel % 2) == 0 ? ListItemType.AlternatingItem :
+ ListItemType.Item);
+
+ prevSelItem.SetItemType (liType);
+ }
+ }
+
+ if (value >= 0 && value < itemsArray.Count) {
+ prevSelItem = (DataListItem) itemsArray [value];
+ if (prevSelItem.ItemType != ListItemType.EditItem) {
+ prevSelItem.SetItemType (ListItemType.SelectedItem);
+ }
+ }
+ }
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The currently selected item.")]
+ public virtual DataListItem SelectedItem {
+ get {
+ if (SelectedIndex == -1)
+ return null;
+
+ return Items [SelectedIndex];
+ }
+ }
+
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [NotifyParentProperty (true)]
+ [WebCategory ("Style")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style used for the currently selected item.")]
+ public virtual TableItemStyle SelectedItemStyle {
+ get {
+ if (selectedItemStyle == null) {
+ selectedItemStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ selectedItemStyle.TrackViewState ();
+ }
+
+ return selectedItemStyle;
+ }
+ }
+
+ [Browsable (false)]
+ [DefaultValue (null)]
+ [TemplateContainer (typeof (DataListItem))]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The template used for currently selected items.")]
+ public virtual ITemplate SelectedItemTemplate {
+ get { return selectedItemTemplate; }
+ set { selectedItemTemplate = value; }
+ }
+
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [NotifyParentProperty (true)]
+ [WebCategory ("Style")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The style applied to separators.")]
+ public virtual TableItemStyle SeparatorStyle {
+ get {
+ if (separatorStyle == null) {
+ separatorStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ separatorStyle.TrackViewState ();
+ }
+
+ return separatorStyle;
+ }
+ }
+
+ [Browsable (false)]
+ [DefaultValue (null)]
+ [TemplateContainer (typeof (DataListItem))]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("The template used for separators.")]
+ public virtual ITemplate SeparatorTemplate {
+ get { return separatorTemplate; }
+ set { separatorTemplate = value; }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (true), WebCategory ("Appearance")]
+ [WebSysDescription ("Display the header for the DataList.")]
+ public virtual bool ShowHeader {
+ get {
+ object o = ViewState ["ShowHeader"];
+ if (o != null)
+ return (bool) o;
+
+ return true;
+ }
+ set { ViewState ["ShowHeader"] = value; }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (true), WebCategory ("Appearance")]
+ [WebSysDescription ("Display the footer for the DataList.")]
+ public virtual bool ShowFooter {
+ get {
+ object o = ViewState ["ShowFooter"];
+ if (o != null)
+ return (bool) o;
+
+ return true;
+ }
+ set
+ {
+ ViewState["ShowFooter"] = value;
+ }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when a cancel command is generated.")]
+ public event DataListCommandEventHandler CancelCommand {
+ add { Events.AddHandler (CancelCommandEvent, value); }
+ remove { Events.RemoveHandler (CancelCommandEvent, value); }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when a delete command is generated.")]
+ public event DataListCommandEventHandler DeleteCommand {
+ add { Events.AddHandler (DeleteCommandEvent, value); }
+ remove { Events.RemoveHandler (DeleteCommandEvent, value); }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when an edit command is generated.")]
+ public event DataListCommandEventHandler EditCommand {
+ add { Events.AddHandler (EditCommandEvent, value); }
+ remove { Events.RemoveHandler (EditCommandEvent, value); }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when an item command is generated.")]
+ public event DataListCommandEventHandler ItemCommand {
+ add { Events.AddHandler (ItemCommandEvent, value); }
+ remove { Events.RemoveHandler (ItemCommandEvent, value); }
+ }
+
+ [WebCategory ("Behavior")]
+ [WebSysDescription ("Raised when a new item is created.")]
+ public event DataListItemEventHandler ItemCreated {
+ add { Events.AddHandler (ItemCreatedEvent, value); }
+ remove { Events.RemoveHandler (ItemCreatedEvent, value); }
+ }
+
+ [WebCategory ("Behavior")]
+ [WebSysDescription ("Raised when a item gets data-bound.")]
+ public event DataListItemEventHandler ItemDataBound {
+ add { Events.AddHandler (ItemDataBoundEvent, value); }
+ remove { Events.RemoveHandler (ItemDataBoundEvent, value); }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when an update command is generated.")]
+ public event DataListCommandEventHandler UpdateCommand {
+ add { Events.AddHandler (UpdateCommandEvent, value); }
+ remove { Events.RemoveHandler (UpdateCommandEvent, value); }
+ }
+
+ protected override Style CreateControlStyle ()
+ {
+ TableStyle retVal = new TableStyle (ViewState);
+ retVal.CellSpacing = 0;
+ return retVal;
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState == null)
+ return;
+
+ object [] states = (object []) savedState;
+
+ if (states [0] != null)
+ base.LoadViewState (states [0]);
+ if (states [1] != null)
+ alternatingItemStyle.LoadViewState (states [1]);
+ if (states [2] != null)
+ editItemStyle.LoadViewState (states [2]);
+ if (states [3] != null)
+ footerStyle.LoadViewState (states [3]);
+ if (states [4] != null)
+ headerStyle.LoadViewState (states [4]);
+ if (states [5] != null)
+ itemStyle.LoadViewState (states [5]);
+ if (states [6] != null)
+ selectedItemStyle.LoadViewState (states [6]);
+ if (states [7] != null)
+ separatorStyle.LoadViewState (states [7]);
+ }
+
+ protected override object SaveViewState()
+ {
+ object [] states = new object [8];
+ states [0] = base.SaveViewState ();
+ states [1] = (alternatingItemStyle == null ? null : alternatingItemStyle.SaveViewState ());
+ states [2] = (editItemStyle == null ? null : editItemStyle.SaveViewState ());
+ states [3] = (footerStyle == null ? null : footerStyle.SaveViewState ());
+ states [4] = (headerStyle == null ? null : headerStyle.SaveViewState ());
+ states [5] = (itemStyle == null ? null : itemStyle.SaveViewState ());
+ states [6] = (selectedItemStyle == null ? null : selectedItemStyle.SaveViewState ());
+ states [7] = (separatorStyle == null ? null : separatorStyle.SaveViewState ());
+ return states;
+ }
+
+ protected override void TrackViewState ()
+ {
+ base.TrackViewState ();
+ if (alternatingItemStyle != null)
+ alternatingItemStyle.TrackViewState ();
+ if (editItemStyle != null)
+ editItemStyle.TrackViewState ();
+ if (footerStyle != null)
+ footerStyle.TrackViewState ();
+ if (headerStyle != null)
+ headerStyle.TrackViewState ();
+ if (itemStyle != null)
+ itemStyle.TrackViewState ();
+ if (selectedItemStyle != null)
+ selectedItemStyle.TrackViewState ();
+ if (separatorStyle != null)
+ separatorStyle.TrackViewState ();
+ }
+
+#if NET_2_0
+ protected override void OnInit (EventArgs e)
+ {
+ Page.RegisterRequiresControlState (this);
+ base.OnInit (e);
+ }
+
+ protected internal override void LoadControlState (object ob)
+ {
+ if (ob == null) return;
+ Pair state = (Pair) ob;
+ base.LoadControlState (state.First);
+
+ if (state.Second != null)
+ SelectedIndex = (int) state.Second;
+ }
+
+ protected internal override object SaveControlState ()
+ {
+ object bstate = base.SaveControlState ();
+ object mstate = SelectedIndex != -1 ? (object) SelectedIndex : null;
+
+ if (bstate != null || mstate != null)
+ return new Pair (bstate, mstate);
+ else
+ return null;
+ }
+#endif
+
+ protected override bool OnBubbleEvent (object source, EventArgs e)
+ {
+ if (!(e is DataListCommandEventArgs))
+ return false;
+
+ DataListCommandEventArgs args = (DataListCommandEventArgs) e;
+ OnItemCommand (args);
+ string cmdName = args.CommandName.ToLower ();
+
+ if (cmdName == "cancel") {
+ OnCancelCommand (args);
+ } else if (cmdName == "delete") {
+ OnDeleteCommand (args);
+ } else if (cmdName == "edit") {
+ OnEditCommand (args);
+ } else if (cmdName == "select") {
+ SelectedIndex = args.Item.ItemIndex;
+ OnSelectedIndexChanged (EventArgs.Empty);
+ } else if (cmdName == "update") {
+ OnUpdateCommand (args);
+ }
+
+ return true;
+ }
+
+ void InvokeCommandEvent (DataListCommandEventArgs args, object key)
+ {
+ DataListCommandEventHandler dlceh = (DataListCommandEventHandler) Events [key];
+ if (dlceh != null)
+ dlceh (this, args);
+ }
+
+ void InvokeItemEvent (DataListItemEventArgs args, object key)
+ {
+ DataListItemEventHandler dlieh = (DataListItemEventHandler) Events [key];
+ if (dlieh != null)
+ dlieh (this, args);
+ }
+
+ protected virtual void OnCancelCommand (DataListCommandEventArgs e)
+ {
+ InvokeCommandEvent (e, CancelCommandEvent);
+ }
+
+ protected virtual void OnDeleteCommand (DataListCommandEventArgs e)
+ {
+ InvokeCommandEvent (e, DeleteCommandEvent);
+ }
+
+ protected virtual void OnEditCommand (DataListCommandEventArgs e)
+ {
+ InvokeCommandEvent (e, EditCommandEvent);
+ }
+
+ protected virtual void OnItemCommand (DataListCommandEventArgs e)
+ {
+ InvokeCommandEvent (e, ItemCommandEvent);
+ }
+
+ protected virtual void OnItemCreated (DataListItemEventArgs e)
+ {
+ InvokeItemEvent (e, ItemCreatedEvent);
+ }
+
+ protected virtual void OnItemDataBound (DataListItemEventArgs e)
+ {
+ InvokeItemEvent (e, ItemDataBoundEvent);
+ }
+
+ protected virtual void OnUpdateCommand (DataListCommandEventArgs e)
+ {
+ InvokeCommandEvent (e, UpdateCommandEvent);
+ }
+
+ protected override void RenderContents (HtmlTextWriter writer)
+ {
+ if (Controls.Count == 0)
+ return;
+
+ RepeatInfo repeater = new RepeatInfo ();
+ Table templateTable = null;
+ if (extractTemplateRows) {
+ repeater.RepeatDirection = RepeatDirection.Vertical;
+ repeater.RepeatLayout = RepeatLayout.Flow;
+ repeater.RepeatColumns = 1;
+ repeater.OuterTableImplied = true;
+
+ templateTable = new Table ();
+ templateTable.ID = ClientID;
+ templateTable.CopyBaseAttributes (this);
+ templateTable.ApplyStyle (ControlStyle);
+ templateTable.RenderBeginTag (writer);
+ } else {
+ repeater.RepeatDirection = RepeatDirection;
+ repeater.RepeatLayout = RepeatLayout;
+ repeater.RepeatColumns = RepeatColumns;
+ }
+
+ repeater.RenderRepeater (writer, this, ControlStyle, this);
+ if (templateTable != null) {
+ templateTable.RenderEndTag (writer);
+ }
+ }
+
+ private DataListItem GetItem (ListItemType itemType, int repeatIndex)
+ {
+ DataListItem retVal = null;
+ switch (itemType) {
+ case ListItemType.Header:
+ retVal = (DataListItem) Controls [0];
+ break;
+ case ListItemType.Footer:
+ retVal = (DataListItem) Controls [Controls.Count - 1];
+ break;
+ case ListItemType.Item:
+ goto case ListItemType.EditItem;
+ case ListItemType.AlternatingItem:
+ goto case ListItemType.EditItem;
+ case ListItemType.SelectedItem:
+ goto case ListItemType.EditItem;
+ case ListItemType.EditItem:
+ retVal = (DataListItem) itemsArray [repeatIndex];
+ break;
+ case ListItemType.Separator:
+ int index = 2 * repeatIndex + 1;
+ if (headerTemplate != null)
+ index ++;
+ retVal = (DataListItem) Controls [index];
+ break;
+ }
+ return retVal;
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected override void CreateControlHierarchy (bool useDataSource)
+ {
+ IEnumerable source = null;
+ ArrayList dkeys = DataKeysArray;
+
+ if (itemsArray != null) {
+ itemsArray.Clear ();
+ } else {
+ itemsArray = new ArrayList ();
+ }
+
+ extractTemplateRows = ExtractTemplateRows;
+ if (!useDataSource) {
+ int count = (int) ViewState ["_!ItemCount"];
+ if (count != -1) {
+ source = new DataSourceInternal (count);
+ itemsArray.Capacity = count;
+ }
+ } else {
+ dkeys.Clear ();
+ source = GetResolvedDataSource ();
+ if (source is ICollection) {
+ dkeys.Capacity = ((ICollection) source).Count;
+ itemsArray.Capacity = ((ICollection) source).Count;
+ }
+ }
+
+ int itemCount = 0;
+ if (source != null) {
+ int index = 0;
+ int editIndex = EditItemIndex;
+ int selIndex = SelectedIndex;
+ string dataKey = DataKeyField;
+
+ if (headerTemplate != null)
+ CreateItem (-1, ListItemType.Header, useDataSource, null);
+
+ foreach (object current in source) {
+ if (useDataSource) {
+ try {
+ dkeys.Add (DataBinder.GetPropertyValue (current, dataKey));
+ } catch {
+ dkeys.Add (dkeys.Count);
+ }
+ }
+
+ ListItemType type = ListItemType.Item;
+ if (index == editIndex) {
+ type = ListItemType.EditItem;
+ } else if (index == selIndex) {
+ type = ListItemType.SelectedItem;
+ } else if ((index % 2) != 0) {
+ type = ListItemType.AlternatingItem;
+ }
+
+ itemsArray.Add (CreateItem (index, type, useDataSource, current));
+ if (separatorTemplate != null)
+ CreateItem (index, ListItemType.Separator, useDataSource, null);
+ itemCount++;
+ index++;
+ }
+
+ if (footerTemplate != null)
+ CreateItem (-1, ListItemType.Footer, useDataSource, null);
+ }
+
+ if (useDataSource)
+ ViewState ["_!ItemCount"] = (source != null ? itemCount : -1);
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected virtual DataListItem CreateItem (int itemIndex, ListItemType itemType)
+ {
+ return new DataListItem (itemIndex, itemType);
+ }
+
+ private DataListItem CreateItem (int itemIndex, ListItemType itemType, bool dataBind, object dataItem)
+ {
+ DataListItem retVal = CreateItem (itemIndex, itemType);
+ DataListItemEventArgs e = new DataListItemEventArgs (retVal);
+ InitializeItem (retVal);
+ if (dataBind)
+ retVal.DataItem = dataItem;
+
+ OnItemCreated (e);
+ Controls.Add (retVal);
+
+ if (dataBind) {
+ retVal.DataBind ();
+ OnItemDataBound (e);
+ retVal.DataItem = null;
+ }
+
+ return retVal;
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected override void PrepareControlHierarchy ()
+ {
+ if (Controls.Count == 0)
+ return;
+
+ Style defaultStyle = null;
+ Style rowStyle = null;
+
+ if (alternatingItemStyle != null) {
+ defaultStyle = new TableItemStyle ();
+ defaultStyle.CopyFrom (itemStyle);
+ defaultStyle.CopyFrom (alternatingItemStyle);
+ } else {
+ defaultStyle = itemStyle;
+ }
+
+ foreach (DataListItem current in Controls) {
+ rowStyle = null;
+ switch (current.ItemType) {
+ case ListItemType.Header:
+ if (headerStyle != null)
+ rowStyle = headerStyle;
+ break;
+ case ListItemType.Footer:
+ if (footerStyle != null)
+ rowStyle = footerStyle;
+ break;
+ case ListItemType.Separator:
+ rowStyle = separatorStyle;
+ break;
+ case ListItemType.Item:
+ rowStyle = itemStyle;
+ break;
+ case ListItemType.AlternatingItem:
+ rowStyle = defaultStyle;
+ break;
+ case ListItemType.SelectedItem:
+ rowStyle = new TableItemStyle ();
+ if ((current.ItemIndex % 2) == 0) {
+ rowStyle.CopyFrom (itemStyle);
+ } else {
+ rowStyle.CopyFrom (defaultStyle);
+ }
+ rowStyle.CopyFrom (selectedItemStyle);
+ break;
+ case ListItemType.EditItem:
+ rowStyle = new TableItemStyle ();
+ if ((current.ItemIndex % 2) == 0) {
+ rowStyle.CopyFrom (itemStyle);
+ } else {
+ rowStyle.CopyFrom (defaultStyle);
+ }
+
+ if (current.ItemIndex == SelectedIndex)
+ rowStyle.CopyFrom (selectedItemStyle);
+
+ rowStyle.CopyFrom (editItemStyle);
+ break;
+ }
+
+ if (rowStyle == null)
+ continue;
+
+ if (!extractTemplateRows) {
+ current.MergeStyle (rowStyle);
+ continue;
+ }
+
+ if (current.HasControls ()) {
+ int len = current.Controls.Count;
+ for (int i = 0 ; i < len ; i++) {
+ Control currentCtrl = current.Controls [i];
+ if (!(currentCtrl is Table))
+ continue;
+
+ foreach (TableRow cRow in ((Table) currentCtrl).Rows)
+ cRow.MergeStyle (rowStyle);
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected virtual void InitializeItem (DataListItem item)
+ {
+ ListItemType type = item.ItemType;
+ ITemplate template = itemTemplate;
+
+ switch (type) {
+ case ListItemType.Header:
+ template = headerTemplate;
+ break;
+ case ListItemType.Footer:
+ template = footerTemplate;
+ break;
+ case ListItemType.AlternatingItem:
+ if (alternatingItemTemplate != null)
+ template = alternatingItemTemplate;
+ break;
+ case ListItemType.SelectedItem:
+ if (selectedItemTemplate != null) {
+ template = selectedItemTemplate;
+ break;
+ }
+
+ if ((item.ItemIndex % 2) != 0)
+ goto case ListItemType.AlternatingItem;
+ break;
+ case ListItemType.EditItem:
+ if (editItemTemplate != null) {
+ template = editItemTemplate;
+ break;
+ }
+
+ if (item.ItemIndex == SelectedIndex)
+ goto case ListItemType.SelectedItem;
+
+ if ((item.ItemIndex % 2) != 0)
+ goto case ListItemType.AlternatingItem;
+ break;
+ case ListItemType.Separator:
+ template = separatorTemplate;
+ break;
+ }
+
+ if (template != null)
+ template.InstantiateIn (item);
+ }
+
+ bool IRepeatInfoUser.HasFooter {
+ get { return (ShowFooter && footerTemplate != null); }
+ }
+
+ bool IRepeatInfoUser.HasHeader {
+ get { return (ShowHeader && headerTemplate != null); }
+ }
+
+ bool IRepeatInfoUser.HasSeparators {
+ get { return (separatorTemplate != null); }
+ }
+
+ int IRepeatInfoUser.RepeatedItemCount {
+ get {
+ if (itemsArray != null)
+ return itemsArray.Count;
+
+ return 0;
+ }
+ }
+
+ void IRepeatInfoUser.RenderItem (ListItemType itemType,
+ int repeatIndex,
+ RepeatInfo repeatInfo,
+ HtmlTextWriter writer)
+ {
+ DataListItem item = GetItem (itemType, repeatIndex);
+ if (item != null)
+ item.RenderItem (writer,
+ extractTemplateRows,
+ (repeatInfo.RepeatLayout == RepeatLayout.Table));
+ }
+
+ Style IRepeatInfoUser.GetItemStyle (ListItemType itemType, int repeatIndex)
+ {
+ DataListItem item = GetItem (itemType, repeatIndex);
+ if (item == null || !item.ControlStyleCreated)
+ return null;
+
+ return item.ControlStyle;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventArgs.cs
new file mode 100644
index 00000000000..30ceb12c4ac
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventArgs.cs
@@ -0,0 +1,70 @@
+
+//
+// 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.
+//
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: DataListCommandEventArgs
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+#if !NET_2_0
+ sealed
+#endif
+ public class DataListCommandEventArgs: CommandEventArgs
+ {
+ private DataListItem dlItem;
+ private object cmdSrc;
+
+ public DataListCommandEventArgs(DataListItem item, object commandSource, CommandEventArgs originalArgs): base(originalArgs)
+ {
+ dlItem = item;
+ cmdSrc = commandSource;
+ }
+
+ public object CommandSource
+ {
+ get
+ {
+ return cmdSrc;
+ }
+ }
+
+ public DataListItem Item
+ {
+ get
+ {
+ return dlItem;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventHandler.cs
new file mode 100644
index 00000000000..6da56f86350
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventHandler.cs
@@ -0,0 +1,37 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataListCommandEventHandler(object sender, DataListCommandEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListItem.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItem.cs
new file mode 100644
index 00000000000..f8235ae57ca
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItem.cs
@@ -0,0 +1,136 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataListItem
+ *
+ * Authors: Gaurav Vaish, Gonzalo Paniagua (gonzalo@ximian.com)
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ * (c) 2002 Ximian, Inc. (http://www.ximian.com)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxItem(false)]
+ public class DataListItem : WebControl, INamingContainer
+#if NET_2_0
+ , IDataItemContainer
+#endif
+ {
+ int itemIndex;
+ ListItemType itemType;
+ object dataItem;
+
+ public DataListItem(int itemIndex, ListItemType itemType)
+ {
+ this.itemIndex = itemIndex;
+ this.itemType = itemType;
+ }
+
+ public virtual object DataItem
+ {
+ get
+ {
+ return dataItem;
+ }
+ set
+ {
+ dataItem = value;
+ }
+ }
+
+ public virtual int ItemIndex
+ {
+ get
+ {
+ return itemIndex;
+ }
+ }
+
+ public virtual ListItemType ItemType
+ {
+ get
+ {
+ return itemType;
+ }
+ }
+
+ public virtual void RenderItem (HtmlTextWriter writer, bool extractRows, bool tableLayout)
+ {
+ if (extractRows){
+ Table tbl = null;
+ foreach (Control ctrl in Controls){
+ if (ctrl is Table){
+ tbl = (Table) ctrl;
+ break;
+ }
+ }
+
+ if (tbl == null)
+ throw new HttpException ("Template table not found!");
+
+ foreach (TableRow row in tbl.Rows)
+ row.RenderControl (writer);
+ } else {
+ if (tableLayout)
+ RenderContents (writer);
+ else
+ RenderControl (writer);
+ }
+
+ }
+
+ protected override Style CreateControlStyle()
+ {
+ return new TableItemStyle();
+ }
+
+ protected override bool OnBubbleEvent(object source, EventArgs e)
+ {
+ if(e is CommandEventArgs)
+ {
+ RaiseBubbleEvent(this, new DataListCommandEventArgs(this, source, (CommandEventArgs)e));
+ return true;
+ }
+ return false;
+ }
+
+ protected internal virtual void SetItemType(ListItemType itemType)
+ {
+ if(Enum.IsDefined(typeof(ListItemType), itemType))
+ {
+ this.itemType = itemType;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemCollection.cs
new file mode 100644
index 00000000000..ab03fafe49a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemCollection.cs
@@ -0,0 +1,104 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataListItemCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataListItemCollection : ICollection, IEnumerable
+ {
+ private ArrayList items;
+
+ public DataListItemCollection(ArrayList items)
+ {
+ this.items = items;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return items.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public DataListItem this[int index]
+ {
+ get
+ {
+ return (DataListItem)(items[index]);
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(DataListItem current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return items.GetEnumerator();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventArgs.cs
new file mode 100644
index 00000000000..777fb180cc6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventArgs.cs
@@ -0,0 +1,61 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataListItemEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+#if !NET_2_0
+ sealed
+#endif
+ public class DataListItemEventArgs : EventArgs
+ {
+ private DataListItem item;
+
+ public DataListItemEventArgs(DataListItem item)
+ {
+ this.item = item;
+ }
+
+ public DataListItem Item
+ {
+ get
+ {
+ return item;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventHandler.cs
new file mode 100644
index 00000000000..bd336d10137
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventHandler.cs
@@ -0,0 +1,37 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataListItemEventHandler(object sender, DataListItemEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataSourceInternal.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataSourceInternal.cs
new file mode 100755
index 00000000000..c5eda5fcf30
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataSourceInternal.cs
@@ -0,0 +1,129 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataSourceInternal
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ * Contact: gvaish_mono@lycos.com
+ * Implementation: Yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ internal class DataSourceInternal : ICollection, IEnumerable
+ {
+ private int itemCount;
+
+ public DataSourceInternal(int itemCount)
+ {
+ this.itemCount = itemCount;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return itemCount;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ IEnumerator e = GetEnumerator();
+ while(e.MoveNext())
+ {
+ array.SetValue(e.Current, index);
+ index++;
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return new DataSourceEnumeratorInternal(itemCount);
+ }
+
+ private class DataSourceEnumeratorInternal : IEnumerator
+ {
+ private int count;
+ private int index;
+
+ public DataSourceEnumeratorInternal(int count)
+ {
+ this.count = count;
+ this.index = -1;
+ }
+
+ public bool MoveNext()
+ {
+ index++;
+ return (index < count);
+ }
+
+ public object Current
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ public void Reset()
+ {
+ this.index = -1;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DayNameFormat.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DayNameFormat.cs
new file mode 100755
index 00000000000..28e225a5763
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DayNameFormat.cs
@@ -0,0 +1,44 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: DayNameFormat
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum DayNameFormat
+ {
+ Full,
+ Short,
+ FirstLetter,
+ FirstTwoLetters
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventArgs.cs
new file mode 100644
index 00000000000..e2bc2400b80
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventArgs.cs
@@ -0,0 +1,81 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: DayRenderEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DayRenderEventArgs
+ {
+ private TableCell cell;
+ private CalendarDay day;
+
+ public DayRenderEventArgs(TableCell cell, CalendarDay day)
+ {
+ this.cell = cell;
+ this.day = day;
+ }
+
+#if NET_2_0
+
+ string selectUrl;
+
+ public DayRenderEventArgs(TableCell cell, CalendarDay day, string selectUrl)
+ {
+ this.cell = cell;
+ this.day = day;
+ this.selectUrl = selectUrl;
+ }
+
+ public string SelectUrl {
+ get { return selectUrl; }
+ }
+
+#endif
+
+ public TableCell Cell
+ {
+ get
+ {
+ return cell;
+ }
+ }
+
+ public CalendarDay Day
+ {
+ get
+ {
+ return day;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventHandler.cs
new file mode 100644
index 00000000000..100b2b11149
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventHandler.cs
@@ -0,0 +1,38 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: DayRenderEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DayRenderEventHandler(object sender, DayRenderEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs
new file mode 100644
index 00000000000..747329e7617
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs
@@ -0,0 +1,1740 @@
+//
+// System.Web.UI.WebControls.DetailsView.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Web.UI;
+using System.Security.Permissions;
+using System.Text;
+using System.IO;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxDataAttribute ("<{0}:DetailsView runat=\"server\" Width=\"125px\" Height=\"50px\"></{0}:DetailsView>")]
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.DetailsViewDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+ [ControlValuePropertyAttribute ("SelectedValue")]
+ [DefaultEventAttribute ("PageIndexChanging")]
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public class DetailsView: CompositeDataBoundControl, ICallbackEventHandler, ICallbackContainer, IDataItemContainer
+ {
+ object dataItem;
+
+ Table table;
+ DetailsViewRowCollection rows;
+ DetailsViewRow headerRow;
+ DetailsViewRow footerRow;
+ DetailsViewRow bottomPagerRow;
+ DetailsViewRow topPagerRow;
+
+ IOrderedDictionary currentEditRowKeys;
+ IOrderedDictionary currentEditNewValues;
+ IOrderedDictionary currentEditOldValues;
+
+ ITemplate pagerTemplate;
+ ITemplate emptyDataTemplate;
+ ITemplate headerTemplate;
+ ITemplate footerTemplate;
+
+ PropertyDescriptor[] cachedKeyProperties;
+ readonly string[] emptyKeys = new string[0];
+
+ CommandField commandField;
+ DetailsViewRow commandRow;
+
+ // View state
+ DataControlFieldCollection columns;
+ PagerSettings pagerSettings;
+
+ TableItemStyle alternatingRowStyle;
+ TableItemStyle editRowStyle;
+ TableItemStyle insertRowStyle;
+ TableItemStyle emptyDataRowStyle;
+ TableItemStyle footerStyle;
+ TableItemStyle headerStyle;
+ TableItemStyle pagerStyle;
+ TableItemStyle rowStyle;
+ TableItemStyle commandRowStyle;
+ TableItemStyle fieldHeaderStyle;
+
+ DataKey key;
+ DataKey oldEditValues;
+ AutoGeneratedFieldProperties[] autoFieldProperties;
+
+ private static readonly object PageIndexChangedEvent = new object();
+ private static readonly object PageIndexChangingEvent = new object();
+ private static readonly object ItemCommandEvent = new object();
+ private static readonly object ItemCreatedEvent = new object();
+ private static readonly object ItemDeletedEvent = new object();
+ private static readonly object ItemDeletingEvent = new object();
+ private static readonly object ItemInsertedEvent = new object();
+ private static readonly object ItemInsertingEvent = new object();
+ private static readonly object ModeChangingEvent = new object();
+ private static readonly object ModeChangedEvent = new object();
+ private static readonly object ItemUpdatedEvent = new object();
+ private static readonly object ItemUpdatingEvent = new object();
+
+ // Control state
+ int pageIndex;
+ DetailsViewMode currentMode = DetailsViewMode.ReadOnly;
+ int pageCount = -1;
+
+ public DetailsView ()
+ {
+ }
+
+ public event EventHandler PageIndexChanged {
+ add { Events.AddHandler (PageIndexChangedEvent, value); }
+ remove { Events.RemoveHandler (PageIndexChangedEvent, value); }
+ }
+
+ public event DetailsViewPageEventHandler PageIndexChanging {
+ add { Events.AddHandler (PageIndexChangingEvent, value); }
+ remove { Events.RemoveHandler (PageIndexChangingEvent, value); }
+ }
+
+ public event DetailsViewCommandEventHandler ItemCommand {
+ add { Events.AddHandler (ItemCommandEvent, value); }
+ remove { Events.RemoveHandler (ItemCommandEvent, value); }
+ }
+
+ public event EventHandler ItemCreated {
+ add { Events.AddHandler (ItemCreatedEvent, value); }
+ remove { Events.RemoveHandler (ItemCreatedEvent, value); }
+ }
+
+ public event DetailsViewDeletedEventHandler ItemDeleted {
+ add { Events.AddHandler (ItemDeletedEvent, value); }
+ remove { Events.RemoveHandler (ItemDeletedEvent, value); }
+ }
+
+ public event DetailsViewDeleteEventHandler ItemDeleting {
+ add { Events.AddHandler (ItemDeletingEvent, value); }
+ remove { Events.RemoveHandler (ItemDeletingEvent, value); }
+ }
+
+ public event DetailsViewInsertedEventHandler ItemInserted {
+ add { Events.AddHandler (ItemInsertedEvent, value); }
+ remove { Events.RemoveHandler (ItemInsertedEvent, value); }
+ }
+
+ public event DetailsViewInsertEventHandler ItemInserting {
+ add { Events.AddHandler (ItemInsertingEvent, value); }
+ remove { Events.RemoveHandler (ItemInsertingEvent, value); }
+ }
+
+ public event DetailsViewModeEventHandler ModeChanging {
+ add { Events.AddHandler (ModeChangingEvent, value); }
+ remove { Events.RemoveHandler (ModeChangingEvent, value); }
+ }
+
+ public event EventHandler ModeChanged {
+ add { Events.AddHandler (ModeChangedEvent, value); }
+ remove { Events.RemoveHandler (ModeChangedEvent, value); }
+ }
+
+ public event DetailsViewUpdatedEventHandler ItemUpdated {
+ add { Events.AddHandler (ItemUpdatedEvent, value); }
+ remove { Events.RemoveHandler (ItemUpdatedEvent, value); }
+ }
+
+ public event DetailsViewUpdateEventHandler ItemUpdating {
+ add { Events.AddHandler (ItemUpdatingEvent, value); }
+ remove { Events.RemoveHandler (ItemUpdatingEvent, value); }
+ }
+
+ protected virtual void OnPageIndexChanged (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) Events [PageIndexChangedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnPageIndexChanging (DetailsViewPageEventArgs e)
+ {
+ if (Events != null) {
+ DetailsViewPageEventHandler eh = (DetailsViewPageEventHandler) Events [PageIndexChangingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnItemCommand (DetailsViewCommandEventArgs e)
+ {
+ if (Events != null) {
+ DetailsViewCommandEventHandler eh = (DetailsViewCommandEventHandler) Events [ItemCommandEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnItemCreated (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) Events [ItemCreatedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnItemDeleted (DetailsViewDeletedEventArgs e)
+ {
+ if (Events != null) {
+ DetailsViewDeletedEventHandler eh = (DetailsViewDeletedEventHandler) Events [ItemDeletedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnItemInserted (DetailsViewInsertedEventArgs e)
+ {
+ if (Events != null) {
+ DetailsViewInsertedEventHandler eh = (DetailsViewInsertedEventHandler) Events [ItemInsertedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnItemInserting (DetailsViewInsertEventArgs e)
+ {
+ if (Events != null) {
+ DetailsViewInsertEventHandler eh = (DetailsViewInsertEventHandler) Events [ItemInsertingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnItemDeleting (DetailsViewDeleteEventArgs e)
+ {
+ if (Events != null) {
+ DetailsViewDeleteEventHandler eh = (DetailsViewDeleteEventHandler) Events [ItemDeletingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnModeChanged (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) Events [ModeChangedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnModeChanging (DetailsViewModeEventArgs e)
+ {
+ if (Events != null) {
+ DetailsViewModeEventHandler eh = (DetailsViewModeEventHandler) Events [ModeChangingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnItemUpdated (DetailsViewUpdatedEventArgs e)
+ {
+ if (Events != null) {
+ DetailsViewUpdatedEventHandler eh = (DetailsViewUpdatedEventHandler) Events [ItemUpdatedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnItemUpdating (DetailsViewUpdateEventArgs e)
+ {
+ if (Events != null) {
+ DetailsViewUpdateEventHandler eh = (DetailsViewUpdateEventHandler) Events [ItemUpdatingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+
+ [WebCategoryAttribute ("Paging")]
+ [DefaultValueAttribute (false)]
+ public bool AllowPaging {
+ get {
+ object ob = ViewState ["AllowPaging"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["AllowPaging"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [DefaultValueAttribute (null)]
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle AlternatingRowStyle {
+ get {
+ if (alternatingRowStyle == null) {
+ alternatingRowStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ alternatingRowStyle.TrackViewState();
+ }
+ return alternatingRowStyle;
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (false)]
+ public virtual bool AutoGenerateEditButton {
+ get {
+ object ob = ViewState ["AutoGenerateEditButton"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["AutoGenerateEditButton"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (false)]
+ public virtual bool AutoGenerateDeleteButton {
+ get {
+ object ob = ViewState ["AutoGenerateDeleteButton"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["AutoGenerateDeleteButton"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (false)]
+ public virtual bool AutoGenerateInsertButton {
+ get {
+ object ob = ViewState ["AutoGenerateInsertButton"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["AutoGenerateInsertButton"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (true)]
+ public virtual bool AutoGenerateRows {
+ get {
+ object ob = ViewState ["AutoGenerateRows"];
+ if (ob != null) return (bool) ob;
+ return true;
+ }
+ set {
+ ViewState ["AutoGenerateRows"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [UrlPropertyAttribute]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("")]
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public virtual string BackImageUrl {
+ get {
+ object ob = ViewState ["BackImageUrl"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["BackImageUrl"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public virtual DetailsViewRow BottomPagerRow {
+ get {
+ EnsureDataBound ();
+ return bottomPagerRow;
+ }
+ }
+
+ [WebCategoryAttribute ("Accessibility")]
+ [DefaultValueAttribute ("")]
+ [LocalizableAttribute (true)]
+ public string Caption {
+ get {
+ object ob = ViewState ["Caption"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["Caption"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Accessibility")]
+ [DefaultValueAttribute (TableCaptionAlign.NotSet)]
+ public virtual TableCaptionAlign CaptionAlign
+ {
+ get {
+ object o = ViewState ["CaptionAlign"];
+ if(o != null) return (TableCaptionAlign) o;
+ return TableCaptionAlign.NotSet;
+ }
+ set {
+ ViewState ["CaptionAlign"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Layout")]
+ [DefaultValueAttribute (-1)]
+ public virtual int CellPadding
+ {
+ get {
+ object o = ViewState ["CellPadding"];
+ if (o != null) return (int) o;
+ return -1;
+ }
+ set {
+ ViewState ["CellPadding"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Layout")]
+ [DefaultValueAttribute (0)]
+ public virtual int CellSpacing
+ {
+ get {
+ object o = ViewState ["CellSpacing"];
+ if (o != null) return (int) o;
+ return 0;
+ }
+ set {
+ ViewState ["CellSpacing"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [DefaultValueAttribute (null)]
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle CommandRowStyle {
+ get {
+ if (commandRowStyle == null) {
+ commandRowStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ commandRowStyle.TrackViewState();
+ }
+ return commandRowStyle;
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public DetailsViewMode CurrentMode {
+ get {
+ return currentMode;
+ }
+ }
+
+ [DefaultValueAttribute (DetailsViewMode.ReadOnly)]
+ [WebCategoryAttribute ("Behavior")]
+ public virtual DetailsViewMode DefaultMode {
+ get {
+ object o = ViewState ["DefaultMode"];
+ if (o != null) return (DetailsViewMode) o;
+ return DetailsViewMode.ReadOnly;
+ }
+ set {
+ ViewState ["DefaultMode"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [EditorAttribute ("System.Web.UI.Design.WebControls.DataControlFieldTypeEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [MergablePropertyAttribute (false)]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [DefaultValueAttribute (null)]
+ [WebCategoryAttribute ("Misc")]
+ public virtual DataControlFieldCollection Fields {
+ get {
+ if (columns == null) {
+ columns = new DataControlFieldCollection ();
+ columns.FieldsChanged += new EventHandler (OnFieldsChanged);
+ if (IsTrackingViewState)
+ ((IStateManager)columns).TrackViewState ();
+ }
+ return columns;
+ }
+ }
+
+ [DefaultValueAttribute (null)]
+ [WebCategoryAttribute ("Data")]
+ [TypeConverter (typeof(StringArrayConverter))]
+ [EditorAttribute ("System.Web.UI.Design.WebControls.DataFieldEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public virtual string[] DataKeyNames
+ {
+ get {
+ object o = ViewState ["DataKeyNames"];
+ if (o != null) return (string[]) o;
+ return emptyKeys;
+ }
+ set {
+ ViewState ["DataKeyNames"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public virtual DataKey DataKey {
+ get {
+ EnsureDataBound ();
+ return key;
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [DefaultValueAttribute (null)]
+ public virtual TableItemStyle EditRowStyle {
+ get {
+ if (editRowStyle == null) {
+ editRowStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ editRowStyle.TrackViewState();
+ }
+ return editRowStyle;
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [DefaultValueAttribute (null)]
+ public virtual TableItemStyle EmptyDataRowStyle {
+ get {
+ if (emptyDataRowStyle == null) {
+ emptyDataRowStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ emptyDataRowStyle.TrackViewState();
+ }
+ return emptyDataRowStyle;
+ }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(DetailsView), BindingDirection.OneWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate EmptyDataTemplate {
+ get { return emptyDataTemplate; }
+ set { emptyDataTemplate = value; RequireBinding (); }
+ }
+
+ [LocalizableAttribute (true)]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("")]
+ public virtual string EmptyDataText {
+ get {
+ object ob = ViewState ["EmptyDataText"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["EmptyDataText"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (false)]
+ public virtual bool EnablePagingCallbacks {
+ get {
+ object ob = ViewState ["EnablePagingCallbacks"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["EnablePagingCallbacks"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle FieldHeaderStyle {
+ get {
+ if (fieldHeaderStyle == null) {
+ fieldHeaderStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ fieldHeaderStyle.TrackViewState();
+ }
+ return fieldHeaderStyle;
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public virtual DetailsViewRow FooterRow {
+ get {
+ EnsureChildControls ();
+ return footerRow;
+ }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(DetailsView), BindingDirection.OneWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate FooterTemplate {
+ get { return footerTemplate; }
+ set { footerTemplate = value; RequireBinding (); }
+ }
+
+ [LocalizableAttribute (true)]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("")]
+ public string FooterText {
+ get {
+ object ob = ViewState ["FooterText"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["FooterText"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle FooterStyle {
+ get {
+ if (footerStyle == null) {
+ footerStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ footerStyle.TrackViewState();
+ }
+ return footerStyle;
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute (GridLines.Both)]
+ public virtual GridLines GridLines {
+ get {
+ object ob = ViewState ["GridLines"];
+ if (ob != null) return (GridLines) ob;
+ return GridLines.Both;
+ }
+ set {
+ ViewState ["GridLines"] = value;
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public virtual DetailsViewRow HeaderRow {
+ get {
+ EnsureChildControls ();
+ return headerRow;
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle HeaderStyle {
+ get {
+ if (headerStyle == null) {
+ headerStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ headerStyle.TrackViewState();
+ }
+ return headerStyle;
+ }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(DetailsView), BindingDirection.OneWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate HeaderTemplate {
+ get { return headerTemplate; }
+ set { headerTemplate = value; RequireBinding (); }
+ }
+
+ [LocalizableAttribute (true)]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("")]
+ public string HeaderText {
+ get {
+ object ob = ViewState ["HeaderText"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["HeaderText"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [DefaultValueAttribute (HorizontalAlign.NotSet)]
+ public virtual HorizontalAlign HorizontalAlign {
+ get {
+ object ob = ViewState ["HorizontalAlign"];
+ if (ob != null) return (HorizontalAlign) ob;
+ return HorizontalAlign.NotSet;
+ }
+ set {
+ ViewState ["HorizontalAlign"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [DefaultValueAttribute (null)]
+ public virtual TableItemStyle InsertRowStyle {
+ get {
+ if (insertRowStyle == null) {
+ insertRowStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ insertRowStyle.TrackViewState();
+ }
+ return insertRowStyle;
+ }
+ }
+
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public int PageCount {
+ get {
+ if (pageCount != -1) return pageCount;
+ EnsureDataBound ();
+ return pageCount;
+ }
+ }
+
+ [WebCategoryAttribute ("Paging")]
+ [BindableAttribute (true, BindingDirection.OneWay)]
+ [DefaultValueAttribute (0)]
+ public int PageIndex {
+ get {
+ return pageIndex;
+ }
+ set {
+ pageIndex = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Paging")]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Content)]
+ [NotifyParentPropertyAttribute (true)]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ public PagerSettings PagerSettings {
+ get {
+ if (pagerSettings == null) {
+ pagerSettings = new PagerSettings (this);
+ if (IsTrackingViewState)
+ ((IStateManager)pagerSettings).TrackViewState ();
+ }
+ return pagerSettings;
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle PagerStyle {
+ get {
+ if (pagerStyle == null) {
+ pagerStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ pagerStyle.TrackViewState();
+ }
+ return pagerStyle;
+ }
+ }
+
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(DetailsView), BindingDirection.OneWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate PagerTemplate {
+ get { return pagerTemplate; }
+ set { pagerTemplate = value; RequireBinding (); }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public virtual DetailsViewRowCollection Rows {
+ get {
+ EnsureDataBound ();
+ return rows;
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [DefaultValue (null)]
+ public virtual TableItemStyle RowStyle {
+ get {
+ if (rowStyle == null) {
+ rowStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ rowStyle.TrackViewState();
+ }
+ return rowStyle;
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public virtual object SelectedValue {
+ get { return DataKey.Value; }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public virtual DetailsViewRow TopPagerRow {
+ get {
+ EnsureDataBound ();
+ return topPagerRow;
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public object DataItem {
+ get {
+ EnsureDataBound ();
+ return dataItem;
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public int DataItemCount {
+ get { return PageCount; }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public int DataItemIndex {
+ get { return PageIndex; }
+ }
+
+ public virtual bool IsBindableType (Type type)
+ {
+ return type.IsPrimitive || type == typeof(string) || type == typeof(DateTime) || type == typeof(Guid);
+ }
+
+ protected override DataSourceSelectArguments CreateDataSourceSelectArguments ()
+ {
+ return base.CreateDataSourceSelectArguments ();
+ }
+
+ protected virtual ICollection CreateFieldSet (object dataItem, bool useDataSource)
+ {
+ ArrayList fields = new ArrayList ();
+
+ if (AutoGenerateRows) {
+ if (useDataSource) {
+ if (dataItem != null)
+ fields.AddRange (CreateAutoGeneratedRows (dataItem));
+ } else {
+ if (autoFieldProperties != null) {
+ foreach (AutoGeneratedFieldProperties props in autoFieldProperties)
+ fields.Add (CreateAutoGeneratedRow (props));
+ }
+ }
+ }
+
+ fields.AddRange (Fields);
+
+ if (AutoGenerateEditButton || AutoGenerateDeleteButton || AutoGenerateInsertButton) {
+ CommandField field = new CommandField ();
+ field.ShowEditButton = AutoGenerateEditButton;
+ field.ShowDeleteButton = AutoGenerateDeleteButton;
+ field.ShowInsertButton = AutoGenerateInsertButton;
+ fields.Add (field);
+ commandField = field;
+ }
+
+ return fields;
+ }
+
+ protected virtual ICollection CreateAutoGeneratedRows (object dataItem)
+ {
+ ArrayList list = new ArrayList ();
+ autoFieldProperties = CreateAutoFieldProperties (dataItem);
+ foreach (AutoGeneratedFieldProperties props in autoFieldProperties)
+ list.Add (CreateAutoGeneratedRow (props));
+ return list;
+ }
+
+ protected virtual AutoGeneratedField CreateAutoGeneratedRow (AutoGeneratedFieldProperties fieldProperties)
+ {
+ return new AutoGeneratedField (fieldProperties);
+ }
+
+ AutoGeneratedFieldProperties[] CreateAutoFieldProperties (object dataItem)
+ {
+ PropertyDescriptorCollection props = TypeDescriptor.GetProperties (dataItem);
+
+ ArrayList retVal = new ArrayList();
+ if (props != null && props.Count > 0)
+ {
+ foreach (PropertyDescriptor current in props) {
+ if (IsBindableType (current.PropertyType)) {
+ AutoGeneratedFieldProperties field = new AutoGeneratedFieldProperties ();
+ ((IStateManager)field).TrackViewState();
+ field.Name = current.Name;
+ field.DataField = current.Name;
+ field.IsReadOnly = current.IsReadOnly;
+ field.Type = current.PropertyType;
+ retVal.Add (field);
+ }
+ }
+ }
+
+ if (retVal.Count > 0)
+ return (AutoGeneratedFieldProperties[]) retVal.ToArray (typeof(AutoGeneratedFieldProperties));
+ else
+ return new AutoGeneratedFieldProperties [0];
+ }
+
+ protected virtual DetailsViewRow CreateRow (int rowIndex, DataControlRowType rowType, DataControlRowState rowState)
+ {
+ DetailsViewRow row = new DetailsViewRow (rowIndex, rowType, rowState);
+ OnItemCreated (EventArgs.Empty);
+ return row;
+ }
+
+ void RequireBinding ()
+ {
+ if (Initialized) {
+ RequiresDataBinding = true;
+ pageCount = -1;
+ }
+ }
+
+ protected virtual Table CreateTable ()
+ {
+ Table table = new Table ();
+ table.Caption = Caption;
+ table.CaptionAlign = CaptionAlign;
+ table.CellPadding = CellPadding;
+ table.CellSpacing = CellSpacing;
+ table.HorizontalAlign = HorizontalAlign;
+ table.BackImageUrl = BackImageUrl;
+ return table;
+ }
+
+ protected override int CreateChildControls (IEnumerable data, bool dataBinding)
+ {
+ PagedDataSource dataSource;
+
+ if (dataBinding) {
+ DataSourceView view = GetData ();
+ dataSource = new PagedDataSource ();
+ dataSource.DataSource = data;
+
+ if (AllowPaging) {
+ dataSource.AllowPaging = true;
+ dataSource.PageSize = 1;
+ dataSource.CurrentPageIndex = PageIndex;
+ if (view.CanPage) {
+ dataSource.AllowServerPaging = true;
+ if (view.CanRetrieveTotalRowCount)
+ dataSource.VirtualCount = SelectArguments.TotalRowCount;
+ else {
+ dataSource.DataSourceView = view;
+ dataSource.DataSourceSelectArguments = SelectArguments;
+ dataSource.SetItemCountFromPageIndex (PageIndex + PagerSettings.PageButtonCount);
+ }
+ }
+ }
+
+ pageCount = dataSource.PageCount;
+ }
+ else
+ {
+ dataSource = new PagedDataSource ();
+ dataSource.DataSource = data;
+ if (AllowPaging) {
+ dataSource.AllowPaging = true;
+ dataSource.PageSize = 1;
+ dataSource.CurrentPageIndex = PageIndex;
+ }
+ }
+
+ bool showPager = AllowPaging && (PageCount > 1);
+
+ Controls.Clear ();
+ table = CreateTable ();
+ Controls.Add (table);
+
+ ArrayList list = new ArrayList ();
+
+ if (!Page.IsPostBack)
+ currentMode = DefaultMode;
+
+
+ // Gets the current data item
+
+ IEnumerator e = dataSource.GetEnumerator ();
+ if (e.MoveNext ())
+ dataItem = e.Current;
+ else
+ dataItem = null;
+
+ // Creates the set of fields to show
+
+ ICollection fieldCollection = CreateFieldSet (dataItem, dataBinding);
+ DataControlField[] fields = new DataControlField [fieldCollection.Count];
+ fieldCollection.CopyTo (fields, 0);
+
+ foreach (DataControlField field in fields) {
+ field.Initialize (false, this);
+ if (EnablePagingCallbacks)
+ field.ValidateSupportsCallback ();
+ }
+
+ // Main table creation
+
+ if (HeaderText.Length != 0 || headerTemplate != null) {
+ headerRow = CreateRow (-1, DataControlRowType.Header, DataControlRowState.Normal);
+ DataControlFieldCell cell = new DataControlFieldCell (null);
+ cell.ColumnSpan = 2;
+ if (headerTemplate != null)
+ headerTemplate.InstantiateIn (cell);
+ else
+ cell.Text = HeaderText;
+ headerRow.Cells.Add (cell);
+ table.Rows.Add (headerRow);
+ }
+
+ if (showPager && PagerSettings.Position == PagerPosition.Top || PagerSettings.Position == PagerPosition.TopAndBottom) {
+ topPagerRow = CreateRow (-1, DataControlRowType.Pager, DataControlRowState.Normal);
+ InitializePager (topPagerRow, dataSource);
+ table.Rows.Add (topPagerRow);
+ }
+
+ if (dataSource.Count > 0) {
+ foreach (DataControlField field in fields) {
+ DataControlRowState rstate = GetRowState (list.Count);
+ DetailsViewRow row = CreateRow (list.Count, DataControlRowType.DataRow, rstate);
+ InitializeRow (row, field);
+ table.Rows.Add (row);
+ list.Add (row);
+
+ if (commandField == field)
+ commandRow = row;
+ }
+ if (!dataBinding) {
+ if (CurrentMode == DetailsViewMode.Edit)
+ oldEditValues = new DataKey (new OrderedDictionary ());
+ key = new DataKey (new OrderedDictionary (), DataKeyNames);
+ }
+ } else {
+ table.Rows.Add (CreateEmptyrRow ());
+ }
+
+ rows = new DetailsViewRowCollection (list);
+
+ if (showPager && PagerSettings.Position == PagerPosition.Bottom || PagerSettings.Position == PagerPosition.TopAndBottom) {
+ bottomPagerRow = CreateRow (-1, DataControlRowType.Pager, DataControlRowState.Normal);
+ InitializePager (bottomPagerRow, dataSource);
+ table.Rows.Add (bottomPagerRow);
+ }
+
+ if (FooterText.Length != 0 || footerTemplate != null) {
+ footerRow = CreateRow (-1, DataControlRowType.Footer, DataControlRowState.Normal);
+ DataControlFieldCell cell = new DataControlFieldCell (null);
+ cell.ColumnSpan = 2;
+ if (footerTemplate != null)
+ footerTemplate.InstantiateIn (cell);
+ else
+ cell.Text = FooterText;
+ footerRow.Cells.Add (cell);
+ table.Rows.Add (footerRow);
+ }
+
+ return dataSource.DataSourceCount;
+ }
+
+ DataControlRowState GetRowState (int index)
+ {
+ DataControlRowState rstate = (index % 2) == 0 ? DataControlRowState.Normal : DataControlRowState.Alternate;
+ if (CurrentMode == DetailsViewMode.Edit) rstate |= DataControlRowState.Edit;
+ else if (CurrentMode == DetailsViewMode.Insert) rstate |= DataControlRowState.Insert;
+ return rstate;
+ }
+
+ protected virtual void InitializePager (DetailsViewRow row, PagedDataSource dataSource)
+ {
+ TableCell cell = new TableCell ();
+ cell.ColumnSpan = 2;
+
+ if (pagerTemplate != null)
+ pagerTemplate.InstantiateIn (cell);
+ else
+ cell.Controls.Add (PagerSettings.CreatePagerControl (dataSource.CurrentPageIndex, dataSource.PageCount));
+
+ row.Cells.Add (cell);
+ }
+
+ DetailsViewRow CreateEmptyrRow ()
+ {
+ DetailsViewRow row = CreateRow (-1, DataControlRowType.EmptyDataRow, DataControlRowState.Normal);
+ TableCell cell = new TableCell ();
+ cell.ColumnSpan = 2;
+
+ if (emptyDataTemplate != null)
+ emptyDataTemplate.InstantiateIn (cell);
+ else
+ cell.Text = EmptyDataText;
+
+ row.Cells.Add (cell);
+ return row;
+ }
+
+ protected virtual void InitializeRow (DetailsViewRow row, DataControlField field)
+ {
+ DataControlFieldCell cell;
+
+ if (field.ShowHeader) {
+ cell = new DataControlFieldCell (field);
+ row.Cells.Add (cell);
+ field.InitializeCell (cell, DataControlCellType.Header, row.RowState, row.RowIndex);
+ }
+
+ cell = new DataControlFieldCell (field);
+ if (!field.ShowHeader)
+ cell.ColumnSpan = 2;
+ row.Cells.Add (cell);
+ field.InitializeCell (cell, DataControlCellType.DataCell, row.RowState, row.RowIndex);
+ }
+
+ IOrderedDictionary CreateRowDataKey (object dataItem)
+ {
+ if (cachedKeyProperties == null) {
+ PropertyDescriptorCollection props = TypeDescriptor.GetProperties (dataItem);
+ cachedKeyProperties = new PropertyDescriptor [DataKeyNames.Length];
+ for (int n=0; n<DataKeyNames.Length; n++) {
+ PropertyDescriptor p = props [DataKeyNames[n]];
+ if (p == null)
+ new InvalidOperationException ("Property '" + DataKeyNames[n] + "' not found in object of type " + dataItem.GetType());
+ cachedKeyProperties [n] = p;
+ }
+ }
+
+ OrderedDictionary dic = new OrderedDictionary ();
+ foreach (PropertyDescriptor p in cachedKeyProperties)
+ dic [p.Name] = p.GetValue (dataItem);
+ return dic;
+ }
+
+ IOrderedDictionary GetRowValues (bool includeReadOnlyFields, bool includePrimaryKey)
+ {
+ OrderedDictionary dic = new OrderedDictionary ();
+ ExtractRowValues (dic, includeReadOnlyFields, includePrimaryKey);
+ return dic;
+ }
+
+ protected virtual void ExtractRowValues (IOrderedDictionary fieldValues, bool includeReadOnlyFields, bool includePrimaryKey)
+ {
+ foreach (DetailsViewRow row in Rows) {
+ if (row.Cells.Count < 1) continue;
+ DataControlFieldCell c = row.Cells[row.Cells.Count-1] as DataControlFieldCell;
+ if (c != null)
+ c.ContainingField.ExtractValuesFromCell (fieldValues, c, row.RowState, includeReadOnlyFields);
+ }
+ if (!includePrimaryKey && DataKeyNames != null)
+ foreach (string key in DataKeyNames)
+ fieldValues.Remove (key);
+ }
+
+ protected override HtmlTextWriterTag TagKey {
+ get {
+ if (EnablePagingCallbacks)
+ return HtmlTextWriterTag.Div;
+ else
+ return HtmlTextWriterTag.Table;
+ }
+ }
+
+ public sealed override void DataBind ()
+ {
+ DataSourceView view = GetData ();
+ if (AllowPaging && view.CanPage) {
+ SelectArguments.StartRowIndex = PageIndex;
+ SelectArguments.MaximumRows = 1;
+ if (view.CanRetrieveTotalRowCount)
+ SelectArguments.RetrieveTotalRowCount = true;
+ }
+
+ cachedKeyProperties = null;
+ base.DataBind ();
+
+ if (dataItem != null) {
+ if (CurrentMode == DetailsViewMode.Edit)
+ oldEditValues = new DataKey (GetRowValues (false, true));
+ key = new DataKey (CreateRowDataKey (dataItem), DataKeyNames);
+ }
+ }
+
+ protected override void PerformDataBinding (IEnumerable data)
+ {
+ base.PerformDataBinding (data);
+ }
+
+ protected override void OnInit (EventArgs e)
+ {
+ Page.RegisterRequiresControlState (this);
+ base.OnInit (e);
+ }
+
+ void OnFieldsChanged (object sender, EventArgs args)
+ {
+ RequireBinding ();
+ }
+
+ protected override void OnDataSourceViewChanged (object sender, EventArgs e)
+ {
+ base.OnDataSourceViewChanged (sender, e);
+ RequireBinding ();
+ }
+
+ protected override bool OnBubbleEvent (object source, EventArgs e)
+ {
+ DetailsViewCommandEventArgs args = e as DetailsViewCommandEventArgs;
+ if (args != null) {
+ OnItemCommand (args);
+ ProcessEvent (args.CommandName, args.CommandArgument as string);
+ }
+ return base.OnBubbleEvent (source, e);
+ }
+
+ // TODO: This is prolly obsolete
+ protected virtual void RaisePostBackEvent (string eventArgument)
+ {
+ int i = eventArgument.IndexOf ('$');
+ if (i != -1)
+ ProcessEvent (eventArgument.Substring (0, i), eventArgument.Substring (i + 1));
+ else
+ ProcessEvent (eventArgument, null);
+ }
+
+ void ProcessEvent (string eventName, string param)
+ {
+ switch (eventName)
+ {
+ case "Page":
+ int newIndex = -1;
+ switch (param) {
+ case "First":
+ newIndex = 0;
+ break;
+ case "Last":
+ newIndex = PageCount - 1;
+ break;
+ case "Next":
+ if (PageIndex < PageCount - 1) newIndex = PageIndex + 1;
+ break;
+ case "Prev":
+ if (PageIndex > 0) newIndex = PageIndex - 1;
+ break;
+ default:
+ newIndex = int.Parse (param) - 1;
+ break;
+ }
+ ShowPage (newIndex);
+ break;
+
+ case "First":
+ ShowPage (0);
+ break;
+
+ case "Last":
+ ShowPage (PageCount - 1);
+ break;
+
+ case "Next":
+ if (PageIndex < PageCount - 1)
+ ShowPage (PageIndex + 1);
+ break;
+
+ case "Prev":
+ if (PageIndex > 0)
+ ShowPage (PageIndex - 1);
+ break;
+
+ case "Edit":
+ ChangeMode (DetailsViewMode.Edit);
+ break;
+
+ case "New":
+ ChangeMode (DetailsViewMode.Insert);
+ break;
+
+ case "Update":
+ UpdateItem (param, true);
+ break;
+
+ case "Cancel":
+ CancelEdit ();
+ break;
+
+ case "Delete":
+ DeleteItem ();
+ break;
+
+ case "Insert":
+ InsertItem (true);
+ break;
+ }
+ }
+
+ void ShowPage (int newIndex)
+ {
+ DetailsViewPageEventArgs args = new DetailsViewPageEventArgs (newIndex);
+ OnPageIndexChanging (args);
+ if (!args.Cancel) {
+ EndRowEdit ();
+ PageIndex = args.NewPageIndex;
+ OnPageIndexChanged (EventArgs.Empty);
+ }
+ }
+
+ public void ChangeMode (DetailsViewMode newMode)
+ {
+ DetailsViewModeEventArgs args = new DetailsViewModeEventArgs (newMode, false);
+ OnModeChanging (args);
+ if (!args.Cancel) {
+ currentMode = args.NewMode;
+ OnModeChanged (EventArgs.Empty);
+ RequireBinding ();
+ }
+ }
+
+ void CancelEdit ()
+ {
+ DetailsViewModeEventArgs args = new DetailsViewModeEventArgs (DetailsViewMode.ReadOnly, true);
+ OnModeChanging (args);
+ if (!args.Cancel) {
+ EndRowEdit ();
+ }
+ }
+
+ public virtual void UpdateItem (bool causesValidation)
+ {
+ UpdateItem (null, causesValidation);
+ }
+
+ void UpdateItem (string param, bool causesValidation)
+ {
+ if (causesValidation)
+ Page.Validate ();
+
+ if (currentMode != DetailsViewMode.Edit) throw new NotSupportedException ();
+
+ currentEditOldValues = oldEditValues.Values;
+
+ currentEditRowKeys = DataKey.Values;
+ currentEditNewValues = GetRowValues (false, false);
+
+ DetailsViewUpdateEventArgs args = new DetailsViewUpdateEventArgs (param, currentEditRowKeys, currentEditOldValues, currentEditNewValues);
+ OnItemUpdating (args);
+ if (!args.Cancel) {
+ DataSourceView view = GetData ();
+ if (view == null) throw new HttpException ("The DataSourceView associated to data bound control was null");
+ view.Update (currentEditRowKeys, currentEditNewValues, currentEditOldValues, new DataSourceViewOperationCallback (UpdateCallback));
+ } else
+ EndRowEdit ();
+ }
+
+ bool UpdateCallback (int recordsAffected, Exception exception)
+ {
+ DetailsViewUpdatedEventArgs dargs = new DetailsViewUpdatedEventArgs (recordsAffected, exception, currentEditRowKeys, currentEditOldValues, currentEditNewValues);
+ OnItemUpdated (dargs);
+
+ if (!dargs.KeepInEditMode)
+ EndRowEdit ();
+
+ return dargs.ExceptionHandled;
+ }
+
+ public virtual void InsertItem (bool causesValidation)
+ {
+ InsertItem (null, causesValidation);
+ }
+
+ void InsertItem (string param, bool causesValidation)
+ {
+ if (causesValidation)
+ Page.Validate ();
+
+ if (currentMode != DetailsViewMode.Insert) throw new NotSupportedException ();
+
+ currentEditNewValues = GetRowValues (false, true);
+ DetailsViewInsertEventArgs args = new DetailsViewInsertEventArgs (param, currentEditNewValues);
+ OnItemInserting (args);
+ if (!args.Cancel) {
+ DataSourceView view = GetData ();
+ if (view == null) throw new HttpException ("The DataSourceView associated to data bound control was null");
+ view.Insert (currentEditNewValues, new DataSourceViewOperationCallback (InsertCallback));
+ } else
+ EndRowEdit ();
+ }
+
+ bool InsertCallback (int recordsAffected, Exception exception)
+ {
+ DetailsViewInsertedEventArgs dargs = new DetailsViewInsertedEventArgs (recordsAffected, exception, currentEditNewValues);
+ OnItemInserted (dargs);
+
+ if (!dargs.KeepInInsertMode)
+ EndRowEdit ();
+
+ return dargs.ExceptionHandled;
+ }
+
+ public void DeleteItem ()
+ {
+ currentEditRowKeys = DataKey.Values;
+ currentEditNewValues = GetRowValues (true, true);
+
+ DetailsViewDeleteEventArgs args = new DetailsViewDeleteEventArgs (PageIndex, currentEditRowKeys, currentEditNewValues);
+ OnItemDeleting (args);
+
+ if (!args.Cancel) {
+ if (PageIndex == PageCount - 1)
+ PageIndex --;
+ RequireBinding ();
+ DataSourceView view = GetData ();
+ if (view != null)
+ view.Delete (currentEditRowKeys, currentEditNewValues, new DataSourceViewOperationCallback (DeleteCallback));
+ else {
+ DetailsViewDeletedEventArgs dargs = new DetailsViewDeletedEventArgs (0, null, currentEditRowKeys, currentEditNewValues);
+ OnItemDeleted (dargs);
+ }
+ }
+ }
+
+ bool DeleteCallback (int recordsAffected, Exception exception)
+ {
+ DetailsViewDeletedEventArgs dargs = new DetailsViewDeletedEventArgs (recordsAffected, exception, currentEditRowKeys, currentEditNewValues);
+ OnItemDeleted (dargs);
+ return dargs.ExceptionHandled;
+ }
+
+ void EndRowEdit ()
+ {
+ ChangeMode (DefaultMode);
+ oldEditValues = new DataKey (new OrderedDictionary ());
+ currentEditRowKeys = null;
+ currentEditOldValues = null;
+ currentEditNewValues = null;
+ RequireBinding ();
+ }
+
+ protected internal override void LoadControlState (object ob)
+ {
+ if (ob == null) return;
+ object[] state = (object[]) ob;
+ base.LoadControlState (state[0]);
+ pageIndex = (int) state[1];
+ pageCount = (int) state[2];
+ currentMode = (DetailsViewMode) state[3];
+ }
+
+ protected internal override object SaveControlState ()
+ {
+ object bstate = base.SaveControlState ();
+ return new object[] {
+ bstate, pageIndex, pageCount, currentMode
+ };
+ }
+
+ protected override void TrackViewState()
+ {
+ base.TrackViewState();
+ if (columns != null) ((IStateManager)columns).TrackViewState();
+ if (pagerSettings != null) ((IStateManager)pagerSettings).TrackViewState();
+ if (alternatingRowStyle != null) ((IStateManager)alternatingRowStyle).TrackViewState();
+ if (footerStyle != null) ((IStateManager)footerStyle).TrackViewState();
+ if (headerStyle != null) ((IStateManager)headerStyle).TrackViewState();
+ if (pagerStyle != null) ((IStateManager)pagerStyle).TrackViewState();
+ if (rowStyle != null) ((IStateManager)rowStyle).TrackViewState();
+ if (editRowStyle != null) ((IStateManager)editRowStyle).TrackViewState();
+ if (insertRowStyle != null) ((IStateManager)insertRowStyle).TrackViewState();
+ if (emptyDataRowStyle != null) ((IStateManager)emptyDataRowStyle).TrackViewState();
+ if (key != null) ((IStateManager)key).TrackViewState();
+ if (autoFieldProperties != null) {
+ foreach (IStateManager sm in autoFieldProperties)
+ sm.TrackViewState ();
+ }
+ }
+
+ protected override object SaveViewState()
+ {
+ object[] states = new object [14];
+ states[0] = base.SaveViewState();
+ states[1] = (columns == null ? null : ((IStateManager)columns).SaveViewState());
+ states[2] = (pagerSettings == null ? null : ((IStateManager)pagerSettings).SaveViewState());
+ states[3] = (alternatingRowStyle == null ? null : ((IStateManager)alternatingRowStyle).SaveViewState());
+ states[4] = (footerStyle == null ? null : ((IStateManager)footerStyle).SaveViewState());
+ states[5] = (headerStyle == null ? null : ((IStateManager)headerStyle).SaveViewState());
+ states[6] = (pagerStyle == null ? null : ((IStateManager)pagerStyle).SaveViewState());
+ states[7] = (rowStyle == null ? null : ((IStateManager)rowStyle).SaveViewState());
+ states[8] = (insertRowStyle == null ? null : ((IStateManager)insertRowStyle).SaveViewState());
+ states[9] = (editRowStyle == null ? null : ((IStateManager)editRowStyle).SaveViewState());
+ states[10] = (emptyDataRowStyle == null ? null : ((IStateManager)emptyDataRowStyle).SaveViewState());
+ states[11] = (key == null ? null : ((IStateManager)key).SaveViewState());
+ states[12] = (oldEditValues == null ? null : ((IStateManager)oldEditValues).SaveViewState());
+
+ if (autoFieldProperties != null) {
+ object[] data = new object [autoFieldProperties.Length];
+ bool allNull = true;
+ for (int n=0; n<data.Length; n++) {
+ data [n] = ((IStateManager)autoFieldProperties [n]).SaveViewState ();
+ if (data [n] != null) allNull = false;
+ }
+ if (!allNull) states [13] = data;
+ }
+
+ for (int i = states.Length - 1; i >= 0; i--) {
+ if (states [i] != null)
+ return states;
+ }
+
+ return null;
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState == null) {
+ base.LoadViewState (null);
+ return;
+ }
+
+ object [] states = (object []) savedState;
+
+ if (states[13] != null) {
+ object[] data = (object[]) states [13];
+ autoFieldProperties = new AutoGeneratedFieldProperties [data.Length];
+ for (int n=0; n<data.Length; n++) {
+ IStateManager p = new AutoGeneratedFieldProperties ();
+ p.TrackViewState ();
+ p.LoadViewState (data [n]);
+ autoFieldProperties [n] = (AutoGeneratedFieldProperties) p;
+ }
+ }
+
+ base.LoadViewState (states[0]);
+ EnsureChildControls ();
+
+ if (states[1] != null) ((IStateManager)Fields).LoadViewState (states[1]);
+ if (states[2] != null) ((IStateManager)PagerSettings).LoadViewState (states[2]);
+ if (states[3] != null) ((IStateManager)AlternatingRowStyle).LoadViewState (states[3]);
+ if (states[4] != null) ((IStateManager)FooterStyle).LoadViewState (states[4]);
+ if (states[5] != null) ((IStateManager)HeaderStyle).LoadViewState (states[5]);
+ if (states[6] != null) ((IStateManager)PagerStyle).LoadViewState (states[6]);
+ if (states[7] != null) ((IStateManager)RowStyle).LoadViewState (states[7]);
+ if (states[8] != null) ((IStateManager)InsertRowStyle).LoadViewState (states[8]);
+ if (states[9] != null) ((IStateManager)EditRowStyle).LoadViewState (states[9]);
+ if (states[10] != null) ((IStateManager)EmptyDataRowStyle).LoadViewState (states[10]);
+ if (states[11] != null) ((IStateManager)DataKey).LoadViewState (states[11]);
+ if (states[12] != null && oldEditValues != null) ((IStateManager)oldEditValues).LoadViewState (states[12]);
+ }
+
+ string ICallbackEventHandler.RaiseCallbackEvent (string eventArgs)
+ {
+ return RaiseCallbackEvent (eventArgs);
+ }
+
+ protected virtual string RaiseCallbackEvent (string eventArgs)
+ {
+ string[] clientData = eventArgs.Split ('|');
+ pageIndex = int.Parse (clientData[0]);
+ RequireBinding ();
+
+ RaisePostBackEvent (clientData[2]);
+ EnsureDataBound ();
+
+ StringWriter sw = new StringWriter ();
+ sw.Write (PageIndex.ToString());
+
+ HtmlTextWriter writer = new HtmlTextWriter (sw);
+ RenderGrid (writer);
+ return sw.ToString ();
+ }
+
+ string ICallbackContainer.GetCallbackScript (IButtonControl control, string argument)
+ {
+ if (EnablePagingCallbacks)
+ return "javascript:GridView_ClientEvent (\"" + ClientID + "\",\"" + control.CommandName + "$" + control.CommandArgument + "\"); return false;";
+ else
+ return null;
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+
+ if (EnablePagingCallbacks)
+ {
+ if (!Page.ClientScript.IsClientScriptIncludeRegistered (typeof(GridView), "GridView.js")) {
+ string url = Page.ClientScript.GetWebResourceUrl (typeof(GridView), "GridView.js");
+ Page.ClientScript.RegisterClientScriptInclude (typeof(GridView), "GridView.js", url);
+ }
+
+ string cgrid = ClientID + "_data";
+ string script = string.Format ("var {0} = new Object ();\n", cgrid);
+ script += string.Format ("{0}.pageIndex = {1};\n", cgrid, ClientScriptManager.GetScriptLiteral (PageIndex));
+ script += string.Format ("{0}.uid = {1};\n", cgrid, ClientScriptManager.GetScriptLiteral (UniqueID));
+ Page.ClientScript.RegisterStartupScript (typeof(TreeView), this.UniqueID, script, true);
+
+ // Make sure the basic script infrastructure is rendered
+ Page.ClientScript.GetCallbackEventReference (this, "null", "", "null");
+ Page.ClientScript.GetPostBackClientHyperlink (this, "");
+ }
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ if (EnablePagingCallbacks)
+ base.RenderBeginTag (writer);
+
+ RenderGrid (writer);
+
+ if (EnablePagingCallbacks)
+ base.RenderEndTag (writer);
+ }
+
+ void RenderGrid (HtmlTextWriter writer)
+ {
+ switch (GridLines) {
+ case GridLines.Horizontal:
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "rows");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+ break;
+ case GridLines.Vertical:
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "cols");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+ break;
+ case GridLines.Both:
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "all");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+ break;
+ default:
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "0");
+ break;
+ }
+
+ writer.AddAttribute (HtmlTextWriterAttribute.Cellspacing, "0");
+ writer.AddStyleAttribute (HtmlTextWriterStyle.BorderCollapse, "collapse");
+ table.RenderBeginTag (writer);
+
+ foreach (DetailsViewRow row in table.Rows)
+ {
+ switch (row.RowType) {
+ case DataControlRowType.Header:
+ if (headerStyle != null)headerStyle.AddAttributesToRender (writer, row);
+ break;
+ case DataControlRowType.Footer:
+ if (footerStyle != null) footerStyle.AddAttributesToRender (writer, row);
+ break;
+ case DataControlRowType.Pager:
+ if (pagerStyle != null) pagerStyle.AddAttributesToRender (writer, row);
+ break;
+ case DataControlRowType.EmptyDataRow:
+ if (emptyDataRowStyle != null) emptyDataRowStyle.AddAttributesToRender (writer, row);
+ break;
+ default:
+ if (rowStyle != null) rowStyle.AddAttributesToRender (writer, row);
+ break;
+ }
+
+ if ((row.RowState & DataControlRowState.Alternate) != 0 && alternatingRowStyle != null)
+ alternatingRowStyle.AddAttributesToRender (writer, row);
+ if ((row.RowState & DataControlRowState.Edit) != 0 && editRowStyle != null)
+ editRowStyle.AddAttributesToRender (writer, row);
+ if ((row.RowState & DataControlRowState.Insert) != 0 && insertRowStyle != null)
+ insertRowStyle.AddAttributesToRender (writer, row);
+
+ if (row == commandRow && commandRowStyle != null)
+ commandRowStyle.AddAttributesToRender (writer, row);
+
+ row.RenderBeginTag (writer);
+
+ for (int n=0; n<row.Cells.Count; n++) {
+ DataControlFieldCell fcell = row.Cells[n] as DataControlFieldCell;
+ if (fcell != null && fcell.ContainingField != null) {
+ if (n == 0 && fcell.ContainingField.ShowHeader) {
+ if (fieldHeaderStyle != null)
+ fieldHeaderStyle.AddAttributesToRender (writer, fcell);
+ fcell.ContainingField.HeaderStyle.AddAttributesToRender (writer, fcell);
+ }
+ else
+ fcell.ContainingField.ItemStyle.AddAttributesToRender (writer, fcell);
+ }
+ row.Cells[n].Render (writer);
+ }
+ row.RenderEndTag (writer);
+ }
+ table.RenderEndTag (writer);
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewCommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewCommandEventArgs.cs
new file mode 100644
index 00000000000..e2e234477f1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewCommandEventArgs.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.UI.WebControls.DetailsViewCommandEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls
+{
+ public class DetailsViewCommandEventArgs : CommandEventArgs
+ {
+ private object source;
+
+ public DetailsViewCommandEventArgs (object source, CommandEventArgs arguments) : base (arguments)
+ {
+ this.source = source;
+ }
+
+ public object CommandSource {
+ get { return source; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewCommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewCommandEventHandler.cs
new file mode 100644
index 00000000000..e25c8cadc74
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewCommandEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.DetailsViewCommandEventHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void DetailsViewCommandEventHandler (object sender, DetailsViewCommandEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewDeleteEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewDeleteEventArgs.cs
new file mode 100644
index 00000000000..2bc0992de9c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewDeleteEventArgs.cs
@@ -0,0 +1,70 @@
+//
+// System.Web.UI.WebControls.DetailsViewDeleteEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class DetailsViewDeleteEventArgs : CancelEventArgs
+ {
+ private int rowIndex;
+ IOrderedDictionary keys;
+ IOrderedDictionary values;
+
+ public DetailsViewDeleteEventArgs (int index)
+ {
+ this.rowIndex = index;
+ }
+
+ internal DetailsViewDeleteEventArgs (int index, IOrderedDictionary keys, IOrderedDictionary values)
+ {
+ this.rowIndex = index;
+ this.keys = keys;
+ this.values = values;
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ public IOrderedDictionary Keys {
+ get { return keys; }
+ }
+
+ public IOrderedDictionary Values {
+ get { return values; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewDeleteEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewDeleteEventHandler.cs
new file mode 100644
index 00000000000..21fc33f947f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewDeleteEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.DetailsViewDeleteEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void DetailsViewDeleteEventHandler (object sender, DetailsViewDeleteEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewDeletedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewDeletedEventArgs.cs
new file mode 100644
index 00000000000..a9abef43cef
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewDeletedEventArgs.cs
@@ -0,0 +1,83 @@
+//
+// System.Web.UI.WebControls.DetailsViewDeletedEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+ public class DetailsViewDeletedEventArgs : EventArgs
+ {
+ private int rowsAffected;
+ private Exception e;
+ private bool exceptionHandled;
+ private bool keepEditMode;
+ private IOrderedDictionary keys;
+ private IOrderedDictionary values;
+
+ public DetailsViewDeletedEventArgs (int affectedRows, Exception e)
+ {
+ this.rowsAffected = affectedRows;
+ this.e = e;
+ this.exceptionHandled = false;
+ }
+
+ internal DetailsViewDeletedEventArgs (int affectedRows, Exception e, IOrderedDictionary keys, IOrderedDictionary values)
+ : this (affectedRows, e)
+ {
+ this.keys = keys;
+ this.values = values;
+ }
+
+ public int AffectedRows {
+ get { return rowsAffected; }
+ }
+
+ public Exception Exception {
+ get { return e; }
+ }
+
+ public bool ExceptionHandled {
+ get { return exceptionHandled; }
+ set { exceptionHandled = value; }
+ }
+
+ public IOrderedDictionary Keys {
+ get { return keys; }
+ }
+
+ public IOrderedDictionary Values {
+ get { return values; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewDeletedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewDeletedEventHandler.cs
new file mode 100644
index 00000000000..e90137b7bc1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewDeletedEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.DetailsViewDeletedEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void DetailsViewDeletedEventHandler (object sender, DetailsViewDeletedEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewInsertEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewInsertEventArgs.cs
new file mode 100644
index 00000000000..2f36a585819
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewInsertEventArgs.cs
@@ -0,0 +1,64 @@
+//
+// System.Web.UI.WebControls.DetailsViewInsertEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class DetailsViewInsertEventArgs : CancelEventArgs
+ {
+ private object argument;
+ private IOrderedDictionary values;
+
+ public DetailsViewInsertEventArgs (object argument)
+ {
+ this.argument = argument;
+ }
+
+ internal DetailsViewInsertEventArgs (object argument, IOrderedDictionary values)
+ {
+ this.argument = argument;
+ this.values = values;
+ }
+
+ public object CommandArgument {
+ get { return argument; }
+ }
+
+ public IOrderedDictionary Values {
+ get { return values; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewInsertEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewInsertEventHandler.cs
new file mode 100644
index 00000000000..ce98285dcde
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewInsertEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.DetailsViewInsertEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void DetailsViewInsertEventHandler (object sender, DetailsViewInsertEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewInsertedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewInsertedEventArgs.cs
new file mode 100644
index 00000000000..277e2050bf6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewInsertedEventArgs.cs
@@ -0,0 +1,82 @@
+//
+// System.Web.UI.WebControls.DetailsViewInsertedEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+ public class DetailsViewInsertedEventArgs : EventArgs
+ {
+ private int rowsAffected;
+ private Exception e;
+ private bool exceptionHandled;
+ private bool keepInsertedMode;
+ private IOrderedDictionary values;
+
+ public DetailsViewInsertedEventArgs (int affectedRows, Exception e)
+ {
+ this.rowsAffected = affectedRows;
+ this.e = e;
+ this.exceptionHandled = false;
+ this.keepInsertedMode = false;
+ }
+
+ internal DetailsViewInsertedEventArgs (int affectedRows, Exception e, IOrderedDictionary values): this (affectedRows, e)
+ {
+ this.values = values;
+ }
+
+ public int AffectedRows {
+ get { return rowsAffected; }
+ }
+
+ public Exception Exception {
+ get { return e; }
+ }
+
+ public bool ExceptionHandled {
+ get { return exceptionHandled; }
+ set { exceptionHandled = value; }
+ }
+
+ public bool KeepInInsertMode {
+ get { return keepInsertedMode; }
+ set { keepInsertedMode = value; }
+ }
+
+ public IOrderedDictionary Values {
+ get { return values; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewInsertedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewInsertedEventHandler.cs
new file mode 100644
index 00000000000..770d730765c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewInsertedEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.DetailsViewInsertedEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void DetailsViewInsertedEventHandler (object sender, DetailsViewInsertedEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewMode.cs
new file mode 100644
index 00000000000..706c9736566
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewMode.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.DetailsViewMode.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum DetailsViewMode {
+ ReadOnly = 0,
+ Edit = 1,
+ Insert = 2
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewModeEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewModeEventArgs.cs
new file mode 100644
index 00000000000..709a978a1dd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewModeEventArgs.cs
@@ -0,0 +1,59 @@
+//
+// System.Web.UI.WebControls.DetailsViewModeEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class DetailsViewModeEventArgs : CancelEventArgs
+ {
+ private DetailsViewMode mode;
+ private bool cancelEdit;
+
+ public DetailsViewModeEventArgs (DetailsViewMode mode, bool cancelingEdit)
+ {
+ this.mode = mode;
+ this.cancelEdit = cancelingEdit;
+ }
+
+ public bool CancelingEdit {
+ get { return cancelEdit; }
+ }
+
+ public DetailsViewMode NewMode {
+ get { return mode; }
+ set { mode = value;}
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewModeEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewModeEventHandler.cs
new file mode 100644
index 00000000000..75d894eb489
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewModeEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.DetailsViewModeEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void DetailsViewModeEventHandler (object sender, DetailsViewModeEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewPageEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewPageEventArgs.cs
new file mode 100644
index 00000000000..cb0b3d52db0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewPageEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.UI.WebControls.DetailsViewPageEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class DetailsViewPageEventArgs : CancelEventArgs
+ {
+ private int pageIndex;
+
+ public DetailsViewPageEventArgs (int pageIndex )
+ {
+ this.pageIndex = pageIndex;
+ }
+
+ public int NewPageIndex {
+ get { return pageIndex; }
+ set { pageIndex = value;}
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewPageEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewPageEventHandler.cs
new file mode 100644
index 00000000000..a34fecbaa64
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewPageEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.DetailsViewPageEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void DetailsViewPageEventHandler (object sender, DetailsViewPageEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewRow.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewRow.cs
new file mode 100644
index 00000000000..b04dac952c6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewRow.cs
@@ -0,0 +1,82 @@
+//
+// System.Web.UI.WebControls.DetailsViewRow.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Web.UI;
+using System.Security.Permissions;
+
+namespace System.Web.UI.WebControls
+{
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public class DetailsViewRow: TableRow
+ {
+ int rowIndex;
+ DataControlRowState rowState;
+ DataControlRowType rowType;
+
+ public DetailsViewRow (int rowIndex, DataControlRowType rowType, DataControlRowState rowState)
+ {
+ this.rowIndex = rowIndex;
+ this.rowType = rowType;
+ this.rowState = rowState;
+ }
+
+ public virtual int RowIndex {
+ get { return rowIndex; }
+ }
+
+ public virtual DataControlRowState RowState {
+ get { return rowState; }
+ }
+
+ public virtual DataControlRowType RowType {
+ get { return rowType; }
+ }
+
+ protected override bool OnBubbleEvent (object source, EventArgs e)
+ {
+ if (base.OnBubbleEvent (source, e)) return true;
+
+ if (e is CommandEventArgs) {
+ DetailsViewCommandEventArgs args = new DetailsViewCommandEventArgs (source, (CommandEventArgs)e);
+ RaiseBubbleEvent (source, args);
+ return true;
+ }
+ return false;
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewRowCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewRowCollection.cs
new file mode 100644
index 00000000000..43717bc5144
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewRowCollection.cs
@@ -0,0 +1,85 @@
+//
+// System.Web.UI.WebControls.DetailsViewRowCollection.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Web.UI;
+using System.Collections;
+
+namespace System.Web.UI.WebControls
+{
+ public class DetailsViewRowCollection: ICollection, IEnumerable
+ {
+ ArrayList rows = new ArrayList ();
+
+ public DetailsViewRowCollection (ArrayList rows)
+ {
+ this.rows = rows;
+ }
+
+ public DetailsViewRow this [int i] {
+ get { return (DetailsViewRow) rows [i]; }
+ }
+
+ public void CopyTo (DetailsViewRow[] array, int index)
+ {
+ rows.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return rows.GetEnumerator ();
+ }
+
+ public int Count {
+ get { return rows.Count; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public object SyncRoot {
+ get { return rows.SyncRoot; }
+ }
+
+ public bool IsReadOnly {
+ get { return false; }
+ }
+
+ void System.Collections.ICollection.CopyTo (Array array, int index)
+ {
+ rows.CopyTo (array, index);
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewUpdateEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewUpdateEventArgs.cs
new file mode 100644
index 00000000000..a60031e1110
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewUpdateEventArgs.cs
@@ -0,0 +1,76 @@
+//
+// System.Web.UI.WebControls.DetailsViewUpdateEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class DetailsViewUpdateEventArgs : CancelEventArgs
+ {
+ private object argument;
+ IOrderedDictionary keys;
+ IOrderedDictionary newValues;
+ IOrderedDictionary oldValues;
+
+ public DetailsViewUpdateEventArgs (object argument)
+ {
+ this.argument = argument;
+ }
+
+ internal DetailsViewUpdateEventArgs (object argument, IOrderedDictionary keys, IOrderedDictionary oldValues, IOrderedDictionary newValues)
+ {
+ this.argument = argument;
+ this.keys = keys;
+ this.newValues = newValues;
+ this.oldValues = oldValues;
+ }
+
+ public object CommandArgument {
+ get { return argument; }
+ }
+
+ public IOrderedDictionary Keys {
+ get { return keys; }
+ }
+
+ public IOrderedDictionary NewValues {
+ get { return newValues; }
+ }
+
+ public IOrderedDictionary OldValues {
+ get { return oldValues; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewUpdateEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewUpdateEventHandler.cs
new file mode 100644
index 00000000000..8ee460a13ed
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewUpdateEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.DetailsViewUpdateEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void DetailsViewUpdateEventHandler (object sender, DetailsViewUpdateEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewUpdatedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewUpdatedEventArgs.cs
new file mode 100644
index 00000000000..7e06244ff88
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewUpdatedEventArgs.cs
@@ -0,0 +1,95 @@
+//
+// System.Web.UI.WebControls.DetailsViewUpdatedEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+ public class DetailsViewUpdatedEventArgs : EventArgs
+ {
+ private int rowsAffected;
+ private Exception e;
+ private bool exceptionHandled;
+ private bool keepEditMode;
+ private IOrderedDictionary keys;
+ private IOrderedDictionary newValues;
+ private IOrderedDictionary oldValues;
+
+ public DetailsViewUpdatedEventArgs (int affectedRows, Exception e)
+ {
+ this.rowsAffected = affectedRows;
+ this.e = e;
+ this.exceptionHandled = false;
+ this.keepEditMode = false;
+ }
+
+ internal DetailsViewUpdatedEventArgs (int affectedRows, Exception e, IOrderedDictionary keys, IOrderedDictionary oldValues, IOrderedDictionary newValues)
+ : this (affectedRows, e)
+ {
+ this.keys = keys;
+ this.newValues = newValues;
+ this.oldValues = oldValues;
+ }
+
+ public int AffectedRows {
+ get { return rowsAffected; }
+ }
+
+ public Exception Exception {
+ get { return e; }
+ }
+
+ public bool ExceptionHandled {
+ get { return exceptionHandled; }
+ set { exceptionHandled = value; }
+ }
+
+ public bool KeepInEditMode {
+ get { return keepEditMode; }
+ set { keepEditMode = value; }
+ }
+
+ public IOrderedDictionary Keys {
+ get { return keys; }
+ }
+
+ public IOrderedDictionary NewValues {
+ get { return newValues; }
+ }
+
+ public IOrderedDictionary OldValues {
+ get { return oldValues; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewUpdatedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewUpdatedEventHandler.cs
new file mode 100644
index 00000000000..1641c8d3fd2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DetailsViewUpdatedEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.DetailsViewUpdatedEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void DetailsViewUpdatedEventHandler (object sender, DetailsViewUpdatedEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs
new file mode 100644
index 00000000000..8503e4eddeb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs
@@ -0,0 +1,277 @@
+//
+// System.Web.UI.WebControls.DropDownList.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Drawing;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ValidationProperty("SelectedItem")]
+ public class DropDownList : ListControl, IPostBackDataHandler
+#if NET_2_0
+ , ITextControl
+#endif
+ {
+#if NET_2_0
+ private static readonly object TextChangedEvent = new object();
+#endif
+
+ public DropDownList(): base()
+ {
+ }
+
+ [Browsable (false)]
+ public override Color BorderColor
+ {
+ get
+ {
+ return base.BorderColor;
+ }
+ set
+ {
+ base.BorderColor = value;
+ }
+ }
+
+ [Browsable (false)]
+ public override BorderStyle BorderStyle
+ {
+ get
+ {
+ return base.BorderStyle;
+ }
+ set
+ {
+ base.BorderStyle = value;
+ }
+ }
+
+ [Browsable (false)]
+ public override Unit BorderWidth
+ {
+ get
+ {
+ return base.BorderWidth;
+ }
+ set
+ {
+ base.BorderWidth = value;
+ }
+ }
+
+ [DefaultValue (0), WebCategory ("Misc")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The index number of the currently selected ListItem.")]
+ public override int SelectedIndex
+ {
+ get
+ {
+ int index = base.SelectedIndex;
+ if (index < 0 && Items.Count > 0) {
+ index = 0;
+ Items [0].Selected = true;
+ }
+ return index;
+ }
+ set
+ {
+ base.SelectedIndex = value;
+ }
+ }
+
+#if !NET_2_0
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Bindable (false), EditorBrowsable (EditorBrowsableState.Never)]
+ public override string ToolTip
+ {
+ // MS ignores the tooltip for this one
+ get {
+ return String.Empty;
+ }
+ set {
+ }
+ }
+#endif
+
+#if NET_2_0
+
+ [MonoTODO ("Make sure that the following attributes are correct")]
+ [DefaultValue (null)]
+ [ThemeableAttribute (false)]
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string Text {
+ get {
+ if (SelectedItem != null) return SelectedItem.Text;
+ else return null;
+ }
+ set {
+ for (int n=0; n < Items.Count; n++) {
+ if (Items[n].Text == value) {
+ SelectedIndex = n;
+ return;
+ }
+ }
+ SelectedIndex = -1;
+ }
+ }
+
+ [WebCategory ("Action")]
+ public event EventHandler TextChanged
+ {
+ add {
+ Events.AddHandler (TextChangedEvent, value);
+ }
+ remove {
+ Events.RemoveHandler (TextChangedEvent, value);
+ }
+ }
+
+ protected override void OnSelectedIndexChanged (EventArgs e)
+ {
+ base.OnSelectedIndexChanged (e);
+ OnTextChanged (e);
+ }
+
+ protected virtual void OnTextChanged (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler)(Events[TextChangedEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+ }
+#endif
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ if(Page != null)
+ {
+ Page.VerifyRenderingInServerForm(this);
+ }
+ writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);
+ base.AddAttributesToRender(writer);
+
+ if(AutoPostBack && Page != null)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Onchange, Page.ClientScript.GetPostBackClientEvent(this,""));
+ writer.AddAttribute("language", "javascript");
+ }
+ }
+
+ protected override ControlCollection CreateControlCollection()
+ {
+ return new EmptyControlCollection(this);
+ }
+
+#if !NET_2_0
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ if(Items != null)
+ {
+ bool selected = false;
+ foreach(ListItem current in Items)
+ {
+ writer.WriteBeginTag("option");
+ if(current.Selected)
+ {
+ if(selected)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Cannot_Multiselect_In_DropDownList"));
+ }
+ selected = true;
+ writer.WriteAttribute("selected", "selected", false);
+ }
+ writer.WriteAttribute("value", current.Value, true);
+ writer.Write('>');
+ HttpUtility.HtmlEncode(current.Text, writer);
+ writer.WriteEndTag("option");
+ writer.WriteLine();
+ }
+ }
+ }
+#else
+ protected internal override void VerifyMultiSelect ()
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Cannot_Multiselect_In_DropDownList"));
+ }
+#endif
+
+
+#if NET_2_0
+ bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+ {
+ return LoadPostData (postDataKey, postCollection);
+ }
+
+ protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
+#else
+ bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+#endif
+ {
+ string[] vals = postCollection.GetValues(postDataKey);
+ if(vals != null)
+ {
+ int index = Items.FindByValueInternal(vals[0]);
+ if(index != SelectedIndex)
+ {
+ SelectedIndex = index;
+ return true;
+ }
+ }
+ return false;
+ }
+
+#if NET_2_0
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ RaisePostDataChangedEvent ();
+ }
+
+ protected virtual void RaisePostDataChangedEvent ()
+ {
+ if (CausesValidation)
+ Page.Validate (ValidationGroup);
+
+ OnSelectedIndexChanged (EventArgs.Empty);
+ }
+#else
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnSelectedIndexChanged (EventArgs.Empty);
+ }
+#endif
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DynamicImageParameterMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DynamicImageParameterMode.cs
new file mode 100644
index 00000000000..92f593e6b0f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DynamicImageParameterMode.cs
@@ -0,0 +1,35 @@
+//
+// System.Web.UI.WebControls.DynamicImageParameterMode.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum DynamicImageParameterMode {
+ ImageGenerationStorage = 0,
+ QueryString = 1
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/EditCommandColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/EditCommandColumn.cs
new file mode 100644
index 00000000000..bde846f1d6a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/EditCommandColumn.cs
@@ -0,0 +1,170 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: EditCommandColumn
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class EditCommandColumn : DataGridColumn
+ {
+ public EditCommandColumn(): base()
+ {
+ }
+
+#if NET_2_0
+ [DefaultValueAttribute (ButtonColumnType.LinkButton)]
+#endif
+ public virtual ButtonColumnType ButtonType
+ {
+ get
+ {
+ object o = ViewState["ButtonType"];
+ if(o != null)
+ {
+ return (ButtonColumnType)o;
+ }
+ return ButtonColumnType.LinkButton;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(ButtonColumnType), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["ButtonType"] = value;
+ OnColumnChanged();
+ }
+ }
+
+#if NET_2_0
+ [LocalizableAttribute (true)]
+ [DefaultValueAttribute ("")]
+#endif
+ public virtual string CancelText
+ {
+ get
+ {
+ object o = ViewState["CancelText"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CancelText"] = value;
+ OnColumnChanged();
+ }
+ }
+
+#if NET_2_0
+ [DefaultValueAttribute ("")]
+ [LocalizableAttribute (true)]
+#endif
+ public virtual string EditText
+ {
+ get
+ {
+ object o = ViewState["EditText"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["EditText"] = value;
+ OnColumnChanged();
+ }
+ }
+
+#if NET_2_0
+ [DefaultValueAttribute ("")]
+ [LocalizableAttribute (true)]
+#endif
+ public virtual string UpdateText
+ {
+ get
+ {
+ object o = ViewState["UpdateText"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["UpdateText"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ base.InitializeCell(cell, columnIndex, itemType);
+
+ if (itemType == ListItemType.Header || itemType == ListItemType.Footer)
+ return;
+
+ if (itemType == ListItemType.EditItem) {
+ cell.Controls.Add (MakeButton ("Update", UpdateText));
+ cell.Controls.Add (new LiteralControl ("&nbsp;"));
+ cell.Controls.Add (MakeButton ("Cancel", CancelText));
+ } else {
+ cell.Controls.Add (MakeButton ("Edit", EditText));
+ }
+ }
+
+ Control MakeButton (string commandName, string text)
+ {
+ if (ButtonType == ButtonColumnType.LinkButton) {
+ DataGridLinkButton ret = new DataGridLinkButton ();
+ ret.CommandName = commandName;
+ ret.Text = text;
+ return ret;
+ } else {
+ Button ret = new Button ();
+ ret.CommandName = commandName;
+ ret.Text = text;
+ return ret;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FirstDayOfWeek.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FirstDayOfWeek.cs
new file mode 100755
index 00000000000..5a0ee94297e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FirstDayOfWeek.cs
@@ -0,0 +1,48 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: FirstDayOfWeek
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum FirstDayOfWeek
+ {
+ Sunday,
+ Monday,
+ Tuesday,
+ Wednesday,
+ Thursday,
+ Friday,
+ Saturday,
+ Default
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs
new file mode 100755
index 00000000000..6b0e09a6ff2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs
@@ -0,0 +1,324 @@
+//
+// System.Web.UI.WebControls.FontInfo.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Text;
+using System.Reflection;
+using System.Web;
+using System.Web.UI;
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public sealed class FontInfo
+ {
+ private Style infoOwner;
+
+ internal FontInfo(Style owner)
+ {
+ infoOwner = owner;
+ }
+
+ /// <summary>
+ /// Default constructor
+ /// <remarks>
+ /// The default constructor is made private to prevent any instances being made.
+ /// </remarks>
+ /// </summary>
+ private FontInfo()
+ {
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (false), WebCategory ("Font")]
+ [NotifyParentProperty (true)]
+ [WebSysDescription ("The 'bold' style of the font.")]
+ public bool Bold
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_BOLD))
+ return (bool)(infoOwner.ViewState["FontInfoBold"]);
+ return false;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoBold"] = value;
+ infoOwner.Set(Style.FONT_BOLD);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (false), WebCategory ("Font")]
+ [NotifyParentProperty (true)]
+ [WebSysDescription ("The 'italic' style of the font.")]
+ public bool Italic
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_ITALIC))
+ return (bool)(infoOwner.ViewState["FontInfoItalic"]);
+ return false;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoItalic"] = value;
+ infoOwner.Set(Style.FONT_ITALIC);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (false), WebCategory ("Font")]
+ [NotifyParentProperty (true)]
+ [WebSysDescription ("The 'overline' style of the font.")]
+ public bool Overline
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_OLINE))
+ return (bool)(infoOwner.ViewState["FontInfoOverline"]);
+ return false;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoOverline"] = value;
+ infoOwner.Set(Style.FONT_OLINE);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (false), WebCategory ("Font")]
+ [NotifyParentProperty (true)]
+ [WebSysDescription ("The 'strikeout' style of the font.")]
+ public bool Strikeout
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_STRIKE))
+ return (bool)(infoOwner.ViewState["FontInfoStrikeout"]);
+ return false;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoStrikeout"] = value;
+ infoOwner.Set(Style.FONT_STRIKE);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (false), WebCategory ("Font")]
+ [NotifyParentProperty (true)]
+ [WebSysDescription ("The 'underline' style of the font.")]
+ public bool Underline
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_ULINE))
+ return (bool)(infoOwner.ViewState["FontInfoUnderline"]);
+ return false;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoUnderline"] = value;
+ infoOwner.Set(Style.FONT_ULINE);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (null), WebCategory ("Font")]
+ [NotifyParentProperty (true)]
+ [WebSysDescription ("The size of the font.")]
+ public FontUnit Size
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_SIZE))
+ return (FontUnit)(infoOwner.ViewState["FontInfoSize"]);
+ return FontUnit.Empty;
+ }
+ set
+ {
+ if ((value.Type == FontSize.AsUnit) && (value.Unit.Value < 0))
+ throw new ArgumentOutOfRangeException("value");
+ infoOwner.ViewState["FontInfoSize"] = value;
+ infoOwner.Set(Style.FONT_SIZE);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Font")]
+ [NotifyParentProperty (true), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Editor ("System.Drawing.Design.FontNameEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [TypeConverter (typeof (FontConverter.FontNameConverter))]
+ [WebSysDescription ("The name of the font that this control should be rendered with.")]
+ public string Name
+ {
+ get
+ {
+ if(Names!=null && Names.Length > 0)
+ return Names[0];
+ return String.Empty;
+ }
+ set
+ {
+ if(value == null)
+ throw new ArgumentException();
+ string[] strArray = null;
+ if(value.Length > 0)
+ {
+ strArray = new string[1];
+ strArray[0] = value;
+ }
+ Names = strArray;
+ }
+ }
+
+ [WebCategory ("Font")]
+ [NotifyParentProperty (true)]
+ [Editor ("System.Windows.Forms.Design.StringArrayEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [TypeConverter (typeof (FontNamesConverter))]
+ [WebSysDescription ("Multiple fonts that can be used to render the control.")]
+ public string[] Names
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_NAMES))
+ return (string[])(infoOwner.ViewState["FontInfoNames"]);
+ return (new string[0]);
+ }
+ set
+ {
+ if(value!=null)
+ {
+ infoOwner.ViewState["FontInfoNames"] = value;
+ infoOwner.Set(Style.FONT_NAMES);
+ }
+ }
+ }
+
+ internal void Reset()
+ {
+ if(infoOwner.IsSet(Style.FONT_NAMES))
+ infoOwner.ViewState.Remove("FontInfoNames");
+ if(infoOwner.IsSet(Style.FONT_BOLD))
+ infoOwner.ViewState.Remove("FontInfoBold");
+ if(infoOwner.IsSet(Style.FONT_ITALIC))
+ infoOwner.ViewState.Remove("FontInfoItalic");
+ if(infoOwner.IsSet(Style.FONT_STRIKE))
+ infoOwner.ViewState.Remove("FontInfoStrikeout");
+ if(infoOwner.IsSet(Style.FONT_OLINE))
+ infoOwner.ViewState.Remove("FontInfoOverline");
+ if(infoOwner.IsSet(Style.FONT_ULINE))
+ infoOwner.ViewState.Remove("FontInfoUnderline");
+ if(infoOwner.IsSet(Style.FONT_SIZE) && infoOwner.Font.Size != FontUnit.Empty)
+ infoOwner.ViewState.Remove("FontInfoSize");
+ }
+
+ internal Style Owner
+ {
+ get
+ {
+ return infoOwner;
+ }
+ }
+
+ public void CopyFrom(FontInfo source)
+ {
+ if(source!=null)
+ {
+ if(source.Owner.IsSet(Style.FONT_NAMES))
+ Names = source.Names;
+ if(source.Owner.IsSet(Style.FONT_BOLD)&& source.Bold)
+ Bold = source.Bold;
+ if(source.Owner.IsSet(Style.FONT_ITALIC)&& source.Italic)
+ Italic = source.Italic;
+ if(source.Owner.IsSet(Style.FONT_STRIKE)&& source.Strikeout)
+ Strikeout = source.Strikeout;
+ if(source.Owner.IsSet(Style.FONT_OLINE)&& source.Overline)
+ Overline = source.Overline;
+ if(source.Owner.IsSet(Style.FONT_ULINE)&& source.Underline)
+ Underline = source.Underline;
+ if(source.Owner.IsSet(Style.FONT_SIZE) && source.Size != FontUnit.Empty)
+ Size = source.Size;
+ }
+ }
+
+ public void MergeWith(FontInfo with)
+ {
+ if(with!=null)
+ {
+ if(with.Owner.IsSet(Style.FONT_NAMES) && !infoOwner.IsSet(Style.FONT_NAMES))
+ Names = with.Names;
+ if(with.Owner.IsSet(Style.FONT_BOLD) && !infoOwner.IsSet(Style.FONT_BOLD))
+ Bold = with.Bold;
+ if(with.Owner.IsSet(Style.FONT_ITALIC) && !infoOwner.IsSet(Style.FONT_ITALIC))
+ Italic = with.Italic;
+ if(with.Owner.IsSet(Style.FONT_STRIKE) && !infoOwner.IsSet(Style.FONT_STRIKE))
+ Strikeout = with.Strikeout;
+ if(with.Owner.IsSet(Style.FONT_OLINE) && !infoOwner.IsSet(Style.FONT_OLINE))
+ Overline = with.Overline;
+ if(with.Owner.IsSet(Style.FONT_ULINE) && !infoOwner.IsSet(Style.FONT_ULINE))
+ Underline = with.Underline;
+ if(with.Owner.IsSet(Style.FONT_SIZE) && with.Size != FontUnit.Empty && !infoOwner.IsSet(Style.FONT_SIZE))
+ Size = with.Size;
+ }
+ }
+
+ public bool ShouldSerializeNames()
+ {
+ return (Names.Length > 0);
+ }
+
+ public override string ToString()
+ {
+ return ( (Name.Length > 0) ? (Name.ToString() + ", " + Size.ToString()) : Size.ToString() );
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FontNamesConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FontNamesConverter.cs
new file mode 100644
index 00000000000..cc7d3e56045
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FontNamesConverter.cs
@@ -0,0 +1,84 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: FontNamesConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Globalization;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class FontNamesConverter : TypeConverter
+ {
+ public FontNamesConverter(): base()
+ {
+ }
+
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ return (sourceType == typeof(string));
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ if(value is string)
+ {
+ string fontNames = (string)value;
+ if(fontNames.Length == 0)
+ {
+ return (new string[0]);
+ }
+ string[] names = fontNames.Split(new char[] { ','});
+ for(int i=0; i < names.Length; i++)
+ {
+ names[i] = names[i].Trim();
+ }
+ return names;
+ }
+ throw GetConvertFromException(value);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ if(destinationType == typeof(string))
+ {
+ if(value == null || ((string[])value) == null)
+ return String.Empty;
+ return String.Join(",", (string[])value);
+ }
+ throw GetConvertToException(value, destinationType);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FontSize.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FontSize.cs
new file mode 100755
index 00000000000..867536f6e9b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FontSize.cs
@@ -0,0 +1,51 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: FontSize
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum FontSize
+ {
+ NotSet,
+ AsUnit,
+ Smaller,
+ Larger,
+ XXSmall,
+ XSmall,
+ Small,
+ Medium,
+ Large,
+ XLarge,
+ XXLarge
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FontUnit.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FontUnit.cs
new file mode 100644
index 00000000000..21a57a1bf87
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FontUnit.cs
@@ -0,0 +1,239 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Struct: FontUnit
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [TypeConverter(typeof(FontUnitConverter))]
+#if NET_2_0
+ [Serializable]
+#endif
+ public struct FontUnit
+ {
+ public static readonly FontUnit Empty = new FontUnit();
+ public static readonly FontUnit Large = new FontUnit(FontSize.Large);
+ public static readonly FontUnit Larger = new FontUnit(FontSize.Larger);
+ public static readonly FontUnit Medium = new FontUnit(FontSize.Medium);
+ public static readonly FontUnit Small = new FontUnit(FontSize.Small);
+ public static readonly FontUnit Smaller = new FontUnit(FontSize.Smaller);
+ public static readonly FontUnit XLarge = new FontUnit(FontSize.XLarge);
+ public static readonly FontUnit XSmall = new FontUnit(FontSize.XSmall);
+ public static readonly FontUnit XXLarge = new FontUnit(FontSize.XXLarge);
+ public static readonly FontUnit XXSmall = new FontUnit(FontSize.XXSmall);
+
+ private FontSize type;
+ private Unit val;
+
+ private static Hashtable sizeTable;
+
+ static FontUnit ()
+ {
+ sizeTable = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant,
+ CaseInsensitiveComparer.DefaultInvariant);
+ sizeTable.Add ("smaller", 2);
+ sizeTable.Add ("larger", 3);
+ sizeTable.Add ("xx-small", 4);
+ sizeTable.Add ("xxsmall", 4);
+ sizeTable.Add ("x-small", 5);
+ sizeTable.Add ("xsmall", 5);
+ sizeTable.Add ("small", 6);
+ sizeTable.Add ("medium", 7);
+ sizeTable.Add ("large", 8);
+ sizeTable.Add ("xlarge", 9);
+ sizeTable.Add ("x-large", 9);
+ sizeTable.Add ("xxlarge", 10);
+ sizeTable.Add ("xx-large", 10);
+ }
+
+ public FontUnit(FontSize type)
+ {
+ if(!Enum.IsDefined(typeof(FontSize), type))
+ throw new ArgumentException();
+ this.type = type;
+ if(this.type == FontSize.AsUnit)
+ {
+ val = Unit.Point(10);
+ } else
+ {
+ val = Unit.Empty;
+ }
+ }
+
+ public FontUnit(int value)
+ {
+ type = FontSize.AsUnit;
+ val = Unit.Point(value);
+ }
+
+ public FontUnit(string value): this(value, CultureInfo.CurrentCulture)
+ {
+ }
+
+ public FontUnit(Unit value)
+ {
+ if(value.IsEmpty)
+ {
+ type = FontSize.NotSet;
+ val = Unit.Empty;
+ } else
+ {
+ type = FontSize.AsUnit;
+ val = value;
+ }
+ }
+
+ public FontUnit(string value, CultureInfo culture)
+ {
+ type = FontSize.NotSet;
+ val = Unit.Empty;
+ if(value != null && value != String.Empty)
+ {
+ string low = value.ToLower(culture);
+ int size = GetTypeFromString(low);
+ if (size != -1)
+ {
+ type = (FontSize)size;
+ } else {
+ val = new Unit(value, culture, UnitType.Point);
+ type = FontSize.AsUnit;
+ }
+ }
+ }
+
+ private static int GetTypeFromString(string strVal)
+ {
+ if (!(sizeTable.ContainsKey (strVal)))
+ return -1;
+ return (int) sizeTable [strVal];
+ }
+
+ public static FontUnit Parse(string s)
+ {
+ return Parse(s, CultureInfo.CurrentCulture);
+ }
+
+ public static FontUnit Parse(string s, CultureInfo culture)
+ {
+ return new FontUnit(s, culture);
+ }
+
+ public static FontUnit Point(int n)
+ {
+ return new FontUnit(n);
+ }
+
+ public static bool operator ==(FontUnit left, FontUnit right)
+ {
+ return (left.type == right.type && left.val == right.val);
+ }
+
+ public static bool operator !=(FontUnit left, FontUnit right)
+ {
+ return !(left == right);
+ }
+
+ public static implicit operator FontUnit(int n)
+ {
+ return FontUnit.Point(n);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if(obj!= null && obj is FontUnit)
+ {
+ FontUnit that = (FontUnit)obj;
+ return (this.type == that.type && this.val == that.val);
+ }
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return ( (type.GetHashCode() << 2) | val.GetHashCode() );
+ }
+
+ public override string ToString()
+ {
+ return ToString(CultureInfo.CurrentCulture);
+ }
+
+ public string ToString(CultureInfo culture)
+ {
+ if(IsEmpty)
+ {
+ return String.Empty;
+ }
+ //string strRepr = String.Empty;
+ switch(type)
+ {
+ case FontSize.AsUnit: return val.ToString(culture);
+ case FontSize.XXSmall: return "XX-Small";
+ case FontSize.XSmall: return "X-Small";
+ case FontSize.XLarge: return "X-Large";
+ case FontSize.XXLarge: return "XX-Large";
+ default: return PropertyConverter.EnumToString(typeof(FontSize), type);
+ }
+ }
+
+ public bool IsEmpty
+ {
+ get
+ {
+ return (type == FontSize.NotSet);
+ }
+ }
+
+ public FontSize Type
+ {
+ get
+ {
+ return type;
+ }
+ }
+
+ public Unit Unit
+ {
+ get
+ {
+ return val;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FontUnitConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FontUnitConverter.cs
new file mode 100644
index 00000000000..d5a9c875522
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FontUnitConverter.cs
@@ -0,0 +1,140 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: FontUnitConverter
+ *
+ * Author: Gaurav Vaish, Gonzalo Paniagua Javier
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>, <gonzalo@ximian.com>
+ * Implementation: yes
+ * Status: 95%
+ *
+ * (C) Gaurav Vaish (2002)
+ * (c) 2002 Ximian, Inc. (http://www.ximian.com)
+ */
+
+using System;
+using System.Globalization;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Reflection;
+using System.ComponentModel.Design.Serialization;
+
+namespace System.Web.UI.WebControls
+{
+ public class FontUnitConverter : TypeConverter
+ {
+ static StandardValuesCollection valuesCollection;
+ static string creatingValues = "creating value collection";
+
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ if(sourceType == typeof(string))
+ return true;
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+#if NET_2_0
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+ {
+ if (destinationType == typeof (string))
+ return true;
+
+ if (destinationType == typeof (InstanceDescriptor))
+ return true;
+
+ return base.CanConvertTo (context, destinationType);
+ }
+#endif
+
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ if(value == null)
+ return null;
+ if(value is string)
+ {
+ string val = ((string)value).Trim();
+ if(val.Length == 0)
+ {
+ return FontUnit.Empty;
+ }
+ return FontUnit.Parse(val, culture);
+ }
+ return base.ConvertFrom(context, culture, value);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ if(destinationType == typeof (string) && value is FontUnit)
+ {
+ FontUnit val = (FontUnit)value;
+ if(val.Type == FontSize.NotSet)
+ {
+ return String.Empty;
+ }
+ return val.ToString(culture);
+ }
+#if NET_2_0
+ if (destinationType == typeof (InstanceDescriptor) && value is FontUnit) {
+ FontUnit s = (FontUnit) value;
+ MethodInfo met = typeof(FontUnit).GetMethod ("Parse", new Type[] {typeof(string)});
+ return new InstanceDescriptor (met, new object[] {s.ToString ()});
+ }
+
+ if (destinationType == typeof (InstanceDescriptor) && value is string) {
+ MethodInfo met = typeof(FontUnit).GetMethod ("Parse", new Type[] {typeof(string)});
+ return new InstanceDescriptor (met, new object[] {value});
+ }
+#endif
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+
+ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+ {
+ if (valuesCollection != null)
+ return valuesCollection;
+
+ lock (creatingValues) {
+ if (valuesCollection != null)
+ return valuesCollection;
+
+ Array values = Enum.GetValues (typeof (FontUnit));
+ Array.Sort (values);
+ valuesCollection = new StandardValuesCollection (values);
+ }
+
+ return valuesCollection;
+ }
+
+ public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
+ {
+ return false;
+ }
+
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormParameter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormParameter.cs
new file mode 100644
index 00000000000..5602e002080
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormParameter.cs
@@ -0,0 +1,93 @@
+//
+// System.Web.UI.WebControls.FormParameter
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+
+ [DefaultPropertyAttribute ("FormField")]
+ public class FormParameter : Parameter {
+
+ public FormParameter () : base ()
+ {
+ }
+
+ protected FormParameter (FormParameter original) : base (original)
+ {
+ this.FormField = original.FormField;
+ }
+
+ public FormParameter (string name, string formField) : base (name)
+ {
+ FormField = formField;
+ }
+
+ public FormParameter (string name, TypeCode type, string formField) : base (name, type)
+ {
+ FormField = formField;
+ }
+
+ protected override Parameter Clone ()
+ {
+ return new FormParameter (this);
+ }
+
+ protected override object Evaluate (HttpContext ctx, Control control)
+ {
+ if (control == null || ctx.Request == null)
+ return null;
+
+ return ctx.Request.Form [FormField];
+ }
+
+ [DefaultValueAttribute ("")]
+ public string FormField {
+ get {
+ string s = ViewState ["FormField"] as string;
+ if (s != null)
+ return s;
+
+ return "";
+ }
+ set {
+ if (FormField != value) {
+ ViewState ["FormField"] = value;
+ OnParameterChanged ();
+ }
+ }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs
new file mode 100644
index 00000000000..39d9fd7547b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs
@@ -0,0 +1,1423 @@
+//
+// System.Web.UI.WebControls.FormView.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Web.UI;
+using System.Security.Permissions;
+using System.Text;
+using System.IO;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls
+{
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.FormViewDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+ [ControlValuePropertyAttribute ("SelectedValue")]
+ [DefaultEventAttribute ("PageIndexChanging")]
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public class FormView: CompositeDataBoundControl, IDataItemContainer
+ {
+ object dataItem;
+
+ Table table;
+ FormViewRow headerRow;
+ FormViewRow footerRow;
+ FormViewRow bottomPagerRow;
+ FormViewRow topPagerRow;
+ FormViewRow itemRow;
+
+ IOrderedDictionary currentEditRowKeys;
+ IOrderedDictionary currentEditNewValues;
+ IOrderedDictionary currentEditOldValues;
+
+ ITemplate pagerTemplate;
+ ITemplate emptyDataTemplate;
+ ITemplate headerTemplate;
+ ITemplate footerTemplate;
+ ITemplate editItemTemplate;
+ ITemplate insertItemTemplate;
+ ITemplate itemTemplate;
+
+ PropertyDescriptor[] cachedKeyProperties;
+ readonly string[] emptyKeys = new string[0];
+
+ // View state
+ PagerSettings pagerSettings;
+
+ TableItemStyle editRowStyle;
+ TableItemStyle insertRowStyle;
+ TableItemStyle emptyDataRowStyle;
+ TableItemStyle footerStyle;
+ TableItemStyle headerStyle;
+ TableItemStyle pagerStyle;
+ TableItemStyle rowStyle;
+
+ DataKey key;
+ DataKey oldEditValues;
+ int dataSourceCount;
+
+ private static readonly object PageIndexChangedEvent = new object();
+ private static readonly object PageIndexChangingEvent = new object();
+ private static readonly object ItemCommandEvent = new object();
+ private static readonly object ItemCreatedEvent = new object();
+ private static readonly object ItemDeletedEvent = new object();
+ private static readonly object ItemDeletingEvent = new object();
+ private static readonly object ItemInsertedEvent = new object();
+ private static readonly object ItemInsertingEvent = new object();
+ private static readonly object ModeChangingEvent = new object();
+ private static readonly object ModeChangedEvent = new object();
+ private static readonly object ItemUpdatedEvent = new object();
+ private static readonly object ItemUpdatingEvent = new object();
+
+ // Control state
+ int pageIndex;
+ FormViewMode currentMode = FormViewMode.ReadOnly;
+ int pageCount = -1;
+
+ public FormView ()
+ {
+ }
+
+ public event EventHandler PageIndexChanged {
+ add { Events.AddHandler (PageIndexChangedEvent, value); }
+ remove { Events.RemoveHandler (PageIndexChangedEvent, value); }
+ }
+
+ public event FormViewPageEventHandler PageIndexChanging {
+ add { Events.AddHandler (PageIndexChangingEvent, value); }
+ remove { Events.RemoveHandler (PageIndexChangingEvent, value); }
+ }
+
+ public event FormViewCommandEventHandler ItemCommand {
+ add { Events.AddHandler (ItemCommandEvent, value); }
+ remove { Events.RemoveHandler (ItemCommandEvent, value); }
+ }
+
+ public event EventHandler ItemCreated {
+ add { Events.AddHandler (ItemCreatedEvent, value); }
+ remove { Events.RemoveHandler (ItemCreatedEvent, value); }
+ }
+
+ public event FormViewDeletedEventHandler ItemDeleted {
+ add { Events.AddHandler (ItemDeletedEvent, value); }
+ remove { Events.RemoveHandler (ItemDeletedEvent, value); }
+ }
+
+ public event FormViewDeleteEventHandler ItemDeleting {
+ add { Events.AddHandler (ItemDeletingEvent, value); }
+ remove { Events.RemoveHandler (ItemDeletingEvent, value); }
+ }
+
+ public event FormViewInsertedEventHandler ItemInserted {
+ add { Events.AddHandler (ItemInsertedEvent, value); }
+ remove { Events.RemoveHandler (ItemInsertedEvent, value); }
+ }
+
+ public event FormViewInsertEventHandler ItemInserting {
+ add { Events.AddHandler (ItemInsertingEvent, value); }
+ remove { Events.RemoveHandler (ItemInsertingEvent, value); }
+ }
+
+ public event FormViewModeEventHandler ModeChanging {
+ add { Events.AddHandler (ModeChangingEvent, value); }
+ remove { Events.RemoveHandler (ModeChangingEvent, value); }
+ }
+
+ public event EventHandler ModeChanged {
+ add { Events.AddHandler (ModeChangedEvent, value); }
+ remove { Events.RemoveHandler (ModeChangedEvent, value); }
+ }
+
+ public event FormViewUpdatedEventHandler ItemUpdated {
+ add { Events.AddHandler (ItemUpdatedEvent, value); }
+ remove { Events.RemoveHandler (ItemUpdatedEvent, value); }
+ }
+
+ public event FormViewUpdateEventHandler ItemUpdating {
+ add { Events.AddHandler (ItemUpdatingEvent, value); }
+ remove { Events.RemoveHandler (ItemUpdatingEvent, value); }
+ }
+
+ protected virtual void OnPageIndexChanged (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) Events [PageIndexChangedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnPageIndexChanging (FormViewPageEventArgs e)
+ {
+ if (Events != null) {
+ FormViewPageEventHandler eh = (FormViewPageEventHandler) Events [PageIndexChangingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnItemCommand (FormViewCommandEventArgs e)
+ {
+ if (Events != null) {
+ FormViewCommandEventHandler eh = (FormViewCommandEventHandler) Events [ItemCommandEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnItemCreated (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) Events [ItemCreatedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnItemDeleted (FormViewDeletedEventArgs e)
+ {
+ if (Events != null) {
+ FormViewDeletedEventHandler eh = (FormViewDeletedEventHandler) Events [ItemDeletedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnItemInserted (FormViewInsertedEventArgs e)
+ {
+ if (Events != null) {
+ FormViewInsertedEventHandler eh = (FormViewInsertedEventHandler) Events [ItemInsertedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnItemInserting (FormViewInsertEventArgs e)
+ {
+ if (Events != null) {
+ FormViewInsertEventHandler eh = (FormViewInsertEventHandler) Events [ItemInsertingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnItemDeleting (FormViewDeleteEventArgs e)
+ {
+ if (Events != null) {
+ FormViewDeleteEventHandler eh = (FormViewDeleteEventHandler) Events [ItemDeletingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnModeChanged (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) Events [ModeChangedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnModeChanging (FormViewModeEventArgs e)
+ {
+ if (Events != null) {
+ FormViewModeEventHandler eh = (FormViewModeEventHandler) Events [ModeChangingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnItemUpdated (FormViewUpdatedEventArgs e)
+ {
+ if (Events != null) {
+ FormViewUpdatedEventHandler eh = (FormViewUpdatedEventHandler) Events [ItemUpdatedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnItemUpdating (FormViewUpdateEventArgs e)
+ {
+ if (Events != null) {
+ FormViewUpdateEventHandler eh = (FormViewUpdateEventHandler) Events [ItemUpdatingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+
+ [WebCategoryAttribute ("Paging")]
+ [DefaultValueAttribute (false)]
+ public bool AllowPaging {
+ get {
+ object ob = ViewState ["AllowPaging"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["AllowPaging"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [UrlPropertyAttribute]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("")]
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public virtual string BackImageUrl {
+ get {
+ object ob = ViewState ["BackImageUrl"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["BackImageUrl"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public virtual FormViewRow BottomPagerRow {
+ get {
+ EnsureDataBound ();
+ return bottomPagerRow;
+ }
+ }
+
+ [WebCategoryAttribute ("Accessibility")]
+ [DefaultValueAttribute ("")]
+ [LocalizableAttribute (true)]
+ public string Caption {
+ get {
+ object ob = ViewState ["Caption"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["Caption"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Accessibility")]
+ [DefaultValueAttribute (TableCaptionAlign.NotSet)]
+ public virtual TableCaptionAlign CaptionAlign
+ {
+ get {
+ object o = ViewState ["CaptionAlign"];
+ if(o != null) return (TableCaptionAlign) o;
+ return TableCaptionAlign.NotSet;
+ }
+ set {
+ ViewState ["CaptionAlign"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Layout")]
+ [DefaultValueAttribute (-1)]
+ public virtual int CellPadding
+ {
+ get {
+ object o = ViewState ["CellPadding"];
+ if (o != null) return (int) o;
+ return -1;
+ }
+ set {
+ ViewState ["CellPadding"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Layout")]
+ [DefaultValueAttribute (0)]
+ public virtual int CellSpacing
+ {
+ get {
+ object o = ViewState ["CellSpacing"];
+ if (o != null) return (int) o;
+ return 0;
+ }
+ set {
+ ViewState ["CellSpacing"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public FormViewMode CurrentMode {
+ get {
+ return currentMode;
+ }
+ }
+
+ [DefaultValueAttribute (FormViewMode.ReadOnly)]
+ [WebCategoryAttribute ("Behavior")]
+ public virtual FormViewMode DefaultMode {
+ get {
+ object o = ViewState ["DefaultMode"];
+ if (o != null) return (FormViewMode) o;
+ return FormViewMode.ReadOnly;
+ }
+ set {
+ ViewState ["DefaultMode"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [DefaultValueAttribute (null)]
+ [WebCategoryAttribute ("Data")]
+ [TypeConverter (typeof(StringArrayConverter))]
+ [EditorAttribute ("System.Web.UI.Design.WebControls.DataFieldEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public virtual string[] DataKeyNames
+ {
+ get {
+ object o = ViewState ["DataKeyNames"];
+ if (o != null) return (string[]) o;
+ return emptyKeys;
+ }
+ set {
+ ViewState ["DataKeyNames"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public virtual DataKey DataKey {
+ get {
+ EnsureDataBound ();
+ return key;
+ }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(FormView), BindingDirection.TwoWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate EditItemTemplate {
+ get { return editItemTemplate; }
+ set { editItemTemplate = value; RequireBinding (); }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [DefaultValueAttribute (null)]
+ public virtual TableItemStyle EditRowStyle {
+ get {
+ if (editRowStyle == null) {
+ editRowStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ editRowStyle.TrackViewState();
+ }
+ return editRowStyle;
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [DefaultValueAttribute (null)]
+ public virtual TableItemStyle EmptyDataRowStyle {
+ get {
+ if (emptyDataRowStyle == null) {
+ emptyDataRowStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ emptyDataRowStyle.TrackViewState();
+ }
+ return emptyDataRowStyle;
+ }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(FormView), BindingDirection.OneWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate EmptyDataTemplate {
+ get { return emptyDataTemplate; }
+ set { emptyDataTemplate = value; RequireBinding (); }
+ }
+
+ [LocalizableAttribute (true)]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("")]
+ public virtual string EmptyDataText {
+ get {
+ object ob = ViewState ["EmptyDataText"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["EmptyDataText"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public virtual FormViewRow FooterRow {
+ get {
+ EnsureChildControls ();
+ return footerRow;
+ }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(FormView), BindingDirection.OneWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate FooterTemplate {
+ get { return footerTemplate; }
+ set { footerTemplate = value; RequireBinding (); }
+ }
+
+ [LocalizableAttribute (true)]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("")]
+ public string FooterText {
+ get {
+ object ob = ViewState ["FooterText"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["FooterText"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle FooterStyle {
+ get {
+ if (footerStyle == null) {
+ footerStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ footerStyle.TrackViewState();
+ }
+ return footerStyle;
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute (GridLines.None)]
+ public virtual GridLines GridLines {
+ get {
+ object ob = ViewState ["GridLines"];
+ if (ob != null) return (GridLines) ob;
+ return GridLines.None;
+ }
+ set {
+ ViewState ["GridLines"] = value;
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public virtual FormViewRow HeaderRow {
+ get {
+ EnsureChildControls ();
+ return headerRow;
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle HeaderStyle {
+ get {
+ if (headerStyle == null) {
+ headerStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ headerStyle.TrackViewState();
+ }
+ return headerStyle;
+ }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(FormView), BindingDirection.OneWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate HeaderTemplate {
+ get { return headerTemplate; }
+ set { headerTemplate = value; RequireBinding (); }
+ }
+
+ [LocalizableAttribute (true)]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("")]
+ public string HeaderText {
+ get {
+ object ob = ViewState ["HeaderText"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["HeaderText"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [DefaultValueAttribute (HorizontalAlign.NotSet)]
+ public virtual HorizontalAlign HorizontalAlign {
+ get {
+ object ob = ViewState ["HorizontalAlign"];
+ if (ob != null) return (HorizontalAlign) ob;
+ return HorizontalAlign.NotSet;
+ }
+ set {
+ ViewState ["HorizontalAlign"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(FormView), BindingDirection.TwoWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate InsertItemTemplate {
+ get { return insertItemTemplate; }
+ set { insertItemTemplate = value; RequireBinding (); }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [DefaultValueAttribute (null)]
+ public virtual TableItemStyle InsertRowStyle {
+ get {
+ if (insertRowStyle == null) {
+ insertRowStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ insertRowStyle.TrackViewState();
+ }
+ return insertRowStyle;
+ }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(FormView), BindingDirection.TwoWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate ItemTemplate {
+ get { return itemTemplate; }
+ set { itemTemplate = value; RequireBinding (); }
+ }
+
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public int PageCount {
+ get {
+ if (pageCount != -1) return pageCount;
+ EnsureDataBound ();
+ return pageCount;
+ }
+ }
+
+ [WebCategoryAttribute ("Paging")]
+ [BindableAttribute (true, BindingDirection.OneWay)]
+ [DefaultValueAttribute (0)]
+ public int PageIndex {
+ get {
+ return pageIndex;
+ }
+ set {
+ pageIndex = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Paging")]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Content)]
+ [NotifyParentPropertyAttribute (true)]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ public PagerSettings PagerSettings {
+ get {
+ if (pagerSettings == null) {
+ pagerSettings = new PagerSettings (this);
+ if (IsTrackingViewState)
+ ((IStateManager)pagerSettings).TrackViewState ();
+ }
+ return pagerSettings;
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle PagerStyle {
+ get {
+ if (pagerStyle == null) {
+ pagerStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ pagerStyle.TrackViewState();
+ }
+ return pagerStyle;
+ }
+ }
+
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(FormView), BindingDirection.OneWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate PagerTemplate {
+ get { return pagerTemplate; }
+ set { pagerTemplate = value; RequireBinding (); }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public FormViewRow Row {
+ get {
+ EnsureDataBound ();
+ return itemRow;
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [DefaultValue (null)]
+ public virtual TableItemStyle RowStyle {
+ get {
+ if (rowStyle == null) {
+ rowStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ rowStyle.TrackViewState();
+ }
+ return rowStyle;
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public virtual object SelectedValue {
+ get { return DataKey.Value; }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public virtual FormViewRow TopPagerRow {
+ get {
+ EnsureDataBound ();
+ return topPagerRow;
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public object DataItem {
+ get {
+ EnsureDataBound ();
+ return dataItem;
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public int DataItemCount {
+ get { return PageCount; }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public int DataItemIndex {
+ get { return PageIndex; }
+ }
+
+ public virtual bool IsBindableType (Type type)
+ {
+ return type.IsPrimitive || type == typeof(string) || type == typeof(DateTime) || type == typeof(Guid);
+ }
+
+ protected override DataSourceSelectArguments CreateDataSourceSelectArguments ()
+ {
+ return base.CreateDataSourceSelectArguments ();
+ }
+
+ protected virtual FormViewRow CreateRow (int rowIndex, DataControlRowType rowType, DataControlRowState rowState)
+ {
+ FormViewRow row = new FormViewRow (rowIndex, rowType, rowState);
+ OnItemCreated (EventArgs.Empty);
+ return row;
+ }
+
+ void RequireBinding ()
+ {
+ if (Initialized) {
+ RequiresDataBinding = true;
+ pageCount = -1;
+ }
+ }
+
+ protected virtual Table CreateTable ()
+ {
+ Table table = new Table ();
+ table.Caption = Caption;
+ table.CaptionAlign = CaptionAlign;
+ table.CellPadding = CellPadding;
+ table.CellSpacing = CellSpacing;
+ table.HorizontalAlign = HorizontalAlign;
+ table.BackImageUrl = BackImageUrl;
+ return table;
+ }
+
+ protected override int CreateChildControls (IEnumerable data, bool dataBinding)
+ {
+ PagedDataSource dataSource;
+
+ if (dataBinding) {
+ DataSourceView view = GetData ();
+ dataSource = new PagedDataSource ();
+ dataSource.DataSource = data;
+
+ if (AllowPaging) {
+ dataSource.AllowPaging = true;
+ dataSource.PageSize = 1;
+ dataSource.CurrentPageIndex = PageIndex;
+ if (view.CanPage) {
+ dataSource.AllowServerPaging = true;
+ if (view.CanRetrieveTotalRowCount)
+ dataSource.VirtualCount = SelectArguments.TotalRowCount;
+ else {
+ dataSource.DataSourceView = view;
+ dataSource.DataSourceSelectArguments = SelectArguments;
+ dataSource.SetItemCountFromPageIndex (PageIndex + PagerSettings.PageButtonCount);
+ }
+ }
+ }
+
+ pageCount = dataSource.PageCount;
+ }
+ else
+ {
+ dataSource = new PagedDataSource ();
+ dataSource.DataSource = data;
+ if (AllowPaging) {
+ dataSource.AllowPaging = true;
+ dataSource.PageSize = 1;
+ dataSource.CurrentPageIndex = PageIndex;
+ }
+ }
+
+ bool showPager = AllowPaging && (PageCount > 1);
+ dataSourceCount = dataSource.Count;
+
+ Controls.Clear ();
+ table = CreateTable ();
+ Controls.Add (table);
+
+ if (!Page.IsPostBack)
+ currentMode = DefaultMode;
+
+ // Gets the current data item
+
+ IEnumerator e = dataSource.GetEnumerator ();
+ if (e.MoveNext ())
+ dataItem = e.Current;
+ else
+ dataItem = null;
+
+ // Main table creation
+
+ if (HeaderText.Length != 0 || headerTemplate != null) {
+ headerRow = CreateRow (-1, DataControlRowType.Header, DataControlRowState.Normal);
+ InitializeRow (headerRow);
+ table.Rows.Add (headerRow);
+ }
+
+ if (showPager && PagerSettings.Position == PagerPosition.Top || PagerSettings.Position == PagerPosition.TopAndBottom) {
+ topPagerRow = CreateRow (-1, DataControlRowType.Pager, DataControlRowState.Normal);
+ InitializePager (topPagerRow, dataSource);
+ table.Rows.Add (topPagerRow);
+ }
+
+ if (dataSourceCount > 0) {
+ DataControlRowState rstate = GetRowState ();
+ itemRow = CreateRow (0, DataControlRowType.DataRow, rstate);
+ InitializeRow (itemRow);
+ table.Rows.Add (itemRow);
+
+ if (!dataBinding) {
+ if (CurrentMode == FormViewMode.Edit)
+ oldEditValues = new DataKey (new OrderedDictionary ());
+ key = new DataKey (new OrderedDictionary (), DataKeyNames);
+ }
+ } else {
+ itemRow = CreateRow (-1, DataControlRowType.EmptyDataRow, DataControlRowState.Normal);
+ table.Rows.Add (itemRow);
+ InitializeRow (itemRow);
+ }
+
+ if (showPager && PagerSettings.Position == PagerPosition.Bottom || PagerSettings.Position == PagerPosition.TopAndBottom) {
+ bottomPagerRow = CreateRow (-1, DataControlRowType.Pager, DataControlRowState.Normal);
+ InitializePager (bottomPagerRow, dataSource);
+ table.Rows.Add (bottomPagerRow);
+ }
+
+ if (FooterText.Length != 0 || footerTemplate != null) {
+ footerRow = CreateRow (-1, DataControlRowType.Footer, DataControlRowState.Normal);
+ InitializeRow (footerRow);
+ table.Rows.Add (footerRow);
+ }
+
+ return dataSource.DataSourceCount;
+ }
+
+ DataControlRowState GetRowState ()
+ {
+ DataControlRowState rstate = DataControlRowState.Normal;
+ if (CurrentMode == FormViewMode.Edit) rstate |= DataControlRowState.Edit;
+ else if (CurrentMode == FormViewMode.Insert) rstate |= DataControlRowState.Insert;
+ return rstate;
+ }
+
+ protected virtual void InitializePager (FormViewRow row, PagedDataSource dataSource)
+ {
+ TableCell cell = new TableCell ();
+
+ if (pagerTemplate != null)
+ pagerTemplate.InstantiateIn (cell);
+ else
+ cell.Controls.Add (PagerSettings.CreatePagerControl (dataSource.CurrentPageIndex, dataSource.PageCount));
+
+ row.Cells.Add (cell);
+ }
+
+ protected virtual void InitializeRow (FormViewRow row)
+ {
+ TableCell cell = new TableCell ();
+
+ if (row.RowType == DataControlRowType.DataRow)
+ {
+ if ((row.RowState & DataControlRowState.Edit) != 0) {
+ if (editItemTemplate != null)
+ editItemTemplate.InstantiateIn (cell);
+ } else if ((row.RowState & DataControlRowState.Insert) != 0) {
+ if (insertItemTemplate != null)
+ insertItemTemplate.InstantiateIn (cell);
+ } else if (itemTemplate != null)
+ itemTemplate.InstantiateIn (cell);
+ }
+ else if (row.RowType == DataControlRowType.EmptyDataRow)
+ {
+ if (emptyDataTemplate != null)
+ emptyDataTemplate.InstantiateIn (cell);
+ else
+ cell.Text = EmptyDataText;
+ }
+ else if (row.RowType == DataControlRowType.Footer)
+ {
+ if (footerTemplate != null)
+ footerTemplate.InstantiateIn (cell);
+ else
+ cell.Text = FooterText;
+ }
+ else if (row.RowType == DataControlRowType.Header)
+ {
+ if (headerTemplate != null)
+ headerTemplate.InstantiateIn (cell);
+ else
+ cell.Text = HeaderText;
+ }
+ row.Cells.Add (cell);
+ }
+
+ IOrderedDictionary CreateRowDataKey (object dataItem)
+ {
+ if (cachedKeyProperties == null) {
+ PropertyDescriptorCollection props = TypeDescriptor.GetProperties (dataItem);
+ cachedKeyProperties = new PropertyDescriptor [DataKeyNames.Length];
+ for (int n=0; n<DataKeyNames.Length; n++) {
+ PropertyDescriptor p = props [DataKeyNames[n]];
+ if (p == null)
+ new InvalidOperationException ("Property '" + DataKeyNames[n] + "' not found in object of type " + dataItem.GetType());
+ cachedKeyProperties [n] = p;
+ }
+ }
+
+ OrderedDictionary dic = new OrderedDictionary ();
+ foreach (PropertyDescriptor p in cachedKeyProperties)
+ dic [p.Name] = p.GetValue (dataItem);
+ return dic;
+ }
+
+ IOrderedDictionary GetRowValues (bool includePrimaryKey)
+ {
+ OrderedDictionary dic = new OrderedDictionary ();
+ ExtractRowValues (dic, includePrimaryKey);
+ return dic;
+ }
+
+ protected virtual void ExtractRowValues (IOrderedDictionary fieldValues, bool includeKeys)
+ {
+ DataControlRowState rowState = Row.RowState;
+ IBindableTemplate bt;
+
+ if ((rowState & DataControlRowState.Insert) != 0)
+ bt = insertItemTemplate as IBindableTemplate;
+ else if ((rowState & DataControlRowState.Edit) != 0)
+ bt = editItemTemplate as IBindableTemplate;
+ else
+ return;
+
+ if (bt != null) {
+ IOrderedDictionary values = bt.ExtractValues (Row.Cells [0]);
+ foreach (DictionaryEntry e in values) {
+ if (includeKeys || Array.IndexOf (DataKeyNames, e.Key) == -1)
+ fieldValues [e.Key] = e.Value;
+ }
+ }
+ }
+
+ protected override HtmlTextWriterTag TagKey {
+ get {
+ return HtmlTextWriterTag.Table;
+ }
+ }
+
+ public sealed override void DataBind ()
+ {
+ DataSourceView view = GetData ();
+ if (AllowPaging && view.CanPage) {
+ SelectArguments.StartRowIndex = PageIndex;
+ SelectArguments.MaximumRows = 1;
+ if (view.CanRetrieveTotalRowCount)
+ SelectArguments.RetrieveTotalRowCount = true;
+ }
+
+ cachedKeyProperties = null;
+ base.DataBind ();
+
+ if (dataSourceCount > 0) {
+ if (CurrentMode == FormViewMode.Edit)
+ oldEditValues = new DataKey (GetRowValues (true));
+ key = new DataKey (CreateRowDataKey (dataItem), DataKeyNames);
+ }
+ }
+
+ protected override void PerformDataBinding (IEnumerable data)
+ {
+ base.PerformDataBinding (data);
+ }
+
+ protected override void OnInit (EventArgs e)
+ {
+ Page.RegisterRequiresControlState (this);
+ base.OnInit (e);
+ }
+
+ protected override void OnDataSourceViewChanged (object sender, EventArgs e)
+ {
+ base.OnDataSourceViewChanged (sender, e);
+ RequireBinding ();
+ }
+
+ protected override bool OnBubbleEvent (object source, EventArgs e)
+ {
+ FormViewCommandEventArgs args = e as FormViewCommandEventArgs;
+ if (args != null) {
+ OnItemCommand (args);
+ ProcessEvent (args.CommandName, args.CommandArgument as string);
+ }
+ return base.OnBubbleEvent (source, e);
+ }
+
+ // This is prolly obsolete
+ protected virtual void RaisePostBackEvent (string eventArgument)
+ {
+ int i = eventArgument.IndexOf ('$');
+ if (i != -1)
+ ProcessEvent (eventArgument.Substring (0, i), eventArgument.Substring (i + 1));
+ else
+ ProcessEvent (eventArgument, null);
+ }
+
+ void ProcessEvent (string eventName, string param)
+ {
+ switch (eventName)
+ {
+ case "Page":
+ int newIndex = -1;
+ switch (param) {
+ case "First":
+ newIndex = 0;
+ break;
+ case "Last":
+ newIndex = PageCount - 1;
+ break;
+ case "Next":
+ if (PageIndex < PageCount - 1) newIndex = PageIndex + 1;
+ break;
+ case "Prev":
+ if (PageIndex > 0) newIndex = PageIndex - 1;
+ break;
+ default:
+ newIndex = int.Parse (param) - 1;
+ break;
+ }
+ ShowPage (newIndex);
+ break;
+
+ case "First":
+ ShowPage (0);
+ break;
+
+ case "Last":
+ ShowPage (PageCount - 1);
+ break;
+
+ case "Next":
+ if (PageIndex < PageCount - 1)
+ ShowPage (PageIndex + 1);
+ break;
+
+ case "Prev":
+ if (PageIndex > 0)
+ ShowPage (PageIndex - 1);
+ break;
+
+ case "Edit":
+ ChangeMode (FormViewMode.Edit);
+ break;
+
+ case "New":
+ ChangeMode (FormViewMode.Insert);
+ break;
+
+ case "Update":
+ UpdateItem (param, true);
+ break;
+
+ case "Cancel":
+ CancelEdit ();
+ break;
+
+ case "Delete":
+ DeleteItem ();
+ break;
+
+ case "Insert":
+ InsertItem (true);
+ break;
+ }
+ }
+
+ void ShowPage (int newIndex)
+ {
+ FormViewPageEventArgs args = new FormViewPageEventArgs (newIndex);
+ OnPageIndexChanging (args);
+ if (!args.Cancel) {
+ EndRowEdit ();
+ PageIndex = args.NewPageIndex;
+ OnPageIndexChanged (EventArgs.Empty);
+ }
+ }
+
+ public void ChangeMode (FormViewMode newMode)
+ {
+ FormViewModeEventArgs args = new FormViewModeEventArgs (newMode, false);
+ OnModeChanging (args);
+ if (!args.Cancel) {
+ currentMode = args.NewMode;
+ OnModeChanged (EventArgs.Empty);
+ RequireBinding ();
+ }
+ }
+
+ void CancelEdit ()
+ {
+ FormViewModeEventArgs args = new FormViewModeEventArgs (FormViewMode.ReadOnly, true);
+ OnModeChanging (args);
+ if (!args.Cancel) {
+ EndRowEdit ();
+ }
+ }
+
+ public virtual void UpdateItem (bool causesValidation)
+ {
+ UpdateItem (null, causesValidation);
+ }
+
+ void UpdateItem (string param, bool causesValidation)
+ {
+ if (causesValidation)
+ Page.Validate ();
+
+ if (currentMode != FormViewMode.Edit) throw new NotSupportedException ();
+
+ currentEditOldValues = oldEditValues.Values;
+ currentEditRowKeys = DataKey.Values;
+ currentEditNewValues = GetRowValues (false);
+
+ FormViewUpdateEventArgs args = new FormViewUpdateEventArgs (param, currentEditRowKeys, currentEditOldValues, currentEditNewValues);
+ OnItemUpdating (args);
+ if (!args.Cancel) {
+ DataSourceView view = GetData ();
+ if (view == null) throw new HttpException ("The DataSourceView associated to data bound control was null");
+ view.Update (currentEditRowKeys, currentEditNewValues, currentEditOldValues, new DataSourceViewOperationCallback (UpdateCallback));
+ } else
+ EndRowEdit ();
+ }
+
+ bool UpdateCallback (int recordsAffected, Exception exception)
+ {
+ FormViewUpdatedEventArgs dargs = new FormViewUpdatedEventArgs (recordsAffected, exception, currentEditRowKeys, currentEditOldValues, currentEditNewValues);
+ OnItemUpdated (dargs);
+
+ if (!dargs.KeepInEditMode)
+ EndRowEdit ();
+
+ return dargs.ExceptionHandled;
+ }
+
+ public virtual void InsertItem (bool causesValidation)
+ {
+ InsertItem (null, causesValidation);
+ }
+
+ void InsertItem (string param, bool causesValidation)
+ {
+ if (causesValidation)
+ Page.Validate ();
+
+ if (currentMode != FormViewMode.Insert) throw new NotSupportedException ();
+
+ currentEditNewValues = GetRowValues (true);
+ FormViewInsertEventArgs args = new FormViewInsertEventArgs (param, currentEditNewValues);
+ OnItemInserting (args);
+ if (!args.Cancel) {
+ DataSourceView view = GetData ();
+ if (view == null) throw new HttpException ("The DataSourceView associated to data bound control was null");
+ view.Insert (currentEditNewValues, new DataSourceViewOperationCallback (InsertCallback));
+ } else
+ EndRowEdit ();
+ }
+
+ bool InsertCallback (int recordsAffected, Exception exception)
+ {
+ FormViewInsertedEventArgs dargs = new FormViewInsertedEventArgs (recordsAffected, exception, currentEditNewValues);
+ OnItemInserted (dargs);
+
+ if (!dargs.KeepInInsertMode)
+ EndRowEdit ();
+
+ return dargs.ExceptionHandled;
+ }
+
+ public void DeleteItem ()
+ {
+ currentEditRowKeys = DataKey.Values;
+ currentEditNewValues = GetRowValues (true);
+
+ FormViewDeleteEventArgs args = new FormViewDeleteEventArgs (PageIndex, currentEditRowKeys, currentEditNewValues);
+ OnItemDeleting (args);
+
+ if (!args.Cancel) {
+ if (PageIndex == PageCount - 1)
+ PageIndex --;
+
+ RequireBinding ();
+
+ DataSourceView view = GetData ();
+ if (view != null)
+ view.Delete (currentEditRowKeys, currentEditNewValues, new DataSourceViewOperationCallback (DeleteCallback));
+ else {
+ FormViewDeletedEventArgs dargs = new FormViewDeletedEventArgs (0, null, currentEditRowKeys, currentEditNewValues);
+ OnItemDeleted (dargs);
+ }
+ }
+ }
+
+ bool DeleteCallback (int recordsAffected, Exception exception)
+ {
+ FormViewDeletedEventArgs dargs = new FormViewDeletedEventArgs (recordsAffected, exception, currentEditRowKeys, currentEditNewValues);
+ OnItemDeleted (dargs);
+ return dargs.ExceptionHandled;
+ }
+
+ void EndRowEdit ()
+ {
+ ChangeMode (DefaultMode);
+ oldEditValues = new DataKey (new OrderedDictionary ());
+ currentEditRowKeys = null;
+ currentEditOldValues = null;
+ currentEditNewValues = null;
+ RequireBinding ();
+ }
+
+ protected internal override void LoadControlState (object ob)
+ {
+ if (ob == null) return;
+ object[] state = (object[]) ob;
+ base.LoadControlState (state[0]);
+ pageIndex = (int) state[1];
+ pageCount = (int) state[2];
+ currentMode = (FormViewMode) state[3];
+ }
+
+ protected internal override object SaveControlState ()
+ {
+ object bstate = base.SaveControlState ();
+ return new object[] {
+ bstate, pageIndex, pageCount, currentMode
+ };
+ }
+
+ protected override void TrackViewState()
+ {
+ base.TrackViewState();
+ if (pagerSettings != null) ((IStateManager)pagerSettings).TrackViewState();
+ if (footerStyle != null) ((IStateManager)footerStyle).TrackViewState();
+ if (headerStyle != null) ((IStateManager)headerStyle).TrackViewState();
+ if (pagerStyle != null) ((IStateManager)pagerStyle).TrackViewState();
+ if (rowStyle != null) ((IStateManager)rowStyle).TrackViewState();
+ if (editRowStyle != null) ((IStateManager)editRowStyle).TrackViewState();
+ if (insertRowStyle != null) ((IStateManager)insertRowStyle).TrackViewState();
+ if (emptyDataRowStyle != null) ((IStateManager)emptyDataRowStyle).TrackViewState();
+ if (key != null) ((IStateManager)key).TrackViewState();
+ }
+
+ protected override object SaveViewState()
+ {
+ object[] states = new object [14];
+ states[0] = base.SaveViewState();
+ states[2] = (pagerSettings == null ? null : ((IStateManager)pagerSettings).SaveViewState());
+ states[4] = (footerStyle == null ? null : ((IStateManager)footerStyle).SaveViewState());
+ states[5] = (headerStyle == null ? null : ((IStateManager)headerStyle).SaveViewState());
+ states[6] = (pagerStyle == null ? null : ((IStateManager)pagerStyle).SaveViewState());
+ states[7] = (rowStyle == null ? null : ((IStateManager)rowStyle).SaveViewState());
+ states[8] = (insertRowStyle == null ? null : ((IStateManager)insertRowStyle).SaveViewState());
+ states[9] = (editRowStyle == null ? null : ((IStateManager)editRowStyle).SaveViewState());
+ states[10] = (emptyDataRowStyle == null ? null : ((IStateManager)emptyDataRowStyle).SaveViewState());
+ states[11] = (key == null ? null : ((IStateManager)key).SaveViewState());
+ states[12] = (oldEditValues == null ? null : ((IStateManager)oldEditValues).SaveViewState());
+
+ for (int i = states.Length - 1; i >= 0; i--) {
+ if (states [i] != null)
+ return states;
+ }
+
+ return null;
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState == null) {
+ base.LoadViewState (null);
+ return;
+ }
+
+ object [] states = (object []) savedState;
+
+ base.LoadViewState (states[0]);
+ EnsureChildControls ();
+
+ if (states[2] != null) ((IStateManager)PagerSettings).LoadViewState (states[2]);
+ if (states[4] != null) ((IStateManager)FooterStyle).LoadViewState (states[4]);
+ if (states[5] != null) ((IStateManager)HeaderStyle).LoadViewState (states[5]);
+ if (states[6] != null) ((IStateManager)PagerStyle).LoadViewState (states[6]);
+ if (states[7] != null) ((IStateManager)RowStyle).LoadViewState (states[7]);
+ if (states[8] != null) ((IStateManager)InsertRowStyle).LoadViewState (states[8]);
+ if (states[9] != null) ((IStateManager)EditRowStyle).LoadViewState (states[9]);
+ if (states[10] != null) ((IStateManager)EmptyDataRowStyle).LoadViewState (states[10]);
+ if (states[11] != null && DataKey != null) ((IStateManager)DataKey).LoadViewState (states[11]);
+ if (states[12] != null && oldEditValues != null) ((IStateManager)oldEditValues).LoadViewState (states[12]);
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ switch (GridLines) {
+ case GridLines.Horizontal:
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "rows");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+ break;
+ case GridLines.Vertical:
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "cols");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+ break;
+ case GridLines.Both:
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "all");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+ break;
+ default:
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "0");
+ break;
+ }
+
+ writer.AddAttribute (HtmlTextWriterAttribute.Cellspacing, "0");
+ writer.AddStyleAttribute (HtmlTextWriterStyle.BorderCollapse, "collapse");
+ table.RenderBeginTag (writer);
+
+ foreach (FormViewRow row in table.Rows)
+ {
+ switch (row.RowType) {
+ case DataControlRowType.Header:
+ if (headerStyle != null)headerStyle.AddAttributesToRender (writer, row);
+ break;
+ case DataControlRowType.Footer:
+ if (footerStyle != null) footerStyle.AddAttributesToRender (writer, row);
+ break;
+ case DataControlRowType.Pager:
+ if (pagerStyle != null) pagerStyle.AddAttributesToRender (writer, row);
+ break;
+ case DataControlRowType.EmptyDataRow:
+ if (emptyDataRowStyle != null) emptyDataRowStyle.AddAttributesToRender (writer, row);
+ break;
+ default:
+ if (rowStyle != null) rowStyle.AddAttributesToRender (writer, row);
+ break;
+ }
+
+ if ((row.RowState & DataControlRowState.Edit) != 0 && editRowStyle != null)
+ editRowStyle.AddAttributesToRender (writer, row);
+ if ((row.RowState & DataControlRowState.Insert) != 0 && insertRowStyle != null)
+ insertRowStyle.AddAttributesToRender (writer, row);
+
+ row.RenderBeginTag (writer);
+
+ for (int n=0; n<row.Cells.Count; n++)
+ row.Cells[n].Render (writer);
+
+ row.RenderEndTag (writer);
+ }
+ table.RenderEndTag (writer);
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewCommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewCommandEventArgs.cs
new file mode 100644
index 00000000000..caf1de50ab3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewCommandEventArgs.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.UI.WebControls.FormViewCommandEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls
+{
+ public class FormViewCommandEventArgs : CommandEventArgs
+ {
+ private object source;
+
+ public FormViewCommandEventArgs (object source, CommandEventArgs arguments) : base (arguments)
+ {
+ this.source = source;
+ }
+
+ public object CommandSource {
+ get { return source; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewCommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewCommandEventHandler.cs
new file mode 100644
index 00000000000..6d1ce1bd79e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewCommandEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.FormViewCommandEventHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void FormViewCommandEventHandler (object sender, FormViewCommandEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewDeleteEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewDeleteEventArgs.cs
new file mode 100644
index 00000000000..8d444489777
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewDeleteEventArgs.cs
@@ -0,0 +1,72 @@
+//
+// System.Web.UI.WebControls.FormViewDeleteEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class FormViewDeleteEventArgs : CancelEventArgs
+ {
+ private int rowIndex;
+ private Exception e;
+ private bool exceptionHandled;
+ private IOrderedDictionary keys;
+ private IOrderedDictionary values;
+
+ public FormViewDeleteEventArgs (int index)
+ {
+ this.rowIndex = index;
+ }
+
+ internal FormViewDeleteEventArgs (int index, IOrderedDictionary keys, IOrderedDictionary values)
+ : this (index)
+ {
+ this.keys = keys;
+ this.values = values;
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ public IOrderedDictionary Keys {
+ get { return keys; }
+ }
+
+ public IOrderedDictionary Values {
+ get { return values; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewDeleteEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewDeleteEventHandler.cs
new file mode 100644
index 00000000000..d1c3efe3ca8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewDeleteEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.FormViewDeleteEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void FormViewDeleteEventHandler (object sender, FormViewDeleteEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewDeletedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewDeletedEventArgs.cs
new file mode 100644
index 00000000000..ae4f591f2d6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewDeletedEventArgs.cs
@@ -0,0 +1,81 @@
+//
+// System.Web.UI.WebControls.FormViewDeletedEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+ public class FormViewDeletedEventArgs : EventArgs
+ {
+ private int rowsAffected;
+ private Exception e;
+ private bool exceptionHandled;
+ private IOrderedDictionary keys;
+ private IOrderedDictionary values;
+
+ public FormViewDeletedEventArgs (int affectedRows, Exception e)
+ {
+ this.rowsAffected = affectedRows;
+ this.e = e;
+ }
+
+ internal FormViewDeletedEventArgs (int affectedRows, Exception e, IOrderedDictionary keys, IOrderedDictionary values)
+ : this (affectedRows, e)
+ {
+ this.keys = keys;
+ this.values = values;
+ }
+
+ public int AffectedRows {
+ get { return rowsAffected; }
+ }
+
+ public Exception Exception {
+ get { return e; }
+ }
+
+ public bool ExceptionHandled {
+ get { return exceptionHandled; }
+ set { exceptionHandled = value; }
+ }
+
+ public IOrderedDictionary Keys {
+ get { return keys; }
+ }
+
+ public IOrderedDictionary Values {
+ get { return values; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewDeletedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewDeletedEventHandler.cs
new file mode 100644
index 00000000000..74a4a2254dc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewDeletedEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.FormViewDeletedEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void FormViewDeletedEventHandler (object sender, FormViewDeletedEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewInsertEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewInsertEventArgs.cs
new file mode 100644
index 00000000000..be8596fc7ff
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewInsertEventArgs.cs
@@ -0,0 +1,64 @@
+//
+// System.Web.UI.WebControls.FormViewInsertEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class FormViewInsertEventArgs : CancelEventArgs
+ {
+ private object argument;
+ private IOrderedDictionary values;
+
+ public FormViewInsertEventArgs (object argument)
+ {
+ this.argument = argument;
+ }
+
+ internal FormViewInsertEventArgs (object argument, IOrderedDictionary values)
+ {
+ this.values = values;
+ this.argument = argument;
+ }
+
+ public object CommandArgument {
+ get { return argument; }
+ }
+
+ public IOrderedDictionary Values {
+ get { return values; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewInsertEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewInsertEventHandler.cs
new file mode 100644
index 00000000000..ec784b6e688
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewInsertEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.FormViewInsertEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void FormViewInsertEventHandler (object sender, FormViewInsertEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewInsertedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewInsertedEventArgs.cs
new file mode 100644
index 00000000000..670dc9bc697
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewInsertedEventArgs.cs
@@ -0,0 +1,81 @@
+//
+// System.Web.UI.WebControls.FormViewInsertedEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+ public class FormViewInsertedEventArgs : EventArgs
+ {
+ private int rowsAffected;
+ private Exception e;
+ private bool exceptionHandled;
+ private bool keepInsertedMode;
+ private IOrderedDictionary values;
+
+ public FormViewInsertedEventArgs (int affectedRows, Exception e)
+ {
+ this.rowsAffected = affectedRows;
+ this.e = e;
+ }
+
+ internal FormViewInsertedEventArgs (int affectedRows, Exception e, IOrderedDictionary values)
+ : this (affectedRows, e)
+ {
+ this.values = values;
+ }
+
+ public int AffectedRows {
+ get { return rowsAffected; }
+ }
+
+ public Exception Exception {
+ get { return e; }
+ }
+
+ public bool ExceptionHandled {
+ get { return exceptionHandled; }
+ set { exceptionHandled = value; }
+ }
+
+ public bool KeepInInsertMode {
+ get { return keepInsertedMode; }
+ set { keepInsertedMode = value; }
+ }
+
+ public IOrderedDictionary Values {
+ get { return values; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewInsertedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewInsertedEventHandler.cs
new file mode 100644
index 00000000000..1e7d6eb6187
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewInsertedEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.FormViewInsertedEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void FormViewInsertedEventHandler (object sender, FormViewInsertedEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewMode.cs
new file mode 100644
index 00000000000..3fbd6f984d2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewMode.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.FormViewMode.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum FormViewMode {
+ ReadOnly = 0,
+ Edit = 1,
+ Insert = 2
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewModeEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewModeEventArgs.cs
new file mode 100644
index 00000000000..296675c97a1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewModeEventArgs.cs
@@ -0,0 +1,59 @@
+//
+// System.Web.UI.WebControls.FormViewModeEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class FormViewModeEventArgs : CancelEventArgs
+ {
+ private FormViewMode mode;
+ private bool cancelEdit;
+
+ public FormViewModeEventArgs (FormViewMode mode, bool cancelingEdit)
+ {
+ this.mode = mode;
+ this.cancelEdit = cancelingEdit;
+ }
+
+ public bool CancelingEdit {
+ get { return cancelEdit; }
+ }
+
+ public FormViewMode NewMode {
+ get { return mode; }
+ set { mode = value;}
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewModeEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewModeEventHandler.cs
new file mode 100644
index 00000000000..fed713b8899
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewModeEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebContrls.FormViewModeEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void FormViewModeEventHandler (object sender, FormViewModeEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewPageEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewPageEventArgs.cs
new file mode 100644
index 00000000000..f8e113d2441
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewPageEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.UI.WebControls.FormViewPageEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class FormViewPageEventArgs : CancelEventArgs
+ {
+ private int pageIndex;
+
+ public FormViewPageEventArgs (int pageIndex )
+ {
+ this.pageIndex = pageIndex;
+ }
+
+ public int NewPageIndex {
+ get { return pageIndex; }
+ set { pageIndex = value;}
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewPageEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewPageEventHandler.cs
new file mode 100644
index 00000000000..230b8c2909e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewPageEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.FormViewPageEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void FormViewPageEventHandler (object sender, FormViewPageEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewRow.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewRow.cs
new file mode 100644
index 00000000000..3d941f2f3e7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewRow.cs
@@ -0,0 +1,82 @@
+//
+// System.Web.UI.WebControls.FormViewRow.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Web.UI;
+using System.Security.Permissions;
+
+namespace System.Web.UI.WebControls
+{
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public class FormViewRow: TableRow
+ {
+ int rowIndex;
+ DataControlRowState rowState;
+ DataControlRowType rowType;
+
+ public FormViewRow (int rowIndex, DataControlRowType rowType, DataControlRowState rowState)
+ {
+ this.rowIndex = rowIndex;
+ this.rowType = rowType;
+ this.rowState = rowState;
+ }
+
+ public virtual int ItemIndex {
+ get { return rowIndex; }
+ }
+
+ public virtual DataControlRowState RowState {
+ get { return rowState; }
+ }
+
+ public virtual DataControlRowType RowType {
+ get { return rowType; }
+ }
+
+ protected override bool OnBubbleEvent (object source, EventArgs e)
+ {
+ if (base.OnBubbleEvent (source, e)) return true;
+
+ if (e is CommandEventArgs) {
+ FormViewCommandEventArgs args = new FormViewCommandEventArgs (source, (CommandEventArgs)e);
+ RaiseBubbleEvent (source, args);
+ return true;
+ }
+ return false;
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewUpdateEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewUpdateEventArgs.cs
new file mode 100644
index 00000000000..22d6e1a62f9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewUpdateEventArgs.cs
@@ -0,0 +1,76 @@
+//
+// System.Web.UI.WebControls.FormViewUpdateEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class FormViewUpdateEventArgs : CancelEventArgs
+ {
+ private object argument;
+ private IOrderedDictionary keys;
+ private IOrderedDictionary oldValues;
+ private IOrderedDictionary newValues;
+
+ public FormViewUpdateEventArgs (object argument)
+ {
+ this.argument = argument;
+ }
+
+ internal FormViewUpdateEventArgs (object argument, IOrderedDictionary keys, IOrderedDictionary oldValues, IOrderedDictionary newValues)
+ : this (argument)
+ {
+ this.keys = keys;
+ this.oldValues = oldValues;
+ this.newValues = newValues;
+ }
+
+ public object CommandArgument {
+ get { return argument; }
+ }
+
+ public IOrderedDictionary Keys {
+ get { return keys; }
+ }
+
+ public IOrderedDictionary NewValues {
+ get { return newValues; }
+ }
+
+ public IOrderedDictionary OldValues {
+ get { return oldValues; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewUpdateEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewUpdateEventHandler.cs
new file mode 100644
index 00000000000..bc57e537fe8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewUpdateEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebContrls.FormViewUpdateEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void FormViewUpdateEventHandler (object sender, FormViewUpdateEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewUpdatedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewUpdatedEventArgs.cs
new file mode 100644
index 00000000000..543d10d24e8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewUpdatedEventArgs.cs
@@ -0,0 +1,95 @@
+//
+// System.Web.UI.WebControls.FormViewUpdatedEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+ public class FormViewUpdatedEventArgs : EventArgs
+ {
+ private int rowsAffected;
+ private Exception e;
+ private bool exceptionHandled;
+ private bool keepEditMode;
+ private IOrderedDictionary keys;
+ private IOrderedDictionary oldValues;
+ private IOrderedDictionary newValues;
+
+ public FormViewUpdatedEventArgs (int affectedRows, Exception e)
+ {
+ this.rowsAffected = affectedRows;
+ this.e = e;
+ this.exceptionHandled = false;
+ this.keepEditMode = false;
+ }
+
+ internal FormViewUpdatedEventArgs (int affectedRows, Exception e, IOrderedDictionary keys, IOrderedDictionary oldValues, IOrderedDictionary newValues)
+ : this (affectedRows, e)
+ {
+ this.keys = keys;
+ this.oldValues = oldValues;
+ this.newValues = newValues;
+ }
+
+ public int AffectedRows {
+ get { return rowsAffected; }
+ }
+
+ public Exception Exception {
+ get { return e; }
+ }
+
+ public bool ExceptionHandled {
+ get { return exceptionHandled; }
+ set { exceptionHandled = value; }
+ }
+
+ public bool KeepInEditMode {
+ get { return keepEditMode; }
+ set { keepEditMode = value; }
+ }
+
+ public IOrderedDictionary Keys {
+ get { return keys; }
+ }
+
+ public IOrderedDictionary NewValues {
+ get { return newValues; }
+ }
+
+ public IOrderedDictionary OldValues {
+ get { return oldValues; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormViewUpdatedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewUpdatedEventHandler.cs
new file mode 100644
index 00000000000..772097da3c2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormViewUpdatedEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.FormViewUpdatedEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void FormViewUpdatedEventHandler (object sender, FormViewUpdatedEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridLines.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridLines.cs
new file mode 100755
index 00000000000..f9ae57cdc5e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridLines.cs
@@ -0,0 +1,44 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: GridLines
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum GridLines
+ {
+ None,
+ Horizontal,
+ Vertical,
+ Both
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
new file mode 100644
index 00000000000..431e5bdaf05
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
@@ -0,0 +1,1846 @@
+//
+// System.Web.UI.WebControls.GridView.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Web.UI;
+using System.Security.Permissions;
+using System.Text;
+using System.IO;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls
+{
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.GridViewDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+ [ControlValuePropertyAttribute ("SelectedValue")]
+ [DefaultEventAttribute ("SelectedIndexChanged")]
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public class GridView: CompositeDataBoundControl, ICallbackEventHandler, ICallbackContainer
+ {
+ Table table;
+ GridViewRowCollection rows;
+ GridViewRow headerRow;
+ GridViewRow footerRow;
+ GridViewRow bottomPagerRow;
+ GridViewRow topPagerRow;
+
+ IOrderedDictionary currentEditRowKeys;
+ IOrderedDictionary currentEditNewValues;
+ IOrderedDictionary currentEditOldValues;
+
+ ITemplate pagerTemplate;
+ ITemplate emptyDataTemplate;
+
+ PropertyDescriptor[] cachedKeyProperties;
+
+ // View state
+ DataControlFieldCollection columns;
+ PagerSettings pagerSettings;
+
+ TableItemStyle alternatingRowStyle;
+ TableItemStyle editRowStyle;
+ TableItemStyle emptyDataRowStyle;
+ TableItemStyle footerStyle;
+ TableItemStyle headerStyle;
+ TableItemStyle pagerStyle;
+ TableItemStyle rowStyle;
+ TableItemStyle selectedRowStyle;
+ DataKeyArray keys;
+ DataKey oldEditValues;
+ AutoGeneratedFieldProperties[] autoFieldProperties;
+ readonly string[] emptyKeys = new string[0];
+
+ private static readonly object PageIndexChangedEvent = new object();
+ private static readonly object PageIndexChangingEvent = new object();
+ private static readonly object RowCancelingEditEvent = new object();
+ private static readonly object RowCommandEvent = new object();
+ private static readonly object RowCreatedEvent = new object();
+ private static readonly object RowDataBoundEvent = new object();
+ private static readonly object RowDeletedEvent = new object();
+ private static readonly object RowDeletingEvent = new object();
+ private static readonly object RowEditingEvent = new object();
+ private static readonly object RowUpdatedEvent = new object();
+ private static readonly object RowUpdatingEvent = new object();
+ private static readonly object SelectedIndexChangedEvent = new object();
+ private static readonly object SelectedIndexChangingEvent = new object();
+ private static readonly object SortedEvent = new object();
+ private static readonly object SortingEvent = new object();
+
+ // Control state
+ int pageIndex;
+ int pageCount = -1;
+ int selectedIndex = -1;
+ int editIndex = -1;
+ SortDirection sortDirection = SortDirection.Ascending;
+ string sortExpression;
+
+ public GridView ()
+ {
+ }
+
+ public event EventHandler PageIndexChanged {
+ add { Events.AddHandler (PageIndexChangedEvent, value); }
+ remove { Events.RemoveHandler (PageIndexChangedEvent, value); }
+ }
+
+ public event GridViewPageEventHandler PageIndexChanging {
+ add { Events.AddHandler (PageIndexChangingEvent, value); }
+ remove { Events.RemoveHandler (PageIndexChangingEvent, value); }
+ }
+
+ public event GridViewCancelEditEventHandler RowCancelingEdit {
+ add { Events.AddHandler (RowCancelingEditEvent, value); }
+ remove { Events.RemoveHandler (RowCancelingEditEvent, value); }
+ }
+
+ public event GridViewCommandEventHandler RowCommand {
+ add { Events.AddHandler (RowCommandEvent, value); }
+ remove { Events.RemoveHandler (RowCommandEvent, value); }
+ }
+
+ public event GridViewRowEventHandler RowCreated {
+ add { Events.AddHandler (RowCreatedEvent, value); }
+ remove { Events.RemoveHandler (RowCreatedEvent, value); }
+ }
+
+ public event GridViewRowEventHandler RowDataBound {
+ add { Events.AddHandler (RowDataBoundEvent, value); }
+ remove { Events.RemoveHandler (RowDataBoundEvent, value); }
+ }
+
+ public event GridViewDeletedEventHandler RowDeleted {
+ add { Events.AddHandler (RowDeletedEvent, value); }
+ remove { Events.RemoveHandler (RowDeletedEvent, value); }
+ }
+
+ public event GridViewDeleteEventHandler RowDeleting {
+ add { Events.AddHandler (RowDeletingEvent, value); }
+ remove { Events.RemoveHandler (RowDeletingEvent, value); }
+ }
+
+ public event GridViewEditEventHandler RowEditing {
+ add { Events.AddHandler (RowEditingEvent, value); }
+ remove { Events.RemoveHandler (RowEditingEvent, value); }
+ }
+
+ public event GridViewUpdatedEventHandler RowUpdated {
+ add { Events.AddHandler (RowUpdatedEvent, value); }
+ remove { Events.RemoveHandler (RowUpdatedEvent, value); }
+ }
+
+ public event GridViewUpdateEventHandler RowUpdating {
+ add { Events.AddHandler (RowUpdatingEvent, value); }
+ remove { Events.RemoveHandler (RowUpdatingEvent, value); }
+ }
+
+ public event EventHandler SelectedIndexChanged {
+ add { Events.AddHandler (SelectedIndexChangedEvent, value); }
+ remove { Events.RemoveHandler (SelectedIndexChangedEvent, value); }
+ }
+
+ public event GridViewSelectEventHandler SelectedIndexChanging {
+ add { Events.AddHandler (SelectedIndexChangingEvent, value); }
+ remove { Events.RemoveHandler (SelectedIndexChangingEvent, value); }
+ }
+
+ public event EventHandler Sorted {
+ add { Events.AddHandler (SortedEvent, value); }
+ remove { Events.RemoveHandler (SortedEvent, value); }
+ }
+
+ public event GridViewSortEventHandler Sorting {
+ add { Events.AddHandler (SortingEvent, value); }
+ remove { Events.RemoveHandler (SortingEvent, value); }
+ }
+
+ protected virtual void OnPageIndexChanged (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) Events [PageIndexChangedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnPageIndexChanging (GridViewPageEventArgs e)
+ {
+ if (Events != null) {
+ GridViewPageEventHandler eh = (GridViewPageEventHandler) Events [PageIndexChangingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnRowCancelingEdit (GridViewCancelEditEventArgs e)
+ {
+ if (Events != null) {
+ GridViewCancelEditEventHandler eh = (GridViewCancelEditEventHandler) Events [RowCancelingEditEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnRowCommand (GridViewCommandEventArgs e)
+ {
+ if (Events != null) {
+ GridViewCommandEventHandler eh = (GridViewCommandEventHandler) Events [RowCommandEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnRowCreated (GridViewRowEventArgs e)
+ {
+ if (Events != null) {
+ GridViewRowEventHandler eh = (GridViewRowEventHandler) Events [RowCreatedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnRowDataBound (GridViewRowEventArgs e)
+ {
+ if (Events != null) {
+ GridViewRowEventHandler eh = (GridViewRowEventHandler) Events [RowDataBoundEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnRowDeleted (GridViewDeletedEventArgs e)
+ {
+ if (Events != null) {
+ GridViewDeletedEventHandler eh = (GridViewDeletedEventHandler) Events [RowDeletedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnRowDeleting (GridViewDeleteEventArgs e)
+ {
+ if (Events != null) {
+ GridViewDeleteEventHandler eh = (GridViewDeleteEventHandler) Events [RowDeletingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnRowEditing (GridViewEditEventArgs e)
+ {
+ if (Events != null) {
+ GridViewEditEventHandler eh = (GridViewEditEventHandler) Events [RowEditingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnRowUpdated (GridViewUpdatedEventArgs e)
+ {
+ if (Events != null) {
+ GridViewUpdatedEventHandler eh = (GridViewUpdatedEventHandler) Events [RowUpdatedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnRowUpdating (GridViewUpdateEventArgs e)
+ {
+ if (Events != null) {
+ GridViewUpdateEventHandler eh = (GridViewUpdateEventHandler) Events [RowUpdatingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnSelectedIndexChanged (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) Events [SelectedIndexChangedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnSelectedIndexChanging (GridViewSelectEventArgs e)
+ {
+ if (Events != null) {
+ GridViewSelectEventHandler eh = (GridViewSelectEventHandler) Events [SelectedIndexChangingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnSorted (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) Events [SortedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnSorting (GridViewSortEventArgs e)
+ {
+ if (Events != null) {
+ GridViewSortEventHandler eh = (GridViewSortEventHandler) Events [SortingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+
+ [WebCategoryAttribute ("Paging")]
+ [DefaultValueAttribute (false)]
+ public bool AllowPaging {
+ get {
+ object ob = ViewState ["AllowPaging"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["AllowPaging"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (false)]
+ public bool AllowSorting {
+ get {
+ object ob = ViewState ["AllowSorting"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["AllowSorting"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle AlternatingRowStyle {
+ get {
+ if (alternatingRowStyle == null) {
+ alternatingRowStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ alternatingRowStyle.TrackViewState();
+ }
+ return alternatingRowStyle;
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (false)]
+ public virtual bool AutoGenerateEditButton {
+ get {
+ object ob = ViewState ["AutoGenerateEditButton"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["AutoGenerateEditButton"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (false)]
+ public virtual bool AutoGenerateDeleteButton {
+ get {
+ object ob = ViewState ["AutoGenerateDeleteButton"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["AutoGenerateDeleteButton"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (false)]
+ public virtual bool AutoGenerateSelectButton {
+ get {
+ object ob = ViewState ["AutoGenerateSelectButton"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["AutoGenerateSelectButton"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (true)]
+ public virtual bool AutoGenerateColumns {
+ get {
+ object ob = ViewState ["AutoGenerateColumns"];
+ if (ob != null) return (bool) ob;
+ return true;
+ }
+ set {
+ ViewState ["AutoGenerateColumns"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [UrlPropertyAttribute]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("")]
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public virtual string BackImageUrl {
+ get {
+ object ob = ViewState ["BackImageUrl"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["BackImageUrl"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public virtual GridViewRow BottomPagerRow {
+ get {
+ EnsureDataBound ();
+ return bottomPagerRow;
+ }
+ }
+
+ [WebCategoryAttribute ("Accessibility")]
+ [DefaultValueAttribute ("")]
+ [LocalizableAttribute (true)]
+ public string Caption {
+ get {
+ object ob = ViewState ["Caption"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["Caption"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Accessibility")]
+ [DefaultValueAttribute (TableCaptionAlign.NotSet)]
+ public virtual TableCaptionAlign CaptionAlign
+ {
+ get {
+ object o = ViewState ["CaptionAlign"];
+ if(o != null) return (TableCaptionAlign) o;
+ return TableCaptionAlign.NotSet;
+ }
+ set {
+ ViewState ["CaptionAlign"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Layout")]
+ [DefaultValueAttribute (-1)]
+ public virtual int CellPadding
+ {
+ get {
+ object o = ViewState ["CellPadding"];
+ if (o != null) return (int) o;
+ return -1;
+ }
+ set {
+ ViewState ["CellPadding"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Layout")]
+ [DefaultValueAttribute (0)]
+ public virtual int CellSpacing
+ {
+ get {
+ object o = ViewState ["CellSpacing"];
+ if (o != null) return (int) o;
+ return 0;
+ }
+ set {
+ ViewState ["CellSpacing"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [EditorAttribute ("System.Web.UI.Design.WebControls.DataControlFieldTypeEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [MergablePropertyAttribute (false)]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [DefaultValueAttribute (null)]
+ [WebCategoryAttribute ("Misc")]
+ public virtual DataControlFieldCollection Columns {
+ get {
+ if (columns == null) {
+ columns = new DataControlFieldCollection ();
+ columns.FieldsChanged += new EventHandler (OnFieldsChanged);
+ if (IsTrackingViewState)
+ ((IStateManager)columns).TrackViewState ();
+ }
+ return columns;
+ }
+ }
+
+ [DefaultValueAttribute (null)]
+ [WebCategoryAttribute ("Data")]
+ [TypeConverter (typeof(StringArrayConverter))]
+ [EditorAttribute ("System.Web.UI.Design.WebControls.DataFieldEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public virtual string[] DataKeyNames
+ {
+ get {
+ object o = ViewState ["DataKeyNames"];
+ if (o != null) return (string[]) o;
+ return emptyKeys;
+ }
+ set {
+ ViewState ["DataKeyNames"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public virtual DataKeyArray DataKeys {
+ get {
+ EnsureDataBound ();
+ return keys;
+ }
+ }
+
+ [WebCategoryAttribute ("Misc")]
+ [DefaultValueAttribute (-1)]
+ public int EditIndex {
+ get {
+ return editIndex;
+ }
+ set {
+ editIndex = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle EditRowStyle {
+ get {
+ if (editRowStyle == null) {
+ editRowStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ editRowStyle.TrackViewState();
+ }
+ return editRowStyle;
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle EmptyDataRowStyle {
+ get {
+ if (emptyDataRowStyle == null) {
+ emptyDataRowStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ emptyDataRowStyle.TrackViewState();
+ }
+ return emptyDataRowStyle;
+ }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(GridView), BindingDirection.OneWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate EmptyDataTemplate {
+ get { return emptyDataTemplate; }
+ set { emptyDataTemplate = value; RequireBinding (); }
+ }
+
+ [LocalizableAttribute (true)]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("")]
+ public virtual string EmptyDataText {
+ get {
+ object ob = ViewState ["EmptyDataText"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["EmptyDataText"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (false)]
+ public virtual bool EnableSortingAndPagingCallbacks {
+ get {
+ object ob = ViewState ["EnableSortingAndPagingCallbacks"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["EnableSortingAndPagingCallbacks"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public virtual GridViewRow FooterRow {
+ get {
+ if (footerRow == null)
+ footerRow = CreateRow (0, 0, DataControlRowType.Footer, DataControlRowState.Normal);
+ return footerRow;
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle FooterStyle {
+ get {
+ if (footerStyle == null) {
+ footerStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ footerStyle.TrackViewState();
+ }
+ return footerStyle;
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute (GridLines.Both)]
+ public virtual GridLines GridLines {
+ get {
+ object ob = ViewState ["GridLines"];
+ if (ob != null) return (GridLines) ob;
+ return GridLines.Both;
+ }
+ set {
+ ViewState ["GridLines"] = value;
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public virtual GridViewRow HeaderRow {
+ get {
+ if (headerRow == null)
+ headerRow = CreateRow (0, 0, DataControlRowType.Header, DataControlRowState.Normal);
+ return headerRow;
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle HeaderStyle {
+ get {
+ if (headerStyle == null) {
+ headerStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ headerStyle.TrackViewState();
+ }
+ return headerStyle;
+ }
+ }
+
+ [DefaultValueAttribute (HorizontalAlign.NotSet)]
+ public virtual HorizontalAlign HorizontalAlign {
+ get {
+ object ob = ViewState ["HorizontalAlign"];
+ if (ob != null) return (HorizontalAlign) ob;
+ return HorizontalAlign.NotSet;
+ }
+ set {
+ ViewState ["HorizontalAlign"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public int PageCount {
+ get {
+ if (pageCount != -1) return pageCount;
+ EnsureDataBound ();
+ return pageCount;
+ }
+ }
+
+ [WebCategoryAttribute ("Paging")]
+ [BrowsableAttribute (true)]
+ [DefaultValueAttribute (0)]
+ public int PageIndex {
+ get {
+ return pageIndex;
+ }
+ set {
+ pageIndex = value;
+ RequireBinding ();
+ }
+ }
+
+ [DefaultValueAttribute (10)]
+ [WebCategoryAttribute ("Paging")]
+ public int PageSize {
+ get {
+ object ob = ViewState ["PageSize"];
+ if (ob != null) return (int) ob;
+ return 10;
+ }
+ set {
+ ViewState ["PageSize"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Paging")]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Content)]
+ [NotifyParentPropertyAttribute (true)]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ public PagerSettings PagerSettings {
+ get {
+ if (pagerSettings == null) {
+ pagerSettings = new PagerSettings (this);
+ if (IsTrackingViewState)
+ ((IStateManager)pagerSettings).TrackViewState ();
+ }
+ return pagerSettings;
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle PagerStyle {
+ get {
+ if (pagerStyle == null) {
+ pagerStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ pagerStyle.TrackViewState();
+ }
+ return pagerStyle;
+ }
+ }
+
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(GridView), BindingDirection.OneWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate PagerTemplate {
+ get { return pagerTemplate; }
+ set { pagerTemplate = value; RequireBinding (); }
+ }
+
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Accessibility")]
+// [TypeConverterAttribute (typeof(System.Web.UI.Design.DataColumnSelectionConverter)]
+ public virtual string RowHeaderColumn {
+ get {
+ object ob = ViewState ["RowHeaderColumn"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["RowHeaderColumn"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public virtual GridViewRowCollection Rows {
+ get {
+ EnsureDataBound ();
+ return rows;
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle RowStyle {
+ get {
+ if (rowStyle == null) {
+ rowStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ rowStyle.TrackViewState();
+ }
+ return rowStyle;
+ }
+ }
+
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public virtual DataKey SelectedDataKey {
+ get {
+ if (selectedIndex >= 0 && selectedIndex < DataKeys.Count) {
+ return DataKeys [selectedIndex];
+ } else
+ return null;
+ }
+ }
+
+ [BindableAttribute (true)]
+ [DefaultValueAttribute (-1)]
+ public int SelectedIndex {
+ get {
+ return selectedIndex;
+ }
+ set {
+ if (selectedIndex >= 0 && selectedIndex < Rows.Count) {
+ int oldIndex = selectedIndex;
+ selectedIndex = -1;
+ Rows [oldIndex].RowState = GetRowState (oldIndex);
+ }
+ selectedIndex = value;
+ if (selectedIndex >= 0 && selectedIndex < Rows.Count) {
+ Rows [selectedIndex].RowState = GetRowState (selectedIndex);
+ }
+ }
+ }
+
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public virtual GridViewRow SelectedRow {
+ get {
+ if (selectedIndex >= 0 && selectedIndex < Rows.Count) {
+ return Rows [selectedIndex];
+ } else
+ return null;
+ }
+ }
+
+ [WebCategoryAttribute ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TableItemStyle SelectedRowStyle {
+ get {
+ if (selectedRowStyle == null) {
+ selectedRowStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ selectedRowStyle.TrackViewState();
+ }
+ return selectedRowStyle;
+ }
+ }
+
+ [BrowsableAttribute (false)]
+ public virtual object SelectedValue {
+ get {
+ if (SelectedDataKey != null)
+ return SelectedDataKey.Value;
+ else
+ return null;
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute (false)]
+ public virtual bool ShowFooter {
+ get {
+ object ob = ViewState ["ShowFooter"];
+ if (ob != null) return (bool) ob;
+ return false;
+ }
+ set {
+ ViewState ["ShowFooter"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute (true)]
+ public virtual bool ShowHeader {
+ get {
+ object ob = ViewState ["ShowHeader"];
+ if (ob != null) return (bool) ob;
+ return true;
+ }
+ set {
+ ViewState ["ShowHeader"] = value;
+ RequireBinding ();
+ }
+ }
+
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [BrowsableAttribute (false)]
+ [DefaultValueAttribute (SortDirection.Ascending)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public virtual SortDirection SortDirection {
+ get { return sortDirection; }
+ }
+
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ public virtual string SortExpression {
+ get { return sortExpression; }
+ }
+
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public virtual GridViewRow TopPagerRow {
+ get {
+ EnsureDataBound ();
+ return topPagerRow;
+ }
+ }
+
+ [WebCategoryAttribute ("Accessibility")]
+ [DefaultValueAttribute (true)]
+ public virtual bool UseAccessibleHeader {
+ get {
+ object ob = ViewState ["UseAccessibleHeader"];
+ if (ob != null) return (bool) ob;
+ return true;
+ }
+ set {
+ ViewState ["UseAccessibleHeader"] = value;
+ RequireBinding ();
+ }
+ }
+
+ public virtual bool IsBindableType (Type type)
+ {
+ return type.IsPrimitive || type == typeof(string) || type == typeof(DateTime) || type == typeof(Guid);
+ }
+
+ protected override DataSourceSelectArguments CreateDataSourceSelectArguments ()
+ {
+ return base.CreateDataSourceSelectArguments ();
+ }
+
+ protected virtual ICollection CreateColumns (PagedDataSource dataSource, bool useDataSource)
+ {
+ ArrayList fields = new ArrayList ();
+
+ if (AutoGenerateEditButton || AutoGenerateDeleteButton || AutoGenerateSelectButton) {
+ CommandField field = new CommandField ();
+ field.ShowEditButton = AutoGenerateEditButton;
+ field.ShowDeleteButton = AutoGenerateDeleteButton;
+ field.ShowSelectButton = AutoGenerateSelectButton;
+ fields.Add (field);
+ }
+
+ if (AutoGenerateColumns) {
+ if (useDataSource)
+ autoFieldProperties = CreateAutoFieldProperties (dataSource);
+
+ if (autoFieldProperties != null) {
+ foreach (AutoGeneratedFieldProperties props in autoFieldProperties)
+ fields.Add (CreateAutoGeneratedColumn (props));
+ }
+ }
+
+ fields.AddRange (Columns);
+
+ return fields;
+ }
+
+ protected virtual AutoGeneratedField CreateAutoGeneratedColumn (AutoGeneratedFieldProperties fieldProperties)
+ {
+ return new AutoGeneratedField (fieldProperties);
+ }
+
+ AutoGeneratedFieldProperties[] CreateAutoFieldProperties (PagedDataSource source)
+ {
+ if(source == null) return null;
+
+ PropertyDescriptorCollection props = source.GetItemProperties (new PropertyDescriptor[0]);
+ Type prop_type;
+
+ ArrayList retVal = new ArrayList();
+
+ if (props == null)
+ {
+ object fitem = null;
+ prop_type = null;
+ PropertyInfo prop_item = source.DataSource.GetType().GetProperty("Item",
+ BindingFlags.Instance | BindingFlags.Static |
+ BindingFlags.Public, null, null,
+ new Type[] { typeof(int) }, null);
+
+ if (prop_item != null) {
+ prop_type = prop_item.PropertyType;
+ }
+
+ if (prop_type == null || prop_type == typeof(object)) {
+ IEnumerator en = source.GetEnumerator();
+ if (en.MoveNext())
+ fitem = en.Current;
+ if (fitem != null)
+ prop_type = fitem.GetType();
+ }
+
+ if (fitem != null && fitem is ICustomTypeDescriptor) {
+ props = TypeDescriptor.GetProperties(fitem);
+ } else if (prop_type != null) {
+ if (IsBindableType (prop_type)) {
+ AutoGeneratedFieldProperties field = new AutoGeneratedFieldProperties ();
+ ((IStateManager)field).TrackViewState();
+ field.Name = "Item";
+ field.DataField = BoundField.ThisExpression;
+ field.Type = prop_type;
+ retVal.Add (field);
+ } else {
+ props = TypeDescriptor.GetProperties (prop_type);
+ }
+ }
+ }
+
+ if (props != null && props.Count > 0)
+ {
+ foreach (PropertyDescriptor current in props) {
+ if (IsBindableType (current.PropertyType)) {
+ AutoGeneratedFieldProperties field = new AutoGeneratedFieldProperties ();
+ ((IStateManager)field).TrackViewState();
+ field.Name = current.Name;
+ field.DataField = current.Name;
+ field.IsReadOnly = current.IsReadOnly;
+ field.Type = current.PropertyType;
+ retVal.Add (field);
+ }
+ }
+ }
+
+ if (retVal.Count > 0)
+ return (AutoGeneratedFieldProperties[]) retVal.ToArray (typeof(AutoGeneratedFieldProperties));
+ else
+ return new AutoGeneratedFieldProperties [0];
+ }
+
+ protected virtual GridViewRow CreateRow (int rowIndex, int dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState)
+ {
+ GridViewRow row = new GridViewRow (rowIndex, dataSourceIndex, rowType, rowState);
+ OnRowCreated (new GridViewRowEventArgs (row));
+ return row;
+ }
+
+ void RequireBinding ()
+ {
+ if (Initialized) {
+ RequiresDataBinding = true;
+ pageCount = -1;
+ }
+ }
+
+ protected virtual Table CreateChildTable ()
+ {
+ Table table = new Table ();
+ table.Caption = Caption;
+ table.CaptionAlign = CaptionAlign;
+ table.CellPadding = CellPadding;
+ table.CellSpacing = CellSpacing;
+ table.HorizontalAlign = HorizontalAlign;
+ table.BackImageUrl = BackImageUrl;
+ return table;
+ }
+
+ protected override int CreateChildControls (IEnumerable data, bool dataBinding)
+ {
+ PagedDataSource dataSource;
+
+ if (dataBinding) {
+ DataSourceView view = GetData ();
+ dataSource = new PagedDataSource ();
+ dataSource.DataSource = data;
+
+ if (AllowPaging) {
+ dataSource.AllowPaging = true;
+ dataSource.PageSize = PageSize;
+ dataSource.CurrentPageIndex = PageIndex;
+ if (view.CanPage) {
+ dataSource.AllowServerPaging = true;
+ if (view.CanRetrieveTotalRowCount)
+ dataSource.VirtualCount = SelectArguments.TotalRowCount;
+ else {
+ dataSource.DataSourceView = view;
+ dataSource.DataSourceSelectArguments = SelectArguments;
+ dataSource.SetItemCountFromPageIndex (PageIndex + PagerSettings.PageButtonCount);
+ }
+ }
+ }
+
+ pageCount = dataSource.PageCount;
+ }
+ else
+ {
+ dataSource = new PagedDataSource ();
+ dataSource.DataSource = data;
+ if (AllowPaging) {
+ dataSource.AllowPaging = true;
+ dataSource.PageSize = PageSize;
+ dataSource.CurrentPageIndex = PageIndex;
+ }
+ }
+
+ bool showPager = AllowPaging && (PageCount > 1);
+
+ Controls.Clear ();
+ table = CreateChildTable ();
+ Controls.Add (table);
+
+ ArrayList list = new ArrayList ();
+ ArrayList keyList = new ArrayList ();
+
+ // Creates the set of fields to show
+
+ ICollection fieldCollection = CreateColumns (dataSource, dataBinding);
+ DataControlField[] fields = new DataControlField [fieldCollection.Count];
+ fieldCollection.CopyTo (fields, 0);
+
+ foreach (DataControlField field in fields) {
+ field.Initialize (AllowSorting, this);
+ if (EnableSortingAndPagingCallbacks)
+ field.ValidateSupportsCallback ();
+ }
+
+ // Main table creation
+
+ if (showPager && PagerSettings.Position == PagerPosition.Top || PagerSettings.Position == PagerPosition.TopAndBottom) {
+ topPagerRow = CreatePagerRow (fields.Length, dataSource);
+ table.Rows.Add (topPagerRow);
+ }
+
+ if (ShowHeader) {
+ headerRow = CreateRow (0, 0, DataControlRowType.Header, DataControlRowState.Normal);
+ table.Rows.Add (headerRow);
+ InitializeRow (headerRow, fields);
+ }
+
+ foreach (object obj in dataSource) {
+ DataControlRowState rstate = GetRowState (list.Count);
+ GridViewRow row = CreateRow (list.Count, list.Count, DataControlRowType.DataRow, rstate);
+ row.DataItem = obj;
+ list.Add (row);
+ table.Rows.Add (row);
+ InitializeRow (row, fields);
+ if (dataBinding) {
+// row.DataBind ();
+ OnRowDataBound (new GridViewRowEventArgs (row));
+ if (EditIndex == row.RowIndex)
+ oldEditValues = new DataKey (GetRowValues (row, false, true));
+ keyList.Add (new DataKey (CreateRowDataKey (row), DataKeyNames));
+ } else {
+ if (EditIndex == row.RowIndex)
+ oldEditValues = new DataKey (new OrderedDictionary ());
+ keyList.Add (new DataKey (new OrderedDictionary (), DataKeyNames));
+ }
+
+ if (list.Count >= PageSize)
+ break;
+ }
+
+ if (list.Count == 0)
+ table.Rows.Add (CreateEmptyrRow (fields.Length));
+
+ if (ShowFooter) {
+ footerRow = CreateRow (0, 0, DataControlRowType.Footer, DataControlRowState.Normal);
+ table.Rows.Add (footerRow);
+ InitializeRow (footerRow, fields);
+ }
+
+ if (showPager && PagerSettings.Position == PagerPosition.Bottom || PagerSettings.Position == PagerPosition.TopAndBottom) {
+ bottomPagerRow = CreatePagerRow (fields.Length, dataSource);
+ table.Rows.Add (bottomPagerRow);
+ }
+
+ rows = new GridViewRowCollection (list);
+ keys = new DataKeyArray (keyList);
+
+ return dataSource.DataSourceCount;
+ }
+
+ DataControlRowState GetRowState (int index)
+ {
+ DataControlRowState rstate = (index % 2) == 0 ? DataControlRowState.Normal : DataControlRowState.Alternate;
+ if (index == SelectedIndex) rstate |= DataControlRowState.Selected;
+ if (index == EditIndex) rstate |= DataControlRowState.Edit;
+ return rstate;
+ }
+
+ GridViewRow CreatePagerRow (int fieldCount, PagedDataSource dataSource)
+ {
+ GridViewRow row = CreateRow (-1, -1, DataControlRowType.Pager, DataControlRowState.Normal);
+ InitializePager (row, fieldCount, dataSource);
+ return row;
+ }
+
+ protected virtual void InitializePager (GridViewRow row, int columnSpan, PagedDataSource dataSource)
+ {
+ TableCell cell = new TableCell ();
+ cell.ColumnSpan = columnSpan;
+
+ if (pagerTemplate != null)
+ pagerTemplate.InstantiateIn (cell);
+ else
+ cell.Controls.Add (PagerSettings.CreatePagerControl (dataSource.CurrentPageIndex, dataSource.PageCount));
+
+ row.Cells.Add (cell);
+ }
+
+ GridViewRow CreateEmptyrRow (int fieldCount)
+ {
+ GridViewRow row = CreateRow (-1, -1, DataControlRowType.EmptyDataRow, DataControlRowState.Normal);
+ TableCell cell = new TableCell ();
+ cell.ColumnSpan = fieldCount;
+
+ if (emptyDataTemplate != null)
+ emptyDataTemplate.InstantiateIn (cell);
+ else
+ cell.Text = EmptyDataText;
+
+ row.Cells.Add (cell);
+ return row;
+ }
+
+ protected virtual void InitializeRow (GridViewRow row, DataControlField[] fields)
+ {
+ DataControlCellType ctype;
+ bool accessibleHeader = false;
+
+ switch (row.RowType) {
+ case DataControlRowType.Header:
+ ctype = DataControlCellType.Header;
+ accessibleHeader = UseAccessibleHeader;
+ break;
+ case DataControlRowType.Footer:
+ ctype = DataControlCellType.Footer;
+ break;
+ default:
+ ctype = DataControlCellType.DataCell;
+ break;
+ }
+
+ for (int n=0; n<fields.Length; n++) {
+ DataControlField field = fields [n];
+ DataControlFieldCell cell;
+ if (((field is BoundField) && ((BoundField)field).DataField == RowHeaderColumn) || accessibleHeader)
+ cell = new DataControlFieldHeaderCell (field, accessibleHeader ? TableHeaderScope.Column : TableHeaderScope.Row);
+ else
+ cell = new DataControlFieldCell (field);
+ row.Cells.Add (cell);
+ field.InitializeCell (cell, ctype, row.RowState, row.RowIndex);
+ }
+ }
+
+ IOrderedDictionary CreateRowDataKey (GridViewRow row)
+ {
+ if (cachedKeyProperties == null) {
+ PropertyDescriptorCollection props = TypeDescriptor.GetProperties (row.DataItem);
+ cachedKeyProperties = new PropertyDescriptor [DataKeyNames.Length];
+ for (int n=0; n<DataKeyNames.Length; n++) {
+ PropertyDescriptor p = props [DataKeyNames[n]];
+ if (p == null)
+ new InvalidOperationException ("Property '" + DataKeyNames[n] + "' not found in object of type " + row.DataItem.GetType());
+ cachedKeyProperties [n] = p;
+ }
+ }
+
+ OrderedDictionary dic = new OrderedDictionary ();
+ foreach (PropertyDescriptor p in cachedKeyProperties)
+ dic [p.Name] = p.GetValue (row.DataItem);
+ return dic;
+ }
+
+ IOrderedDictionary GetRowValues (GridViewRow row, bool includeReadOnlyFields, bool includePrimaryKey)
+ {
+ OrderedDictionary dic = new OrderedDictionary ();
+ ExtractRowValues (dic, row, includeReadOnlyFields, includePrimaryKey);
+ return dic;
+ }
+
+ protected virtual void ExtractRowValues (IOrderedDictionary fieldValues, GridViewRow row, bool includeReadOnlyFields, bool includePrimaryKey)
+ {
+ foreach (TableCell cell in row.Cells) {
+ DataControlFieldCell c = cell as DataControlFieldCell;
+ if (c != null)
+ c.ContainingField.ExtractValuesFromCell (fieldValues, c, row.RowState, includeReadOnlyFields);
+ }
+ if (!includePrimaryKey && DataKeyNames != null)
+ foreach (string key in DataKeyNames)
+ fieldValues.Remove (key);
+ }
+
+ protected override HtmlTextWriterTag TagKey {
+ get {
+ if (EnableSortingAndPagingCallbacks)
+ return HtmlTextWriterTag.Div;
+ else
+ return HtmlTextWriterTag.Table;
+ }
+ }
+
+ public sealed override void DataBind ()
+ {
+ DataSourceView view = GetData ();
+ if (AllowPaging && view.CanPage) {
+ SelectArguments.StartRowIndex = PageIndex * PageSize;
+ SelectArguments.MaximumRows = PageSize;
+ if (view.CanRetrieveTotalRowCount)
+ SelectArguments.RetrieveTotalRowCount = true;
+ }
+
+ if (sortExpression != "") {
+ if (sortDirection == SortDirection.Ascending)
+ SelectArguments.SortExpression = sortExpression;
+ else
+ SelectArguments.SortExpression = sortExpression + " DESC";
+ }
+
+ cachedKeyProperties = null;
+ base.DataBind ();
+ }
+
+ protected override void PerformDataBinding (IEnumerable data)
+ {
+ base.PerformDataBinding (data);
+ }
+
+ protected override void OnInit (EventArgs e)
+ {
+ Page.RegisterRequiresControlState (this);
+ base.OnInit (e);
+ }
+
+ void OnFieldsChanged (object sender, EventArgs args)
+ {
+ RequireBinding ();
+ }
+
+ protected override void OnDataPropertyChanged ()
+ {
+ base.OnDataPropertyChanged ();
+ RequireBinding ();
+ }
+
+ protected override void OnDataSourceViewChanged (object sender, EventArgs e)
+ {
+ base.OnDataSourceViewChanged (sender, e);
+ RequireBinding ();
+ }
+
+ protected override bool OnBubbleEvent (object source, EventArgs e)
+ {
+ GridViewCommandEventArgs args = e as GridViewCommandEventArgs;
+ if (args != null) {
+ OnRowCommand (args);
+ ProcessEvent (args.CommandName, args.CommandArgument as string);
+ }
+ return base.OnBubbleEvent (source, e);
+ }
+
+ // This is prolly obsolete
+ protected virtual void RaisePostBackEvent (string eventArgument)
+ {
+ int i = eventArgument.IndexOf ('$');
+ if (i != -1)
+ ProcessEvent (eventArgument.Substring (0, i), eventArgument.Substring (i + 1));
+ else
+ ProcessEvent (eventArgument, null);
+ }
+
+ void ProcessEvent (string eventName, string param)
+ {
+ switch (eventName)
+ {
+ case "Page":
+ int newIndex = -1;
+ switch (param) {
+ case "First":
+ newIndex = 0;
+ break;
+ case "Last":
+ newIndex = PageCount - 1;
+ break;
+ case "Next":
+ if (PageIndex < PageCount - 1) newIndex = PageIndex + 1;
+ break;
+ case "Prev":
+ if (PageIndex > 0) newIndex = PageIndex - 1;
+ break;
+ default:
+ newIndex = int.Parse (param) - 1;
+ break;
+ }
+ ShowPage (newIndex);
+ break;
+
+ case "First":
+ ShowPage (0);
+ break;
+
+ case "Last":
+ ShowPage (PageCount - 1);
+ break;
+
+ case "Next":
+ if (PageIndex < PageCount - 1)
+ ShowPage (PageIndex + 1);
+ break;
+
+ case "Prev":
+ if (PageIndex > 0)
+ ShowPage (PageIndex - 1);
+ break;
+
+ case "Select":
+ SelectRow (int.Parse (param));
+ break;
+
+ case "Edit":
+ EditRow (int.Parse (param));
+ break;
+
+ case "Update":
+ UpdateRow (EditIndex, true);
+ break;
+
+ case "Cancel":
+ CancelEdit ();
+ break;
+
+ case "Delete":
+ DeleteRow (int.Parse (param));
+ break;
+
+ case "Sort":
+ Sort (param);
+ break;
+ }
+ }
+
+ void Sort (string newSortExpression)
+ {
+ SortDirection newDirection;
+ if (sortExpression == newSortExpression) {
+ if (sortDirection == SortDirection.Ascending)
+ newDirection = SortDirection.Descending;
+ else
+ newDirection = SortDirection.Ascending;
+ } else
+ newDirection = sortDirection;
+
+ Sort (newSortExpression, newDirection);
+ }
+
+ public void Sort (string newSortExpression, SortDirection newSortDirection)
+ {
+ GridViewSortEventArgs args = new GridViewSortEventArgs (newSortExpression, newSortDirection);
+ OnSorting (args);
+ if (args.Cancel) return;
+
+ sortExpression = args.SortExpression;
+ sortDirection = args.SortDirection;
+ RequireBinding ();
+
+ OnSorted (EventArgs.Empty);
+ }
+
+ void SelectRow (int index)
+ {
+ GridViewSelectEventArgs args = new GridViewSelectEventArgs (index);
+ OnSelectedIndexChanging (args);
+ if (!args.Cancel) {
+ SelectedIndex = args.NewSelectedIndex;
+ OnSelectedIndexChanged (EventArgs.Empty);
+ }
+ }
+
+ void ShowPage (int newIndex)
+ {
+ GridViewPageEventArgs args = new GridViewPageEventArgs (newIndex);
+ OnPageIndexChanging (args);
+ if (!args.Cancel) {
+ EndRowEdit ();
+ PageIndex = args.NewPageIndex;
+ OnPageIndexChanged (EventArgs.Empty);
+ }
+ }
+
+ void EditRow (int index)
+ {
+ GridViewEditEventArgs args = new GridViewEditEventArgs (index);
+ OnRowEditing (args);
+ if (!args.Cancel) {
+ EditIndex = args.NewEditIndex;
+ }
+ }
+
+ void CancelEdit ()
+ {
+ GridViewCancelEditEventArgs args = new GridViewCancelEditEventArgs (EditIndex);
+ OnRowCancelingEdit (args);
+ if (!args.Cancel) {
+ EndRowEdit ();
+ }
+ }
+
+ [MonoTODO ("Support two-way binding expressions")]
+ public virtual void UpdateRow (int rowIndex, bool causesValidation)
+ {
+ if (causesValidation)
+ Page.Validate ();
+
+ if (rowIndex != EditIndex) throw new NotSupportedException ();
+
+ currentEditOldValues = oldEditValues.Values;
+
+ GridViewRow row = Rows [rowIndex];
+ currentEditRowKeys = DataKeys [rowIndex].Values;
+ currentEditNewValues = GetRowValues (row, false, false);
+
+ GridViewUpdateEventArgs args = new GridViewUpdateEventArgs (EditIndex, currentEditRowKeys, currentEditOldValues, currentEditNewValues);
+ OnRowUpdating (args);
+ if (!args.Cancel) {
+ DataSourceView view = GetData ();
+ if (view == null) throw new HttpException ("The DataSourceView associated to data bound control was null");
+ view.Update (currentEditRowKeys, currentEditNewValues, currentEditOldValues, new DataSourceViewOperationCallback (UpdateCallback));
+ } else
+ EndRowEdit ();
+ }
+
+ bool UpdateCallback (int recordsAffected, Exception exception)
+ {
+ GridViewUpdatedEventArgs dargs = new GridViewUpdatedEventArgs (recordsAffected, exception, currentEditRowKeys, currentEditOldValues, currentEditNewValues);
+ OnRowUpdated (dargs);
+
+ if (!dargs.KeepInEditMode)
+ EndRowEdit ();
+
+ return dargs.ExceptionHandled;
+ }
+
+ public void DeleteRow (int rowIndex)
+ {
+ GridViewRow row = Rows [rowIndex];
+ currentEditRowKeys = DataKeys [rowIndex].Values;
+ currentEditNewValues = GetRowValues (row, true, true);
+
+ GridViewDeleteEventArgs args = new GridViewDeleteEventArgs (rowIndex, currentEditRowKeys, currentEditNewValues);
+ OnRowDeleting (args);
+
+ if (!args.Cancel) {
+ RequireBinding ();
+ DataSourceView view = GetData ();
+ if (view != null)
+ view.Delete (currentEditRowKeys, currentEditNewValues, new DataSourceViewOperationCallback (DeleteCallback));
+ else {
+ GridViewDeletedEventArgs dargs = new GridViewDeletedEventArgs (0, null, currentEditRowKeys, currentEditNewValues);
+ OnRowDeleted (dargs);
+ }
+ }
+ }
+
+ bool DeleteCallback (int recordsAffected, Exception exception)
+ {
+ GridViewDeletedEventArgs dargs = new GridViewDeletedEventArgs (recordsAffected, exception, currentEditRowKeys, currentEditNewValues);
+ OnRowDeleted (dargs);
+ return dargs.ExceptionHandled;
+ }
+
+ void EndRowEdit ()
+ {
+ EditIndex = -1;
+ oldEditValues = new DataKey (new OrderedDictionary ());
+ currentEditRowKeys = null;
+ currentEditOldValues = null;
+ currentEditNewValues = null;
+ }
+
+ protected internal override void LoadControlState (object ob)
+ {
+ if (ob == null) return;
+ object[] state = (object[]) ob;
+ base.LoadControlState (state[0]);
+ pageIndex = (int) state[1];
+ pageCount = (int) state[2];
+ selectedIndex = (int) state[3];
+ editIndex = (int) state[4];
+ sortExpression = (string) state[5];
+ sortDirection = (SortDirection) state[6];
+ }
+
+ protected internal override object SaveControlState ()
+ {
+ object bstate = base.SaveControlState ();
+ return new object[] {
+ bstate, pageIndex, pageCount, selectedIndex, editIndex, sortExpression, sortDirection
+ };
+ }
+
+ protected override void TrackViewState()
+ {
+ base.TrackViewState();
+ if (columns != null) ((IStateManager)columns).TrackViewState();
+ if (pagerSettings != null) ((IStateManager)pagerSettings).TrackViewState();
+ if (alternatingRowStyle != null) ((IStateManager)alternatingRowStyle).TrackViewState();
+ if (footerStyle != null) ((IStateManager)footerStyle).TrackViewState();
+ if (headerStyle != null) ((IStateManager)headerStyle).TrackViewState();
+ if (pagerStyle != null) ((IStateManager)pagerStyle).TrackViewState();
+ if (rowStyle != null) ((IStateManager)rowStyle).TrackViewState();
+ if (selectedRowStyle != null) ((IStateManager)selectedRowStyle).TrackViewState();
+ if (editRowStyle != null) ((IStateManager)editRowStyle).TrackViewState();
+ if (emptyDataRowStyle != null) ((IStateManager)emptyDataRowStyle).TrackViewState();
+ if (keys != null) ((IStateManager)keys).TrackViewState();
+ if (autoFieldProperties != null) {
+ foreach (IStateManager sm in autoFieldProperties)
+ sm.TrackViewState ();
+ }
+ }
+
+ protected override object SaveViewState()
+ {
+ object[] states = new object [14];
+ states[0] = base.SaveViewState();
+ states[1] = (columns == null ? null : ((IStateManager)columns).SaveViewState());
+ states[2] = (pagerSettings == null ? null : ((IStateManager)pagerSettings).SaveViewState());
+ states[3] = (alternatingRowStyle == null ? null : ((IStateManager)alternatingRowStyle).SaveViewState());
+ states[4] = (footerStyle == null ? null : ((IStateManager)footerStyle).SaveViewState());
+ states[5] = (headerStyle == null ? null : ((IStateManager)headerStyle).SaveViewState());
+ states[6] = (pagerStyle == null ? null : ((IStateManager)pagerStyle).SaveViewState());
+ states[7] = (rowStyle == null ? null : ((IStateManager)rowStyle).SaveViewState());
+ states[8] = (selectedRowStyle == null ? null : ((IStateManager)selectedRowStyle).SaveViewState());
+ states[9] = (editRowStyle == null ? null : ((IStateManager)editRowStyle).SaveViewState());
+ states[10] = (emptyDataRowStyle == null ? null : ((IStateManager)emptyDataRowStyle).SaveViewState());
+ states[11] = (keys == null ? null : ((IStateManager)keys).SaveViewState());
+ states[12] = (oldEditValues == null ? null : ((IStateManager)oldEditValues).SaveViewState());
+
+ if (autoFieldProperties != null) {
+ object[] data = new object [autoFieldProperties.Length];
+ bool allNull = true;
+ for (int n=0; n<data.Length; n++) {
+ data [n] = ((IStateManager)autoFieldProperties [n]).SaveViewState ();
+ if (data [n] != null) allNull = false;
+ }
+ if (!allNull) states [13] = data;
+ }
+
+ for (int i = states.Length - 1; i >= 0; i--) {
+ if (states [i] != null)
+ return states;
+ }
+
+ return null;
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState == null) {
+ base.LoadViewState (null);
+ return;
+ }
+
+ object [] states = (object []) savedState;
+
+ if (states[13] != null) {
+ object[] data = (object[]) states [13];
+ autoFieldProperties = new AutoGeneratedFieldProperties [data.Length];
+ for (int n=0; n<data.Length; n++) {
+ IStateManager p = new AutoGeneratedFieldProperties ();
+ p.TrackViewState ();
+ p.LoadViewState (data [n]);
+ autoFieldProperties [n] = (AutoGeneratedFieldProperties) p;
+ }
+ }
+
+ base.LoadViewState (states[0]);
+ EnsureChildControls ();
+
+ if (states[1] != null) ((IStateManager)Columns).LoadViewState (states[1]);
+ if (states[2] != null) ((IStateManager)PagerSettings).LoadViewState (states[2]);
+ if (states[3] != null) ((IStateManager)AlternatingRowStyle).LoadViewState (states[3]);
+ if (states[4] != null) ((IStateManager)FooterStyle).LoadViewState (states[4]);
+ if (states[5] != null) ((IStateManager)HeaderStyle).LoadViewState (states[5]);
+ if (states[6] != null) ((IStateManager)PagerStyle).LoadViewState (states[6]);
+ if (states[7] != null) ((IStateManager)RowStyle).LoadViewState (states[7]);
+ if (states[8] != null) ((IStateManager)SelectedRowStyle).LoadViewState (states[8]);
+ if (states[9] != null) ((IStateManager)EditRowStyle).LoadViewState (states[9]);
+ if (states[10] != null) ((IStateManager)EmptyDataRowStyle).LoadViewState (states[10]);
+ if (states[11] != null) ((IStateManager)DataKeys).LoadViewState (states[11]);
+ if (states[12] != null && oldEditValues != null) ((IStateManager)oldEditValues).LoadViewState (states[12]);
+ }
+
+ string ICallbackEventHandler.RaiseCallbackEvent (string eventArgs)
+ {
+ return RaiseCallbackEvent (eventArgs);
+ }
+
+ protected virtual string RaiseCallbackEvent (string eventArgs)
+ {
+ string[] clientData = eventArgs.Split ('|');
+ pageIndex = int.Parse (clientData[0]);
+ sortExpression = HttpUtility.UrlDecode (clientData[1]);
+ if (sortExpression == "") sortExpression = null;
+ RequireBinding ();
+
+ RaisePostBackEvent (clientData[2]);
+ EnsureDataBound ();
+
+ StringWriter sw = new StringWriter ();
+ sw.Write (PageIndex.ToString() + '|' + SortExpression + '|');
+
+ HtmlTextWriter writer = new HtmlTextWriter (sw);
+ RenderGrid (writer);
+ return sw.ToString ();
+ }
+
+ string ICallbackContainer.GetCallbackScript (IButtonControl control, string argument)
+ {
+ return GetCallbackScript (control, argument);
+ }
+
+ protected virtual string GetCallbackScript (IButtonControl control, string argument)
+ {
+ if (EnableSortingAndPagingCallbacks)
+ return "javascript:GridView_ClientEvent (\"" + ClientID + "\",\"" + control.CommandName + "$" + control.CommandArgument + "\"); return false;";
+ else
+ return null;
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+
+ if (EnableSortingAndPagingCallbacks)
+ {
+ if (!Page.ClientScript.IsClientScriptIncludeRegistered (typeof(GridView), "GridView.js")) {
+ string url = Page.ClientScript.GetWebResourceUrl (typeof(GridView), "GridView.js");
+ Page.ClientScript.RegisterClientScriptInclude (typeof(GridView), "GridView.js", url);
+ }
+
+ string cgrid = ClientID + "_data";
+ string script = string.Format ("var {0} = new Object ();\n", cgrid);
+ script += string.Format ("{0}.pageIndex = {1};\n", cgrid, ClientScriptManager.GetScriptLiteral (PageIndex));
+ script += string.Format ("{0}.sortExp = {1};\n", cgrid, ClientScriptManager.GetScriptLiteral (SortExpression == null ? "" : SortExpression));
+ script += string.Format ("{0}.uid = {1};\n", cgrid, ClientScriptManager.GetScriptLiteral (UniqueID));
+ Page.ClientScript.RegisterStartupScript (typeof(TreeView), this.UniqueID, script, true);
+
+ // Make sure the basic script infrastructure is rendered
+ Page.ClientScript.GetCallbackEventReference (this, "null", "", "null");
+ Page.ClientScript.GetPostBackClientHyperlink (this, "");
+ }
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ if (EnableSortingAndPagingCallbacks)
+ base.RenderBeginTag (writer);
+
+ RenderGrid (writer);
+
+ if (EnableSortingAndPagingCallbacks)
+ base.RenderEndTag (writer);
+ }
+
+ void RenderGrid (HtmlTextWriter writer)
+ {
+ switch (GridLines) {
+ case GridLines.Horizontal:
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "rows");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+ break;
+ case GridLines.Vertical:
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "cols");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+ break;
+ case GridLines.Both:
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "all");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+ break;
+ default:
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "0");
+ break;
+ }
+
+ writer.AddAttribute (HtmlTextWriterAttribute.Cellspacing, "0");
+ writer.AddStyleAttribute (HtmlTextWriterStyle.BorderCollapse, "collapse");
+ table.RenderBeginTag (writer);
+
+ foreach (GridViewRow row in table.Rows)
+ {
+ switch (row.RowType) {
+ case DataControlRowType.Header:
+ if (headerStyle != null)headerStyle.AddAttributesToRender (writer, row);
+ break;
+ case DataControlRowType.Footer:
+ if (footerStyle != null) footerStyle.AddAttributesToRender (writer, row);
+ break;
+ case DataControlRowType.Pager:
+ if (pagerStyle != null) pagerStyle.AddAttributesToRender (writer, row);
+ break;
+ case DataControlRowType.EmptyDataRow:
+ if (emptyDataRowStyle != null) emptyDataRowStyle.AddAttributesToRender (writer, row);
+ break;
+ default:
+ if (rowStyle != null) rowStyle.AddAttributesToRender (writer, row);
+ break;
+ }
+
+ if ((row.RowState & DataControlRowState.Alternate) != 0 && alternatingRowStyle != null)
+ alternatingRowStyle.AddAttributesToRender (writer, row);
+ if ((row.RowState & DataControlRowState.Edit) != 0 && editRowStyle != null)
+ editRowStyle.AddAttributesToRender (writer, row);
+ if ((row.RowState & DataControlRowState.Selected) != 0 && selectedRowStyle != null)
+ selectedRowStyle.AddAttributesToRender (writer, row);
+
+ row.RenderBeginTag (writer);
+
+ foreach (TableCell cell in row.Cells) {
+ DataControlFieldCell fcell = cell as DataControlFieldCell;
+ if (fcell != null) {
+ Style cellStyle = null;
+ switch (row.RowType) {
+ case DataControlRowType.Header: cellStyle = fcell.ContainingField.HeaderStyle; break;
+ case DataControlRowType.Footer: cellStyle = fcell.ContainingField.FooterStyle; break;
+ default: cellStyle = fcell.ContainingField.ItemStyle; break;
+ }
+ if (cellStyle != null)
+ cellStyle.AddAttributesToRender (writer, cell);
+ }
+ cell.Render (writer);
+ }
+ row.RenderEndTag (writer);
+ }
+ table.RenderEndTag (writer);
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridView.js b/mcs/class/System.Web/System.Web.UI.WebControls/GridView.js
new file mode 100644
index 00000000000..d7dda1c1c14
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridView.js
@@ -0,0 +1,21 @@
+function GridView_ClientEvent (ctrlId, evnt)
+{
+ var gridData = eval (ctrlId + "_data");
+ var clientData = gridData.pageIndex + '|' + escape (gridData.sortExp) + '|' + evnt;
+ WebForm_DoCallback (gridData.uid, clientData, GridView_ClientRender, ctrlId, GridView_ClientRender_Error);
+}
+
+function GridView_ClientRender (data, ctx)
+{
+ var gridData = eval (ctx + "_data");
+ var grid = document.getElementById (ctx);
+ var i = data.indexOf ("|");
+ var j = data.indexOf ("|", i+1);
+ gridData.pageIndex = parseInt (data.substring (0, i));
+ gridData.sortExp = unescape (data.substring (i+1, j));
+ grid.innerHTML = data.substr (j+1);
+}
+
+function GridView_ClientRender_Error (data, ctx)
+{
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewCancelEditEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewCancelEditEventArgs.cs
new file mode 100644
index 00000000000..3e7ae4f706a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewCancelEditEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.UI.WebControls.GridViewCancelEditEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class GridViewCancelEditEventArgs : CancelEventArgs
+ {
+ private int rowIndex;
+
+ public GridViewCancelEditEventArgs (int index)
+ {
+ this.rowIndex = index;
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewCancelEditEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewCancelEditEventHandler.cs
new file mode 100644
index 00000000000..2e98d1afffb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewCancelEditEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.GridViewCancelEditEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void GridViewCancelEditEventHandler (object sender, GridViewCancelEditEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewCommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewCommandEventArgs.cs
new file mode 100644
index 00000000000..6631c6099cb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewCommandEventArgs.cs
@@ -0,0 +1,58 @@
+//
+// System.Web.UI.WebControls.GridViewCommandEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls
+{
+ public class GridViewCommandEventArgs : CommandEventArgs
+ {
+ private object source;
+ private GridViewRow row;
+
+ public GridViewCommandEventArgs (object source, CommandEventArgs arguments) : base (arguments)
+ {
+ this.source = source;
+ this.row = null;
+ }
+
+ public GridViewCommandEventArgs (GridViewRow row, object source, CommandEventArgs arguments) : base (arguments)
+ {
+ this.source = source;
+ this.row = row;
+ }
+
+ public object CommandSource {
+ get { return source; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewCommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewCommandEventHandler.cs
new file mode 100644
index 00000000000..ab030f4c71a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewCommandEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.GridViewCommandEventHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void GridViewCommandEventHandler (object sender, GridViewCommandEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewDeleteEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewDeleteEventArgs.cs
new file mode 100644
index 00000000000..c88c4755acb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewDeleteEventArgs.cs
@@ -0,0 +1,70 @@
+//
+// System.Web.UI.WebControls.GridViewDeleteEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class GridViewDeleteEventArgs : CancelEventArgs
+ {
+ private int rowIndex;
+ IOrderedDictionary keys;
+ IOrderedDictionary values;
+
+ public GridViewDeleteEventArgs (int index)
+ {
+ this.rowIndex = index;
+ }
+
+ internal GridViewDeleteEventArgs (int index, IOrderedDictionary keys, IOrderedDictionary values)
+ {
+ this.rowIndex = index;
+ this.keys = keys;
+ this.values = values;
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ public IOrderedDictionary Keys {
+ get { return keys; }
+ }
+
+ public IOrderedDictionary Values {
+ get { return values; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewDeleteEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewDeleteEventHandler.cs
new file mode 100644
index 00000000000..f6f2112b9b1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewDeleteEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.GridViewDeleteEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void GridViewDeleteEventHandler (object sender, GridViewDeleteEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewDeletedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewDeletedEventArgs.cs
new file mode 100644
index 00000000000..317f20acc93
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewDeletedEventArgs.cs
@@ -0,0 +1,82 @@
+//
+// System.Web.UI.WebControls.GridViewDeletedEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+ public class GridViewDeletedEventArgs : EventArgs
+ {
+ private int rowsAffected;
+ private Exception e;
+ private bool exceptionHandled;
+ IOrderedDictionary keys;
+ IOrderedDictionary values;
+
+ public GridViewDeletedEventArgs (int affectedRows, Exception e)
+ {
+ this.rowsAffected = affectedRows;
+ this.e = e;
+ this.exceptionHandled = false;
+ }
+
+ public GridViewDeletedEventArgs (int affectedRows, Exception e, IOrderedDictionary keys, IOrderedDictionary values)
+ : this (affectedRows, e)
+ {
+ this.keys = keys;
+ this.values = values;
+ }
+
+ public int AffectedRows {
+ get { return rowsAffected; }
+ }
+
+ public Exception Exception {
+ get { return e; }
+ }
+
+ public bool ExceptionHandled {
+ get { return exceptionHandled; }
+ set { exceptionHandled = value; }
+ }
+
+ public IOrderedDictionary Keys {
+ get { return keys; }
+ }
+
+ public IOrderedDictionary Values {
+ get { return values; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewDeletedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewDeletedEventHandler.cs
new file mode 100644
index 00000000000..79e3b481a09
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewDeletedEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.GridViewDeletedEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void GridViewDeletedEventHandler (object sender, GridViewDeletedEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewEditEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewEditEventArgs.cs
new file mode 100644
index 00000000000..8c96d20ad98
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewEditEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.UI.WebControls.GridViewEditEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class GridViewEditEventArgs : CancelEventArgs
+ {
+ private int index;
+
+ public GridViewEditEventArgs (int editIndex)
+ {
+ this.index = editIndex;
+ }
+
+ public int NewEditIndex {
+ get { return index; }
+ set { index = value; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewEditEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewEditEventHandler.cs
new file mode 100644
index 00000000000..45960c30fb3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewEditEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.GridViewEditEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void GridViewEditEventHandler (object sender, GridViewEditEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewPageEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewPageEventArgs.cs
new file mode 100644
index 00000000000..cbf8ddf2aef
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewPageEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.UI.WebControls.GridViewPageEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class GridViewPageEventArgs : CancelEventArgs
+ {
+ private int pageIndex;
+
+ public GridViewPageEventArgs (int pageIndex )
+ {
+ this.pageIndex = pageIndex;
+ }
+
+ public int NewPageIndex {
+ get { return pageIndex; }
+ set { pageIndex = value;}
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewPageEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewPageEventHandler.cs
new file mode 100644
index 00000000000..8bf6e6f4909
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewPageEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.GridViewPageEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void GridViewPageEventHandler (object sender, GridViewPageEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewRow.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewRow.cs
new file mode 100644
index 00000000000..5eca4d1b4da
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewRow.cs
@@ -0,0 +1,108 @@
+//
+// System.Web.UI.WebControls.GridViewRow.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Web.UI;
+using System.Security.Permissions;
+
+namespace System.Web.UI.WebControls
+{
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public class GridViewRow: TableRow, IDataItemContainer, INamingContainer
+ {
+ object dataItem;
+ int rowIndex;
+ int dataItemIndex;
+ DataControlRowState rowState;
+ DataControlRowType rowType;
+
+ public GridViewRow (int rowIndex, int dataItemIndex, DataControlRowType rowType, DataControlRowState rowState)
+ {
+ this.rowIndex = rowIndex;
+ this.dataItemIndex = dataItemIndex;
+ this.rowType = rowType;
+ this.rowState = rowState;
+ }
+
+ public virtual object DataItem {
+ get { return dataItem; }
+ set { dataItem = value; }
+ }
+
+ public virtual int DataItemIndex {
+ get { return dataItemIndex; }
+ }
+
+ public virtual int RowIndex {
+ get { return rowIndex; }
+ }
+
+ public virtual DataControlRowState RowState {
+ get { return rowState; }
+ set { rowState = value; }
+ }
+
+ public virtual DataControlRowType RowType {
+ get { return rowType; }
+ set { rowType = value; }
+ }
+
+ object IDataItemContainer.DataItem {
+ get { return DataItem; }
+ }
+
+/* int IDataItemContainer.DataItemIndex {
+ get { return DataItemIndex; }
+ }
+
+ int IDataItemContainer.DisplayIndex {
+ get { return RowIndex; }
+ }*/
+
+ protected override bool OnBubbleEvent (object source, EventArgs e)
+ {
+ if (base.OnBubbleEvent (source, e)) return true;
+
+ if (e is CommandEventArgs) {
+ GridViewCommandEventArgs args = new GridViewCommandEventArgs (this, source, (CommandEventArgs)e);
+ RaiseBubbleEvent (source, args);
+ return true;
+ }
+ return false;
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewRowCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewRowCollection.cs
new file mode 100644
index 00000000000..5ec7fcf03cf
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewRowCollection.cs
@@ -0,0 +1,81 @@
+//
+// System.Web.UI.WebControls.GridViewRowCollection.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Web.UI;
+using System.Collections;
+
+namespace System.Web.UI.WebControls
+{
+ public class GridViewRowCollection: ICollection, IEnumerable
+ {
+ ArrayList rows = new ArrayList ();
+
+ public GridViewRowCollection (ArrayList rows)
+ {
+ this.rows = rows;
+ }
+
+ public GridViewRow this [int i] {
+ get { return (GridViewRow) rows [i]; }
+ }
+
+ public void CopyTo (GridViewRow[] array, int index)
+ {
+ rows.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return rows.GetEnumerator ();
+ }
+
+ public int Count {
+ get { return rows.Count; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public object SyncRoot {
+ get { return rows.SyncRoot; }
+ }
+
+ void System.Collections.ICollection.CopyTo (Array array, int index)
+ {
+ rows.CopyTo (array, index);
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewRowEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewRowEventArgs.cs
new file mode 100644
index 00000000000..ab219faac11
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewRowEventArgs.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.UI.WebControls.GridViewRowEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls
+{
+ public class GridViewRowEventArgs : EventArgs
+ {
+ private GridViewRow row;
+
+ public GridViewRowEventArgs (GridViewRow row )
+ {
+ this.row = row;
+ }
+
+ public GridViewRow Row {
+ get { return row; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewRowEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewRowEventHandler.cs
new file mode 100644
index 00000000000..64855105665
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewRowEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.GridViewRowEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void GridViewRowEventHandler (object sender, GridViewRowEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewSelectEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewSelectEventArgs.cs
new file mode 100644
index 00000000000..d477b911a84
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewSelectEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.UI.WebControls.GridViewSelectEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class GridViewSelectEventArgs : CancelEventArgs
+ {
+ private int selectedIndex;
+
+ public GridViewSelectEventArgs (int selectedIndex )
+ {
+ this.selectedIndex = selectedIndex;
+ }
+
+ public int NewSelectedIndex {
+ get { return selectedIndex; }
+ set { selectedIndex = value;}
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewSelectEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewSelectEventHandler.cs
new file mode 100644
index 00000000000..e499ca9eece
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewSelectEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.GridViewSelectEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void GridViewSelectEventHandler (object sender, GridViewSelectEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewSortEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewSortEventArgs.cs
new file mode 100644
index 00000000000..d549267641d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewSortEventArgs.cs
@@ -0,0 +1,60 @@
+//
+// System.Web.UI.WebControls.GridViewSortEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class GridViewSortEventArgs : CancelEventArgs
+ {
+ private string sortExpression;
+ private SortDirection sortDirection;
+
+ public GridViewSortEventArgs (string expression, SortDirection sortDirection)
+ {
+ this.sortExpression = expression;
+ this.sortDirection = sortDirection;
+ }
+
+ public string SortExpression {
+ get { return sortExpression; }
+ set { sortExpression = value;}
+ }
+
+ public SortDirection SortDirection {
+ get { return sortDirection; }
+ set { sortDirection = value;}
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewSortEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewSortEventHandler.cs
new file mode 100644
index 00000000000..34963dc9a88
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewSortEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.GridViewSortEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void GridViewSortEventHandler (object sender, GridViewSortEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewUpdateEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewUpdateEventArgs.cs
new file mode 100644
index 00000000000..23bc9b8d794
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewUpdateEventArgs.cs
@@ -0,0 +1,76 @@
+//
+// System.Web.UI.WebControls.GridViewUpdateEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class GridViewUpdateEventArgs : CancelEventArgs
+ {
+ private int rowIndex;
+ IOrderedDictionary keys;
+ IOrderedDictionary newValues;
+ IOrderedDictionary oldValues;
+
+ public GridViewUpdateEventArgs (int rowIndex)
+ {
+ this.rowIndex = rowIndex;
+ }
+
+ internal GridViewUpdateEventArgs (int rowIndex, IOrderedDictionary keys, IOrderedDictionary oldValues, IOrderedDictionary newValues)
+ {
+ this.rowIndex = rowIndex;
+ this.keys = keys;
+ this.newValues = newValues;
+ this.oldValues = oldValues;
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ public IOrderedDictionary Keys {
+ get { return keys; }
+ }
+
+ public IOrderedDictionary NewValues {
+ get { return newValues; }
+ }
+
+ public IOrderedDictionary OldValues {
+ get { return oldValues; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewUpdateEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewUpdateEventHandler.cs
new file mode 100644
index 00000000000..8d89487a4d0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewUpdateEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebContrls.GridViewUpdateEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void GridViewUpdateEventHandler (object sender, GridViewUpdateEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewUpdatedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewUpdatedEventArgs.cs
new file mode 100644
index 00000000000..42c6651e924
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewUpdatedEventArgs.cs
@@ -0,0 +1,95 @@
+//
+// System.Web.UI.WebControls.GridViewUpdatedEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+ public class GridViewUpdatedEventArgs : EventArgs
+ {
+ private int rowsAffected;
+ private Exception e;
+ private bool exceptionHandled;
+ private bool keepEditMode;
+ private IOrderedDictionary keys;
+ private IOrderedDictionary newValues;
+ private IOrderedDictionary oldValues;
+
+ public GridViewUpdatedEventArgs (int affectedRows, Exception e)
+ {
+ this.rowsAffected = affectedRows;
+ this.e = e;
+ this.exceptionHandled = false;
+ this.keepEditMode = false;
+ }
+
+ internal GridViewUpdatedEventArgs (int affectedRows, Exception e, IOrderedDictionary keys, IOrderedDictionary oldValues, IOrderedDictionary newValues)
+ : this (affectedRows, e)
+ {
+ this.keys = keys;
+ this.newValues = newValues;
+ this.oldValues = oldValues;
+ }
+
+ public int AffectedRows {
+ get { return rowsAffected; }
+ }
+
+ public Exception Exception {
+ get { return e; }
+ }
+
+ public bool ExceptionHandled {
+ get { return exceptionHandled; }
+ set { exceptionHandled = value; }
+ }
+
+ public bool KeepInEditMode {
+ get { return keepEditMode; }
+ set { keepEditMode = value; }
+ }
+
+ public IOrderedDictionary Keys {
+ get { return keys; }
+ }
+
+ public IOrderedDictionary NewValues {
+ get { return newValues; }
+ }
+
+ public IOrderedDictionary OldValues {
+ get { return oldValues; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridViewUpdatedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewUpdatedEventHandler.cs
new file mode 100644
index 00000000000..e0da117dcde
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridViewUpdatedEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.GridViewUpdatedEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void GridViewUpdatedEventHandler (object sender, GridViewUpdatedEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HiddenField.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HiddenField.cs
new file mode 100644
index 00000000000..e379da2c0f7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HiddenField.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.UI.WebControls.HiddenField.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class HiddenField : Control
+ {
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HierarchicalDataBoundControl.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HierarchicalDataBoundControl.cs
new file mode 100644
index 00000000000..c0f58fcd8de
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HierarchicalDataBoundControl.cs
@@ -0,0 +1,121 @@
+//
+// System.Web.UI.WebControls.HierarchicalDataBoundControl.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.HierarchicalDataBoundControlDesigner, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+ public abstract class HierarchicalDataBoundControl : BaseDataBoundControl
+ {
+ [IDReferencePropertyAttribute (typeof(HierarchicalDataSourceControl))]
+ public override string DataSourceID {
+ get {
+ object o = ViewState ["DataSourceID"];
+ if (o != null)
+ return (string)o;
+
+ return String.Empty;
+ }
+ set {
+ if (Initialized)
+ RequiresDataBinding = true;
+
+ ViewState ["DataSourceID"] = value;
+ }
+ }
+
+ protected HierarchicalDataSourceView GetData (string viewPath)
+ {
+ if (DataSource != null && DataSourceID != "")
+ throw new HttpException ();
+
+ IHierarchicalDataSource ds = GetDataSource ();
+ if (ds != null)
+ return ds.GetHierarchicalView (viewPath);
+ else
+ return null;
+ }
+
+ protected IHierarchicalDataSource GetDataSource ()
+ {
+ if (DataSourceID != "")
+ return NamingContainer.FindControl (DataSourceID) as IHierarchicalDataSource;
+
+ return DataSource as IHierarchicalDataSource;
+ }
+
+ protected override void OnDataPropertyChanged ()
+ {
+ RequiresDataBinding = true;
+ }
+
+ protected virtual void OnDataSourceChanged (object sender, EventArgs e)
+ {
+ RequiresDataBinding = true;
+ }
+
+ protected override void OnLoad (EventArgs e)
+ {
+ IHierarchicalDataSource ds = GetDataSource ();
+ if (ds != null && DataSourceID != "")
+ ds.DataSourceChanged += new EventHandler (OnDataSourceChanged);
+
+ base.OnLoad(e);
+ }
+
+ [MonoTODO]
+ protected override void OnPagePreLoad (object sender, EventArgs e)
+ {
+ base.OnPagePreLoad (sender, e);
+ }
+
+ protected internal virtual void PerformDataBinding ()
+ {
+ OnDataBinding (EventArgs.Empty);
+ }
+
+ protected override void PerformSelect ()
+ {
+ PerformDataBinding ();
+ }
+
+ protected override void ValidateDataSource (object dataSource)
+ {
+ if (dataSource is IHierarchicalDataSource || dataSource is IHierarchicalEnumerable)
+ return;
+ throw new InvalidOperationException ("Invalid data source");
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlign.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlign.cs
new file mode 100755
index 00000000000..b0c36bbd65e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlign.cs
@@ -0,0 +1,48 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: HorizontalAlign
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [TypeConverter(typeof(HorizontalAlignConverter))]
+ public enum HorizontalAlign
+ {
+ NotSet,
+ Left,
+ Center,
+ Right,
+ Justify
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlignConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlignConverter.cs
new file mode 100644
index 00000000000..2816122f498
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlignConverter.cs
@@ -0,0 +1,72 @@
+//
+// System.Web.UI.WebControls.HorizontalAlignConverter
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.Globalization;
+
+namespace System.Web.UI.WebControls
+{
+ class HorizontalAlignConverter : EnumConverter
+ {
+ public HorizontalAlignConverter () : base (typeof(HorizontalAlign))
+ {
+ }
+
+ // The base class is enough to handle everything.
+ // The methods are here just to make the class status page happy.
+ // Add some optimizations?
+
+ public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+ {
+ return base.CanConvertFrom (context, sourceType);
+ }
+
+ public override object ConvertFrom (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value)
+ {
+ return base.ConvertFrom (context, culture, value);
+ }
+
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+ {
+ return base.CanConvertTo (context, destinationType);
+ }
+
+ public override object ConvertTo (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value,
+ Type destinationType)
+ {
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HotSpotMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HotSpotMode.cs
new file mode 100644
index 00000000000..d5bf87ca999
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HotSpotMode.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.UI.WebControls.HotSpotMode.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum HotSpotMode {
+ NotSet = 0,
+ Navigate = 1,
+ PostBack = 2,
+ Inactive = 3
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HyperLink.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLink.cs
new file mode 100755
index 00000000000..13fda8806c9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLink.cs
@@ -0,0 +1,241 @@
+//
+// System.Web.UI.WebControls.HyperLink.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("Text")]
+ [ControlBuilder(typeof(HyperLinkControlBuilder))]
+ [Designer("System.Web.UI.Design.WebControls.HyperLinkDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ [DataBindingHandler("System.Web.UI.Design.HyperLinkDataBindingHandler, " + Consts.AssemblySystem_Design)]
+ [ParseChildren(false)]
+ [ToolboxData("<{0}:HyperLink runat=\"server\">HyperLink</{0}:HyperLink>")]
+ public class HyperLink: WebControl
+ {
+ bool textSet;
+
+ public HyperLink(): base(HtmlTextWriterTag.A)
+ {
+ }
+
+#if NET_2_0
+ [UrlPropertyAttribute]
+#endif
+ [DefaultValue (""), Bindable (true), WebCategory ("Appearance")]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [WebSysDescription ("The URL to the image file.")]
+ public virtual string ImageUrl
+ {
+ get
+ {
+ object o = ViewState["ImageUrl"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ImageUrl"] = value;
+ }
+ }
+
+#if NET_2_0
+ [UrlPropertyAttribute]
+#endif
+ [DefaultValue (""), Bindable (true), WebCategory ("Navigation")]
+ [Editor ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [WebSysDescription ("The URL to navigate to.")]
+ public string NavigateUrl
+ {
+ get
+ {
+ object o = ViewState["NavigateUrl"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["NavigateUrl"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Navigation")]
+ [TypeConverter (typeof (TargetConverter))]
+ [WebSysDescription ("The target frame in which the navigation target should be opened.")]
+ public string Target
+ {
+ get
+ {
+ object o = ViewState["Target"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Target"] = value;
+ }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#endif
+ [DefaultValue (""), Bindable (true), WebCategory ("Appearance")]
+ [PersistenceMode (PersistenceMode.InnerDefaultProperty)]
+ [WebSysDescription ("The text that should be shown on this HyperLink.")]
+ public virtual string Text
+ {
+ get {
+ object o = ViewState ["Text"];
+ if (o != null)
+ return (string) o;
+
+ return String.Empty;
+ }
+ set {
+ if (HasControls())
+ Controls.Clear();
+ ViewState["Text"] = value;
+ textSet = true;
+ }
+ }
+
+#if NET_2_0
+ [BindableAttribute (true)]
+ [LocalizableAttribute (true)]
+ [DefaultValueAttribute ("")]
+ public string SoftkeyLabel {
+ get {
+ string text = (string)ViewState["SoftkeyLabel"];
+ if (text!=null) return text;
+ return String.Empty;
+ }
+ set {
+ ViewState["SoftkeyLabel"] = value;
+ }
+ }
+#endif
+
+ string InternalText
+ {
+ get { return Text; }
+ set { ViewState["Text"] = value; }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(NavigateUrl.Length > 0)
+ {
+ string url = ResolveUrl (NavigateUrl);
+ writer.AddAttribute(HtmlTextWriterAttribute.Href, url);
+ }
+ if(Target.Length > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Target, Target);
+ }
+ }
+
+ protected override void AddParsedSubObject(object obj)
+ {
+ if(HasControls())
+ {
+ base.AddParsedSubObject(obj);
+ return;
+ }
+ if(obj is LiteralControl)
+ {
+ // This is a hack to workaround the behaviour of the code generator, which
+ // may split a text in several LiteralControls if there's a special character
+ // such as '<' in it.
+ if (textSet) {
+ Text = ((LiteralControl)obj).Text;
+ textSet = false;
+ } else {
+ InternalText += ((LiteralControl)obj).Text;
+ }
+ //
+
+ return;
+ }
+ if(Text.Length > 0)
+ {
+ base.AddParsedSubObject(new LiteralControl (Text));
+ Text = String.Empty;
+ }
+ base.AddParsedSubObject (obj);
+ }
+
+ protected override void LoadViewState(object savedState)
+ {
+ if(savedState != null)
+ {
+ base.LoadViewState(savedState);
+ object o = ViewState["Text"];
+ if(o!=null)
+ Text = (string)o;
+ }
+ }
+
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ if(ImageUrl.Length > 0)
+ {
+ Image img = new Image();
+ img.ImageUrl = ResolveUrl(ImageUrl);
+ if(ToolTip.Length > 0)
+ img.ToolTip = ToolTip;
+ if(Text.Length > 0)
+ img.AlternateText = Text;
+ img.RenderControl(writer);
+ return;
+ }
+ if(HasControls())
+ {
+ base.RenderContents(writer);
+ return;
+ }
+ writer.Write(Text);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs
new file mode 100644
index 00000000000..8ff281b89fc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs
@@ -0,0 +1,262 @@
+//
+// System.Web.UI.WebControls.HyperLinkColumn.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class HyperLinkColumn: DataGridColumn
+ {
+ PropertyDescriptor textFieldDescriptor;
+ PropertyDescriptor urlFieldDescriptor;
+
+ public HyperLinkColumn ()
+ {
+ }
+
+ [DefaultValue (""), WebCategory ("Misc")]
+ [WebSysDescription ("The field that gets data-bound to the NavigateUrl.")]
+ public virtual string DataNavigateUrlField {
+ get {
+ object o = ViewState ["DataNavigateUrlField"];
+ if (o != null)
+ return (string) o;
+ return String.Empty;
+ }
+
+ set {
+ ViewState ["DataNavigateUrlField"] = value;
+ OnColumnChanged ();
+ }
+ }
+
+ // LAMESPEC should use WebSysDescription as all others do, but MS uses Description here
+
+ [DefaultValue (""), WebCategory ("Misc")]
+ [Description ("The formatting rule for the text content that gets data-bound to the NavigateUrl.")]
+ public virtual string DataNavigateUrlFormatString {
+ get {
+ object o = ViewState ["DataNavigateUrlFormatString"];
+ if (o != null)
+ return (string) o;
+ return String.Empty;
+ }
+
+ set {
+ ViewState ["DataNavigateUrlFormatString"] = value;
+ OnColumnChanged ();
+ }
+ }
+
+ [DefaultValue (""), WebCategory ("Misc")]
+ [WebSysDescription ("The field that gets data-bound to the Text property.")]
+ public virtual string DataTextField {
+ get {
+ object o = ViewState ["DataTextField"];
+ if (o != null)
+ return (string) o;
+ return String.Empty;
+ }
+ set {
+ ViewState ["DataTextField"] = value;
+ OnColumnChanged ();
+ }
+ }
+
+ // LAMESPEC should use WebSysDescription as all others do, but MS uses Description here
+
+ [DefaultValue (""), WebCategory ("Misc")]
+ [Description ("The formatting rule for the text content that gets data-bound to the Text property.")]
+ public virtual string DataTextFormatString {
+ get {
+ object o = ViewState ["DataTextFormatString"];
+ if (o != null)
+ return (string) o;
+ return String.Empty;
+ }
+
+ set {
+ ViewState ["DataTextFormatString"] = value;
+ OnColumnChanged ();
+ }
+ }
+
+#if NET_2_0
+ [UrlPropertyAttribute]
+#endif
+ [DefaultValue (""), WebCategory ("Misc")]
+ [WebSysDescription ("The URL that this hyperlink links to.")]
+ public virtual string NavigateUrl {
+ get {
+ object o = ViewState ["NavigateUrl"];
+ if (o != null)
+ return (string) o;
+ return String.Empty;
+ }
+
+ set {
+ ViewState ["NavigateUrl"] = value;
+ OnColumnChanged ();
+ }
+ }
+
+ [DefaultValue (""), WebCategory ("Misc")]
+ [WebSysDescription ("The target frame in which the NavigateUrl property should be opened.")]
+ public virtual string Target {
+ get {
+ object o = ViewState ["Target"];
+ if (o != null)
+ return (string) o;
+ return String.Empty;
+ }
+
+ set {
+ ViewState ["Target"] = value;
+ OnColumnChanged ();
+ }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Misc")]
+ [WebSysDescription ("The Text for the hyperlink.")]
+ public virtual string Text {
+ get {
+ object o = ViewState ["Text"];
+ if (o != null)
+ return (string) o;
+ return String.Empty;
+ }
+
+ set {
+ ViewState ["Text"] = value;
+ OnColumnChanged ();
+ }
+ }
+
+ public override void Initialize ()
+ {
+ textFieldDescriptor = null;
+ urlFieldDescriptor = null;
+ base.Initialize ();
+ }
+
+ public override void InitializeCell (TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ base.InitializeCell (cell, columnIndex, itemType);
+
+ if (itemType != ListItemType.Header && itemType != ListItemType.Footer) {
+ HyperLink toDisplay = new HyperLink ();
+ toDisplay.Text = Text;
+ toDisplay.NavigateUrl = NavigateUrl;
+ toDisplay.Target = Target;
+
+ if (DataTextField.Length > 0 || DataNavigateUrlField.Length > 0)
+ toDisplay.DataBinding += new EventHandler (OnDataBindHyperLinkColumn);
+
+ cell.Controls.Add (toDisplay);
+ }
+ }
+
+ private void OnDataBindHyperLinkColumn (object sender, EventArgs e)
+ {
+ HyperLink link = (HyperLink) sender;
+ object item = ((DataGridItem) link.NamingContainer).DataItem;
+
+ PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (item);
+ if (textFieldDescriptor == null)
+ textFieldDescriptor = properties.Find (DataTextField, true);
+
+ if (urlFieldDescriptor == null)
+ urlFieldDescriptor = properties.Find (DataNavigateUrlField, true);
+
+ if (DataTextField.Length > 0 && textFieldDescriptor == null && !DesignMode)
+ throw new HttpException (HttpRuntime.FormatResourceString (
+ "Field_Not_Found", DataTextField));
+
+ if (DataNavigateUrlField.Length > 0 && urlFieldDescriptor == null && !DesignMode)
+ throw new HttpException (HttpRuntime.FormatResourceString (
+ "Field_Not_Found", DataNavigateUrlField));
+
+ if (textFieldDescriptor != null) {
+ link.Text = FormatDataTextValue (textFieldDescriptor.GetValue (item));
+ } else {
+ link.Text = Text;
+ }
+
+ if (urlFieldDescriptor != null) {
+ link.NavigateUrl = FormatDataNavigateUrlValue (urlFieldDescriptor.GetValue (item));
+ return;
+ }
+
+ if (DataNavigateUrlField.Length != 0 && DesignMode)
+ link.NavigateUrl = "url";
+ }
+
+ protected virtual string FormatDataNavigateUrlValue (object dataUrlValue)
+ {
+ if (dataUrlValue == null)
+ return String.Empty;
+
+ string retVal;
+ if (DataNavigateUrlFormatString.Length > 0) {
+ retVal = String.Format (DataNavigateUrlFormatString, dataUrlValue);
+ } else {
+ retVal = dataUrlValue.ToString ();
+ }
+
+ return retVal;
+ }
+
+ protected virtual string FormatDataTextValue (object dataTextValue)
+ {
+ if (dataTextValue == null)
+ return String.Empty;
+
+ string retVal;
+ if (DataTextFormatString.Length > 0) {
+ retVal = String.Format (DataTextFormatString, dataTextValue);
+ } else {
+ retVal = dataTextValue.ToString ();
+ }
+
+ return retVal;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkControlBuilder.cs
new file mode 100644
index 00000000000..5217a4cde6b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkControlBuilder.cs
@@ -0,0 +1,48 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: HyperLinkControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public class HyperLinkControlBuilder : ControlBuilder
+ {
+ public HyperLinkControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkField.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkField.cs
new file mode 100644
index 00000000000..c2513e9cf2e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkField.cs
@@ -0,0 +1,275 @@
+//
+// System.Web.UI.WebControls.HyperLinkField.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Security.Permissions;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls {
+
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public class HyperLinkField : DataControlField
+ {
+ PropertyDescriptor textProperty;
+ PropertyDescriptor[] urlProperties;
+ static string[] emptyFields;
+
+ public override bool Initialize (bool sortingEnabled, Control control)
+ {
+ return base.Initialize (sortingEnabled, control);
+ }
+
+ [EditorAttribute ("System.Web.UI.Design.WebControls.DataFieldEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [TypeConverterAttribute (typeof(StringArrayConverter))]
+ [WebCategoryAttribute ("Data")]
+ [DefaultValueAttribute ("")]
+ public virtual string[] DataNavigateUrlFields {
+ get {
+ object ob = ViewState ["DataNavigateUrlFields"];
+ if (ob != null) return (string[]) ob;
+ if (emptyFields == null) emptyFields = new string[0];
+ return emptyFields;
+ }
+ set {
+ ViewState ["DataNavigateUrlFields"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Data")]
+ public virtual string DataNavigateUrlFormatString {
+ get {
+ object ob = ViewState ["DataNavigateUrlFormatString"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["DataNavigateUrlFormatString"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Data")]
+ [DefaultValueAttribute ("")]
+ [TypeConverterAttribute ("System.Web.UI.Design.DataSourceViewSchemaConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public virtual string DataTextField {
+ get {
+ object ob = ViewState ["DataTextField"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["DataTextField"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Data")]
+ public virtual string DataTextFormatString {
+ get {
+ object ob = ViewState ["DataTextFormatString"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["DataTextFormatString"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [UrlPropertyAttribute]
+ [WebCategoryAttribute ("Behavior")]
+ public virtual string NavigateUrl {
+ get {
+ object ob = ViewState ["NavigateUrl"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["NavigateUrl"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Behavior")]
+ [TypeConverterAttribute (typeof(TargetConverter))]
+ public virtual string Target {
+ get {
+ object ob = ViewState ["Target"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["Target"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [LocalizableAttribute (true)]
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Appearance")]
+ public virtual string Text {
+ get {
+ object ob = ViewState ["Text"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["Text"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ public override void InitializeCell (DataControlFieldCell cell,
+ DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
+ {
+ base.InitializeCell (cell, cellType, rowState, rowIndex);
+ HyperLink link = new HyperLink ();
+ bool bind = false;
+
+ if (Target.Length > 0)
+ link.Target = Target;
+
+ if (DataTextField.Length > 0)
+ bind = true;
+ else
+ link.Text = Text;
+
+ string[] fields = DataNavigateUrlFields;
+ if (fields.Length > 0)
+ bind = true;
+ else
+ link.NavigateUrl = NavigateUrl;
+
+ if (bind && cellType == DataControlCellType.DataCell && (rowState & DataControlRowState.Insert) == 0)
+ cell.DataBinding += new EventHandler (OnDataBindField);
+
+ cell.Controls.Add (link);
+ }
+
+ protected virtual string FormatDataNavigateUrlValue (object[] dataUrlValues)
+ {
+ if (dataUrlValues == null || dataUrlValues.Length == 0)
+ return "";
+ else if (DataNavigateUrlFormatString.Length > 0)
+ return string.Format (DataNavigateUrlFormatString, dataUrlValues);
+ else
+ return dataUrlValues[0].ToString ();
+ }
+
+ protected virtual string FormatDataTextValue (object dataTextValue)
+ {
+ if (DataTextFormatString.Length > 0)
+ return string.Format (DataTextFormatString, dataTextValue);
+ else if (dataTextValue == null)
+ return "";
+ else
+ return dataTextValue.ToString ();
+ }
+
+ void OnDataBindField (object sender, EventArgs e)
+ {
+ DataControlFieldCell cell = (DataControlFieldCell) sender;
+ HyperLink link = (HyperLink) cell.Controls [0];
+ object controlContainer = cell.BindingContainer;
+ object item = DataBinder.GetDataItem (controlContainer);
+
+ if (DataTextField.Length > 0) {
+ if (textProperty == null) SetupProperties (controlContainer);
+ link.Text = FormatDataTextValue (textProperty.GetValue (item));
+ }
+
+ string[] urlFields = DataNavigateUrlFields;
+ if (urlFields.Length > 0) {
+ if (urlProperties == null) SetupProperties (controlContainer);
+ object[] dataUrlValues = new object [urlFields.Length];
+ for (int n=0; n<dataUrlValues.Length; n++)
+ dataUrlValues [n] = urlProperties [n].GetValue (item);
+ link.NavigateUrl = FormatDataNavigateUrlValue (dataUrlValues);
+ }
+ }
+
+ void SetupProperties (object controlContainer)
+ {
+ object item = DataBinder.GetDataItem (controlContainer);
+ PropertyDescriptorCollection props = TypeDescriptor.GetProperties (item);
+
+ if (DataTextField.Length > 0) {
+ textProperty = props [DataTextField];
+ if (textProperty == null)
+ new InvalidOperationException ("Property '" + DataTextField + "' not found in object of type " + item.GetType());
+ }
+
+ string[] urlFields = DataNavigateUrlFields;
+ if (urlFields.Length > 0) {
+ urlProperties = new PropertyDescriptor [urlFields.Length];
+ for (int n=0; n<urlFields.Length; n++) {
+ PropertyDescriptor prop = props [urlFields [n]];
+ if (prop == null)
+ new InvalidOperationException ("Property '" + urlFields [n] + "' not found in object of type " + item.GetType());
+ urlProperties [n] = prop;
+ }
+ }
+ }
+
+ protected override DataControlField CreateField ()
+ {
+ return new HyperLinkField ();
+ }
+
+ protected override void CopyProperties (DataControlField newField)
+ {
+ base.CopyProperties (newField);
+ HyperLinkField field = (HyperLinkField) newField;
+ field.DataNavigateUrlFields = DataNavigateUrlFields;
+ field.DataNavigateUrlFormatString = DataNavigateUrlFormatString;
+ field.DataTextField = DataTextField;
+ field.DataTextFormatString = DataTextFormatString;
+ field.NavigateUrl = NavigateUrl;
+ field.Target = Target;
+ field.Text = Text;
+ }
+
+ public override void ValidateSupportsCallback ()
+ {
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/IButtonControl.cs b/mcs/class/System.Web/System.Web.UI.WebControls/IButtonControl.cs
new file mode 100644
index 00000000000..37ce408eff0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/IButtonControl.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.UI.WebControls.IButtonControl.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI.WebControls
+{
+ public interface IButtonControl
+ {
+ bool CausesValidation { get; set; }
+ string CommandArgument { get; set; }
+ string CommandName { get; set; }
+ string PostBackUrl { get; set; }
+ string Text { get; set; }
+ string ValidationGroup { get; set; }
+
+ event EventHandler Click;
+ event CommandEventHandler Command;
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ICallbackContainer.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ICallbackContainer.cs
new file mode 100644
index 00000000000..20d11dbc702
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ICallbackContainer.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.WebControls.ICallbackContainer.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI.WebControls
+{
+ public interface ICallbackContainer
+ {
+ string GetCallbackScript (IButtonControl control, string argument);
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ICompositeControlDesignerAccessor.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ICompositeControlDesignerAccessor.cs
new file mode 100644
index 00000000000..74a463b2ffb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ICompositeControlDesignerAccessor.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.WebControls. ICompositeControlDesignerAccessor.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI.WebControls
+{
+ public interface ICompositeControlDesignerAccessor
+ {
+ void RecreateChildControls ();
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/IPostBackContainer.cs b/mcs/class/System.Web/System.Web.UI.WebControls/IPostBackContainer.cs
new file mode 100644
index 00000000000..6557873f15c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/IPostBackContainer.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.WebControls.IPostBackContainer.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public interface IPostBackContainer
+ {
+ PostBackOptions GetPostBackOptions (IButtonControl control);
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/IRepeatInfoUser.cs b/mcs/class/System.Web/System.Web.UI.WebControls/IRepeatInfoUser.cs
new file mode 100755
index 00000000000..462fb3a9c3c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/IRepeatInfoUser.cs
@@ -0,0 +1,50 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Interface: IRepeatInfoUser
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public interface IRepeatInfoUser
+ {
+ bool HasFooter { get; }
+ bool HasHeader { get; }
+ bool HasSeparators { get; }
+ int RepeatedItemCount { get; }
+ void RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer);
+ Style GetItemStyle(ListItemType itemType, int repeatIndex);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Image.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Image.cs
new file mode 100644
index 00000000000..8d0f1ecd426
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Image.cs
@@ -0,0 +1,198 @@
+//
+// System.Web.UI.WebControls.Image.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("ImageUrl")]
+ public class Image : WebControl
+ {
+ public Image(): base(HtmlTextWriterTag.Img)
+ {
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#endif
+ [DefaultValue (""), Bindable (true), WebCategory ("Appearance")]
+ [WebSysDescription ("An alternative text that is shown if the image cannot be displayed.")]
+ public virtual string AlternateText
+ {
+ get
+ {
+ object o = ViewState["AlternateText"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["AlternateText"] = value;
+ }
+ }
+
+ [Browsable (false), EditorBrowsable (EditorBrowsableState.Never)]
+ public override bool Enabled
+ {
+ get
+ {
+ return base.Enabled;
+ }
+ set
+ {
+ base.Enabled = value;
+ }
+ }
+
+ [Browsable (false), EditorBrowsable (EditorBrowsableState.Never)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public override FontInfo Font
+ {
+ get
+ {
+ return base.Font;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (ImageAlign), "NotSet"), WebCategory ("Layout")]
+ [WebSysDescription ("The alignment of the image.")]
+ public virtual ImageAlign ImageAlign
+ {
+ get
+ {
+ object o = ViewState["ImageAlign"];
+ if(o!=null)
+ return (ImageAlign)o;
+ return ImageAlign.NotSet;
+ }
+ set
+ {
+ ViewState["ImageAlign"] = value;
+ }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+ [UrlProperty]
+#endif
+ [DefaultValue (""), Bindable (true), WebCategory ("Appearance")]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [WebSysDescription ("The URL to the image file.")]
+ public virtual string ImageUrl
+ {
+ get
+ {
+ object o = ViewState["ImageUrl"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ImageUrl"] = value;
+ }
+ }
+
+#if NET_2_0
+ [WebCategory ("Accessibility")]
+ [DefaultValueAttribute ("")]
+ [UrlPropertyAttribute]
+ [EditorAttribute ("System.Web.UI.Design.UrlEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public string DescriptionUrl {
+ get {
+ object o = ViewState["DescriptionUrl"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set {
+ ViewState["DescriptionUrl"] = value;
+ }
+ }
+
+ [DefaultValueAttribute (false)]
+ [WebCategory ("Accessibility")]
+ public bool GenerateEmptyAlternateText {
+ get {
+ object o = ViewState["GenerateEmptyAlternateText"];
+ if(o!=null)
+ return (bool)o;
+ return false;
+ }
+ set {
+ ViewState["GenerateEmptyAlternateText"] = value;
+ }
+ }
+
+#endif
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(ImageUrl.Length > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Src, ResolveUrl(ImageUrl));
+ }
+
+#if NET_2_0
+ if (DescriptionUrl.Length > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Longdesc, DescriptionUrl);
+
+ if (AlternateText.Length > 0 || GenerateEmptyAlternateText)
+ writer.AddAttribute(HtmlTextWriterAttribute.Alt, AlternateText);
+#else
+ if (AlternateText.Length > 0)
+ writer.AddAttribute(HtmlTextWriterAttribute.Alt, AlternateText);
+#endif
+
+ if(BorderWidth.IsEmpty)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
+ }
+ if(ImageAlign != ImageAlign.NotSet)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Align, Enum.Format(typeof(ImageAlign), ImageAlign, "G"));
+ }
+ }
+
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ImageAlign.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ImageAlign.cs
new file mode 100755
index 00000000000..ba0ce08922f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ImageAlign.cs
@@ -0,0 +1,50 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ImageAlign
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ImageAlign
+ {
+ NotSet,
+ Left,
+ Right,
+ Baseline,
+ Top,
+ Middle,
+ Bottom,
+ AbsBottom,
+ AbsMiddle,
+ TextTop
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs
new file mode 100644
index 00000000000..3ce94d1c154
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs
@@ -0,0 +1,396 @@
+//
+// System.Web.UI.WebControls.ImageButton.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+#if NET_2_0
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.PreviewControlDesigner, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+#endif
+ [DefaultEvent("Click")]
+ public class ImageButton: Image, IPostBackDataHandler, IPostBackEventHandler
+#if NET_2_0
+ , IButtonControl
+#endif
+ {
+ private static readonly object ClickEvent = new object();
+ private static readonly object CommandEvent = new object();
+#if NET_2_0
+ private static readonly object ButtonClickEvent = new object();
+#endif
+
+ private int x, y;
+
+ public ImageButton(): base()
+ {
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#else
+ [Bindable (false)]
+#endif
+ [DefaultValue (true), WebCategory ("Behavior")]
+ [WebSysDescription ("Determines if validation is performed when clicked.")]
+ public bool CausesValidation
+ {
+ get
+ {
+ object o = ViewState["CausesValidation"];
+ if(o!=null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["CausesValidation"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (""), Bindable (true), WebCategory ("Behavior")]
+ [WebSysDescription ("An argument for the Command of this control.")]
+ public string CommandArgument
+ {
+ get
+ {
+ object o = ViewState["CommandArgument"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandArgument"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (""), WebCategory ("Behavior")]
+ [WebSysDescription ("The name of the Command of this control.")]
+ public string CommandName
+ {
+ get
+ {
+ object o = ViewState["CommandName"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandName"] = value;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ protected override HtmlTextWriterTag TagKey
+ {
+ get
+ {
+ return HtmlTextWriterTag.Input;
+ }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when the LinkButton is clicked.")]
+ public event ImageClickEventHandler Click
+ {
+ add
+ {
+ Events.AddHandler(ClickEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ClickEvent, value);
+ }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when a LinkButton Command is executed.")]
+ public event CommandEventHandler Command
+ {
+ add
+ {
+ Events.AddHandler(CommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(CommandEvent, value);
+ }
+ }
+
+#if NET_2_0
+ [BindableAttribute (true)]
+ [DefaultValueAttribute ("")]
+ public string SoftkeyLabel {
+ get {
+ string text = (string)ViewState["SoftkeyLabel"];
+ if (text!=null) return text;
+ return String.Empty;
+ }
+ set {
+ ViewState["SoftkeyLabel"] = value;
+ }
+ }
+
+ [ThemeableAttribute (false)]
+ [EditorAttribute ("System.Web.UI.Design.UrlEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [DefaultValueAttribute ("")]
+ [UrlProperty]
+ public string PostBackUrl {
+ get {
+ string text = (string)ViewState["PostBackUrl"];
+ if (text!=null) return text;
+ return String.Empty;
+ }
+ set {
+ ViewState["PostBackUrl"] = value;
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [ThemeableAttribute (false)]
+ [WebCategoryAttribute ("Behavior")]
+ public string OnClientClick {
+ get {
+ string text = (string)ViewState["OnClientClick"];
+ if (text!=null) return text;
+ return String.Empty;
+ }
+ set {
+ ViewState["OnClientClick"] = value;
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [ThemeableAttribute (false)]
+ [WebCategoryAttribute ("Behavior")]
+ public string ValidationGroup {
+ get {
+ string text = (string)ViewState["ValidationGroup"];
+ if (text!=null) return text;
+ return String.Empty;
+ }
+ set {
+ ViewState["ValidationGroup"] = value;
+ }
+ }
+
+ public string Text {
+ get { return AlternateText; }
+ set { AlternateText = value; }
+ }
+
+ event EventHandler IButtonControl.Click
+ {
+ add
+ {
+ Events.AddHandler (ButtonClickEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler (ButtonClickEvent, value);
+ }
+ }
+
+
+ protected virtual PostBackOptions GetPostBackOptions ()
+ {
+ PostBackOptions ops = new PostBackOptions (this);
+ if (PostBackUrl != "")
+ ops.ActionUrl = PostBackUrl;
+ ops.PerformValidation = Page.Validators.Count > 0 && CausesValidation;
+ if (ops.PerformValidation && ValidationGroup != "")
+ ops.ValidationGroup = ValidationGroup;
+ ops.RequiresJavaScriptProtocol = false;
+ return ops;
+ }
+#endif
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Type, "image");
+ writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);
+
+#if NET_2_0
+ if (Page != null && Enabled) {
+ string script = "";
+
+ script = OnClientClick;
+ if (script.Length > 0) script += ";";
+
+ PostBackOptions ops = GetPostBackOptions ();
+ if (ops.RequiresSpecialPostBack || ops.ClientSubmit) {
+ script += Page.ClientScript.GetPostBackEventReference (ops);
+ }
+ else if (CausesValidation && Page.Validators.Count > 0) {
+ script += Utils.GetClientValidatedEvent (Page);
+ }
+
+ if (script != "") {
+ writer.AddAttribute (HtmlTextWriterAttribute.Onclick, script);
+ writer.AddAttribute ("language", "javascript");
+ }
+ }
+
+ if (!Enabled)
+ writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+#else
+ if (Page != null && CausesValidation && Page.Validators.Count > 0) {
+ writer.AddAttribute (HtmlTextWriterAttribute.Onclick, Utils.GetClientValidatedEvent (Page));
+ writer.AddAttribute ("language", "javascript");
+ }
+#endif
+ base.AddAttributesToRender(writer);
+ }
+
+ protected virtual void OnClick(ImageClickEventArgs e)
+ {
+ if(Events != null)
+ {
+ ImageClickEventHandler iceh = (ImageClickEventHandler)(Events[ClickEvent]);
+ if(iceh != null)
+ iceh(this, e);
+
+#if NET_2_0
+ EventHandler eh = (EventHandler) (Events [ButtonClickEvent]);
+ if(eh != null)
+ eh (this, e);
+#endif
+ }
+ }
+
+ protected virtual void OnCommand(CommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ CommandEventHandler ceh = (CommandEventHandler)(Events[CommandEvent]);
+ if(ceh != null)
+ ceh(this, e);
+ RaiseBubbleEvent(this, e);
+ }
+ }
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ if(Page != null)
+ {
+ Page.RegisterRequiresPostBack(this);
+ }
+ }
+
+#if NET_2_0
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ return LoadPostData (postDataKey, postCollection);
+ }
+
+ protected virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection)
+#else
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+#endif
+ {
+ string xCoord = postCollection[UniqueID + ".x"];
+ string yCoord = postCollection[UniqueID + ".y"];
+ string id = postCollection[UniqueID];
+ if(xCoord != null && yCoord != null && xCoord.Length > 0 && yCoord.Length > 0)
+ {
+ x = Int32.Parse(xCoord);
+ y = Int32.Parse(yCoord);
+ Page.RegisterRequiresRaiseEvent(this);
+ } else if (id != null)
+ {
+ //
+ // This is a workaround for bug #49819. It appears that the .x and .y
+ // values are not being posted, and only the x value is being posted
+ // with the ctrl's id as the key.
+ //
+ x = Int32.Parse (id);
+ Page.RegisterRequiresRaiseEvent (this);
+ }
+ return false;
+ }
+
+#if NET_2_0
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ RaisePostDataChangedEvent ();
+ }
+
+ protected virtual void RaisePostDataChangedEvent ()
+ {
+ }
+#else
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ }
+#endif
+
+
+#if NET_2_0
+ void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
+ {
+ RaisePostBackEvent (eventArgument);
+ }
+
+ protected virtual void RaisePostBackEvent(string eventArgument)
+ {
+ if(CausesValidation)
+ Page.Validate (ValidationGroup);
+
+ OnClick(new ImageClickEventArgs(x, y));
+ OnCommand(new CommandEventArgs(CommandName, CommandArgument));
+ }
+#else
+ void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
+ {
+ if(CausesValidation)
+ Page.Validate ();
+
+ OnClick(new ImageClickEventArgs(x, y));
+ OnCommand(new CommandEventArgs(CommandName, CommandArgument));
+ }
+#endif
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ImageField.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ImageField.cs
new file mode 100644
index 00000000000..e8513fe47bc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ImageField.cs
@@ -0,0 +1,329 @@
+//
+// System.Web.UI.WebControls.ImageField.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Security.Permissions;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls {
+
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public class ImageField : DataControlField
+ {
+ public static readonly string ThisExpression = "!";
+
+ PropertyDescriptor imageProperty;
+ PropertyDescriptor textProperty;
+
+ public override bool Initialize (bool sortingEnabled, Control control)
+ {
+ return base.Initialize (sortingEnabled, control);
+ }
+
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Appearance")]
+ [LocalizableAttribute (true)]
+ public virtual string AlternateText {
+ get {
+ object ob = ViewState ["AlternateText"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["AlternateText"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValueAttribute (true)]
+ [WebCategoryAttribute ("Behavior")]
+ public virtual bool ConvertEmptyStringToNull {
+ get {
+ object ob = ViewState ["ConvertEmptyStringToNull"];
+ if (ob != null) return (bool) ob;
+ return true;
+ }
+ set {
+ ViewState ["ConvertEmptyStringToNull"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [TypeConverterAttribute ("System.Web.UI.Design.DataSourceViewSchemaConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [WebCategoryAttribute ("Data")]
+ [DefaultValueAttribute ("")]
+ public virtual string DataAlternateTextField {
+ get {
+ object ob = ViewState ["DataAlternateTextField"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["DataAlternateTextField"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Data")]
+ [DefaultValueAttribute ("")]
+ public virtual string DataAlternateTextFormatString {
+ get {
+ object ob = ViewState ["DataAlternateTextFormatString"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["DataAlternateTextFormatString"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [TypeConverterAttribute ("System.Web.UI.Design.DataSourceViewSchemaConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [WebCategoryAttribute ("Data")]
+ [DefaultValueAttribute ("")]
+ public virtual string DataImageUrlField {
+ get {
+ object ob = ViewState ["DataImageUrlField"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["DataImageUrlField"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Data")]
+ [DefaultValueAttribute ("")]
+ public virtual string DataImageUrlFormatString {
+ get {
+ object ob = ViewState ["DataImageUrlFormatString"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["DataImageUrlFormatString"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Behavior")]
+ [LocalizableAttribute (true)]
+ public virtual string NullDisplayText {
+ get {
+ object ob = ViewState ["NullDisplayText"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["NullDisplayText"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [UrlPropertyAttribute]
+ [WebCategoryAttribute ("Behavior")]
+ public virtual string NullImageUrl {
+ get {
+ object ob = ViewState ["NullImageUrl"];
+ if (ob != null) return (string) ob;
+ return "";
+ }
+ set {
+ ViewState ["NullImageUrl"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (false)]
+ public bool ReadOnly {
+ get {
+ object val = ViewState ["ReadOnly"];
+ return val != null ? (bool) val : false;
+ }
+ set {
+ ViewState ["ReadOnly"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ public override void ExtractValuesFromCell (IOrderedDictionary dictionary,
+ DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
+ {
+ if ((ReadOnly && !includeReadOnly) || cell.Controls.Count == 0) return;
+
+ bool editable = (rowState & (DataControlRowState.Edit | DataControlRowState.Insert)) != 0;
+ if (editable && !ReadOnly) {
+ TextBox box = cell.Controls [0] as TextBox;
+ dictionary [DataImageUrlField] = box.Text;
+ } else if (includeReadOnly) {
+ Image img = cell.Controls [0] as Image;
+ dictionary [DataImageUrlField] = img.ImageUrl;
+ }
+ }
+
+ public override void InitializeCell (DataControlFieldCell cell,
+ DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
+ {
+ base.InitializeCell (cell, cellType, rowState, rowIndex);
+ if (cellType == DataControlCellType.DataCell) {
+ InitializeDataCell (cell, rowState);
+ if ((rowState & DataControlRowState.Insert) == 0)
+ cell.DataBinding += new EventHandler (OnDataBindField);
+ }
+ }
+
+ public virtual void InitializeDataCell (DataControlFieldCell cell, DataControlRowState rowState)
+ {
+ bool editable = (rowState & (DataControlRowState.Edit | DataControlRowState.Insert)) != 0;
+ if (editable && !ReadOnly) {
+ TextBox box = new TextBox ();
+ cell.Controls.Add (box);
+ } else {
+ Image img = new Image ();
+ cell.Controls.Add (img);
+ }
+ }
+
+ protected virtual string FormatImageUrlValue (object value)
+ {
+ if (value == null || (value.ToString().Length == 0 && ConvertEmptyStringToNull))
+ return NullImageUrl;
+ else if (DataImageUrlFormatString.Length > 0)
+ return string.Format (DataImageUrlFormatString, value);
+ else
+ return value.ToString ();
+ }
+
+ protected virtual string GetFormattedAlternateText (Control controlContainer)
+ {
+ if (DataAlternateTextField.Length > 0)
+ {
+ if (textProperty == null)
+ textProperty = GetProperty (controlContainer, DataAlternateTextField);
+
+ object value = GetValue (controlContainer, DataAlternateTextField, ref textProperty);
+
+ if (value == null || (value.ToString().Length == 0 && ConvertEmptyStringToNull))
+ return NullDisplayText;
+ else if (DataAlternateTextFormatString.Length > 0)
+ return string.Format (DataAlternateTextFormatString, value);
+ else
+ return value.ToString ();
+ }
+ else
+ return AlternateText;
+
+ }
+
+ protected virtual object GetValue (Control controlContainer, string fieldName, ref PropertyDescriptor cachedDescriptor)
+ {
+ if (DesignMode)
+ return GetDesignTimeValue ();
+ else {
+ if (fieldName == ThisExpression)
+ return controlContainer.ToString ();
+ else {
+ IDataItemContainer dic = (IDataItemContainer) controlContainer;
+ if (cachedDescriptor != null) return cachedDescriptor.GetValue (dic.DataItem);
+ PropertyDescriptor prop = GetProperty (controlContainer, fieldName);
+ return prop.GetValue (dic.DataItem);
+ }
+ }
+ }
+
+ PropertyDescriptor GetProperty (Control controlContainer, string fieldName)
+ {
+ IDataItemContainer dic = (IDataItemContainer) controlContainer;
+ PropertyDescriptor prop = TypeDescriptor.GetProperties (dic.DataItem) [fieldName];
+ if (prop == null)
+ new InvalidOperationException ("Property '" + fieldName + "' not found in object of type " + dic.DataItem.GetType());
+ return prop;
+ }
+
+ protected virtual string GetDesignTimeValue ()
+ {
+ return "Databound";
+ }
+
+ protected virtual void OnDataBindField (object sender, EventArgs e)
+ {
+ DataControlFieldCell cell = (DataControlFieldCell) sender;
+
+ if (imageProperty == null)
+ imageProperty = GetProperty (cell.BindingContainer, DataImageUrlField);
+
+ Control c = cell.Controls [0];
+ if (c is TextBox) {
+ object val = GetValue (cell.BindingContainer, DataImageUrlField, ref imageProperty);
+ ((TextBox)c).Text = val != null ? val.ToString() : "";
+ }
+ else if (c is Image) {
+ Image img = (Image)c;
+ img.ImageUrl = FormatImageUrlValue (GetValue (cell.BindingContainer, DataImageUrlField, ref imageProperty));
+ img.AlternateText = GetFormattedAlternateText (cell.BindingContainer);
+ }
+ }
+
+ public override void ValidateSupportsCallback ()
+ {
+ }
+
+ protected override DataControlField CreateField ()
+ {
+ return new ImageField ();
+ }
+
+ protected override void CopyProperties (DataControlField newField)
+ {
+ base.CopyProperties (newField);
+ ImageField field = (ImageField) newField;
+ field.AlternateText = AlternateText;
+ field.ConvertEmptyStringToNull = ConvertEmptyStringToNull;
+ field.DataAlternateTextField = DataAlternateTextField;
+ field.DataAlternateTextFormatString = DataAlternateTextFormatString;
+ field.DataImageUrlField = DataImageUrlField;
+ field.DataImageUrlFormatString = DataImageUrlFormatString;
+ field.NullDisplayText = NullDisplayText;
+ field.NullImageUrl = NullImageUrl;
+ field.ReadOnly = ReadOnly;
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ImageFieldMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ImageFieldMode.cs
new file mode 100644
index 00000000000..26da1b8f31d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ImageFieldMode.cs
@@ -0,0 +1,35 @@
+//
+// System.Web.UI.WebControls.ImageFieldMode.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum ImageFieldMode {
+ ImageData = 0,
+ ImageUrl = 1
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ImageMapEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ImageMapEventArgs.cs
new file mode 100644
index 00000000000..7008fc1b35f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ImageMapEventArgs.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.UI.WebControls.ImageMapEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls
+{
+ public class ImageMapEventArgs : EventArgs
+ {
+ private string value;
+
+ public ImageMapEventArgs (string value)
+ {
+ this.value = value;
+ }
+
+ public string PostBackValue {
+ get { return value; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ImageMapEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ImageMapEventHandler.cs
new file mode 100644
index 00000000000..6ba2eb7485a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ImageMapEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.ImageMapEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void ImageMapEventHandler (object sender, ImageMapEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Label.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Label.cs
new file mode 100644
index 00000000000..0321c101503
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Label.cs
@@ -0,0 +1,153 @@
+//
+// System.Web.UI.WebControls.Label.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+#if NET_2_0
+ [ControlValuePropertyAttribute ("Text")]
+#endif
+ [DefaultProperty("Text")]
+ [Designer("System.Web.UI.Design.WebControls.LabelDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ [DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
+ [ControlBuilder(typeof(LabelControlBuilder))]
+ [ParseChildren(false)]
+ [ToolboxData("<{0}:Label runat=\"server\">Label</{0}:Label>")]
+ public class Label : WebControl
+#if NET_2_0
+ , ITextControl
+#endif
+ {
+ public Label (): base ()
+ {
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#endif
+ [DefaultValue (""), Bindable (true), WebCategory ("Appearance")]
+ [PersistenceMode (PersistenceMode.InnerDefaultProperty)]
+ [WebSysDescription ("The text that should be shown on this Label.")]
+ public virtual string Text
+ {
+ get {
+ object o = ViewState ["Text"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["Text"] = value; }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+ [DefaultValueAttribute ("")]
+ [IDReferencePropertyAttribute (typeof(System.Web.UI.Control))]
+ [WebCategory ("Accessibility")]
+ [TypeConverterAttribute (typeof(AssociatedControlConverter))]
+ public string AssociatedControlID
+ {
+ get {
+ object o = ViewState ["AssociatedControlID"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["AssociatedControlID"] = value; }
+ }
+
+
+ protected override HtmlTextWriterTag TagKey {
+ get {
+ if (AssociatedControlID.Length == 0)
+ return HtmlTextWriterTag.Span;
+ else
+ return HtmlTextWriterTag.Label;
+ }
+ }
+
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ if (AssociatedControlID.Length > 0) {
+ Control ctrl = Page.FindControl (AssociatedControlID);
+ if (ctrl != null)
+ writer.AddAttribute (HtmlTextWriterAttribute.For, ctrl.ClientID);
+ }
+
+ base.AddAttributesToRender (writer);
+
+ }
+#endif
+
+
+ protected override void AddParsedSubObject (object obj)
+ {
+ if(HasControls ()){
+ base.AddParsedSubObject (obj);
+ return;
+ }
+
+ if(obj is LiteralControl){
+ Text = ((LiteralControl) obj).Text;
+ return;
+ }
+
+ if(Text.Length > 0){
+ base.AddParsedSubObject (new LiteralControl (Text));
+ Text = String.Empty;
+ }
+
+ base.AddParsedSubObject (obj);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if(savedState != null) {
+ base.LoadViewState (savedState);
+ string savedText = ViewState ["Text"] as string;
+ if(savedText != null)
+ Text = savedText;
+ }
+ }
+
+ protected override void RenderContents (HtmlTextWriter writer)
+ {
+ if(HasControls ())
+ base.RenderContents (writer);
+ else
+ writer.Write (Text);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LabelControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LabelControlBuilder.cs
new file mode 100644
index 00000000000..adcc858306d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LabelControlBuilder.cs
@@ -0,0 +1,48 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: LabelControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public class LabelControlBuilder : ControlBuilder
+ {
+ public LabelControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs
new file mode 100644
index 00000000000..43525a40382
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs
@@ -0,0 +1,322 @@
+//
+// System.Web.UI.WebControls.LinkButton.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("Click")]
+ [DefaultProperty("Text")]
+ [ControlBuilder(typeof(LinkButtonControlBuilder))]
+ [Designer("System.Web.UI.Design.WebControls.LinkButtonDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ [DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
+ [ParseChildren(false)]
+ [ToolboxData("<{0}:LinkButton runat=\"server\">LinkButton</{0}:LinkButton>")]
+ public class LinkButton : WebControl, IPostBackEventHandler
+#if NET_2_0
+ , IButtonControl
+#endif
+ {
+ private static readonly object ClickEvent = new object();
+ private static readonly object CommandEvent = new object();
+
+ public LinkButton () : base (HtmlTextWriterTag.A)
+ {
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#else
+ [Bindable (false)]
+#endif
+ [DefaultValue (true), WebCategory ("Behavior")]
+ [WebSysDescription ("Determines if validation is performed when clicked.")]
+ public bool CausesValidation
+ {
+ get {
+ object o = ViewState ["CausesValidation"];
+ return (o == null) ? true : (bool) o;
+ }
+
+ set { ViewState ["CausesValidation"] = value; }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (""), Bindable (true), WebCategory ("Behavior")]
+ [WebSysDescription ("An argument for the Command of this control.")]
+ public string CommandArgument
+ {
+ get {
+ object o = ViewState ["CommandArgument"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["CommandArgument"] = value; }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (""), WebCategory ("Behavior")]
+ [WebSysDescription ("The name of the Command of this control.")]
+ public string CommandName
+ {
+ get {
+ object o = ViewState ["CommandName"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["CommandName"] = value; }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#endif
+ [DefaultValue (""), Bindable (true), WebCategory ("Appearance")]
+ [PersistenceMode (PersistenceMode.InnerDefaultProperty)]
+ [WebSysDescription ("The text that should be shown on this LinkButton.")]
+ public virtual string Text
+ {
+ get {
+ object o = ViewState ["Text"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["Text"] = value; }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+ [EditorAttribute ("System.Web.UI.Design.UrlEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [DefaultValueAttribute ("")]
+ [UrlProperty]
+ public string PostBackUrl {
+ get {
+ string text = (string)ViewState["PostBackUrl"];
+ if (text!=null) return text;
+ return String.Empty;
+ }
+ set {
+ ViewState["PostBackUrl"] = value;
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [ThemeableAttribute (false)]
+ [WebCategoryAttribute ("Behavior")]
+ public string ValidationGroup {
+ get {
+ string text = (string)ViewState["ValidationGroup"];
+ if (text!=null) return text;
+ return String.Empty;
+ }
+ set {
+ ViewState["ValidationGroup"] = value;
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [ThemeableAttribute (false)]
+ [WebCategoryAttribute ("Behavior")]
+ public string OnClientClick {
+ get {
+ string text = (string)ViewState["OnClientClick"];
+ if (text!=null) return text;
+ return String.Empty;
+ }
+ set {
+ ViewState["OnClientClick"] = value;
+ }
+ }
+
+ protected virtual PostBackOptions GetPostBackOptions ()
+ {
+ PostBackOptions ops = new PostBackOptions (this);
+ if (PostBackUrl != "")
+ ops.ActionUrl = PostBackUrl;
+ ops.PerformValidation = Page.Validators.Count > 0 && CausesValidation;
+ if (ops.PerformValidation && ValidationGroup != "")
+ ops.ValidationGroup = ValidationGroup;
+ ops.RequiresJavaScriptProtocol = false;
+ return ops;
+ }
+#endif
+
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when the LinkButton is clicked.")]
+ public event EventHandler Click
+ {
+ add { Events.AddHandler(ClickEvent, value); }
+ remove { Events.RemoveHandler(ClickEvent, value); }
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when a LinkButton Command is executed.")]
+ public event CommandEventHandler Command
+ {
+ add { Events.AddHandler(CommandEvent, value); }
+ remove { Events.RemoveHandler(CommandEvent, value); }
+ }
+
+ protected virtual void OnClick (EventArgs e)
+ {
+ if(Events != null){
+ EventHandler eh = (EventHandler) (Events [ClickEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+ }
+
+ protected virtual void OnCommand (CommandEventArgs e)
+ {
+ if(Events != null){
+ CommandEventHandler ceh = (CommandEventHandler) (Events [CommandEvent]);
+ if (ceh != null)
+ ceh (this, e);
+ }
+ RaiseBubbleEvent (this, e);
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender(e);
+ }
+
+#if NET_2_0
+ void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
+ {
+ RaisePostBackEvent (eventArgument);
+ }
+
+ protected virtual void RaisePostBackEvent (string eventArgument)
+ {
+ if (CausesValidation)
+ Page.Validate (ValidationGroup);
+ OnClick (EventArgs.Empty);
+ OnCommand (new CommandEventArgs (CommandName, CommandArgument));
+ }
+#else
+ void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
+ {
+ if (CausesValidation)
+ Page.Validate ();
+ OnClick (EventArgs.Empty);
+ OnCommand (new CommandEventArgs (CommandName, CommandArgument));
+ }
+#endif
+
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender (writer);
+#if NET_2_0
+ if (Page != null && Enabled) {
+
+ if (OnClientClick != "")
+ writer.AddAttribute (HtmlTextWriterAttribute.Onclick, OnClientClick);
+
+ string script = "";
+
+ PostBackOptions ops = GetPostBackOptions ();
+ if (ops.RequiresSpecialPostBack || ops.ClientSubmit) {
+ script = Page.ClientScript.GetPostBackEventReference (ops);
+ }
+ else if (CausesValidation && Page.Validators.Count > 0) {
+ script = Utils.GetClientValidatedPostBack (this);
+ }
+ else {
+ script = Page.ClientScript.GetPostBackClientEvent (this,"");
+ }
+ if (script != "")
+ writer.AddAttribute (HtmlTextWriterAttribute.Href, "javascript:" + script);
+ }
+
+#else
+ if (Enabled && Page != null){
+ if (CausesValidation && Page.Validators.Count > 0){
+ writer.AddAttribute (HtmlTextWriterAttribute.Href,
+ "javascript:" +
+ Utils.GetClientValidatedPostBack (this));
+ return;
+ }
+ writer.AddAttribute (HtmlTextWriterAttribute.Href,
+ Page.ClientScript.GetPostBackClientHyperlink (this, ""));
+ }
+#endif
+ }
+
+ protected override void AddParsedSubObject (object obj)
+ {
+ if (HasControls ()){
+ base.AddParsedSubObject (obj);
+ return;
+ }
+
+ if (obj is LiteralControl){
+ Text = ((LiteralControl) obj).Text;
+ return;
+ }
+
+ if (Text.Length > 0){
+ base.AddParsedSubObject (new LiteralControl (Text));
+ Text = String.Empty;
+ }
+
+ base.AddParsedSubObject (obj);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState != null){
+ base.LoadViewState (savedState);
+ string savedText = (string) ViewState ["Text"];
+ if (savedText != null)
+ Text = savedText;
+ }
+ }
+
+ protected override void RenderContents (HtmlTextWriter writer)
+ {
+ if (HasControls ()){
+ base.RenderContents (writer);
+ return;
+ }
+ writer.Write (Text);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonControlBuilder.cs
new file mode 100644
index 00000000000..2afd2d5468c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonControlBuilder.cs
@@ -0,0 +1,52 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: LinkButtonControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class LinkButtonControlBuilder : ControlBuilder
+ {
+ public LinkButtonControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonInternal.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonInternal.cs
new file mode 100644
index 00000000000..560ac381f66
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonInternal.cs
@@ -0,0 +1,76 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: LinkButtonInternal
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Drawing;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ internal class LinkButtonInternal : LinkButton
+ {
+ public LinkButtonInternal() : base()
+ {
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ SetForeColor();
+ base.Render(writer);
+ }
+
+ private void SetForeColor()
+ {
+ if(!ControlStyle.IsSet(System.Web.UI.WebControls.Style.FORECOLOR))
+ {
+ Control ctrl = this;
+ Color foreCol;
+ int ctr = 0;
+ //FIXME: this-> LinkButton-> WebControl
+ while(ctr < 2)
+ {
+ ctrl = ctrl.Parent;
+ foreCol = ((WebControl)ctrl).ForeColor;
+ if(foreCol != Color.Empty)
+ {
+ ForeColor = foreCol;
+ return;
+ }
+ ctr++;
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs
new file mode 100644
index 00000000000..73713735d70
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs
@@ -0,0 +1,241 @@
+//
+// System.Web.UI.WebControls.ListBox.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Drawing;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ValidationProperty("SelectedItem")]
+ public class ListBox : ListControl, IPostBackDataHandler
+ {
+ public ListBox () : base ()
+ {
+ }
+
+ [Browsable (false)]
+ public override Color BorderColor
+ {
+ get { return base.BorderColor; }
+ set { base.BorderColor = value; }
+ }
+
+ [Browsable (false)]
+ public override BorderStyle BorderStyle
+ {
+ get { return base.BorderStyle; }
+ set { base.BorderStyle = value; }
+ }
+
+ [Browsable (false)]
+ public override Unit BorderWidth
+ {
+ get { return base.BorderWidth; }
+ set { base.BorderWidth = value; }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (4), WebCategory ("Appearance")]
+ [WebSysDescription ("The number of rows displayed by the control.")]
+ public virtual int Rows
+ {
+ get {
+ object o = ViewState ["Rows"];
+ return (o == null) ? 4 : (int) o;
+ }
+
+ set {
+ if (value < 1 || value > 2000)
+ throw new ArgumentOutOfRangeException ("value", "Rows value has to be >= 0 and <= 2000.");
+
+ ViewState ["Rows"] = value;
+ }
+ }
+
+ [DefaultValue (typeof (ListSelectionMode), "Single"), WebCategory ("Behavior")]
+ [WebSysDescription ("The mode describing how the entries can be selected.")]
+ public virtual ListSelectionMode SelectionMode
+ {
+ get
+ {
+ object o = ViewState ["SelectionMode"];
+ return (o == null) ? ListSelectionMode.Single : (ListSelectionMode) o;
+ }
+ set
+ {
+ if (!Enum.IsDefined (typeof (ListSelectionMode), value))
+ throw new ArgumentOutOfRangeException ("value", "Only valid enumeration members are allowed");
+ ViewState ["SelectionMode"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Bindable (false), EditorBrowsable (EditorBrowsableState.Never)]
+ public override string ToolTip
+ {
+ get { return String.Empty; }
+ set { /* Don't do anything. */ }
+ }
+#endif
+
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ if (Page != null)
+ Page.VerifyRenderingInServerForm (this);
+
+ writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
+ base.AddAttributesToRender (writer);
+ writer.AddAttribute (HtmlTextWriterAttribute.Size,
+ Rows.ToString (NumberFormatInfo.InvariantInfo));
+
+ if (SelectionMode == ListSelectionMode.Multiple)
+ writer.AddAttribute (HtmlTextWriterAttribute.Multiple, "multiple");
+
+ if (AutoPostBack && Page != null){
+ writer.AddAttribute (HtmlTextWriterAttribute.Onchange,
+ Page.ClientScript.GetPostBackClientEvent (this, ""));
+ writer.AddAttribute ("language", "javascript");
+ }
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+ if (Page != null && SelectionMode == ListSelectionMode.Multiple && Enabled)
+ Page.RegisterRequiresPostBack(this);
+ }
+
+#if !NET_2_0
+ protected override void RenderContents (HtmlTextWriter writer)
+ {
+ bool isMultAllowed = (SelectionMode == ListSelectionMode.Multiple);
+ bool selMade = false;
+ foreach (ListItem current in Items){
+ writer.WriteBeginTag ("option");
+ if (current.Selected){
+ if (!isMultAllowed && selMade)
+ throw new HttpException ("Cannot_MultiSelect_In_Single_Mode");
+ selMade = true;
+ writer.WriteAttribute ("selected", "selected");
+ }
+ writer.WriteAttribute ("value", current.Value, true);
+ writer.Write ('>');
+ writer.Write (HttpUtility.HtmlEncode (current.Text));
+ writer.WriteEndTag ("option");
+ writer.WriteLine ();
+ }
+ }
+#endif
+
+#if NET_2_0
+ public int[] GetSelectedIndices ()
+ {
+ return (int[]) SelectedIndices.ToArray (typeof(int));
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+ {
+ return LoadPostData (postDataKey, postCollection);
+ }
+
+ protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
+#else
+ bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+#endif
+ {
+ string[] vals = postCollection.GetValues (postDataKey);
+ bool updated = false;
+ if (vals != null){
+ if (SelectionMode == ListSelectionMode.Single){
+ int index = Items.FindByValueInternal (vals [0]);
+ if (SelectedIndex != index){
+ SelectedIndex = index;
+ updated = true;
+ }
+ } else {
+ ArrayList indices = SelectedIndices;
+ int length = vals.Length;
+ ArrayList final = new ArrayList (length);
+ foreach (string current in vals)
+ final.Add (Items.FindByValueInternal (current));
+
+ if (indices.Count == length) {
+ for (int ctr = 0; ctr < length; ctr++){
+ if (((int) final [ctr]) != ((int) indices [ctr])){
+ updated = true;
+ break;
+ }
+ }
+ } else {
+ updated = true;
+ }
+ if (updated)
+ Select (final);
+ }
+ } else {
+ if (SelectedIndex != -1)
+ SelectedIndex = -1;
+ updated = true;
+ }
+ return updated;
+ }
+
+#if NET_2_0
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ RaisePostDataChangedEvent ();
+ }
+
+ protected virtual void RaisePostDataChangedEvent ()
+ {
+ if (CausesValidation)
+ Page.Validate (ValidationGroup);
+
+ OnSelectedIndexChanged (EventArgs.Empty);
+ }
+#else
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnSelectedIndexChanged (EventArgs.Empty);
+ }
+#endif
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs
new file mode 100644
index 00000000000..2ccb369a372
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs
@@ -0,0 +1,640 @@
+//
+// System.Web.UI.WebControls.ListControl.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Web;
+using System.Web.UI;
+using System.Web.Util;
+
+namespace System.Web.UI.WebControls
+{
+#if NET_2_0
+ [ControlValuePropertyAttribute ("SelectedValue")]
+#else
+ [DefaultProperty("DataSource")]
+#endif
+ [DefaultEvent("SelectedIndexChanged")]
+ [Designer ("System.Web.UI.Design.WebControls.ListControlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ [DataBindingHandler("System.Web.UI.Design.ListControlDataBindingHandler, " + Consts.AssemblySystem_Design)]
+ [ParseChildren(true, "Items")]
+ public abstract class ListControl :
+ #if NET_2_0
+ DataBoundControl
+ #else
+ WebControl
+ #endif
+ {
+ private static readonly object SelectedIndexChangedEvent = new object();
+
+ #if !NET_2_0
+ private object dataSource;
+ #endif
+
+ private ListItemCollection items;
+
+ private int cachedSelectedIndex = -1;
+ private string cachedSelectedValue;
+
+ #if !NET_2_0
+ public ListControl(): base(HtmlTextWriterTag.Select)
+ {
+ }
+ #else
+
+ ArrayList selectedIndices;
+
+ protected override HtmlTextWriterTag TagKey {
+ get { return HtmlTextWriterTag.Select; }
+ }
+ #endif
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when the selected index entry has changed.")]
+ public event EventHandler SelectedIndexChanged
+ {
+ add
+ {
+ Events.AddHandler(SelectedIndexChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(SelectedIndexChangedEvent, value);
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (false), WebCategory ("Behavior")]
+ [WebSysDescription ("The control automatically posts back after changing the text.")]
+ public virtual bool AutoPostBack
+ {
+ get
+ {
+ object o = ViewState["AutoPostBack"];
+ if(o!=null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["AutoPostBack"] = value;
+ }
+ }
+
+ #if !NET_2_0
+ [DefaultValue (""), WebCategory ("Data")]
+ [WebSysDescription ("The name of the table that is used for binding when a DataSource is specified.")]
+ public virtual string DataMember
+ {
+ get
+ {
+ object o = ViewState["DataMember"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataMember"] = value;
+ }
+ }
+
+
+ [DefaultValue (null), Bindable (true), WebCategory ("Data")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The DataSource that is used for data-binding.")]
+ public virtual object DataSource
+ {
+ get
+ {
+ return dataSource;
+ }
+ set
+ {
+ if(value == null || value is IListSource || value is IEnumerable) {
+ dataSource = value;
+ return;
+ }
+ throw new ArgumentException(HttpRuntime.FormatResourceString(ID, "Invalid DataSource Type"));
+ }
+ }
+ #endif
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (""), WebCategory ("Data")]
+ [WebSysDescription ("The field in the datatable that provides the text entry.")]
+ public virtual string DataTextField
+ {
+ get
+ {
+ object o = ViewState["DataTextField"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataTextField"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (""), WebCategory ("Data")]
+ [WebSysDescription ("Specifies a formatting rule for the texts that are returned.")]
+ public virtual string DataTextFormatString
+ {
+ get
+ {
+ object o = ViewState["DataTextFormatString"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataTextFormatString"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (""), WebCategory ("Data")]
+ [WebSysDescription ("The field in the datatable that provides the entry value.")]
+ public virtual string DataValueField
+ {
+ get
+ {
+ object o = ViewState["DataValueField"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataValueField"] = value;
+ }
+ }
+
+#if NET_2_0
+ [Editor ("System.Web.UI.Design.WebControls.ListItemsCollectionEditor,System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+#endif
+ [DefaultValue (null), MergableProperty (false), WebCategory ("Misc")]
+ [PersistenceMode (PersistenceMode.InnerDefaultProperty)]
+ [WebSysDescription ("A collection of all items contained in this list.")]
+ public virtual ListItemCollection Items
+ {
+ get
+ {
+ if(items==null)
+ {
+ items = new ListItemCollection();
+
+ if(IsTrackingViewState)
+ {
+ items.TrackViewState();
+ }
+ }
+ return items;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (0), Bindable (true), WebCategory ("Misc")]
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The index number of the currently selected ListItem.")]
+ public virtual int SelectedIndex
+ {
+ get {
+ ListItemCollection items = Items;
+ int last = items.Count;
+ for (int i = 0; i < last; i++) {
+ if (items [i].Selected)
+ return i;
+ }
+ return -1;
+ }
+ set {
+ if (Items.Count == 0)
+ {
+ cachedSelectedIndex = value;
+ return;
+ }
+ if ((value < -1) || (value >= Items.Count))
+ throw new ArgumentOutOfRangeException ();
+
+ ClearSelection ();
+ if (value != -1)
+ Items [value].Selected = true;
+ }
+ }
+
+ [DefaultValue (null), WebCategory ("Misc")]
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The currently selected ListItem.")]
+ public virtual ListItem SelectedItem
+ {
+ get
+ {
+ int idx = SelectedIndex;
+ if (idx < 0)
+ return null;
+
+ return Items [idx];
+ }
+ }
+
+#if NET_1_1
+ #if NET_2_0
+ [ThemeableAttribute (false)]
+ #endif
+ [DefaultValue (""), Bindable (true), WebCategory ("Misc")]
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The value of the currently selected ListItem.")]
+ public virtual string SelectedValue {
+ get {
+ int idx = SelectedIndex;
+ if (idx == -1)
+ return "";
+
+ return Items [idx].Value;
+ }
+
+ set {
+ ListItem item = null;
+
+ if (value != null) {
+ if (Items.Count > 0) {
+ item = Items.FindByValue (value);
+ if (item == null)
+ throw new ArgumentOutOfRangeException ("value");
+ } else {
+ cachedSelectedValue = value;
+ return;
+ }
+ }
+
+ ClearSelection ();
+ if (item != null)
+ item.Selected = true;
+ }
+ }
+#endif
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+ [DefaultValue (false), WebCategory ("Behavior")]
+ [WebSysDescription ("Determines if validation is performed when clicked.")]
+ public bool CausesValidation
+ {
+ get
+ {
+ Object cv = ViewState["CausesValidation"];
+ if(cv!=null)
+ return (Boolean)cv;
+ return true;
+ }
+ set
+ {
+ ViewState["CausesValidation"] = value;
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [ThemeableAttribute (false)]
+ [WebCategoryAttribute ("Behavior")]
+ public string ValidationGroup {
+ get {
+ string text = (string)ViewState["ValidationGroup"];
+ if (text!=null) return text;
+ return String.Empty;
+ }
+ set {
+ ViewState["ValidationGroup"] = value;
+ }
+ }
+
+ [ThemeableAttribute (false)]
+ [WebCategory ("Behavior")]
+ [DefaultValueAttribute (false)]
+ public bool AppendDataBoundItems {
+ get {
+ Object cv = ViewState["AppendDataBoundItems"];
+ if (cv != null) return (bool) cv;
+ return false;
+ }
+ set {
+ ViewState["AppendDataBoundItems"] = value;
+ }
+ }
+#endif
+
+ internal virtual ArrayList SelectedIndices
+ {
+ get
+ {
+ ArrayList si = new ArrayList();
+ for(int i=0; i < Items.Count; i++)
+ {
+ if(Items[i].Selected)
+ si.Add(i);
+ }
+ return si;
+ }
+ }
+
+ internal void Select(ArrayList indices)
+ {
+ ClearSelection();
+ foreach(object intObj in indices)
+ {
+ int index = (int)intObj;
+ if(index >= 0 && index < Items.Count)
+ Items[index].Selected = true;
+ }
+ }
+
+ public virtual void ClearSelection()
+ {
+ for(int i=0; i < Items.Count; i++)
+ {
+ Items[i].Selected = false;
+ }
+ }
+
+#if !NET_2_0
+ protected override void LoadViewState(object savedState)
+ {
+ //Order: BaseClass, Items (Collection), Indices
+ if(savedState != null && savedState is Triplet)
+ {
+ Triplet state = (Triplet)savedState;
+ base.LoadViewState(state.First);
+ Items.LoadViewState(state.Second);
+ object indices = state.Third;
+ if(indices != null)
+ {
+ Select((ArrayList)indices);
+ }
+ }
+ }
+#else
+ protected override void LoadViewState(object savedState)
+ {
+ //Order: BaseClass, Items (Collection)
+ if(savedState != null && savedState is Pair)
+ {
+ Pair state = (Pair) savedState;
+ base.LoadViewState(state.First);
+ Items.LoadViewState(state.Second);
+ }
+ if (selectedIndices != null) {
+ Select (selectedIndices);
+ selectedIndices = null;
+ }
+ }
+#endif
+
+#if NET_2_0
+ protected override void PerformSelect ()
+ {
+ base.PerformSelect ();
+ }
+
+ protected override void PerformDataBinding (IEnumerable ds)
+ {
+ base.PerformDataBinding (ds);
+ if (!AppendDataBoundItems)
+ Items.Clear();
+ FillItems (ds);
+ }
+
+#else
+ protected override void OnDataBinding(EventArgs e)
+ {
+ base.OnDataBinding(e);
+ IEnumerable ds = DataSourceHelper.GetResolvedDataSource (DataSource, DataMember);
+ if (ds != null)
+ Items.Clear ();
+ FillItems (ds);
+ }
+#endif
+
+ void FillItems (IEnumerable ds)
+ {
+ if(ds != null) {
+ string dtf = DataTextField;
+ string dvf = DataValueField;
+ string dtfs = DataTextFormatString;
+ if (dtfs.Length == 0)
+ dtfs = "{0}";
+
+ bool dontUseProperties = (dtf.Length == 0 && dvf.Length == 0);
+
+ foreach (object current in ds) {
+ ListItem li = new ListItem();
+ if (dontUseProperties){
+ li.Text = String.Format (dtfs, current);
+ li.Value = current.ToString ();
+ Items.Add (li);
+ continue;
+ }
+
+ object o;
+ if (dtf.Length > 0) {
+ o = DataBinder.GetPropertyValue (current, dtf, dtfs);
+ li.Text = o.ToString ();
+ }
+
+ if (dvf.Length > 0) {
+ o = DataBinder.GetPropertyValue (current, dvf, null);
+ li.Value = o.ToString ();
+ }
+
+ Items.Add(li);
+ }
+ }
+
+ if (cachedSelectedValue != null) {
+ int index = Items.FindByValueInternal (cachedSelectedValue);
+ if (index == -1)
+ throw new ArgumentOutOfRangeException("value");
+
+ if (cachedSelectedIndex != -1 && cachedSelectedIndex != index)
+ throw new ArgumentException(HttpRuntime.FormatResourceString(
+ "Attributes_mutually_exclusive", "Selected Index", "Selected Value"));
+
+ SelectedIndex = index;
+ cachedSelectedIndex = -1;
+ cachedSelectedValue = null;
+ return;
+ }
+
+ if (cachedSelectedIndex != -1) {
+ SelectedIndex = cachedSelectedIndex;
+ cachedSelectedIndex = -1;
+ }
+ }
+
+ protected virtual void OnSelectedIndexChanged(EventArgs e)
+ {
+ if(Events!=null)
+ {
+ EventHandler eh = (EventHandler)(Events[SelectedIndexChangedEvent]);
+ if(eh!=null)
+ eh(this, e);
+ }
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender(e);
+ }
+
+#if !NET_2_0
+ protected override object SaveViewState()
+ {
+ //Order: BaseClass, Items (Collection), Indices
+ object vs = base.SaveViewState();
+ object itemSvs = Items.SaveViewState();
+
+ object indices = null;
+ if (SaveSelectedIndicesViewState)
+ indices = SelectedIndices;
+
+ if (vs != null || itemSvs != null || indices != null)
+ return new Triplet(vs, itemSvs, indices);
+
+ return null;
+ }
+#else
+ protected override object SaveViewState()
+ {
+ //Order: BaseClass, Items (Collection), Indices
+ object vs = base.SaveViewState();
+ object itemSvs = Items.SaveViewState();
+ if (vs != null || itemSvs != null)
+ return new Pair (vs, itemSvs);
+
+ return null;
+ }
+#endif
+
+ protected override void TrackViewState()
+ {
+ base.TrackViewState();
+ Items.TrackViewState();
+ }
+
+ private bool SaveSelectedIndicesViewState {
+ get {
+ if (Events[SelectedIndexChangedEvent] == null && Enabled && Visible) {
+ Type t = GetType();
+ // If I am a derivative, let it take of storing the selected indices.
+ if (t == typeof(DropDownList) || t == typeof(ListBox) ||
+ t == typeof(CheckBoxList) || t == typeof(RadioButtonList))
+ return false;
+ }
+ return true;
+ }
+ }
+
+#if NET_2_0
+
+ protected override void OnInit (EventArgs e)
+ {
+ Page.RegisterRequiresControlState (this);
+ base.OnInit (e);
+ }
+
+ protected internal override void LoadControlState (object ob)
+ {
+ if (ob == null) return;
+ object[] state = (object[]) ob;
+ base.LoadControlState (state[0]);
+ selectedIndices = state[1] as ArrayList;
+ if (!EnableViewState) {
+ Select (selectedIndices);
+ selectedIndices = null;
+ }
+ }
+
+ protected internal override object SaveControlState ()
+ {
+ object bstate = base.SaveControlState ();
+ ArrayList mstate = SelectedIndices;
+ if (mstate.Count == 0) mstate = null;
+
+ if (bstate != null || mstate != null)
+ return new object[] { bstate, mstate };
+ else
+ return null;
+ }
+
+ protected internal virtual void VerifyMultiSelect ()
+ {
+ object o = ViewState ["SelectionMode"];
+ if (o != null && o.ToString () == "Single")
+ throw new HttpException ("Cannot_MultiSelect_In_Single_Mode");
+ }
+
+ protected override void RenderContents (HtmlTextWriter writer)
+ {
+ bool selMade = false;
+ foreach (ListItem current in Items){
+ writer.WriteBeginTag ("option");
+ if (current.Selected){
+ if (selMade) VerifyMultiSelect ();
+ selMade = true;
+ writer.WriteAttribute ("selected", "selected");
+ }
+ writer.WriteAttribute ("value", current.Value, true);
+ writer.Write ('>');
+ writer.Write (HttpUtility.HtmlEncode (current.Text));
+ writer.WriteEndTag ("option");
+ writer.WriteLine ();
+ }
+ }
+
+#endif
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListItem.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListItem.cs
new file mode 100644
index 00000000000..b69c6f4bfcd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListItem.cs
@@ -0,0 +1,300 @@
+//
+// System.Web.UI.WebControls.ListItem.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+#if NET_2_0
+ [ParseChildren (true, "Text")]
+#endif
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ [ControlBuilder(typeof(ListItemControlBuilder))]
+ public sealed class ListItem : IStateManager, IParserAccessor, IAttributeAccessor
+ {
+ private AttributeCollection attributes;
+ private string text;
+ private string val;
+ private bool marked;
+ private bool selected;
+ private bool dirty_t;
+ private bool dirty_v;
+
+#if NET_2_0
+ private bool enabled;
+#endif
+
+ public ListItem(string text, string value)
+ {
+ this.text = text;
+ this.val = value;
+ attributes = null;
+ }
+
+ public ListItem(string text): this(text, null)
+ {
+ }
+
+ public ListItem(): this(null, null)
+ {
+ }
+
+#if NET_2_0
+ public ListItem (string text, string value, bool enabled): this (text, value)
+ {
+ this.enabled = enabled;
+ }
+#endif
+
+ public static ListItem FromString(string text)
+ {
+ return new ListItem(text);
+ }
+
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public AttributeCollection Attributes
+ {
+ get
+ {
+ if(attributes == null)
+ attributes = new AttributeCollection(new StateBag(true));
+ return attributes;
+ }
+ }
+
+#if NET_2_0
+// [TypeConverterAttribute (typeof (System.Web.UI.MinimizableAttributeTypeConverter))]
+#endif
+ [DefaultValue (false)]
+ public bool Selected
+ {
+ get {
+ return selected;
+ }
+
+ set {
+ selected = value;
+ }
+ }
+
+ internal bool Dirty
+ {
+ get {
+ return (dirty_t && dirty_v);
+ }
+
+ set {
+ dirty_t = value;
+ dirty_v = value;
+ }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#endif
+ [DefaultValue ("")]
+ [PersistenceMode (PersistenceMode.EncodedInnerDefaultProperty)]
+ public string Text
+ {
+ get
+ {
+ if(text!=null)
+ {
+ return text;
+ }
+ if(val!=null)
+ {
+ return val;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ text = value;
+ if (IsTrackingViewState)
+ dirty_t = true;
+ }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#endif
+ [DefaultValue ("")]
+ public string Value
+ {
+ get {
+ if (val != null)
+ return val;
+
+ if (text != null)
+ return text;
+
+ return String.Empty;
+ }
+ set
+ {
+ val = value;
+ if(IsTrackingViewState)
+ dirty_v = true;
+ }
+ }
+
+#if NET_2_0
+ [MonoTODO ("Disable items in ListControl and subclasses")]
+ [DefaultValue (true)]
+ public bool Enabled {
+ get { return enabled; }
+ set { enabled = value; }
+ }
+#endif
+
+ string IAttributeAccessor.GetAttribute (string key)
+ {
+ if (attributes == null)
+ return null;
+
+ return attributes [key];
+ }
+
+ void IAttributeAccessor.SetAttribute (string key, string value)
+ {
+ Attributes [key] = value;
+ }
+
+ /// <remarks>
+ /// The data is parsed - object must be of type LiteralControl or DataBoundLiteralControl.
+ /// In latter case, throw an exception telling that the data cannot be bind-ed.
+ /// </remarks>
+ void IParserAccessor.AddParsedSubObject(object obj)
+ {
+ if(obj is LiteralControl)
+ {
+ Text = ((LiteralControl)obj).Text;
+ return;
+ }
+ if(obj is DataBoundLiteralControl)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Control_Cannot_DataBind","ListItem"));
+ }
+ throw new HttpException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type", "ListItem", obj.GetType().ToString()));
+ }
+
+ bool IsTrackingViewState
+ {
+ get
+ {
+ return marked;
+ }
+ }
+
+ internal void TrackViewState()
+ {
+ marked = true;
+ }
+
+ internal void LoadViewState(object state)
+ {
+ if(state is Pair)
+ {
+ Pair tv = (Pair)state;
+ if(tv.First!=null)
+ {
+ Text = (string)tv.First;
+ }
+ if(tv.Second!=null)
+ {
+ Value = (string)tv.Second;
+ }
+ }
+ }
+
+ internal object SaveViewState()
+ {
+ if (dirty_t && dirty_v)
+ return new Pair(Text, Value);
+
+ if (dirty_t)
+ return new Pair (Text, null);
+
+ if (dirty_v)
+ return new Pair(null, Value);
+
+ return null;
+ }
+
+ public override bool Equals (object o)
+ {
+ ListItem li = o as ListItem;
+ if (li == null)
+ return false;
+
+ return (Text == li.Text && Value == li.Value);
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ return Text;
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get
+ {
+ return IsTrackingViewState;
+ }
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ TrackViewState();
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ return SaveViewState();
+ }
+
+ void IStateManager.LoadViewState(object state)
+ {
+ LoadViewState(state);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs
new file mode 100644
index 00000000000..7a9237bea09
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs
@@ -0,0 +1,383 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ListItemCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls
+{
+ [Editor ("System.Web.UI.Design.WebControls.ListItemsCollectionEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public sealed class ListItemCollection : IList, ICollection, IEnumerable, IStateManager
+ {
+ private ArrayList items;
+ private bool saveAll;
+ private bool marked;
+
+ public ListItemCollection()
+ {
+ items = new ArrayList();
+ saveAll = false;
+ marked = false;
+ }
+
+ public int Capacity
+ {
+ get
+ {
+ return items.Capacity;
+ }
+ set
+ {
+ items.Capacity = value;
+ }
+ }
+
+ public int Count
+ {
+ get
+ {
+ return items.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return items.IsReadOnly;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return items.IsSynchronized;
+ }
+ }
+
+ public ListItem this[int index]
+ {
+ get
+ {
+ if(index < 0 || index >= Count)
+ return null;
+ return (ListItem)(items[index]);
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void Add(ListItem item)
+ {
+ items.Add(item);
+ if(marked)
+ item.Dirty = true;
+ }
+
+ public void Add(string item)
+ {
+ Add(new ListItem(item));
+ }
+
+ public void AddRange(ListItem[] items)
+ {
+ foreach(ListItem item in items)
+ {
+ if(item!=null)
+ Add(item);
+ }
+ }
+
+ public void Clear()
+ {
+ items.Clear();
+ if(marked)
+ saveAll = true;
+ }
+
+ public bool Contains(ListItem item)
+ {
+ return items.Contains(item);
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ items.CopyTo(array, index);
+ }
+
+ public ListItem FindByText(string text)
+ {
+ int i=-1;
+ foreach(object current in items)
+ {
+ i++;
+ if(((ListItem)current).Text == text)
+ break;
+ }
+ return (i==-1 ? null : (ListItem)items[i]);
+ }
+
+ public ListItem FindByValue(string value)
+ {
+ foreach(ListItem current in items)
+ {
+ if(current.Value == value)
+ {
+ return current;
+ }
+ }
+ return null;
+ }
+
+ internal int FindByValueInternal(string value)
+ {
+ int i = -1;
+ foreach(ListItem current in items)
+ {
+ i++;
+ if(current.Value == value)
+ {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return items.GetEnumerator();
+ }
+
+ public int IndexOf(ListItem item)
+ {
+ return items.IndexOf(item);
+ }
+
+ public void Insert(int index, ListItem item)
+ {
+ items.Insert(index, item);
+ if(marked)
+ saveAll = true;
+ }
+
+ public void Insert(int index, string item)
+ {
+ Insert(index, new ListItem(item));
+ }
+
+ public void RemoveAt(int index)
+ {
+ if(index < 0 || index >= items.Count)
+ return;
+ items.RemoveAt(index);
+ if(marked)
+ saveAll = true;
+ }
+
+ public void Remove(ListItem item)
+ {
+ RemoveAt(IndexOf(item));
+ }
+
+ public void Remove(string item)
+ {
+ RemoveAt(IndexOf(ListItem.FromString(item)));
+ }
+
+ internal object SaveViewState ()
+ {
+ int count = Count;
+ if (saveAll) {
+ string [] keys = new string [count];
+ string [] vals = new string [count];
+ for(int i = 0; i < count; i++) {
+ keys[i] = this [i].Text;
+ vals[i] = this [i].Value;
+ }
+
+ return new Triplet (count, keys, vals);
+ }
+
+ ArrayList indices = new ArrayList ();
+ ArrayList states = new ArrayList ();
+ object o;
+ for(int i = 0; i < count; i++) {
+ o = this [i].SaveViewState ();
+ if (o == null)
+ continue;
+
+ indices.Add (i);
+ states.Add (o);
+ }
+
+ if (indices.Count > 0)
+ return new Pair (indices, states);
+
+ return null;
+ }
+
+ internal void LoadViewState (object savedState)
+ {
+ if (savedState == null)
+ return;
+
+ int i, end;
+ if (savedState is Pair) {
+ Pair pair = (Pair) savedState;
+ ArrayList indices = (ArrayList) pair.First;
+ ArrayList states = (ArrayList) pair.Second;
+
+ end = indices.Count;
+ for (i = 0; i < end; i++) {
+ if ((int) indices [i] < Count ) {
+ this [(int) indices [i]].LoadViewState (states [i]);
+ } else {
+ ListItem temp = new ListItem ();
+ temp.LoadViewState (states [i]);
+ Add (temp);
+ }
+ }
+ } else if (savedState is Triplet) {
+ Triplet t = (Triplet) savedState;
+ items = new ArrayList ((int) t.First);
+ saveAll = true;
+ object [] text = (object []) t.Second;
+ object [] vals = (object []) t.Third;
+ end = text.Length;
+ for(i = 0; i < end; i++)
+ items.Add (new ListItem (text[i].ToString (), vals[i].ToString ()));
+ }
+ }
+
+ internal void TrackViewState()
+ {
+ marked = true;
+ foreach(ListItem current in items)
+ current.TrackViewState();
+ }
+
+ bool IList.IsFixedSize
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ object IList.this[int index]
+ {
+ get
+ {
+ return this[index];
+ }
+
+ set
+ {
+ if(index >= 0 && index < Count)
+ if(value is ListItem)
+ items[index] = (ListItem) value;
+ }
+ }
+
+ int IList.Add(object item)
+ {
+ int index = (item is ListItem ? items.Add((ListItem)item) : -1);
+ if(index!=-1 && marked)
+ ((ListItem)item).Dirty = true;
+ return index;
+ }
+
+ bool IList.Contains(object item)
+ {
+ if(item is ListItem)
+ return Contains((ListItem)item);
+ return false;
+ }
+
+ int IList.IndexOf(object item)
+ {
+ if(item is ListItem)
+ return IndexOf((ListItem)item);
+ return -1;
+ }
+
+ void IList.Insert(int index, object item)
+ {
+ if(item is ListItem)
+ Insert(index, (ListItem)item);
+ }
+
+ void IList.Remove(object item)
+ {
+ if(item is string)
+ Remove((string)item);
+ if(item is ListItem)
+ Remove((ListItem)item);
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get
+ {
+ return marked;
+ }
+ }
+
+ void IStateManager.LoadViewState(object state)
+ {
+ LoadViewState(state);
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ return SaveViewState();
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ TrackViewState();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListItemControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemControlBuilder.cs
new file mode 100644
index 00000000000..a7c7f94c8d2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemControlBuilder.cs
@@ -0,0 +1,57 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ListItemControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class ListItemControlBuilder : ControlBuilder
+ {
+ public ListItemControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+
+ public override bool HtmlDecodeLiterals()
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListItemType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemType.cs
new file mode 100755
index 00000000000..36339ffc9df
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemType.cs
@@ -0,0 +1,48 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ListItemType
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ListItemType
+ {
+ Header,
+ Footer,
+ Item,
+ AlternatingItem,
+ SelectedItem,
+ EditItem,
+ Separator,
+ Pager
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListSelectionMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListSelectionMode.cs
new file mode 100755
index 00000000000..d5c886a0ac7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListSelectionMode.cs
@@ -0,0 +1,42 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ListSelectionMode
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ListSelectionMode
+ {
+ Single,
+ Multiple
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Literal.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Literal.cs
new file mode 100644
index 00000000000..45c3e3b4247
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Literal.cs
@@ -0,0 +1,109 @@
+//
+// System.Web.UI.WebControls.Literal.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+// (C) 2004, 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
+// "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;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("Text")]
+ [ControlBuilder(typeof(LiteralControlBuilder))]
+ [DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
+#if NET_2_0
+ [DesignerAttribute ("Value not found")]
+#endif
+ public class Literal : Control
+#if NET_2_0
+ , ITextControl
+#endif
+ {
+ public Literal () : base ()
+ {
+ }
+
+ [DefaultValue (""), Bindable (true), WebCategory ("Appearance")]
+ [WebSysDescription ("The text for the literal WebControl.")]
+#if NET_2_0
+ [Localizable (true)]
+#endif
+ public string Text
+ {
+ get {
+ object o = ViewState ["Text"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["Text"] = value; }
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new EmptyControlCollection (this);
+ }
+
+ protected override void AddParsedSubObject (object obj)
+ {
+ if (!(obj is LiteralControl))
+ throw new HttpException (HttpRuntime.FormatResourceString (
+ "Cannot_Have_Children_Of_Type", "Literal",
+ obj.GetType ().Name.ToString ()));
+
+ Text = ((LiteralControl) obj).Text;
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ if (Text.Length > 0)
+ writer.Write (Text);
+ }
+
+#if NET_2_0
+ private LiteralMode literalMode;
+ [DefaultValue (LiteralMode.Transform), WebCategory ("Behavior"), WebSysDescription ("Determines whether the text is transformed or encoded")]
+ public LiteralMode Mode {
+ get { return literalMode; }
+ set { literalMode = value; }
+ }
+
+ public override void Focus ()
+ {
+ throw new NotSupportedException ("The Literal control does not support the Focus operation");
+ }
+#endif
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LiteralControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LiteralControlBuilder.cs
new file mode 100644
index 00000000000..335c2ce3614
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LiteralControlBuilder.cs
@@ -0,0 +1,57 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: LiteralControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class LiteralControlBuilder : ControlBuilder
+ {
+ public LiteralControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+
+ public override void AppendSubBuilder(ControlBuilder subBuilder)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Control_does_not_allow_children",(typeof(Literal)).ToString()));
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LiteralMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LiteralMode.cs
new file mode 100644
index 00000000000..9e36bd27a21
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LiteralMode.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.LiteralMode.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum LiteralMode {
+ Transform = 0,
+ PassThrough = 1,
+ Encode = 2
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Localize.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Localize.cs
new file mode 100644
index 00000000000..708fe154cb2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Localize.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.UI.WebControls.Localize.cs
+//
+// Authors:
+// Sanjay Gupta gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI.WebControls {
+ public class Localize : Literal
+#if NET_2_0
+ , ITextControl
+#endif
+ {
+ //No methods/properties/defined for this class. It inherits
+ // everything from literal class
+ public Localize ()
+ {}
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Login.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Login.cs
new file mode 100644
index 00000000000..dd9c4f6dafe
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Login.cs
@@ -0,0 +1,59 @@
+//
+// System.Web.UI.WebControls.Login.cs
+//
+// Authors:
+// Gaurav Vaish (gaurav.vaish@gmail.com)
+//
+// (C) 2004 Gaurav Vaish (http://www.mastergaurav.net)
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace System.Web.UI.WebControls
+{
+ public class Login : CompositeControl
+ {
+ public Login()
+ {
+ }
+
+ public int BorderPadding
+ {
+ get {
+ object o = ViewState["BorderPadding"];
+ if(o != null) {
+ return (int)o;
+ }
+ return 1;
+ }
+ set {
+ ViewState["BorderPadding"] = value;
+ }
+ }
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LoginFailureAction.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LoginFailureAction.cs
new file mode 100644
index 00000000000..5849375f0f6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LoginFailureAction.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.UI.WebControls.LoginFailureAction.cs
+//
+// Author: Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+
+ public enum LoginFailureAction
+ {
+ Refresh = 0,
+ RedirectToLoginPage = 1,
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LoginTextLayout.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LoginTextLayout.cs
new file mode 100644
index 00000000000..41a2caf56f3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LoginTextLayout.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.UI.WebControls.LoginTextLayout.cs
+//
+// Author: Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+
+ public enum LoginTextLayout
+ {
+ TextOnLeft = 0,
+ TextOnTop = 1
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LogoutAction.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LogoutAction.cs
new file mode 100644
index 00000000000..c2e6c389809
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LogoutAction.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.LogoutAction.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum LogoutAction {
+ Refresh = 0,
+ Redirect = 1,
+ RedirectToLoginPage = 2
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MailMessageEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MailMessageEventArgs.cs
new file mode 100644
index 00000000000..18da4a0a2ef
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MailMessageEventArgs.cs
@@ -0,0 +1,52 @@
+//
+// System.Web.UI.WebControls.MalMessageEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Net.Mail;
+
+namespace System.Web.UI.WebControls
+{
+ public class MailMessageEventArgs : EventArgs
+ {
+ private MailMessage message;
+
+ public MailMessageEventArgs (MailMessage message)
+ {
+ this.message = message;
+ }
+
+ public MailMessage Message {
+ get { return message; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MailMessageEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MailMessageEventHandler.cs
new file mode 100644
index 00000000000..2455971bbf4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MailMessageEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.MailMessageEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void MailMessageEventHandler (object sender, MailMessageEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs
new file mode 100644
index 00000000000..c7a11e45c19
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs
@@ -0,0 +1,1284 @@
+//
+// System.Web.UI.WebControls.Menu.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Text;
+using System.ComponentModel;
+using System.Web.UI;
+using System.Web.Handlers;
+using System.Collections.Specialized;
+using System.IO;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent ("MenuItemClick")]
+ [ControlValueProperty ("SelectedValue")]
+ [Designer ("System.Web.UI.Design.WebControls.MenuDesigner, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+ public class Menu : HierarchicalDataBoundControl, IPostBackEventHandler, INamingContainer
+ {
+ MenuItemStyle dynamicMenuItemStyle;
+ SubMenuStyle dynamicMenuStyle;
+ MenuItemStyle dynamicSelectedStyle;
+ MenuItemStyle staticMenuItemStyle;
+ SubMenuStyle staticMenuStyle;
+ MenuItemStyle staticSelectedStyle;
+ Style staticHoverStyle;
+ Style dynamicHoverStyle;
+
+ MenuItemStyleCollection levelMenuItemStyles;
+ MenuItemStyleCollection levelSelectedStyles;
+ ITemplate staticItemTemplate;
+ ITemplate dynamicItemTemplate;
+
+ MenuItemCollection items;
+ MenuItemBindingCollection dataBindings;
+ MenuItem selectedItem;
+ string selectedItemPath;
+ Hashtable bindings;
+ ArrayList dynamicMenus;
+
+ private static readonly object MenuItemClickEvent = new object();
+
+ public event MenuEventHandler MenuItemClick {
+ add { Events.AddHandler (MenuItemClickEvent, value); }
+ remove { Events.RemoveHandler (MenuItemClickEvent, value); }
+ }
+
+ protected virtual void OnMenuItemClick (MenuEventArgs e)
+ {
+ if (Events != null) {
+ MenuEventHandler eh = (MenuEventHandler) Events [MenuItemClickEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [Editor ("System.Web.UI.Design.MenuItemBindingsEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual MenuItemBindingCollection DataBindings {
+ get {
+ if (dataBindings == null) {
+ dataBindings = new MenuItemBindingCollection ();
+ if (IsTrackingViewState)
+ ((IStateManager)dataBindings).TrackViewState();
+ }
+ return dataBindings;
+ }
+ }
+
+ [DefaultValue (500)]
+ [ThemeableAttribute (false)]
+ public virtual int DisappearAfter {
+ get {
+ object o = ViewState ["DisappearAfter"];
+ if (o != null) return (int)o;
+ return 500;
+ }
+ set {
+ ViewState["DisappearAfter"] = value;
+ }
+ }
+
+ [ThemeableAttribute (false)]
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual string DynamicBottomSeparatorImageUrl {
+ get {
+ object o = ViewState ["dbsiu"];
+ if (o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState["dbsiu"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [WebCategory ("Appearance")]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual string DynamicTopSeparatorImageUrl {
+ get {
+ object o = ViewState ["dtsiu"];
+ if (o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState["dtsiu"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [WebCategory ("Appearance")]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual string StaticBottomSeparatorImageUrl {
+ get {
+ object o = ViewState ["sbsiu"];
+ if (o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState["sbsiu"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [WebCategory ("Appearance")]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual string StaticTopSeparatorImageUrl {
+ get {
+ object o = ViewState ["stsiu"];
+ if (o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState["stsiu"] = value;
+ }
+ }
+
+ [DefaultValue (Orientation.Vertical)]
+ public virtual Orientation Orientation {
+ get {
+ object o = ViewState ["Orientation"];
+ if (o != null) return (Orientation) o;
+ return Orientation.Vertical;
+ }
+ set {
+ ViewState["Orientation"] = value;
+ }
+ }
+
+ [DefaultValue (1)]
+ [ThemeableAttribute (false)]
+ public virtual int StaticDisplayLevels {
+ get {
+ object o = ViewState ["StaticDisplayLevels"];
+ if (o != null) return (int)o;
+ return 1;
+ }
+ set {
+ if (value < 1) throw new ArgumentOutOfRangeException ();
+ ViewState["StaticDisplayLevels"] = value;
+ }
+ }
+
+ [DefaultValue ("16px")]
+ [ThemeableAttribute (false)]
+ public Unit StaticSubMenuIndent {
+ get {
+ object o = ViewState ["StaticSubMenuIndent"];
+ if (o != null) return (Unit)o;
+ return new Unit (16);
+ }
+ set {
+ ViewState["StaticSubMenuIndent"] = value;
+ }
+ }
+
+ [ThemeableAttribute (false)]
+ [DefaultValue (3)]
+ public virtual int MaximumDynamicDisplayLevels {
+ get {
+ object o = ViewState ["MaximumDynamicDisplayLevels"];
+ if (o != null) return (int)o;
+ return 3;
+ }
+ set {
+ if (value < 0) throw new ArgumentOutOfRangeException ();
+ ViewState["MaximumDynamicDisplayLevels"] = value;
+ }
+ }
+
+ [DefaultValue (0)]
+ public virtual int DynamicVerticalOffset {
+ get {
+ object o = ViewState ["DynamicVerticalOffset"];
+ if (o != null) return (int)o;
+ return 0;
+ }
+ set {
+ ViewState["DynamicVerticalOffset"] = value;
+ }
+ }
+
+ [DefaultValue (0)]
+ public virtual int DynamicHorizontalOffset {
+ get {
+ object o = ViewState ["DynamicHorizontalOffset"];
+ if (o != null) return (int)o;
+ return 0;
+ }
+ set {
+ ViewState["DynamicHorizontalOffset"] = value;
+ }
+ }
+
+ [DefaultValue (true)]
+ public virtual bool DynamicEnableDefaultPopOutImage {
+ get {
+ object o = ViewState ["dedpoi"];
+ if (o != null) return (bool)o;
+ return true;
+ }
+ set {
+ ViewState["dedpoi"] = value;
+ }
+ }
+
+ [DefaultValue (true)]
+ public virtual bool StaticEnableDefaultPopOutImage {
+ get {
+ object o = ViewState ["sedpoi"];
+ if (o != null) return (bool)o;
+ return true;
+ }
+ set {
+ ViewState["sedpoi"] = value;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Editor ("System.Web.UI.Design.MenuItemCollectionEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual MenuItemCollection Items {
+ get {
+ if (items == null) {
+ items = new MenuItemCollection (this);
+ if (IsTrackingViewState)
+ ((IStateManager)items).TrackViewState();
+ }
+ return items;
+ }
+ }
+
+ [DefaultValue ('/')]
+ public virtual char PathSeparator {
+ get {
+ object o = ViewState ["PathSeparator"];
+ if(o != null) return (char)o;
+ return '/';
+ }
+ set {
+ ViewState ["PathSeparator"] = value;
+ }
+ }
+
+ [DefaultValue (false)]
+ public virtual bool ItemWrap {
+ get {
+ object o = ViewState ["ItemWrap"];
+ if(o != null) return (bool)o;
+ return false;
+ }
+ set {
+ ViewState ["ItemWrap"] = value;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual MenuItemStyle DynamicMenuItemStyle {
+ get {
+ if (dynamicMenuItemStyle == null) {
+ dynamicMenuItemStyle = new MenuItemStyle ();
+ if (IsTrackingViewState)
+ dynamicMenuItemStyle.TrackViewState();
+ }
+ return dynamicMenuItemStyle;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual MenuItemStyle DynamicSelectedStyle {
+ get {
+ if (dynamicSelectedStyle == null) {
+ dynamicSelectedStyle = new MenuItemStyle ();
+ if (IsTrackingViewState)
+ dynamicSelectedStyle.TrackViewState();
+ }
+ return dynamicSelectedStyle;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual SubMenuStyle DynamicMenuStyle {
+ get {
+ if (dynamicMenuStyle == null) {
+ dynamicMenuStyle = new SubMenuStyle ();
+ if (IsTrackingViewState)
+ dynamicMenuStyle.TrackViewState();
+ }
+ return dynamicMenuStyle;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual MenuItemStyle StaticMenuItemStyle {
+ get {
+ if (staticMenuItemStyle == null) {
+ staticMenuItemStyle = new MenuItemStyle ();
+ if (IsTrackingViewState)
+ staticMenuItemStyle.TrackViewState();
+ }
+ return staticMenuItemStyle;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual MenuItemStyle StaticSelectedStyle {
+ get {
+ if (staticSelectedStyle == null) {
+ staticSelectedStyle = new MenuItemStyle ();
+ if (IsTrackingViewState)
+ staticSelectedStyle.TrackViewState();
+ }
+ return staticSelectedStyle;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual SubMenuStyle StaticMenuStyle {
+ get {
+ if (staticMenuStyle == null) {
+ staticMenuStyle = new SubMenuStyle ();
+ if (IsTrackingViewState)
+ staticMenuStyle.TrackViewState();
+ }
+ return staticMenuStyle;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [Editor ("System.Web.UI.Design.WebControls.MenuItemStyleCollectionEditor,System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public virtual MenuItemStyleCollection LevelMenuItemStyles {
+ get {
+ if (levelMenuItemStyles == null) {
+ levelMenuItemStyles = new MenuItemStyleCollection ();
+ if (IsTrackingViewState)
+ ((IStateManager)levelMenuItemStyles).TrackViewState();
+ }
+ return levelMenuItemStyles;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual MenuItemStyleCollection LevelSelectedStyles {
+ get {
+ if (levelSelectedStyles == null) {
+ levelSelectedStyles = new MenuItemStyleCollection ();
+ if (IsTrackingViewState)
+ ((IStateManager)levelSelectedStyles).TrackViewState();
+ }
+ return levelSelectedStyles;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual Style DynamicHoverStyle {
+ get {
+ if (dynamicHoverStyle == null) {
+ dynamicHoverStyle = new Style ();
+ if (IsTrackingViewState)
+ dynamicHoverStyle.TrackViewState();
+ }
+ return dynamicHoverStyle;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual Style StaticHoverStyle {
+ get {
+ if (staticHoverStyle == null) {
+ staticHoverStyle = new Style ();
+ if (IsTrackingViewState)
+ staticHoverStyle.TrackViewState();
+ }
+ return staticHoverStyle;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual string ScrollDownImageUrl {
+ get {
+ object o = ViewState ["sdiu"];
+ if (o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState["sdiu"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual string ScrollUpImageUrl {
+ get {
+ object o = ViewState ["suiu"];
+ if (o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState["suiu"] = value;
+ }
+ }
+
+ [Localizable (true)]
+ public virtual string ScrollDownText {
+ get {
+ object o = ViewState ["ScrollDownText"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState["ScrollDownText"] = value;
+ }
+ }
+
+ [Localizable (true)]
+ public virtual string ScrollUpText {
+ get {
+ object o = ViewState ["ScrollUpText"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState["ScrollUpText"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual string DynamicPopOutImageUrl {
+ get {
+ object o = ViewState ["dpoiu"];
+ if (o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState["dpoiu"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual string StaticPopOutImageUrl {
+ get {
+ object o = ViewState ["spoiu"];
+ if (o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState["spoiu"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ public virtual string Target {
+ get {
+ object o = ViewState ["Target"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState["Target"] = value;
+ }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(MenuItemTemplateContainer), BindingDirection.OneWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate StaticItemTemplate {
+ get { return staticItemTemplate; }
+ set { staticItemTemplate = value; }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(MenuItemTemplateContainer), BindingDirection.OneWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate DynamicItemTemplate {
+ get { return dynamicItemTemplate; }
+ set { dynamicItemTemplate = value; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public MenuItem SelectedItem {
+ get {
+ if (selectedItem == null && selectedItemPath != null) {
+ selectedItem = FindItemByPos (selectedItemPath);
+ }
+
+ return selectedItem;
+ }
+ }
+
+ [Browsable (false)]
+ [DefaultValue ("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string SelectedValue {
+ get { return selectedItem != null ? selectedItem.Value : null; }
+ }
+
+ internal void SetSelectedItem (MenuItem item)
+ {
+ if (selectedItem == item) return;
+ selectedItem = item;
+ selectedItemPath = item.Path;
+ }
+
+ public MenuItem FindItem (string valuePath)
+ {
+ if (valuePath == null) throw new ArgumentNullException ("valuePath");
+ string[] path = valuePath.Split (PathSeparator);
+ int n = 0;
+ MenuItemCollection col = Items;
+ bool foundBranch = true;
+ while (col.Count > 0 && foundBranch) {
+ foundBranch = false;
+ foreach (MenuItem item in col) {
+ if (item.Value == path [n]) {
+ if (++n == path.Length) return item;
+ col = item.ChildItems;
+ foundBranch = true;
+ break;
+ }
+ }
+ }
+ return null;
+ }
+
+ string GetBindingKey (string dataMember, int depth)
+ {
+ return dataMember + " " + depth;
+ }
+
+ internal MenuItemBinding FindBindingForItem (string type, int depth)
+ {
+ if (bindings == null) return null;
+
+ MenuItemBinding bin = (MenuItemBinding) bindings [GetBindingKey (type, depth)];
+ if (bin != null) return bin;
+
+ bin = (MenuItemBinding) bindings [GetBindingKey (type, -1)];
+ if (bin != null) return bin;
+
+ bin = (MenuItemBinding) bindings [GetBindingKey ("", depth)];
+ if (bin != null) return bin;
+
+ bin = (MenuItemBinding) bindings [GetBindingKey ("", -1)];
+ return bin;
+ }
+
+ protected internal override void PerformDataBinding ()
+ {
+ base.PerformDataBinding ();
+ HierarchicalDataSourceView data = GetData ("");
+ IHierarchicalEnumerable e = data.Select ();
+ foreach (object obj in e) {
+ IHierarchyData hdata = e.GetHierarchyData (obj);
+ MenuItem item = new MenuItem ();
+ item.Bind (hdata);
+ Items.Add (item);
+ }
+ }
+
+ public void RaisePostBackEvent (string eventArgument)
+ {
+ MenuItem item = FindItemByPos (eventArgument);
+ if (item == null) return;
+ item.Selected = true;
+ OnMenuItemClick (new MenuEventArgs (item));
+ }
+
+ MenuItem FindItemByPos (string path)
+ {
+ string[] indexes = path.Split ('_');
+ MenuItem item = null;
+
+ foreach (string index in indexes) {
+ int i = int.Parse (index);
+ if (item == null) {
+ if (i >= Items.Count) return null;
+ item = Items [i];
+ } else {
+ if (i >= item.ChildItems.Count) return null;
+ item = item.ChildItems [i];
+ }
+ }
+ return item;
+ }
+
+ protected override HtmlTextWriterTag TagKey {
+ get { return HtmlTextWriterTag.Table; }
+ }
+
+ protected override void TrackViewState()
+ {
+ EnsureDataBound ();
+
+ base.TrackViewState();
+ if (dataBindings != null) {
+ ((IStateManager)dataBindings).TrackViewState ();
+ }
+ if (items != null) {
+ ((IStateManager)items).TrackViewState();
+ }
+ if (dynamicMenuItemStyle != null)
+ dynamicMenuItemStyle.TrackViewState ();
+ if (dynamicMenuStyle != null)
+ dynamicMenuStyle.TrackViewState ();
+ if (levelMenuItemStyles != null)
+ ((IStateManager)levelMenuItemStyles).TrackViewState();
+ if (levelSelectedStyles != null)
+ ((IStateManager)levelSelectedStyles).TrackViewState();
+ if (dynamicSelectedStyle != null)
+ dynamicSelectedStyle.TrackViewState();
+ if (staticMenuItemStyle != null)
+ staticMenuItemStyle.TrackViewState ();
+ if (staticMenuStyle != null)
+ staticMenuStyle.TrackViewState ();
+ if (staticSelectedStyle != null)
+ staticSelectedStyle.TrackViewState();
+ if (staticHoverStyle != null)
+ staticHoverStyle.TrackViewState();
+ if (dynamicHoverStyle != null)
+ dynamicHoverStyle.TrackViewState();
+ }
+
+ protected override object SaveViewState()
+ {
+ object[] states = new object [13];
+ states[0] = base.SaveViewState ();
+ states[1] = dataBindings == null ? null : ((IStateManager)dataBindings).SaveViewState();
+ states[2] = items == null ? null : ((IStateManager)items).SaveViewState();
+ states[3] = dynamicMenuItemStyle == null ? null : dynamicMenuItemStyle.SaveViewState();
+ states[4] = dynamicMenuStyle == null ? null : dynamicMenuStyle.SaveViewState();
+ states[5] = levelMenuItemStyles == null ? null : ((IStateManager)levelMenuItemStyles).SaveViewState();
+ states[6] = levelSelectedStyles == null ? null : ((IStateManager)levelSelectedStyles).SaveViewState();
+ states[7] = dynamicSelectedStyle == null ? null : dynamicSelectedStyle.SaveViewState();
+ states[8] = (staticMenuItemStyle == null ? null : staticMenuItemStyle.SaveViewState());
+ states[9] = staticMenuStyle == null ? null : staticMenuStyle.SaveViewState();
+ states[10] = staticSelectedStyle == null ? null : staticSelectedStyle.SaveViewState();
+ states[11] = staticHoverStyle == null ? null : staticHoverStyle.SaveViewState();
+ states[12] = dynamicHoverStyle == null ? null : dynamicHoverStyle.SaveViewState();
+
+ for (int i = states.Length - 1; i >= 0; i--) {
+ if (states [i] != null)
+ return states;
+ }
+
+ return null;
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState == null)
+ return;
+
+ object [] states = (object []) savedState;
+ base.LoadViewState (states[0]);
+
+ if (states[1] != null)
+ ((IStateManager)DataBindings).LoadViewState(states[1]);
+ if (states[2] != null)
+ ((IStateManager)Items).LoadViewState(states[2]);
+ if (states[3] != null)
+ DynamicMenuItemStyle.LoadViewState (states[3]);
+ if (states[4] != null)
+ DynamicMenuStyle.LoadViewState (states[4]);
+ if (states[5] != null)
+ ((IStateManager)LevelMenuItemStyles).LoadViewState(states[5]);
+ if (states[6] != null)
+ ((IStateManager)LevelSelectedStyles).LoadViewState(states[6]);
+ if (states[7] != null)
+ DynamicSelectedStyle.LoadViewState (states[7]);
+ if (states[8] != null)
+ StaticMenuItemStyle.LoadViewState (states[8]);
+ if (states[9] != null)
+ StaticMenuStyle.LoadViewState (states[9]);
+ if (states[10] != null)
+ StaticSelectedStyle.LoadViewState (states[10]);
+ if (states[11] != null)
+ StaticHoverStyle.LoadViewState (states[11]);
+ if (states[12] != null)
+ DynamicHoverStyle.LoadViewState (states[12]);
+ }
+
+ protected override void OnInit (EventArgs e)
+ {
+ Page.RegisterRequiresControlState (this);
+ base.OnInit (e);
+ }
+
+ protected internal override void LoadControlState (object ob)
+ {
+ if (ob == null) return;
+ object[] state = (object[]) ob;
+ base.LoadControlState (state[0]);
+ selectedItemPath = state[1] as string;
+ }
+
+ protected internal override object SaveControlState ()
+ {
+ object bstate = base.SaveControlState ();
+ object mstate = selectedItemPath;
+
+ if (bstate != null || mstate != null)
+ return new object[] { bstate, mstate };
+ else
+ return null;
+ }
+
+ [MonoTODO]
+ protected override void CreateChildControls ()
+ {
+ base.CreateChildControls ();
+ }
+
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+
+ if (!Page.ClientScript.IsClientScriptIncludeRegistered (typeof(Menu), "Menu.js")) {
+ string url = Page.ClientScript.GetWebResourceUrl (typeof(Menu), "Menu.js");
+ Page.ClientScript.RegisterClientScriptInclude (typeof(Menu), "Menu.js", url);
+ }
+
+ string cmenu = ClientID + "_data";
+ string script = string.Format ("var {0} = new Object ();\n", cmenu);
+ script += string.Format ("{0}.disappearAfter = {1};\n", cmenu, ClientScriptManager.GetScriptLiteral (DisappearAfter));
+ script += string.Format ("{0}.vertical = {1};\n", cmenu, ClientScriptManager.GetScriptLiteral (Orientation == Orientation.Vertical));
+ if (DynamicHorizontalOffset != 0)
+ script += string.Format ("{0}.dho = {1};\n", cmenu, ClientScriptManager.GetScriptLiteral (DynamicHorizontalOffset));
+ if (DynamicVerticalOffset != 0)
+ script += string.Format ("{0}.dvo = {1};\n", cmenu, ClientScriptManager.GetScriptLiteral (DynamicVerticalOffset));
+
+ // The order in which styles are defined matters when more than one class
+ // is assigned to an element
+
+ if (dynamicMenuStyle != null)
+ RegisterItemStyle (dynamicMenuStyle);
+ if (staticMenuStyle != null)
+ RegisterItemStyle (staticMenuStyle);
+
+ if (staticMenuItemStyle != null)
+ RegisterItemStyle (staticMenuItemStyle);
+ if (staticSelectedStyle != null)
+ RegisterItemStyle (staticSelectedStyle);
+
+ if (dynamicMenuItemStyle != null)
+ RegisterItemStyle (dynamicMenuItemStyle);
+ if (dynamicSelectedStyle != null)
+ RegisterItemStyle (dynamicSelectedStyle);
+
+ if (levelMenuItemStyles != null)
+ foreach (Style style in levelMenuItemStyles)
+ RegisterItemStyle (style);
+
+ if (levelSelectedStyles != null)
+ foreach (Style style in levelSelectedStyles)
+ RegisterItemStyle (style);
+
+ if (dynamicHoverStyle != null)
+ RegisterItemStyle (dynamicHoverStyle);
+ if (staticHoverStyle != null)
+ RegisterItemStyle (staticHoverStyle);
+
+ if (staticHoverStyle != null)
+ script += string.Format ("{0}.staticHover = {1};\n", cmenu, ClientScriptManager.GetScriptLiteral (staticHoverStyle.RegisteredCssClass));
+ if (dynamicHoverStyle != null)
+ script += string.Format ("{0}.dynamicHover = {1};\n", cmenu, ClientScriptManager.GetScriptLiteral (dynamicHoverStyle.RegisteredCssClass));
+
+ Page.ClientScript.RegisterStartupScript (typeof(Menu), ClientID, script, true);
+
+ if (dataBindings != null && dataBindings.Count > 0) {
+ bindings = new Hashtable ();
+ foreach (TreeNodeBinding bin in dataBindings) {
+ string key = GetBindingKey (bin.DataMember, bin.Depth);
+ bindings [key] = bin;
+ }
+ }
+ else
+ bindings = null;
+ }
+
+ void RegisterItemStyle (Style baseStyle)
+ {
+ Page.Header.StyleSheet.RegisterStyle (baseStyle, this);
+ Style ts = new Style ();
+ ts.CopyTextStylesFrom (baseStyle);
+ Page.Header.StyleSheet.CreateStyleRule (ts, "." + baseStyle.RegisteredCssClass + " A", this);
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ base.Render (writer);
+ }
+
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ RenderMenuBeginTagAttributes (writer, false);
+ }
+
+ public override void RenderBeginTag (HtmlTextWriter writer)
+ {
+ base.RenderBeginTag (writer);
+ }
+
+ public override void RenderEndTag (HtmlTextWriter writer)
+ {
+ base.RenderEndTag (writer);
+
+ // Render dynamic menus outside the main control tag
+ for (int n=0; n<dynamicMenus.Count; n++) {
+ MenuItem item = (MenuItem) dynamicMenus [n];
+ RenderDynamicMenu (writer, item);
+ }
+ dynamicMenus = null;
+ }
+
+ protected override void RenderContents (HtmlTextWriter writer)
+ {
+ dynamicMenus = new ArrayList ();
+ RenderMenuBody (writer, Items, Orientation == Orientation.Vertical, false);
+ }
+
+ void RenderDynamicMenu (HtmlTextWriter writer, MenuItem item)
+ {
+ if (dynamicMenuStyle != null)
+ writer.AddAttribute ("class", dynamicMenuStyle.RegisteredCssClass);
+
+ writer.AddStyleAttribute ("visibility", "hidden");
+ writer.AddStyleAttribute ("position", "absolute");
+ writer.AddStyleAttribute ("left", "0px");
+ writer.AddStyleAttribute ("top", "0px");
+ writer.AddAttribute ("id", GetItemClientId (item, "s"));
+ writer.RenderBeginTag (HtmlTextWriterTag.Div);
+
+ // Up button
+ writer.AddAttribute ("id", GetItemClientId (item, "cu"));
+ writer.AddStyleAttribute ("display", "block");
+ writer.AddStyleAttribute ("text-align", "center");
+ writer.AddAttribute ("onmouseover", string.Format ("javascript:Menu_OverScrollBtn ('{0}','{1}','{2}')", ClientID, item.Path, "u"));
+ writer.AddAttribute ("onmouseout", string.Format ("javascript:Menu_OutScrollBtn ('{0}','{1}','{2}')", ClientID, item.Path, "u"));
+ writer.RenderBeginTag (HtmlTextWriterTag.Div);
+
+ string src = ScrollUpImageUrl != "" ? ScrollUpImageUrl : Page.ClientScript.GetWebResourceUrl (typeof(Menu), "arrow_up.gif");
+ writer.AddAttribute ("src", src);
+ writer.AddAttribute ("alt", ScrollUpText);
+ writer.RenderBeginTag (HtmlTextWriterTag.Img);
+ writer.RenderEndTag (); // IMG
+
+ writer.RenderEndTag (); // DIV scroll button
+
+ writer.AddAttribute ("id", GetItemClientId (item, "cb")); // Scroll container
+ writer.RenderBeginTag (HtmlTextWriterTag.Div);
+ writer.AddAttribute ("id", GetItemClientId (item, "cc")); // Content
+ writer.RenderBeginTag (HtmlTextWriterTag.Div);
+
+ RenderMenu (writer, item.ChildItems, true, true);
+
+ writer.RenderEndTag (); // DIV Content
+ writer.RenderEndTag (); // DIV Scroll container
+
+ // Down button
+ writer.AddAttribute ("id", GetItemClientId (item, "cd"));
+ writer.AddStyleAttribute ("display", "block");
+ writer.AddStyleAttribute ("text-align", "center");
+ writer.AddAttribute ("onmouseover", string.Format ("javascript:Menu_OverScrollBtn ('{0}','{1}','{2}')", ClientID, item.Path, "d"));
+ writer.AddAttribute ("onmouseout", string.Format ("javascript:Menu_OutScrollBtn ('{0}','{1}','{2}')", ClientID, item.Path, "d"));
+ writer.RenderBeginTag (HtmlTextWriterTag.Div);
+
+ src = ScrollDownImageUrl != "" ? ScrollDownImageUrl : Page.ClientScript.GetWebResourceUrl (typeof(Menu), "arrow_down.gif");
+ writer.AddAttribute ("src", src);
+ writer.AddAttribute ("alt", ScrollDownText);
+ writer.RenderBeginTag (HtmlTextWriterTag.Img);
+ writer.RenderEndTag (); // IMG
+
+ writer.RenderEndTag (); // DIV scroll button
+
+ writer.RenderEndTag (); // DIV menu
+ }
+
+ void RenderMenuBeginTagAttributes (HtmlTextWriter writer, bool dynamic)
+ {
+ writer.AddAttribute ("cellpadding", "0");
+ writer.AddAttribute ("cellspacing", "0");
+
+ if (!dynamic && staticMenuStyle != null)
+ writer.AddAttribute ("class", staticMenuStyle.RegisteredCssClass);
+ }
+
+ void RenderMenu (HtmlTextWriter writer, MenuItemCollection items, bool vertical, bool dynamic)
+ {
+ RenderMenuBeginTag (writer, dynamic);
+ RenderMenuBody (writer, items, vertical, dynamic);
+ RenderMenuEndTag (writer);
+ }
+
+ void RenderMenuBeginTag (HtmlTextWriter writer, bool dynamic)
+ {
+ RenderMenuBeginTagAttributes (writer, dynamic);
+ writer.RenderBeginTag (HtmlTextWriterTag.Table);
+ }
+
+ void RenderMenuEndTag (HtmlTextWriter writer)
+ {
+ writer.RenderEndTag ();
+ }
+
+ void RenderMenuBody (HtmlTextWriter writer, MenuItemCollection items, bool vertical, bool dynamic)
+ {
+ if (!vertical) writer.RenderBeginTag (HtmlTextWriterTag.Tr);
+
+ for (int n=0; n<items.Count; n++) {
+ MenuItem item = items [n];
+ if (n > 0) {
+ Unit itemSpacing = GetItemSpacing (item, dynamic);
+ if (itemSpacing != Unit.Empty) {
+ if (vertical) {
+ writer.AddAttribute ("height", itemSpacing.ToString());
+ writer.RenderBeginTag (HtmlTextWriterTag.Tr);
+ writer.RenderEndTag ();
+ } else {
+ writer.AddAttribute ("width", itemSpacing.ToString());
+ writer.RenderBeginTag (HtmlTextWriterTag.Td);
+ writer.RenderEndTag ();
+ }
+ }
+ }
+ RenderMenuItem (writer, item);
+ }
+
+ if (!vertical) writer.RenderEndTag (); // TR
+ }
+
+ void RenderMenuItem (HtmlTextWriter writer, MenuItem item)
+ {
+ bool displayChildren = (item.Depth + 1 < StaticDisplayLevels + MaximumDynamicDisplayLevels);
+ bool dynamicChildren = displayChildren && (item.Depth + 1 >= StaticDisplayLevels) && item.ChildItems.Count > 0;
+ bool isDynamicItem = item.Depth + 1 > StaticDisplayLevels;
+ bool vertical = (Orientation == Orientation.Vertical) || isDynamicItem;
+
+ if (vertical)
+ writer.RenderBeginTag (HtmlTextWriterTag.Tr);
+
+ Style itemStyle = null;
+ if (levelMenuItemStyles != null && item.Depth < levelMenuItemStyles.Count)
+ itemStyle = levelMenuItemStyles [item.Depth];
+ else if (isDynamicItem) {
+ if (dynamicMenuItemStyle != null)
+ itemStyle = dynamicMenuItemStyle;
+ } else {
+ if (staticMenuItemStyle != null)
+ itemStyle = staticMenuItemStyle;
+ }
+
+ Style selectedStyle = null;
+ if (item == SelectedItem) {
+ if (levelSelectedStyles != null && item.Depth < levelSelectedStyles.Count)
+ selectedStyle = levelSelectedStyles [item.Depth];
+ else if (isDynamicItem) {
+ if (dynamicSelectedStyle != null)
+ selectedStyle = dynamicSelectedStyle;
+ } else {
+ if (staticSelectedStyle != null)
+ selectedStyle = staticSelectedStyle;
+ }
+ }
+
+ string cls = "";
+ if (itemStyle != null) cls += itemStyle.RegisteredCssClass + " ";
+ if (selectedStyle != null) cls += selectedStyle.RegisteredCssClass + " ";
+ if (cls != "")
+ writer.AddAttribute ("class", cls);
+
+ string parentId = isDynamicItem ? "'" + item.Parent.Path + "'" : "null";
+ if (dynamicChildren) {
+ writer.AddAttribute ("onmouseover", string.Format ("javascript:Menu_OverItem ('{0}','{1}',{2})", ClientID, item.Path, parentId));
+ writer.AddAttribute ("onmouseout", string.Format ("javascript:Menu_OutItem ('{0}','{1}')", ClientID, item.Path));
+ } else if (isDynamicItem) {
+ writer.AddAttribute ("onmouseover", string.Format ("javascript:Menu_OverDynamicLeafItem ('{0}','{1}',{2})", ClientID, item.Path, parentId));
+ writer.AddAttribute ("onmouseout", string.Format ("javascript:Menu_OutItem ('{0}','{1}',{2})", ClientID, item.Path, parentId));
+ } else {
+ writer.AddAttribute ("onmouseover", string.Format ("javascript:Menu_OverStaticLeafItem ('{0}','{1}')", ClientID, item.Path));
+ writer.AddAttribute ("onmouseout", string.Format ("javascript:Menu_OutItem ('{0}','{1}')", ClientID, item.Path));
+ }
+
+ writer.AddAttribute ("id", GetItemClientId (item, "i"));
+
+ writer.RenderBeginTag (HtmlTextWriterTag.Td);
+
+ // Top separator image
+
+ if (isDynamicItem && DynamicTopSeparatorImageUrl != "") {
+ writer.AddAttribute ("src", DynamicTopSeparatorImageUrl);
+ writer.RenderBeginTag (HtmlTextWriterTag.Img);
+ writer.RenderEndTag (); // IMG
+ } else if (!isDynamicItem && StaticTopSeparatorImageUrl != "") {
+ writer.AddAttribute ("src", StaticTopSeparatorImageUrl);
+ writer.RenderBeginTag (HtmlTextWriterTag.Img);
+ writer.RenderEndTag (); // IMG
+ }
+
+ // Menu item box
+
+ writer.AddAttribute ("cellpadding", "0");
+ writer.AddAttribute ("cellspacing", "0");
+ writer.AddAttribute ("width", "100%");
+ writer.RenderBeginTag (HtmlTextWriterTag.Table);
+ writer.RenderBeginTag (HtmlTextWriterTag.Tr);
+
+ if (item.Depth > 0 && !isDynamicItem) {
+ writer.RenderBeginTag (HtmlTextWriterTag.Td);
+ writer.AddStyleAttribute ("width", StaticSubMenuIndent.ToString ());
+ writer.RenderBeginTag (HtmlTextWriterTag.Div);
+ writer.RenderEndTag (); // DIV
+ writer.RenderEndTag (); // TD
+ }
+
+ if (item.ImageUrl != "") {
+ writer.RenderBeginTag (HtmlTextWriterTag.Td);
+ RenderItemHref (writer, item);
+ writer.RenderBeginTag (HtmlTextWriterTag.A);
+ writer.AddAttribute ("src", item.ImageUrl);
+ writer.AddAttribute ("border", "0");
+ writer.RenderBeginTag (HtmlTextWriterTag.Img);
+ writer.RenderEndTag (); // IMG
+ writer.RenderEndTag (); // A
+ writer.RenderEndTag (); // TD
+ }
+
+ // Menu item text
+
+ writer.AddAttribute ("width", "100%");
+ if (!ItemWrap)
+ writer.AddAttribute ("nowrap", "nowrap");
+ writer.RenderBeginTag (HtmlTextWriterTag.Td);
+
+ RenderItemHref (writer, item);
+ writer.AddStyleAttribute ("text-decoration", "none");
+ writer.RenderBeginTag (HtmlTextWriterTag.A);
+ RenderItemContent (writer, item, isDynamicItem);
+ writer.RenderEndTag (); // A
+
+ writer.RenderEndTag (); // TD
+
+ // Popup image
+
+ if (dynamicChildren) {
+ string popOutImage = GetPopOutImage (item, isDynamicItem);
+ if (popOutImage != null)
+ {
+ writer.RenderBeginTag (HtmlTextWriterTag.Td);
+ writer.AddAttribute ("src", popOutImage);
+ writer.AddAttribute ("border", "0");
+ writer.RenderBeginTag (HtmlTextWriterTag.Img);
+ writer.RenderEndTag (); // IMG
+ writer.RenderEndTag (); // TD
+ }
+ }
+
+ writer.RenderEndTag (); // TR
+ writer.RenderEndTag (); // TABLE
+
+ // Bottom separator image
+
+ string separatorImg = item.SeparatorImageUrl;
+ if (separatorImg.Length == 0) {
+ if (isDynamicItem) separatorImg = DynamicBottomSeparatorImageUrl;
+ else separatorImg = StaticBottomSeparatorImageUrl;
+ }
+ if (separatorImg.Length > 0) {
+ writer.AddAttribute ("src", separatorImg);
+ writer.RenderBeginTag (HtmlTextWriterTag.Img);
+ writer.RenderEndTag (); // IMG
+ }
+
+ // Submenu
+
+ if (vertical) {
+ if (displayChildren) {
+ if (dynamicChildren) dynamicMenus.Add (item);
+ else {
+ writer.AddAttribute ("width", "100%");
+ RenderMenu (writer, item.ChildItems, true, false);
+ }
+ }
+
+ writer.RenderEndTag (); // TD
+ writer.RenderEndTag (); // TR
+ } else {
+ writer.RenderEndTag (); // TD
+
+ writer.RenderBeginTag (HtmlTextWriterTag.Td);
+ if (displayChildren) {
+ if (dynamicChildren) dynamicMenus.Add (item);
+ else RenderMenu (writer, item.ChildItems, false, false);
+ }
+ writer.RenderEndTag (); // TD
+ }
+ }
+
+ void RenderItemContent (HtmlTextWriter writer, MenuItem item, bool isDynamicItem)
+ {
+ if (isDynamicItem && dynamicItemTemplate != null) {
+ MenuItemTemplateContainer cter = new MenuItemTemplateContainer (item.Index, item);
+ dynamicItemTemplate.InstantiateIn (cter);
+ cter.Render (writer);
+ } else if (!isDynamicItem && staticItemTemplate != null) {
+ MenuItemTemplateContainer cter = new MenuItemTemplateContainer (item.Index, item);
+ staticItemTemplate.InstantiateIn (cter);
+ cter.Render (writer);
+ } else {
+ writer.Write (item.Text);
+ }
+ }
+
+ Unit GetItemSpacing (MenuItem item, bool dynamic)
+ {
+ Unit itemSpacing;
+
+ if (item.Selected) {
+ if (levelSelectedStyles != null && item.Depth < levelSelectedStyles.Count) {
+ itemSpacing = levelSelectedStyles [item.Depth].ItemSpacing;
+ if (itemSpacing != Unit.Empty) return itemSpacing;
+ }
+
+ if (dynamic) itemSpacing = DynamicSelectedStyle.ItemSpacing;
+ else itemSpacing = StaticSelectedStyle.ItemSpacing;
+ if (itemSpacing != Unit.Empty) return itemSpacing;
+ }
+
+ if (levelMenuItemStyles != null && item.Depth < levelMenuItemStyles.Count) {
+ itemSpacing = levelMenuItemStyles [item.Depth].ItemSpacing;
+ if (itemSpacing != Unit.Empty) return itemSpacing;
+ }
+
+ if (dynamic) return DynamicMenuItemStyle.ItemSpacing;
+ else return StaticMenuItemStyle.ItemSpacing;
+ }
+
+
+ string GetItemSeparatorImage (MenuItem item, bool isDynamicItem)
+ {
+ if (item.SeparatorImageUrl != "") return item.SeparatorImageUrl;
+ if (isDynamicItem && DynamicTopSeparatorImageUrl != "")
+ return DynamicTopSeparatorImageUrl;
+ else if (!isDynamicItem && StaticTopSeparatorImageUrl != "")
+ return StaticTopSeparatorImageUrl;
+ return null;
+ }
+
+ string GetPopOutImage (MenuItem item, bool isDynamicItem)
+ {
+ if (item.PopOutImageUrl != "")
+ return item.PopOutImageUrl;
+
+ if (isDynamicItem) {
+ if (DynamicPopOutImageUrl != "")
+ return DynamicPopOutImageUrl;
+ if (DynamicEnableDefaultPopOutImage)
+ return AssemblyResourceLoader.GetResourceUrl (typeof(Menu), "arrow_plus.gif");
+ } else {
+ if (StaticPopOutImageUrl != "")
+ return StaticPopOutImageUrl;
+ if (StaticEnableDefaultPopOutImage)
+ return AssemblyResourceLoader.GetResourceUrl (typeof(Menu), "arrow_plus.gif");
+ }
+ return null;
+ }
+
+ void RenderItemHref (HtmlTextWriter writer, MenuItem item)
+ {
+ if (item.NavigateUrl != "") {
+ writer.AddAttribute ("href", item.NavigateUrl);
+ if (item.Target != "")
+ writer.AddAttribute ("target", item.Target);
+ else if (Target != "")
+ writer.AddAttribute ("target", Target);
+ }
+ else {
+ writer.AddAttribute ("href", GetClientEvent (item));
+ }
+ }
+
+ string GetItemClientId (MenuItem item, string sufix)
+ {
+ return ClientID + "_" + item.Path + sufix;
+ }
+
+ string GetClientEvent (MenuItem item)
+ {
+ return Page.ClientScript.GetPostBackClientHyperlink (this, item.Path);
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Menu.js b/mcs/class/System.Web/System.Web.UI.WebControls/Menu.js
new file mode 100644
index 00000000000..7d9090debf6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Menu.js
@@ -0,0 +1,190 @@
+
+function Menu_OverItem (menuId, itemId, parentId) {
+ var menu = getMenu (menuId);
+ var subm = getSubMenu (menuId, itemId);
+ if (subm.parentMenu == null && parentId != null)
+ subm.parentMenu = getSubMenu (menuId, parentId);
+
+ if (subm.firstShown != true) {
+ var item = getMenuItem (menuId, itemId);
+ var offx; var offy;
+ if (subm.parentMenu != null) {
+ offx = parseInt (subm.parentMenu.style.left);
+ offy = parseInt (subm.parentMenu.style.top);
+ } else {
+ offx = offy = 0;
+ }
+
+ if (menu.dho != null) offx += menu.dho;
+ if (menu.dvo != null) offy += menu.dvo;
+
+ if (menu.vertical || parentId != null)
+ Menu_Reposition (item, subm, item.offsetWidth + offx, offy);
+ else
+ Menu_Reposition (item, subm, offx, item.offsetHeight + offy);
+
+ subm.initialLeft = subm.style.left;
+ subm.initialTop = subm.style.top;
+ subm.initialContentHeight = getMenuScrollBox (menuId, itemId, "b").offsetHeight;
+ subm.scrollButtonsHeight = subm.offsetHeight - subm.initialContentHeight;
+ var submMargin = subm.offsetHeight - subm.clientHeight;
+ subm.initialOffsetHeight = subm.offsetHeight - subm.scrollButtonsHeight + submMargin;
+ subm.firstShown = true;
+ }
+
+ Menu_SetActive (menu, subm);
+ Menu_ShowMenu (subm);
+ Menu_Resize (subm, menuId, itemId);
+
+ if (parentId != null && menu.dynamicHover != null)
+ Menu_HilighItem (menuId, itemId, menu.dynamicHover);
+ else if (parentId == null && menu.staticHover != null)
+ Menu_HilighItem (menuId, itemId, menu.staticHover);
+}
+
+function Menu_OverDynamicLeafItem (menuId, itemId, parentId) {
+ var menu = getMenu (menuId);
+ var subm = getSubMenu (menuId, parentId);
+ Menu_SetActive (menu, subm);
+ Menu_ShowMenu (subm);
+ if (menu.dynamicHover != null)
+ Menu_HilighItem (menuId, itemId, menu.dynamicHover);
+}
+
+function Menu_OverStaticLeafItem (menuId, itemId) {
+ var menu = getMenu (menuId);
+ Menu_SetActive (menu, null);
+ if (menu.dynamicHover != null)
+ Menu_HilighItem (menuId, itemId, menu.staticHover);
+}
+
+function Menu_HilighItem (menuId, itemId, hoverClass)
+{
+ var item = getMenuItem (menuId, itemId);
+ if (item.normalClass == null)
+ item.normalClass = item.className;
+ item.className = item.normalClass + " " + hoverClass;
+}
+
+function Menu_OutItem (menuId, itemId, parentId) {
+ var menu = getMenu (menuId);
+ var subm = getSubMenu (menuId, itemId);
+ if (subm == null && parentId != null)
+ subm = getSubMenu (menuId, parentId);
+ if (subm != null)
+ Menu_HideMenu (menu, subm, menu.disappearAfter);
+ var item = getMenuItem (menuId, itemId);
+ if (item != null && item.normalClass != null)
+ item.className = item.normalClass;
+}
+
+function Menu_OverScrollBtn (menuId, parentId, updown) {
+ var menu = getMenu (menuId);
+ var subm = getSubMenu (menuId, parentId);
+ Menu_SetActive (menu, subm);
+ Menu_ShowMenu (subm);
+ if (subm.scrollThread != null)
+ clearInterval (subm.scrollThread);
+ var box = getMenuScrollBox (menuId, parentId, "b");
+ subm.scrollThread = setInterval ("Menu_ScrollMenu ('" + box.id + "','" + updown + "')", 60);
+}
+
+function Menu_OutScrollBtn (menuId, parentId, updown) {
+ var menu = getMenu (menuId);
+ var subm = getSubMenu (menuId, parentId);
+ if (subm.scrollThread != null)
+ clearInterval (subm.scrollThread);
+ Menu_HideMenu (menu, subm, menu.disappearAfter);
+}
+
+function Menu_ScrollMenu (boxId, updown) {
+ var box = document.getElementById (boxId);
+ if (updown == "u") box.scrollTop -= 5;
+ else box.scrollTop += 5;
+}
+
+
+function Menu_SetActive (menu, subm) {
+ if (menu.active != null && subm != menu.active)
+ Menu_HideMenu (menu, menu.active, 0);
+ menu.active = subm;
+}
+
+function Menu_HideMenu (menu, subm, time)
+{
+ if (subm.timer != null) clearTimeout (subm.timer);
+ if (time > 0) subm.timer = setTimeout ("Menu_HideMenuCallback ('" + subm.id + "')", time);
+ else Menu_HideMenuCallback (subm.id);
+
+ if (subm.parentMenu != null)
+ Menu_HideMenu (menu, subm.parentMenu, time);
+}
+
+function Menu_HideMenuCallback (spanId)
+{
+ var subm = document.getElementById (spanId);
+ subm.style.visibility = "hidden";
+}
+
+function Menu_ShowMenu (subm)
+{
+ if (subm.timer != null)
+ clearTimeout (subm.timer);
+
+ subm.style.visibility = "visible";
+
+ if (subm.parentMenu != null)
+ Menu_ShowMenu (subm.parentMenu);
+}
+
+function Menu_Reposition (it, elem, offx, offy)
+{
+ var le = 0;
+ var to = 0;
+ while (it != null && it.style.position != "absolute") {
+ le += it.offsetLeft;
+ to += it.offsetTop;
+ it = it.offsetParent;
+ }
+ elem.style.left = (le + offx) + "px";
+ elem.style.top = (to + offy) + "px";
+}
+
+function Menu_Resize (subm, menuId, itemId)
+{
+ subm.style.top = subm.initialTop;
+ var parent = subm.offsetParent;
+ var box = getMenuScrollBox (menuId, itemId, "b");
+ box.scrollTop = 0;
+ var bottom = subm.offsetTop + subm.initialOffsetHeight - parent.scrollTop;
+ var displayScroll;
+
+ if (bottom > parent.clientHeight /* && parent.scrollHeight > parent.clientHeight*/) {
+ var overflow = bottom - parent.clientHeight;
+ var freeTop = subm.offsetTop - parent.scrollTop;
+ if (overflow <= freeTop) {
+ subm.style.top = (subm.offsetTop - overflow) + "px";
+ displayScroll = "none";
+ box.style.height = subm.initialContentHeight + "px";
+ } else {
+ subm.style.top = (subm.offsetTop - freeTop) + "px";
+ var bh = (parent.clientHeight - subm.offsetTop + parent.scrollTop) - subm.scrollButtonsHeight;
+ box.style.overflow = "hidden";
+ box.style.height = bh + "px";
+ displayScroll = "block";
+ }
+ } else {
+ displayScroll = "none";
+ box.style.height = subm.initialContentHeight + "px";
+ }
+ var btn = getMenuScrollBox (menuId, itemId, "u");
+ btn.style.display = displayScroll;
+ btn = getMenuScrollBox (menuId, itemId, "d");
+ btn.style.display = displayScroll;
+}
+
+function getMenu (menuId) { return eval (menuId + "_data"); }
+function getSubMenu (menuId, itemId) { return document.getElementById (menuId + "_" + itemId + "s"); }
+function getMenuItem (menuId, itemId) { return document.getElementById (menuId + "_" + itemId + "i"); }
+function getMenuScrollBox (menuId, itemId, btn) { return document.getElementById (menuId + "_" + itemId + "c" + btn); }
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MenuEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MenuEventArgs.cs
new file mode 100644
index 00000000000..a0a6012dd29
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MenuEventArgs.cs
@@ -0,0 +1,62 @@
+//
+// System.Web.UI.WebControls.MenuEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class MenuEventArgs : CommandEventArgs
+ {
+ private MenuItem item;
+ private object source;
+
+ public MenuEventArgs (MenuItem item) : base ("", null)
+ {
+ this.item = item;
+ this.source = null;
+ }
+
+ public MenuEventArgs (MenuItem item, object source, CommandEventArgs arguments) : base (arguments)
+ {
+ this.item = item;
+ this.source = source;
+ }
+
+ public object CommandSource {
+ get { return source; }
+ }
+
+ public MenuItem Item {
+ get { return item; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MenuEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MenuEventHandler.cs
new file mode 100644
index 00000000000..27e4d5bc683
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MenuEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.MenuEventHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void MenuEventHandler (object sender, MenuEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MenuItem.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MenuItem.cs
new file mode 100644
index 00000000000..b696d394ccc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MenuItem.cs
@@ -0,0 +1,520 @@
+//
+// System.Web.UI.WebControls.MenuItem.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Text;
+using System.ComponentModel;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ParseChildrenAttribute (true, "ChildItems")]
+ public sealed class MenuItem: IStateManager, ICloneable
+ {
+ StateBag ViewState = new StateBag ();
+ MenuItemCollection items;
+ bool marked;
+ Menu menu;
+ MenuItem parent;
+ int index;
+ string path;
+ int depth = -1;
+
+ IHierarchyData hierarchyData;
+ bool gotBinding;
+ MenuItemBinding binding;
+ PropertyDescriptorCollection boundProperties;
+
+ public MenuItem ()
+ {
+ }
+
+ public MenuItem (string text)
+ {
+ Text = text;
+ }
+
+ public MenuItem (string text, string value)
+ {
+ Text = text;
+ Value = value;
+ }
+
+ public MenuItem (string text, string value, string imageUrl)
+ {
+ Text = text;
+ Value = value;
+ ImageUrl = imageUrl;
+ }
+
+ public MenuItem (string text, string value, string imageUrl, string navigateUrl)
+ {
+ Text = text;
+ Value = value;
+ ImageUrl = imageUrl;
+ NavigateUrl = navigateUrl;
+ }
+
+ public MenuItem (string text, string value, string imageUrl, string navigateUrl, string target)
+ {
+ Text = text;
+ Value = value;
+ ImageUrl = imageUrl;
+ NavigateUrl = navigateUrl;
+ Target = target;
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public int Depth {
+ get {
+ if (depth != -1) return depth;
+ if (Parent == null) depth = 0;
+ else depth = Parent.Depth + 1;
+ return depth;
+ }
+ }
+
+ void ResetPathData ()
+ {
+ path = null;
+ depth = -1;
+ gotBinding = false;
+ }
+
+ internal Menu Menu {
+ get { return menu; }
+ set {
+ menu = value;
+ if (items != null)
+ items.SetMenu (menu);
+ ResetPathData ();
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [DefaultValue (false)]
+ [Browsable (false)]
+ public bool DataBound {
+ get { return hierarchyData != null; }
+ }
+
+ [DefaultValue (null)]
+ [Browsable (false)]
+ public object DataItem {
+ get {
+ if (hierarchyData == null) throw new InvalidOperationException ("MenuItem is not data bound.");
+ return hierarchyData.Item;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [DefaultValue ("")]
+ [Browsable (false)]
+ public string DataPath {
+ get {
+ if (hierarchyData == null) throw new InvalidOperationException ("MenuItem is not data bound.");
+ return hierarchyData.Path;
+ }
+ }
+
+ [MergableProperty (false)]
+ [Browsable (false)]
+ [PersistenceMode (PersistenceMode.InnerDefaultProperty)]
+ public MenuItemCollection ChildItems {
+ get {
+ if (items == null) {
+ if (DataBound)
+ FillBoundChildren ();
+ else
+ items = new MenuItemCollection (this);
+
+ if (((IStateManager)this).IsTrackingViewState)
+ ((IStateManager)items).TrackViewState();
+ }
+ return items;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public string ImageUrl {
+ get {
+ object o = ViewState ["ImageUrl"];
+ if (o != null) return (string)o;
+ if (DataBound) {
+ MenuItemBinding bin = GetBinding ();
+ if (bin != null) {
+ if (bin.ImageUrlField != "")
+ return (string) GetBoundPropertyValue (bin.ImageUrlField);
+ return bin.ImageUrl;
+ }
+ }
+ return "";
+ }
+ set {
+ ViewState ["ImageUrl"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public string NavigateUrl {
+ get {
+ object o = ViewState ["NavigateUrl"];
+ if (o != null) return (string)o;
+ if (DataBound) {
+ MenuItemBinding bin = GetBinding ();
+ if (bin != null) {
+ if (bin.NavigateUrlField != "")
+ return (string) GetBoundPropertyValue (bin.NavigateUrlField);
+ return bin.NavigateUrl;
+ }
+ }
+ return "";
+ }
+ set {
+ ViewState ["NavigateUrl"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public string PopOutImageUrl {
+ get {
+ object o = ViewState ["PopOutImageUrl"];
+ if (o != null) return (string)o;
+ if (DataBound) {
+ MenuItemBinding bin = GetBinding ();
+ if (bin != null) {
+ if (bin.PopOutImageUrlField != "")
+ return (string) GetBoundPropertyValue (bin.PopOutImageUrlField);
+ return bin.PopOutImageUrl;
+ }
+ }
+ return "";
+ }
+ set {
+ ViewState ["PopOutImageUrl"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ public string Target {
+ get {
+ object o = ViewState ["Target"];
+ if(o != null) return (string)o;
+ if (DataBound) {
+ MenuItemBinding bin = GetBinding ();
+ if (bin != null) {
+ if (bin.TargetField != "")
+ return (string) GetBoundPropertyValue (bin.TargetField);
+ return bin.Target;
+ }
+ }
+ return "";
+ }
+ set {
+ ViewState ["Target"] = value;
+ }
+ }
+
+ [Localizable (true)]
+ [DefaultValue ("")]
+ public string Text {
+ get {
+ object o = ViewState ["Text"];
+ if (o != null) return (string)o;
+ if (DataBound) {
+ MenuItemBinding bin = GetBinding ();
+ if (bin != null) {
+ string text;
+ if (bin.TextField != "")
+ text = (string) GetBoundPropertyValue (bin.TextField);
+ else if (bin.Text != "")
+ text = bin.Text;
+ else
+ text = hierarchyData.ToString ();
+
+ if (bin.FormatString.Length != 0)
+ text = string.Format (bin.FormatString, text);
+ return text;
+ }
+ return hierarchyData.ToString ();
+ }
+ return "";
+ }
+ set {
+ ViewState ["Text"] = value;
+ }
+ }
+
+ [Localizable (true)]
+ [DefaultValue ("")]
+ public string ToolTip {
+ get {
+ object o = ViewState ["ToolTip"];
+ if(o != null) return (string)o;
+ if (DataBound) {
+ MenuItemBinding bin = GetBinding ();
+ if (bin != null) {
+ if (bin.ToolTipField != "")
+ return (string) GetBoundPropertyValue (bin.ToolTipField);
+ return bin.ToolTip;
+ }
+ }
+ return "";
+ }
+ set {
+ ViewState ["ToolTip"] = value;
+ }
+ }
+
+ [Localizable (true)]
+ [DefaultValue ("")]
+ public string Value {
+ get {
+ object o = ViewState ["Value"];
+ if(o != null) return (string)o;
+ if (DataBound) {
+ MenuItemBinding bin = GetBinding ();
+ if (bin != null) {
+ if (bin.ValueField != "")
+ return (string) GetBoundPropertyValue (bin.ValueField);
+ if (bin.Value != "")
+ return bin.Value;
+ }
+ return hierarchyData.ToString ();
+ }
+ return "";
+ }
+ set {
+ ViewState ["Value"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public string SeparatorImageUrl {
+ get {
+ object o = ViewState ["SeparatorImageUrl"];
+ if (o != null) return (string)o;
+ if (DataBound) {
+ MenuItemBinding bin = GetBinding ();
+ if (bin != null) {
+ if (bin.SeparatorImageUrlField != "")
+ return (string) GetBoundPropertyValue (bin.SeparatorImageUrlField);
+ return bin.SeparatorImageUrl;
+ }
+ }
+ return "";
+ }
+ set {
+ ViewState ["SeparatorImageUrl"] = value;
+ }
+ }
+
+ [DefaultValue (false)]
+ [Browsable (false)]
+ public bool Selected {
+ get {
+ if (menu != null)
+ return menu.SelectedItem == this;
+ else
+ return false;
+ }
+ set {
+ if (menu != null) {
+ if (!value && menu.SelectedItem == this)
+ menu.SetSelectedItem (null);
+ else if (value)
+ menu.SetSelectedItem (this);
+ }
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public MenuItem Parent {
+ get { return parent; }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public string ValuePath {
+ get {
+ if (menu == null) return Value;
+
+ StringBuilder sb = new StringBuilder (Value);
+ MenuItem item = parent;
+ while (item != null) {
+ sb.Insert (0, menu.PathSeparator);
+ sb.Insert (0, item.Value);
+ item = item.Parent;
+ }
+ return sb.ToString ();
+ }
+ }
+
+ internal int Index {
+ get { return index; }
+ set { index = value; ResetPathData (); }
+ }
+
+ internal void SetParent (MenuItem item) {
+ parent = item;
+ ResetPathData ();
+ }
+
+ internal string Path {
+ get {
+ if (path != null) return path;
+ StringBuilder sb = new StringBuilder (index.ToString());
+ MenuItem item = parent;
+ while (item != null) {
+ sb.Insert (0, '_');
+ sb.Insert (0, item.Index.ToString ());
+ item = item.Parent;
+ }
+ path = sb.ToString ();
+ return path;
+ }
+ }
+
+ internal bool HasChildData {
+ get { return items != null; }
+ }
+
+ void IStateManager.LoadViewState (object savedState)
+ {
+ if (savedState == null)
+ return;
+
+ object[] states = (object[]) savedState;
+ ViewState.LoadViewState (states [0]);
+
+ if (states [1] != null)
+ ((IStateManager)ChildItems).LoadViewState (states [1]);
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ object[] states = new object[2];
+ states[0] = ViewState.SaveViewState();
+ states[1] = (items == null ? null : ((IStateManager)items).SaveViewState());
+
+ for (int i = 0; i < states.Length; i++) {
+ if (states [i] != null)
+ return states;
+ }
+ return null;
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ if (marked) return;
+ marked = true;
+ ViewState.TrackViewState();
+
+ if (items != null)
+ ((IStateManager)items).TrackViewState ();
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get { return marked; }
+ }
+
+ internal void SetDirty ()
+ {
+ ViewState.SetDirty ();
+ }
+
+ object ICloneable.Clone ()
+ {
+ MenuItem nod = new MenuItem ();
+ foreach (DictionaryEntry e in ViewState)
+ nod.ViewState [(string)e.Key] = e.Value;
+
+ foreach (ICloneable c in ChildItems)
+ nod.ChildItems.Add ((MenuItem)c.Clone ());
+
+ return nod;
+ }
+
+ internal void Bind (IHierarchyData hierarchyData)
+ {
+ this.hierarchyData = hierarchyData;
+ }
+
+ MenuItemBinding GetBinding ()
+ {
+ if (menu == null) return null;
+ if (gotBinding) return binding;
+ binding = menu.FindBindingForItem (hierarchyData.Type, Depth);
+ gotBinding = true;
+ return binding;
+ }
+
+ object GetBoundPropertyValue (string name)
+ {
+ if (boundProperties == null)
+ boundProperties = TypeDescriptor.GetProperties (hierarchyData);
+
+ PropertyDescriptor prop = boundProperties.Find (name, true);
+ if (prop == null)
+ throw new InvalidOperationException ("Property '" + name + "' not found in data bound item");
+ return prop.GetValue (hierarchyData);
+ }
+
+ void FillBoundChildren ()
+ {
+ items = new MenuItemCollection (this);
+ if (!hierarchyData.HasChildren) return;
+
+ IHierarchicalEnumerable e = hierarchyData.GetChildren ();
+ foreach (object obj in e) {
+ IHierarchyData hdata = e.GetHierarchyData (obj);
+ MenuItem item = new MenuItem ();
+ item.Bind (hdata);
+ items.Add (item);
+ }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemBinding.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemBinding.cs
new file mode 100644
index 00000000000..b51ed8e78a8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemBinding.cs
@@ -0,0 +1,360 @@
+//
+// System.Web.UI.WebControls.MenuItemBinding.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty ("TextField")]
+ public sealed class MenuItemBinding: IStateManager, ICloneable, IDataSourceViewSchemaAccessor
+ {
+ StateBag ViewState = new StateBag ();
+
+ [DefaultValue ("")]
+ public string DataMember {
+ get {
+ object o = ViewState ["DataMember"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["DataMember"] = value;
+ }
+ }
+
+ [DefaultValue (-1)]
+ public int Depth {
+ get {
+ object o = ViewState ["Depth"];
+ if (o != null) return (int) o;
+ return -1;
+ }
+ set {
+ ViewState ["Depth"] = value;
+ }
+ }
+
+ [DefaultValue (true)]
+ public bool Enabled {
+ get {
+ object o = ViewState ["Enabled"];
+ if (o != null) return (bool) o;
+ return true;
+ }
+ set {
+ ViewState ["Enabled"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
+ public string EnabledField {
+ get {
+ object o = ViewState ["EnabledField"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["EnabledField"] = value;
+ }
+ }
+
+ [Localizable (true)]
+ [DefaultValue ("")]
+ public string FormatString {
+ get {
+ object o = ViewState ["FormatString"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["FormatString"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public string ImageUrl {
+ get {
+ object o = ViewState ["ImageUrl"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["ImageUrl"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
+ public string ImageUrlField {
+ get {
+ object o = ViewState ["ImageUrlField"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["ImageUrlField"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public string NavigateUrl {
+ get {
+ object o = ViewState ["NavigateUrl"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["NavigateUrl"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
+ public string NavigateUrlField {
+ get {
+ object o = ViewState ["NavigateUrlField"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["NavigateUrlField"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ public string Target {
+ get {
+ object o = ViewState ["Target"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["Target"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
+ public string TargetField {
+ get {
+ object o = ViewState ["TargetField"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["TargetField"] = value;
+ }
+ }
+
+ [Localizable (true)]
+ [DefaultValue ("")]
+ [WebSysDescription ("The display text of the menu item.")]
+ public string Text {
+ get {
+ object o = ViewState ["Text"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["Text"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
+ public string TextField {
+ get {
+ object o = ViewState ["TextField"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["TextField"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [Localizable (true)]
+ public string ToolTip {
+ get {
+ object o = ViewState ["ToolTip"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["ToolTip"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
+ public string ToolTipField {
+ get {
+ object o = ViewState ["ToolTipField"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["ToolTipField"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [Localizable (true)]
+ public string Value {
+ get {
+ object o = ViewState ["Value"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["Value"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
+ public string ValueField {
+ get {
+ object o = ViewState ["ValueField"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["ValueField"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public string PopOutImageUrl {
+ get {
+ object o = ViewState ["PopOutImageUrl"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["PopOutImageUrl"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
+ public string PopOutImageUrlField {
+ get {
+ object o = ViewState ["PopOutImageUrlField"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["PopOutImageUrlField"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public string SeparatorImageUrl {
+ get {
+ object o = ViewState ["SeparatorImageUrl"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["SeparatorImageUrl"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
+ public string SeparatorImageUrlField {
+ get {
+ object o = ViewState ["SeparatorImageUrlField"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["SeparatorImageUrlField"] = value;
+ }
+ }
+
+ void IStateManager.LoadViewState (object savedState)
+ {
+ ViewState.LoadViewState (savedState);
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ return ViewState.SaveViewState();
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ ViewState.TrackViewState ();
+ }
+
+ bool IStateManager.IsTrackingViewState {
+ get { return ViewState.IsTrackingViewState; }
+ }
+
+ [MonoTODO]
+ object IDataSourceViewSchemaAccessor.DataSourceViewSchema {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ object ICloneable.Clone ()
+ {
+ MenuItemBinding bin = new MenuItemBinding ();
+ foreach (DictionaryEntry e in ViewState)
+ bin.ViewState [(string)e.Key] = e.Value;
+ return bin;
+ }
+
+ internal void SetDirty ()
+ {
+ foreach (string key in ViewState.Keys)
+ ViewState.SetItemDirty (key, true);
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemBindingCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemBindingCollection.cs
new file mode 100644
index 00000000000..0c8161955fa
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemBindingCollection.cs
@@ -0,0 +1,104 @@
+//
+// System.Web.UI.WebControls.MenuItemBindingCollection.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class MenuItemBindingCollection: StateManagedCollection
+ {
+ static Type[] types = new Type[] { typeof (MenuItemBinding) };
+
+ internal MenuItemBindingCollection ()
+ {
+ }
+
+ public int Add (MenuItemBinding binding)
+ {
+ return ((IList)this).Add (binding);
+ }
+
+ public bool Contains (MenuItemBinding binding)
+ {
+ return ((IList)this).Contains (binding);
+ }
+
+ public void CopyTo (MenuItemBinding[] array, int index)
+ {
+ ((IList)this).CopyTo (array, index);
+ }
+
+ protected override object CreateKnownType (int index)
+ {
+ return new MenuItemBinding ();
+ }
+
+ protected override Type[] GetKnownTypes ()
+ {
+ return types;
+ }
+
+ public int IndexOf (MenuItemBinding binding)
+ {
+ return ((IList)this).IndexOf (binding);
+ }
+
+ public void Insert (int index, MenuItemBinding binding)
+ {
+ ((IList)this).Insert (index, binding);
+ }
+
+ public void Remove (MenuItemBinding binding)
+ {
+ ((IList)this).Remove (binding);
+ }
+
+ public void RemoveAt (int index)
+ {
+ ((IList)this).RemoveAt (index);
+ }
+
+ public MenuItemBinding this [int i] {
+ get { return (MenuItemBinding) ((IList)this) [i]; }
+ set { ((IList)this) [i] = value; }
+ }
+
+ protected override void SetDirtyObject (object o)
+ {
+ ((MenuItemBinding)o).SetDirty ();
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemCollection.cs
new file mode 100644
index 00000000000..01514219f8d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemCollection.cs
@@ -0,0 +1,248 @@
+//
+// System.Web.UI.WebControls.MenuItemCollection.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Web.UI;
+using System.Collections;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class MenuItemCollection: ICollection, IEnumerable, IStateManager
+ {
+ MenuItem[] originalItems;
+ ArrayList items = new ArrayList ();
+ Menu menu;
+ MenuItem parent;
+ bool marked;
+ bool dirty;
+
+ public MenuItemCollection ()
+ {
+ }
+
+ public MenuItemCollection (MenuItem owner)
+ {
+ this.parent = owner;
+ this.menu = owner.Menu;
+ }
+
+ internal MenuItemCollection (Menu menu)
+ {
+ this.menu = menu;
+ }
+
+ internal void SetMenu (Menu menu)
+ {
+ this.menu = menu;
+ foreach (MenuItem item in items)
+ item.Menu = menu;
+ }
+
+ public MenuItem this [int i] {
+ get { return (MenuItem) items [i]; }
+ }
+
+ public void Add (MenuItem child)
+ {
+ child.Index = items.Add (child);
+ child.Menu = menu;
+ child.SetParent (parent);
+ if (marked) {
+ ((IStateManager)child).TrackViewState ();
+ child.SetDirty ();
+ dirty = true;
+ }
+ }
+
+ public void AddAt (int index, MenuItem child)
+ {
+ items.Insert (index, child);
+ child.Index = index;
+ child.Menu = menu;
+ child.SetParent (parent);
+ for (int n=index+1; n<items.Count; n++)
+ ((MenuItem)items[n]).Index = n;
+ if (marked) {
+ ((IStateManager)child).TrackViewState ();
+ child.SetDirty ();
+ dirty = true;
+ }
+ }
+
+ public void Clear ()
+ {
+ if (menu != null || parent != null) {
+ foreach (MenuItem nod in items) {
+ nod.Menu = null;
+ nod.SetParent (null);
+ }
+ }
+ items.Clear ();
+ dirty = true;
+ }
+
+ public bool Contains (MenuItem child)
+ {
+ return items.Contains (child);
+ }
+
+ public void CopyTo (Array itemArray, int index)
+ {
+ items.CopyTo (itemArray, index);
+ }
+
+ public void CopyTo (MenuItem[] itemArray, int index)
+ {
+ items.CopyTo (itemArray, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return items.GetEnumerator ();
+ }
+
+ public int IndexOf (MenuItem item)
+ {
+ return items.IndexOf (item);
+ }
+
+ public void Remove (MenuItem item)
+ {
+ int i = IndexOf (item);
+ if (i == -1) return;
+ items.RemoveAt (i);
+ if (menu != null)
+ item.Menu = null;
+ dirty = true;
+ }
+
+ public void RemoveAt (int index)
+ {
+ MenuItem item = (MenuItem) items [index];
+ items.RemoveAt (index);
+ if (menu != null)
+ item.Menu = null;
+ dirty = true;
+ }
+
+ public int Count {
+ get { return items.Count; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public object SyncRoot {
+ get { return items; }
+ }
+
+ void System.Collections.ICollection.CopyTo (Array array, int index)
+ {
+ items.CopyTo (array, index);
+ }
+
+ void IStateManager.LoadViewState (object state)
+ {
+ if (state == null) return;
+ object[] its = (object[]) state;
+
+ dirty = (bool)its [0];
+
+ if (dirty)
+ items.Clear ();
+
+ for (int n=1; n<its.Length; n++) {
+ Pair pair = (Pair) its [n];
+ int oi = (int) pair.First;
+ MenuItem item;
+ if (oi != -1) item = originalItems [oi];
+ else item = new MenuItem ();
+ if (dirty) Add (item);
+ ((IStateManager)item).LoadViewState (pair.Second);
+ }
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ object[] state = null;
+ bool hasData = false;
+
+ if (dirty) {
+ state = new object [items.Count + 1];
+ state [0] = true;
+ for (int n=0; n<items.Count; n++) {
+ MenuItem item = items[n] as MenuItem;
+ int oi = Array.IndexOf (originalItems, item);
+ object ns = ((IStateManager)item).SaveViewState ();
+ if (ns != null) hasData = true;
+ state [n + 1] = new Pair (oi, ns);
+ }
+ } else {
+ ArrayList list = new ArrayList ();
+ for (int n=0; n<items.Count; n++) {
+ MenuItem item = items[n] as MenuItem;
+ object ns = ((IStateManager)item).SaveViewState ();
+ if (ns != null) {
+ hasData = true;
+ list.Add (new Pair (n, ns));
+ }
+ }
+ if (hasData) {
+ list.Insert (0, false);
+ state = list.ToArray ();
+ }
+ }
+
+ if (hasData)
+ return state;
+ else
+ return null;
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ marked = true;
+ originalItems = new MenuItem [items.Count];
+ for (int n=0; n<items.Count; n++) {
+ originalItems [n] = (MenuItem) items [n];
+ ((IStateManager)originalItems [n]).TrackViewState ();
+ }
+ }
+
+ bool IStateManager.IsTrackingViewState {
+ get { return marked; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemStyle.cs
new file mode 100644
index 00000000000..76585542098
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemStyle.cs
@@ -0,0 +1,162 @@
+//
+// System.Web.UI.WebControls.MenuItemStyle.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class MenuItemStyle: Style
+ {
+ private static int HORZ_PADD = (0x01 << 16);
+ private static int SPACING = (0x01 << 17);
+ private static int VERT_PADD = (0x01 << 18);
+
+ [DefaultValue (0)]
+ [NotifyParentProperty (true)]
+ public Unit HorizontalPadding {
+ get {
+ if(IsSet(HORZ_PADD))
+ return (Unit)(ViewState["HorizontalPadding"]);
+ return Unit.Empty;
+ }
+ set {
+ ViewState["HorizontalPadding"] = value;
+ Set(HORZ_PADD);
+ }
+ }
+
+ [DefaultValue (0)]
+ [NotifyParentProperty (true)]
+ public Unit VerticalPadding {
+ get {
+ if(IsSet(VERT_PADD))
+ return (Unit)(ViewState["VerticalPadding"]);
+ return Unit.Empty;
+ }
+ set {
+ ViewState["VerticalPadding"] = value;
+ Set(VERT_PADD);
+ }
+ }
+
+ [DefaultValue (0)]
+ [NotifyParentProperty (true)]
+ public Unit ItemSpacing {
+ get {
+ if(IsSet(SPACING))
+ return (Unit)(ViewState["ItemSpacing"]);
+ return Unit.Empty;
+ }
+ set {
+ ViewState["ItemSpacing"] = value;
+ Set(SPACING);
+ }
+ }
+
+ protected internal override bool IsEmpty {
+ get { return base.IsEmpty; }
+ }
+
+ public override void CopyFrom (Style s)
+ {
+ if (s == null || s.IsEmpty)
+ return;
+
+ base.CopyFrom (s);
+ MenuItemStyle from = s as MenuItemStyle;
+ if (from == null)
+ return;
+
+ if (from.IsSet (HORZ_PADD))
+ HorizontalPadding = from.HorizontalPadding;
+
+ if (from.IsSet (SPACING))
+ ItemSpacing = from.ItemSpacing;
+
+ if (from.IsSet (VERT_PADD))
+ VerticalPadding = from.VerticalPadding;
+ }
+
+ public override void MergeWith(Style s)
+ {
+ if(s != null && !s.IsEmpty)
+ {
+ if (IsEmpty) {
+ CopyFrom (s);
+ return;
+ }
+ base.MergeWith(s);
+
+ MenuItemStyle with = s as MenuItemStyle;
+ if (with == null) return;
+
+ if (with.IsSet(HORZ_PADD) && !IsSet(HORZ_PADD)) {
+ HorizontalPadding = with.HorizontalPadding;
+ }
+ if (with.IsSet(SPACING) && !IsSet(SPACING)) {
+ ItemSpacing = with.ItemSpacing;
+ }
+ if (with.IsSet(VERT_PADD) && !IsSet(VERT_PADD)) {
+ VerticalPadding = with.VerticalPadding;
+ }
+ }
+ }
+
+ public override void Reset()
+ {
+ if(IsSet(HORZ_PADD))
+ ViewState.Remove("HorizontalPadding");
+ if(IsSet(SPACING))
+ ViewState.Remove("ItemSpacing");
+ if(IsSet(VERT_PADD))
+ ViewState.Remove("VerticalPadding");
+ base.Reset();
+ }
+
+ protected override void FillStyleAttributes (CssStyleCollection attributes, IUrlResolutionService urlResolver)
+ {
+ base.FillStyleAttributes (attributes, urlResolver);
+ if (IsSet (HORZ_PADD)) {
+ attributes.Add (HtmlTextWriterStyle.PaddingLeft, HorizontalPadding.ToString ());
+ attributes.Add (HtmlTextWriterStyle.PaddingRight, HorizontalPadding.ToString ());
+ }
+ if (IsSet (VERT_PADD)) {
+ attributes.Add (HtmlTextWriterStyle.PaddingTop, VerticalPadding.ToString ());
+ attributes.Add (HtmlTextWriterStyle.PaddingBottom, VerticalPadding.ToString ());
+ }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemStyleCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemStyleCollection.cs
new file mode 100644
index 00000000000..c9413e0b779
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemStyleCollection.cs
@@ -0,0 +1,104 @@
+//
+// System.Web.UI.WebControls.MenuItemStyleCollection.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class MenuItemStyleCollection: StateManagedCollection
+ {
+ static Type[] types = new Type[] { typeof (MenuItemStyle) };
+
+ internal MenuItemStyleCollection ()
+ {
+ }
+
+ public int Add (MenuItemStyle style)
+ {
+ return ((IList)this).Add (style);
+ }
+
+ public bool Contains (MenuItemStyle style)
+ {
+ return ((IList)this).Contains (style);
+ }
+
+ public void CopyTo (MenuItemStyle[] array, int index)
+ {
+ ((IList)this).CopyTo (array, index);
+ }
+
+ protected override object CreateKnownType (int index)
+ {
+ return new MenuItemStyle ();
+ }
+
+ protected override Type[] GetKnownTypes ()
+ {
+ return types;
+ }
+
+ public int IndexOf (MenuItemStyle style)
+ {
+ return ((IList)this).IndexOf (style);
+ }
+
+ public void Insert (int index, MenuItemStyle style)
+ {
+ ((IList)this).Insert (index, style);
+ }
+
+ public void Remove (MenuItemStyle style)
+ {
+ ((IList)this).Remove (style);
+ }
+
+ public void RemoveAt (int index)
+ {
+ ((IList)this).RemoveAt (index);
+ }
+
+ public MenuItemStyle this [int i] {
+ get { return (MenuItemStyle) ((IList)this) [i]; }
+ set { ((IList)this) [i] = value; }
+ }
+
+ protected override void SetDirtyObject (object o)
+ {
+ ((MenuItemStyle)o).SetDirty ();
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemTemplateContainer.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemTemplateContainer.cs
new file mode 100644
index 00000000000..e0cd20763f3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemTemplateContainer.cs
@@ -0,0 +1,73 @@
+//
+// System.Web.UI.WebControls.MenuItemTemplateContainer.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class MenuItemTemplateContainer: Control, IDataItemContainer, INamingContainer
+ {
+ object dataItem;
+ int index;
+
+ public MenuItemTemplateContainer (int itemIndex, MenuItem menuItem)
+ {
+ index = itemIndex;
+ dataItem = menuItem;
+ }
+
+ [MonoTODO]
+ protected override bool OnBubbleEvent (object source, EventArgs args)
+ {
+ return base.OnBubbleEvent (source, args);
+ }
+
+ [MonoTODO]
+ protected override void Render (HtmlTextWriter writer)
+ {
+ base.Render (writer);
+ }
+
+ public object DataItem {
+ get { return dataItem; }
+ set { dataItem = value; }
+ }
+
+ public object ItemIndex {
+ get { return index; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventArgs.cs
new file mode 100644
index 00000000000..9e415e6d16e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventArgs.cs
@@ -0,0 +1,71 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: MonthChangedEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+#if !NET_2_0
+ sealed
+#endif
+ public class MonthChangedEventArgs
+ {
+ private DateTime nDate;
+ private DateTime pDate;
+
+ public MonthChangedEventArgs(DateTime newDate, DateTime previousDate)
+ {
+ nDate = newDate;
+ pDate = previousDate;
+ }
+
+ public DateTime NewDate
+ {
+ get
+ {
+ return nDate;
+ }
+ }
+
+ public DateTime PreviousDate
+ {
+ get
+ {
+ return pDate;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventHandler.cs
new file mode 100644
index 00000000000..2888cd75f9b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventHandler.cs
@@ -0,0 +1,37 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void MonthChangedEventHandler(object sender, MonthChangedEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MultiView.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MultiView.cs
new file mode 100644
index 00000000000..c7216f2c7b3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MultiView.cs
@@ -0,0 +1,195 @@
+//
+// System.Web.UI.WebControls.MultiView.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+// [ControlBuilder (typeof(MultiViewControlBuilder)]
+ [Designer ("System.Web.UI.Design.WebControls.MultiViewDesigner, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+ [ToolboxData ("<{0}:MultiView runat=\"server\"></{0}:MultiView>")]
+ [ParseChildren (false, ChildControlType = typeof(View))]
+ [DefaultEvent ("ActiveViewChanged")]
+ public class MultiView: Control
+ {
+ public static readonly string NextViewCommandName = "NextView";
+ public static readonly string PreviousViewCommandName = "PrevView";
+ public static readonly string SwitchViewByIDCommandName = "SwitchViewByID";
+ public static readonly string SwitchViewByIndexCommandName = "SwitchViewByIndex";
+
+ private static readonly object ActiveViewChangedEvent = new object();
+
+ int viewIndex = -1;
+ int initialIndex = -1;
+ bool initied;
+
+ public event EventHandler ActiveViewChanged {
+ add { Events.AddHandler (ActiveViewChangedEvent, value); }
+ remove { Events.RemoveHandler (ActiveViewChangedEvent, value); }
+ }
+
+ protected override void AddParsedSubObject (object ob)
+ {
+ if (ob is View)
+ Controls.Add (ob as View);
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new ViewCollection (this);
+ }
+
+ public View GetActiveView ()
+ {
+ if (viewIndex < 0 || viewIndex >= Controls.Count)
+ throw new HttpException ("The ActiveViewIndex is not set to a valid View control");
+ return Controls [viewIndex] as View;
+ }
+
+ public void SetActiveView (View view)
+ {
+ int i = Controls.IndexOf (view);
+ if (i == -1)
+ throw new HttpException ("The provided view is not contained in the MultiView control.");
+
+ ActiveViewIndex = i;
+ }
+
+ [DefaultValue (-1)]
+ public virtual int ActiveViewIndex {
+ get { return viewIndex; }
+ set {
+ if (!initied) {
+ initialIndex = value;
+ return;
+ }
+
+ if (value < -1 || value >= Controls.Count)
+ throw new ArgumentOutOfRangeException ();
+
+ if (viewIndex != -1)
+ ((View)Controls [viewIndex]).NotifyActivation (false);
+
+ viewIndex = value;
+
+ if (viewIndex != -1)
+ ((View)Controls [viewIndex]).NotifyActivation (true);
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerDefaultProperty)]
+ [Browsable (false)]
+ public virtual ViewCollection Views {
+ get { return Controls as ViewCollection; }
+ }
+
+ protected override bool OnBubbleEvent (object source, EventArgs e)
+ {
+ CommandEventArgs ca = e as CommandEventArgs;
+ if (ca != null) {
+ switch (ca.CommandName) {
+ case "NextView":
+ if (viewIndex < Controls.Count - 1 && Controls.Count > 0)
+ ActiveViewIndex = viewIndex + 1;
+ break;
+
+ case "PrevView":
+ if (viewIndex > 0)
+ ActiveViewIndex = viewIndex - 1;
+ break;
+
+ case "SwitchViewByID":
+ foreach (View v in Controls)
+ if (v.ID == ca.CommandArgument) {
+ SetActiveView (v);
+ break;
+ }
+ break;
+
+ case "SwitchViewByIndex":
+ int i = (int) Convert.ChangeType (ca.CommandArgument, typeof(int));
+ ActiveViewIndex = i;
+ break;
+ }
+ }
+ return false;
+ }
+
+ protected override void OnInit (EventArgs e)
+ {
+ initied = true;
+ Page.RegisterRequiresControlState (this);
+ ActiveViewIndex = initialIndex;
+ base.OnInit (e);
+ }
+
+ protected internal override void RemovedControl (Control ctl)
+ {
+ if (viewIndex >= Controls.Count)
+ viewIndex = Controls.Count - 1;
+
+ base.RemovedControl (ctl);
+ }
+
+ protected internal override void LoadControlState (object state)
+ {
+ if (state != null) viewIndex = (int)state;
+ else viewIndex = -1;
+ }
+
+ protected internal override object SaveControlState ()
+ {
+ if (viewIndex != -1) return viewIndex;
+ else return null;
+ }
+
+ protected virtual void OnActiveViewChanged (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) Events [ActiveViewChangedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ if (viewIndex != -1)
+ GetActiveView ().Render (writer);
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/NextPrevFormat.cs b/mcs/class/System.Web/System.Web.UI.WebControls/NextPrevFormat.cs
new file mode 100755
index 00000000000..7199e284f15
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/NextPrevFormat.cs
@@ -0,0 +1,43 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: NextPrevFormat
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum NextPrevFormat
+ {
+ CustomText,
+ ShortMonth,
+ FullMonth
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSource.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSource.cs
new file mode 100644
index 00000000000..e376e0fe0ce
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSource.cs
@@ -0,0 +1,352 @@
+//
+// System.Web.UI.WebControls.ObjectDataSource
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.IO;
+using System.Security.Permissions;
+
+namespace System.Web.UI.WebControls
+{
+
+ [DefaultEventAttribute ("Selecting")]
+ [DefaultPropertyAttribute ("TypeName")]
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.ObjectDataSourceDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+ [ParseChildrenAttribute (true)]
+ [PersistChildrenAttribute (false)]
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public class ObjectDataSource : DataSourceControl
+ {
+ ObjectDataSourceView defaultView;
+
+ public ObjectDataSource ()
+ {
+ }
+
+ public ObjectDataSource (string typeName, string selectMethod)
+ {
+ SelectMethod = selectMethod;
+ TypeName = typeName;
+ }
+
+ ObjectDataSourceView DefaultView {
+ get {
+ if (defaultView == null)
+ defaultView = new ObjectDataSourceView (this, "DefaultView", Context);
+ return defaultView;
+ }
+ }
+
+ public event ObjectDataSourceStatusEventHandler Deleted {
+ add { DefaultView.Deleted += value; }
+ remove { DefaultView.Deleted -= value; }
+ }
+
+ public event ObjectDataSourceMethodEventHandler Deleting {
+ add { DefaultView.Deleting += value; }
+ remove { DefaultView.Deleting -= value; }
+ }
+
+ public event ObjectDataSourceFilteringEventHandler Filtering {
+ add { DefaultView.Filtering += value; }
+ remove { DefaultView.Filtering -= value; }
+ }
+
+ public event ObjectDataSourceStatusEventHandler Inserted {
+ add { DefaultView.Inserted += value; }
+ remove { DefaultView.Inserted -= value; }
+ }
+
+ public event ObjectDataSourceMethodEventHandler Inserting {
+ add { DefaultView.Inserting += value; }
+ remove { DefaultView.Inserting -= value; }
+ }
+
+ public event ObjectDataSourceObjectEventHandler ObjectCreated {
+ add { DefaultView.ObjectCreated += value; }
+ remove { DefaultView.ObjectCreated -= value; }
+ }
+
+ public event ObjectDataSourceObjectEventHandler ObjectCreating {
+ add { DefaultView.ObjectCreating += value; }
+ remove { DefaultView.ObjectCreating -= value; }
+ }
+
+ public event ObjectDataSourceDisposingEventHandler ObjectDisposing {
+ add { DefaultView.ObjectDisposing += value; }
+ remove { DefaultView.ObjectDisposing -= value; }
+ }
+
+/* public event ObjectDataSourceResolvingMethodEventHandler ResolvingMethod {
+ add { DefaultView.ResolvingMethod += value; }
+ remove { DefaultView.ResolvingMethod -= value; }
+ }
+*/
+ public event ObjectDataSourceStatusEventHandler Selected {
+ add { DefaultView.Selected += value; }
+ remove { DefaultView.Selected -= value; }
+ }
+
+ public event ObjectDataSourceSelectingEventHandler Selecting {
+ add { DefaultView.Selecting += value; }
+ remove { DefaultView.Selecting -= value; }
+ }
+
+ public event ObjectDataSourceStatusEventHandler Updated {
+ add { DefaultView.Updated += value; }
+ remove { DefaultView.Updated -= value; }
+ }
+
+ public event ObjectDataSourceMethodEventHandler Updating {
+ add { DefaultView.Updating += value; }
+ remove { DefaultView.Updating -= value; }
+ }
+
+ [WebCategoryAttribute ("Data")]
+ [DefaultValueAttribute (ConflictOptions.OverwriteChanges)]
+ public ConflictOptions ConflictDetection {
+ get { return DefaultView.ConflictDetection; }
+ set { DefaultView.ConflictDetection = value; }
+ }
+
+ [WebCategoryAttribute ("Data")]
+ [DefaultValueAttribute ("")]
+ public string DataObjectTypeName {
+ get { return DefaultView.DataObjectTypeName; }
+ set { DefaultView.DataObjectTypeName = value; }
+ }
+
+ [WebCategoryAttribute ("Data")]
+ [DefaultValueAttribute ("")]
+ public string DeleteMethod {
+ get { return DefaultView.DeleteMethod; }
+ set { DefaultView.DeleteMethod = value; }
+ }
+
+ [WebCategoryAttribute ("Data")]
+ [MergablePropertyAttribute (false)]
+ [EditorAttribute ("System.Web.UI.Design.WebControls.ParameterCollectionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [DefaultValueAttribute (null)]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ public ParameterCollection DeleteParameters {
+ get { return DefaultView.DeleteParameters; }
+ }
+
+ [WebCategoryAttribute ("Paging")]
+ [DefaultValueAttribute (false)]
+ public virtual bool EnablePaging {
+ get { return DefaultView.EnablePaging; }
+ set { DefaultView.EnablePaging = value; }
+ }
+
+ [WebCategoryAttribute ("Data")]
+ [DefaultValueAttribute ("")]
+ public string FilterExpression {
+ get { return DefaultView.FilterExpression; }
+ set { DefaultView.FilterExpression = value; }
+ }
+
+ [WebCategoryAttribute ("Data")]
+ [MergablePropertyAttribute (false)]
+ [EditorAttribute ("System.Web.UI.Design.WebControls.ParameterCollectionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [DefaultValueAttribute (null)]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ public ParameterCollection FilterParameters {
+ get { return DefaultView.FilterParameters; }
+ }
+
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Data")]
+ public virtual string InsertMethod {
+ get { return DefaultView.InsertMethod; }
+ set { DefaultView.InsertMethod = value; }
+ }
+
+ [WebCategoryAttribute ("Data")]
+ [MergablePropertyAttribute (false)]
+ [EditorAttribute ("System.Web.UI.Design.WebControls.ParameterCollectionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [DefaultValueAttribute (null)]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ public ParameterCollection InsertParameters {
+ get { return DefaultView.InsertParameters; }
+ }
+
+ [WebCategoryAttribute ("Paging")]
+ [DefaultValueAttribute ("maximumRows")]
+ public string MaximumRowsParameterName {
+ get { return DefaultView.MaximumRowsParameterName; }
+ set { DefaultView.MaximumRowsParameterName = value; }
+ }
+
+ [WebCategoryAttribute ("Data")]
+ [DefaultValueAttribute ("original_{0}")]
+ public string OldValuesParameterFormatString {
+ get { return DefaultView.OldValuesParameterFormatString; }
+ set { DefaultView.OldValuesParameterFormatString = value; }
+ }
+
+ [WebCategoryAttribute ("Paging")]
+ [DefaultValueAttribute ("")]
+ public virtual string SelectCountMethod {
+ get { return DefaultView.SelectCountMethod; }
+ set { DefaultView.SelectCountMethod = value; }
+ }
+
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Data")]
+ public virtual string SelectMethod {
+ get { return DefaultView.SelectMethod; }
+ set { DefaultView.SelectMethod = value; }
+ }
+
+ [WebCategoryAttribute ("Data")]
+ [MergablePropertyAttribute (false)]
+ [EditorAttribute ("System.Web.UI.Design.WebControls.ParameterCollectionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [DefaultValueAttribute (null)]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ public ParameterCollection SelectParameters {
+ get { return DefaultView.SelectParameters; }
+ }
+
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Data")]
+ public string SortParameterName {
+ get { return DefaultView.SortParameterName; }
+ set { DefaultView.SortParameterName = value; }
+ }
+
+ [WebCategoryAttribute ("Paging")]
+ [DefaultValueAttribute ("startRowIndex")]
+ public string StartRowIndexParameterName {
+ get { return DefaultView.StartRowIndexParameterName; }
+ set { DefaultView.StartRowIndexParameterName = value; }
+ }
+
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Data")]
+ public virtual string TypeName {
+ get { return DefaultView.TypeName; }
+ set { DefaultView.TypeName = value; }
+ }
+
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Data")]
+ public virtual string UpdateMethod {
+ get { return DefaultView.UpdateMethod; }
+ set { DefaultView.UpdateMethod = value; }
+ }
+
+ [WebCategoryAttribute ("Data")]
+ [MergablePropertyAttribute (false)]
+ [EditorAttribute ("System.Web.UI.Design.WebControls.ParameterCollectionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [DefaultValueAttribute (null)]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ public ParameterCollection UpdateParameters {
+ get { return DefaultView.UpdateParameters; }
+ }
+
+ protected override DataSourceView GetView (string viewName)
+ {
+ return DefaultView;
+ }
+
+ protected override ICollection GetViewNames ()
+ {
+ return new string [] { "DefaultView" };
+ }
+
+ public IEnumerable Select ()
+ {
+ return DefaultView.Select (DataSourceSelectArguments.Empty);
+ }
+
+ public int Update ()
+ {
+ Hashtable empty = new Hashtable ();
+ return DefaultView.Update (empty, empty, null);
+ }
+
+ public int Delete ()
+ {
+ Hashtable empty = new Hashtable ();
+ return DefaultView.Delete (empty, null);
+ }
+
+ public int Insert ()
+ {
+ Hashtable empty = new Hashtable ();
+ return DefaultView.Insert (empty);
+ }
+
+ protected override void OnInit (EventArgs e)
+ {
+ Page.LoadComplete += OnPageLoadComplete;
+ }
+
+ void OnPageLoadComplete (object sender, EventArgs e)
+ {
+ DeleteParameters.UpdateValues (Context, this);
+ FilterParameters.UpdateValues (Context, this);
+ InsertParameters.UpdateValues (Context, this);
+ SelectParameters.UpdateValues (Context, this);
+ UpdateParameters.UpdateValues (Context, this);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState == null) {
+ base.LoadViewState (null);
+ ((IStateManager)DefaultView).LoadViewState (null);
+ } else {
+ Pair p = (Pair) savedState;
+ base.LoadViewState (p.First);
+ ((IStateManager)DefaultView).LoadViewState (p.Second);
+ }
+ }
+
+ protected override object SaveViewState()
+ {
+ object baseState = base.SaveViewState ();
+ object viewState = ((IStateManager)DefaultView).SaveViewState ();
+ if (baseState != null || viewState != null) return new Pair (baseState, viewState);
+ else return null;
+ }
+
+ protected override void TrackViewState()
+ {
+ ((IStateManager)DefaultView).TrackViewState ();
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceDisposingEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceDisposingEventArgs.cs
new file mode 100644
index 00000000000..ceee10a702b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceDisposingEventArgs.cs
@@ -0,0 +1,51 @@
+//
+// System.Web.UI.WebControls.ObjectDataSourceDisposingEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class ObjectDataSourceDisposingEventArgs : CancelEventArgs
+ {
+ private object objectInstance;
+
+ public ObjectDataSourceDisposingEventArgs (object objectInstance)
+ {
+ this.objectInstance = objectInstance;
+ }
+
+ public object ObjectInstance {
+ get { return objectInstance; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceDisposingEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceDisposingEventHandler.cs
new file mode 100644
index 00000000000..dfdbc0b5c37
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceDisposingEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebContrls.ObjectDataSourceDisposingEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void ObjectDataSourceDisposingEventHandler (object sender, ObjectDataSourceDisposingEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceEventArgs.cs
new file mode 100644
index 00000000000..1b4f95b647a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceEventArgs.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.UI.WebControls.ObjectDataSourceEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls
+{
+ public class ObjectDataSourceEventArgs : EventArgs
+ {
+ private object objectInstance;
+
+ public ObjectDataSourceEventArgs (object objectInstance)
+ {
+ this.objectInstance = objectInstance;
+ }
+
+ public object ObjectInstance {
+ get { return objectInstance; }
+ set { objectInstance = value; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceEventHandler.cs
new file mode 100644
index 00000000000..e0bf3622925
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebContrls.ObjectDataSourceEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void ObjectDataSourceObjectEventHandler (object sender, ObjectDataSourceEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceFilteringEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceFilteringEventArgs.cs
new file mode 100644
index 00000000000..73b62ff85f0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceFilteringEventArgs.cs
@@ -0,0 +1,51 @@
+//
+// System.Web.UI.WebControls.ObjectDataSourceFilteringEventArgs.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+ public class ObjectDataSourceFilteringEventArgs : System.ComponentModel.CancelEventArgs
+ {
+ private IOrderedDictionary parameters;
+
+ public ObjectDataSourceFilteringEventArgs (IOrderedDictionary parameterValues)
+ {
+ this.parameters = parameterValues;
+ }
+
+ public IOrderedDictionary ParameterValues {
+ get { return parameters; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceFilteringEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceFilteringEventHandler.cs
new file mode 100644
index 00000000000..51295f0439f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceFilteringEventHandler.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.UI.WebControls.ObjectDataSourceFilteringEventHandler.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void ObjectDataSourceFilteringEventHandler (object sender, ObjectDataSourceFilteringEventArgs e);
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceMethodEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceMethodEventArgs.cs
new file mode 100644
index 00000000000..e8f5853175a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceMethodEventArgs.cs
@@ -0,0 +1,52 @@
+//
+// System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+ public class ObjectDataSourceMethodEventArgs : System.ComponentModel.CancelEventArgs
+ {
+ private IOrderedDictionary parameters;
+
+ public ObjectDataSourceMethodEventArgs (IOrderedDictionary inputParameters)
+ {
+ this.parameters = inputParameters;
+ }
+
+ public IOrderedDictionary InputParameters {
+ get { return parameters; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceMethodEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceMethodEventHandler.cs
new file mode 100644
index 00000000000..67f93215ce2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceMethodEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebContrls.ObjectDataSourceMethodEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void ObjectDataSourceMethodEventHandler (object sender, ObjectDataSourceMethodEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceSelectingEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceSelectingEventArgs.cs
new file mode 100644
index 00000000000..462df8f99e8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceSelectingEventArgs.cs
@@ -0,0 +1,58 @@
+//
+// System.Web.UI.WebControls.ObjectDataSourceSelectingEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+ public class ObjectDataSourceSelectingEventArgs: ObjectDataSourceMethodEventArgs
+ {
+ private bool executeSelectCount;
+ private DataSourceSelectArguments arguments;
+
+ public ObjectDataSourceSelectingEventArgs (IOrderedDictionary inputParameters, DataSourceSelectArguments arguments, bool executeSelectCount) : base (inputParameters)
+ {
+ this.executeSelectCount = executeSelectCount;
+ this.arguments = arguments;
+ }
+
+ public bool ExecutingSelectCount {
+ get { return executeSelectCount; }
+ }
+
+ public DataSourceSelectArguments Arguments {
+ get { return arguments; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceSelectingEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceSelectingEventHandler.cs
new file mode 100644
index 00000000000..0ef51f522cf
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceSelectingEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebContrls.ObjectDataSourceSelectingEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void ObjectDataSourceSelectingEventHandler (object sender, ObjectDataSourceSelectingEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceStatusEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceStatusEventArgs.cs
new file mode 100644
index 00000000000..fba330b3653
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceStatusEventArgs.cs
@@ -0,0 +1,78 @@
+//
+// System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections;
+
+namespace System.Web.UI.WebControls
+{
+ public class ObjectDataSourceStatusEventArgs : EventArgs
+ {
+ private object returnVal;
+ private IDictionary outPutParam;
+ private Exception exception;
+ private bool exceptionHandled;
+
+ public ObjectDataSourceStatusEventArgs (object returnVal, IDictionary outPutParam)
+ {
+ this.returnVal = returnVal;
+ this.outPutParam = outPutParam;
+ this.exception = null;
+ this.exceptionHandled = false;
+ }
+
+ public ObjectDataSourceStatusEventArgs (object returnVal, IDictionary outPutParam, Exception e)
+ {
+ this.returnVal = returnVal;
+ this.outPutParam = outPutParam;
+ this.exception = e;
+ this.exceptionHandled = true;
+ }
+
+ public Exception Exception {
+ get { return exception; }
+ }
+
+ public bool ExceptionHandled {
+ get { return exceptionHandled; }
+ set { exceptionHandled = value; }
+ }
+
+ public IDictionary OutputParameters {
+ get { return outPutParam; }
+ }
+
+ public object ReturnValue {
+ get { return returnVal; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceStatusEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceStatusEventHandler.cs
new file mode 100644
index 00000000000..cbe4936b6dd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceStatusEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebContrls.ObjectDataSourceStatusEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void ObjectDataSourceStatusEventHandler (object sender, ObjectDataSourceStatusEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceView.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceView.cs
new file mode 100644
index 00000000000..2462e3785df
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceView.cs
@@ -0,0 +1,1038 @@
+//
+// System.Web.UI.WebControls.ObjectDataSourceView
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System;
+using System.Reflection;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.IO;
+using System.Data;
+
+namespace System.Web.UI.WebControls
+{
+
+ public class ObjectDataSourceView : DataSourceView, IStateManager
+ {
+ ObjectDataSource owner;
+ HttpContext context;
+ Type objectType;
+ Type dataObjectType;
+
+ StateBag viewState = new StateBag ();
+ ParameterCollection selectParameters;
+ ParameterCollection updateParameters;
+ ParameterCollection deleteParameters;
+ ParameterCollection insertParameters;
+ ParameterCollection filterParameters;
+
+ private static readonly object DeletedEvent = new object();
+ private static readonly object DeletingEvent = new object();
+ private static readonly object FilteringEvent = new object();
+ private static readonly object InsertedEvent = new object();
+ private static readonly object InsertingEvent = new object();
+ private static readonly object ObjectCreatedEvent = new object();
+ private static readonly object ObjectCreatingEvent = new object();
+ private static readonly object ObjectDisposingEvent = new object();
+// private static readonly object ResolvingMethodEvent = new object();
+ private static readonly object SelectedEvent = new object();
+ private static readonly object SelectingEvent = new object();
+ private static readonly object UpdatedEvent = new object();
+ private static readonly object UpdatingEvent = new object();
+
+ public ObjectDataSourceView (ObjectDataSource owner, string name, HttpContext context): base (owner, name)
+ {
+ this.owner = owner;
+ this.context = context;
+ }
+
+ public event ObjectDataSourceStatusEventHandler Deleted {
+ add { Events.AddHandler (DeletedEvent, value); }
+ remove { Events.RemoveHandler (DeletedEvent, value); }
+ }
+
+ public event ObjectDataSourceMethodEventHandler Deleting {
+ add { Events.AddHandler (DeletingEvent, value); }
+ remove { Events.RemoveHandler (DeletingEvent, value); }
+ }
+
+ public event ObjectDataSourceFilteringEventHandler Filtering {
+ add { Events.AddHandler (FilteringEvent, value); }
+ remove { Events.RemoveHandler (FilteringEvent, value); }
+ }
+
+ public event ObjectDataSourceStatusEventHandler Inserted {
+ add { Events.AddHandler (InsertedEvent, value); }
+ remove { Events.RemoveHandler (InsertedEvent, value); }
+ }
+
+ public event ObjectDataSourceMethodEventHandler Inserting {
+ add { Events.AddHandler (InsertingEvent, value); }
+ remove { Events.RemoveHandler (InsertingEvent, value); }
+ }
+
+ public event ObjectDataSourceObjectEventHandler ObjectCreated {
+ add { Events.AddHandler (ObjectCreatedEvent, value); }
+ remove { Events.RemoveHandler (ObjectCreatedEvent, value); }
+ }
+
+ public event ObjectDataSourceObjectEventHandler ObjectCreating {
+ add { Events.AddHandler (ObjectCreatingEvent, value); }
+ remove { Events.RemoveHandler (ObjectCreatingEvent, value); }
+ }
+
+ public event ObjectDataSourceDisposingEventHandler ObjectDisposing {
+ add { Events.AddHandler (ObjectDisposingEvent, value); }
+ remove { Events.RemoveHandler (ObjectDisposingEvent, value); }
+ }
+
+/* public event ObjectDataSourceResolvingMethodEventHandler ResolvingMethod {
+ add { Events.AddHandler (ResolvingMethodEvent, value); }
+ remove { Events.RemoveHandler (ResolvingMethodEvent, value); }
+ }
+*/
+ public event ObjectDataSourceStatusEventHandler Selected {
+ add { Events.AddHandler (SelectedEvent, value); }
+ remove { Events.RemoveHandler (SelectedEvent, value); }
+ }
+
+ public event ObjectDataSourceSelectingEventHandler Selecting {
+ add { Events.AddHandler (SelectingEvent, value); }
+ remove { Events.RemoveHandler (SelectingEvent, value); }
+ }
+
+ public event ObjectDataSourceStatusEventHandler Updated {
+ add { Events.AddHandler (UpdatedEvent, value); }
+ remove { Events.RemoveHandler (UpdatedEvent, value); }
+ }
+
+ public event ObjectDataSourceMethodEventHandler Updating {
+ add { Events.AddHandler (UpdatingEvent, value); }
+ remove { Events.RemoveHandler (UpdatingEvent, value); }
+ }
+
+ protected virtual void OnDeleted (ObjectDataSourceStatusEventArgs e)
+ {
+ if (Events != null) {
+ ObjectDataSourceStatusEventHandler eh = (ObjectDataSourceStatusEventHandler) Events [DeletedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnDeleting (ObjectDataSourceMethodEventArgs e)
+ {
+ if (Events != null) {
+ ObjectDataSourceMethodEventHandler eh = (ObjectDataSourceMethodEventHandler) Events [DeletingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnFiltering (ObjectDataSourceFilteringEventArgs e)
+ {
+ if (Events != null) {
+ ObjectDataSourceFilteringEventHandler eh = (ObjectDataSourceFilteringEventHandler) Events [FilteringEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnInserted (ObjectDataSourceStatusEventArgs e)
+ {
+ if (Events != null) {
+ ObjectDataSourceStatusEventHandler eh = (ObjectDataSourceStatusEventHandler) Events [InsertedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnInserting (ObjectDataSourceMethodEventArgs e)
+ {
+ if (Events != null) {
+ ObjectDataSourceMethodEventHandler eh = (ObjectDataSourceMethodEventHandler) Events [InsertingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnObjectCreated (ObjectDataSourceEventArgs e)
+ {
+ if (Events != null) {
+ ObjectDataSourceObjectEventHandler eh = (ObjectDataSourceObjectEventHandler) Events [ObjectCreatedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnObjectCreating (ObjectDataSourceEventArgs e)
+ {
+ if (Events != null) {
+ ObjectDataSourceObjectEventHandler eh = (ObjectDataSourceObjectEventHandler) Events [ObjectCreatingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnObjectDisposing (ObjectDataSourceDisposingEventArgs e)
+ {
+ if (Events != null) {
+ ObjectDataSourceDisposingEventHandler eh = (ObjectDataSourceDisposingEventHandler) Events [ObjectDisposingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+/* protected virtual void OnResolvingMethod (ObjectDataSourceResolvingMethodEventArgs e)
+ {
+ if (Events != null) {
+ ObjectDataSourceResolvingMethodEventHandler eh = (ObjectDataSourceResolvingMethodEventHandler) Events [ResolvingMethodEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+*/
+
+ protected virtual void OnSelected (ObjectDataSourceStatusEventArgs e)
+ {
+ if (Events != null) {
+ ObjectDataSourceStatusEventHandler eh = (ObjectDataSourceStatusEventHandler) Events [SelectedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnSelecting (ObjectDataSourceSelectingEventArgs e)
+ {
+ if (Events != null) {
+ ObjectDataSourceSelectingEventHandler eh = (ObjectDataSourceSelectingEventHandler) Events [SelectingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnUpdated (ObjectDataSourceStatusEventArgs e)
+ {
+ if (Events != null) {
+ ObjectDataSourceStatusEventHandler eh = (ObjectDataSourceStatusEventHandler) Events [UpdatedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnUpdating (ObjectDataSourceMethodEventArgs e)
+ {
+ if (Events != null) {
+ ObjectDataSourceMethodEventHandler eh = (ObjectDataSourceMethodEventHandler) Events [UpdatingEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ StateBag ViewState {
+ get { return viewState; }
+ }
+
+ public override bool CanDelete {
+ get { return DeleteMethod.Length > 0; }
+ }
+
+ public override bool CanInsert {
+ get { return InsertMethod.Length > 0; }
+ }
+
+ public override bool CanPage {
+ get { return EnablePaging; }
+ }
+
+ public override bool CanRetrieveTotalRowCount {
+ get { return SelectCountMethod.Length > 0; }
+ }
+
+ public override bool CanSort {
+ get { return true; }
+ }
+
+ public override bool CanUpdate {
+ get { return UpdateMethod.Length > 0; }
+ }
+
+ public ConflictOptions ConflictDetection {
+ get {
+ object ret = ViewState ["ConflictDetection"];
+ return ret != null ? (ConflictOptions)ret : ConflictOptions.OverwriteChanges;
+ }
+ set {
+ ViewState ["ConflictDetection"] = value;
+ }
+ }
+
+ public bool ConvertNullToDBNull {
+ get {
+ object ret = ViewState ["ConvertNullToDBNull"];
+ return ret != null ? (bool)ret : false;
+ }
+ set {
+ ViewState ["ConvertNullToDBNull"] = value;
+ }
+ }
+
+ public string DataObjectTypeName {
+ get {
+ object ret = ViewState ["DataObjectTypeName"];
+ return ret != null ? (string)ret : string.Empty;
+ }
+ set {
+ ViewState ["DataObjectTypeName"] = value;
+ }
+ }
+
+ public string DeleteMethod {
+ get {
+ object ret = ViewState ["DeleteMethod"];
+ return ret != null ? (string)ret : string.Empty;
+ }
+ set {
+ ViewState ["DeleteMethod"] = value;
+ }
+ }
+
+ public ParameterCollection DeleteParameters {
+ get {
+ if (deleteParameters == null) {
+ deleteParameters = new ParameterCollection ();
+ deleteParameters.ParametersChanged += new EventHandler (OnParametersChanged);
+ if (((IStateManager)this).IsTrackingViewState)
+ ((IStateManager)deleteParameters).TrackViewState ();
+ }
+ return deleteParameters;
+ }
+ }
+
+ public bool EnablePaging {
+ get {
+ object ret = ViewState ["EnablePaging"];
+ return ret != null ? (bool)ret : false;
+ }
+ set {
+ ViewState ["EnablePaging"] = value;
+ }
+ }
+
+ public string FilterExpression {
+ get {
+ object ret = ViewState ["FilterExpression"];
+ return ret != null ? (string)ret : string.Empty;
+ }
+ set {
+ ViewState ["FilterExpression"] = value;
+ }
+ }
+
+ public ParameterCollection FilterParameters {
+ get {
+ if (filterParameters == null) {
+ filterParameters = new ParameterCollection ();
+ filterParameters.ParametersChanged += new EventHandler (OnParametersChanged);
+ if (IsTrackingViewState)
+ ((IStateManager)filterParameters).TrackViewState ();
+ }
+ return filterParameters;
+ }
+ }
+
+ public string InsertMethod {
+ get {
+ object ret = ViewState ["InsertMethod"];
+ return ret != null ? (string)ret : string.Empty;
+ }
+ set {
+ ViewState ["InsertMethod"] = value;
+ }
+ }
+
+ public ParameterCollection InsertParameters {
+ get {
+ if (insertParameters == null) {
+ insertParameters = new ParameterCollection ();
+ insertParameters.ParametersChanged += new EventHandler (OnParametersChanged);
+ if (IsTrackingViewState)
+ ((IStateManager)insertParameters).TrackViewState ();
+ }
+ return insertParameters;
+ }
+ }
+
+ public string MaximumRowsParameterName {
+ get {
+ object ret = ViewState ["MaximumRowsParameterName"];
+ return ret != null ? (string)ret : "maximumRows";
+ }
+ set {
+ ViewState ["MaximumRowsParameterName"] = value;
+ }
+ }
+
+ [DefaultValueAttribute ("original_{0}")]
+ public string OldValuesParameterFormatString {
+ get {
+ object ret = ViewState ["OldValuesParameterFormatString"];
+ return ret != null ? (string)ret : "original_{0}";
+ }
+ set {
+ ViewState ["OldValuesParameterFormatString"] = value;
+ }
+ }
+
+ public string SelectCountMethod {
+ get {
+ object ret = ViewState ["SelectCountMethod"];
+ return ret != null ? (string)ret : string.Empty;
+ }
+ set {
+ ViewState ["SelectCountMethod"] = value;
+ }
+ }
+
+ public string SelectMethod {
+ get {
+ object ret = ViewState ["SelectMethod"];
+ return ret != null ? (string)ret : string.Empty;
+ }
+ set {
+ ViewState ["SelectMethod"] = value;
+ }
+ }
+
+ public ParameterCollection SelectParameters {
+ get {
+ if (selectParameters == null) {
+ selectParameters = new ParameterCollection ();
+ selectParameters.ParametersChanged += new EventHandler (OnParametersChanged);
+ if (((IStateManager)this).IsTrackingViewState)
+ ((IStateManager)selectParameters).TrackViewState ();
+ }
+ return selectParameters;
+ }
+ }
+
+ public string SortParameterName {
+ get {
+ object ret = ViewState ["SortParameterName"];
+ return ret != null ? (string)ret : string.Empty;
+ }
+ set {
+ ViewState ["SortParameterName"] = value;
+ }
+ }
+
+ public string StartRowIndexParameterName {
+ get {
+ object ret = ViewState ["StartRowIndexParameterName"];
+ return ret != null ? (string)ret : "startRowIndex";
+ }
+ set {
+ ViewState ["StartRowIndexParameterName"] = value;
+ }
+ }
+
+ public string TypeName {
+ get {
+ object ret = ViewState ["TypeName"];
+ return ret != null ? (string)ret : string.Empty;
+ }
+ set {
+ ViewState ["TypeName"] = value;
+ objectType = null;
+ }
+ }
+
+ public string UpdateMethod {
+ get {
+ object ret = ViewState ["UpdateMethod"];
+ return ret != null ? (string)ret : string.Empty;
+ }
+ set {
+ ViewState ["UpdateMethod"] = value;
+ }
+ }
+
+ public ParameterCollection UpdateParameters {
+ get {
+ if (updateParameters == null) {
+ updateParameters = new ParameterCollection ();
+ updateParameters.ParametersChanged += new EventHandler (OnParametersChanged);
+ if (((IStateManager)this).IsTrackingViewState)
+ ((IStateManager)updateParameters).TrackViewState ();
+ }
+ return updateParameters;
+ }
+ }
+
+ Type ObjectType {
+ get {
+ if (objectType == null) {
+ objectType = Type.GetType (TypeName);
+ if (objectType == null)
+ throw new InvalidOperationException ("Type not found: " + TypeName);
+ }
+ return objectType;
+ }
+ }
+
+ Type DataObjectType {
+ get {
+ if (dataObjectType == null) {
+ dataObjectType = Type.GetType (DataObjectTypeName);
+ if (objectType == null)
+ throw new InvalidOperationException ("Type not found: " + DataObjectTypeName);
+ }
+ return dataObjectType;
+ }
+ }
+
+ public IEnumerable Select (DataSourceSelectArguments arguments)
+ {
+ return ExecuteSelect (arguments);
+ }
+
+ public int Update (IDictionary keys, IDictionary values, IDictionary oldValues)
+ {
+ return ExecuteUpdate (keys, values, oldValues);
+ }
+
+ public int Delete (IDictionary keys, IDictionary oldValues)
+ {
+ return ExecuteDelete (keys, oldValues);
+ }
+
+ public int Insert (IDictionary values)
+ {
+ return ExecuteInsert (values);
+ }
+
+ protected override int ExecuteInsert (IDictionary values)
+ {
+ if (!CanInsert)
+ throw new NotSupportedException ("Insert operation not supported.");
+
+ IOrderedDictionary paramValues;
+ MethodInfo method;
+
+ if (DataObjectTypeName.Length == 0) {
+ paramValues = MergeParameterValues (InsertParameters, values, null, true);
+ method = GetObjectMethod (InsertMethod, paramValues);
+ } else {
+ method = ResolveDataObjectMethod (InsertMethod, values, null, out paramValues);
+ }
+
+ ObjectDataSourceMethodEventArgs args = new ObjectDataSourceMethodEventArgs (paramValues);
+ OnInserting (args);
+ if (args.Cancel)
+ return -1;
+
+ ObjectDataSourceStatusEventArgs rargs = InvokeMethod (method, paramValues);
+ OnInserted (rargs);
+
+ if (rargs.Exception != null && !rargs.ExceptionHandled)
+ throw rargs.Exception;
+
+ return -1;
+ }
+
+ protected override int ExecuteDelete (IDictionary keys, IDictionary oldValues)
+ {
+ if (!CanDelete)
+ throw new NotSupportedException ("Delete operation not supported.");
+
+ if (ConflictDetection == ConflictOptions.CompareAllValues && (oldValues == null || oldValues.Count == 0))
+ throw new InvalidOperationException ("ConflictDetection is set to CompareAllValues and oldValues collection is null or empty.");
+
+ IDictionary oldDataValues;
+ if (ConflictDetection == ConflictOptions.CompareAllValues) {
+ oldDataValues = new Hashtable ();
+ foreach (DictionaryEntry de in keys)
+ oldDataValues [de.Key] = de.Value;
+ foreach (DictionaryEntry de in oldValues)
+ oldDataValues [de.Key] = de.Value;
+ } else
+ oldDataValues = keys;
+
+ IOrderedDictionary paramValues;
+ MethodInfo method;
+
+ if (DataObjectTypeName.Length == 0) {
+ paramValues = MergeParameterValues (DeleteParameters, null, oldDataValues, true);
+ method = GetObjectMethod (DeleteMethod, paramValues);
+ } else {
+ method = ResolveDataObjectMethod (DeleteMethod, oldDataValues, null, out paramValues);
+ }
+
+ ObjectDataSourceMethodEventArgs args = new ObjectDataSourceMethodEventArgs (paramValues);
+ OnDeleting (args);
+ if (args.Cancel)
+ return -1;
+
+ ObjectDataSourceStatusEventArgs rargs = InvokeMethod (method, paramValues);
+
+ OnDeleted (rargs);
+
+ if (rargs.Exception != null && !rargs.ExceptionHandled)
+ throw rargs.Exception;
+
+ return -1;
+ }
+
+ protected override int ExecuteUpdate (IDictionary keys, IDictionary values, IDictionary oldValues)
+ {
+ IOrderedDictionary paramValues;
+ MethodInfo method;
+
+ if (DataObjectTypeName.Length == 0)
+ {
+ IDictionary dataValues;
+ IDictionary oldDataValues;
+ if (ConflictDetection == ConflictOptions.CompareAllValues) {
+ oldDataValues = new Hashtable ();
+ dataValues = values;
+ foreach (DictionaryEntry de in keys)
+ oldDataValues [de.Key] = de.Value;
+ foreach (DictionaryEntry de in oldValues)
+ oldDataValues [de.Key] = de.Value;
+ } else {
+ oldDataValues = keys;
+ dataValues = values;
+ }
+ paramValues = MergeParameterValues (UpdateParameters, dataValues, oldDataValues, false);
+ method = GetObjectMethod (UpdateMethod, paramValues);
+ }
+ else
+ {
+ IDictionary dataValues = new Hashtable ();
+ IDictionary oldDataValues;
+
+ foreach (DictionaryEntry de in values)
+ dataValues [de.Key] = de.Value;
+
+ if (ConflictDetection == ConflictOptions.CompareAllValues) {
+ oldDataValues = new Hashtable ();
+ foreach (DictionaryEntry de in keys) {
+ oldDataValues [de.Key] = de.Value;
+ dataValues [de.Key] = de.Value;
+ }
+ foreach (DictionaryEntry de in oldValues)
+ oldDataValues [de.Key] = de.Value;
+ } else {
+ oldDataValues = null;
+ foreach (DictionaryEntry de in keys)
+ dataValues [de.Key] = de.Value;
+ }
+ method = ResolveDataObjectMethod (UpdateMethod, dataValues, oldDataValues, out paramValues);
+ }
+
+ ObjectDataSourceMethodEventArgs args = new ObjectDataSourceMethodEventArgs (paramValues);
+ OnUpdating (args);
+ if (args.Cancel)
+ return -1;
+
+ ObjectDataSourceStatusEventArgs rargs = InvokeMethod (method, paramValues);
+ OnUpdated (rargs);
+
+ if (rargs.Exception != null && !rargs.ExceptionHandled)
+ throw rargs.Exception;
+
+ return -1;
+ }
+
+ protected internal override IEnumerable ExecuteSelect (DataSourceSelectArguments arguments)
+ {
+ arguments.RaiseUnsupportedCapabilitiesError (this);
+
+ IOrderedDictionary paramValues = MergeParameterValues (SelectParameters, null, null, true);
+ ObjectDataSourceSelectingEventArgs args = new ObjectDataSourceSelectingEventArgs (paramValues, arguments, false);
+ OnSelecting (args);
+ if (args.Cancel)
+ return new ArrayList ();
+
+ if (CanRetrieveTotalRowCount && arguments.RetrieveTotalRowCount)
+ arguments.TotalRowCount = QueryTotalRowCount (paramValues, arguments);
+
+ if (CanPage) {
+ if (StartRowIndexParameterName.Length == 0)
+ throw new InvalidOperationException ("Paging is enabled, but the StartRowIndexParameterName property is not set.");
+ if (MaximumRowsParameterName.Length == 0)
+ throw new InvalidOperationException ("Paging is enabled, but the MaximumRowsParameterName property is not set.");
+ paramValues [StartRowIndexParameterName] = arguments.StartRowIndex;
+ paramValues [MaximumRowsParameterName] = arguments.MaximumRows;
+ }
+
+ if (SortParameterName.Length > 0)
+ paramValues [SortParameterName] = arguments.SortExpression;
+
+ object result = InvokeSelect (SelectMethod, paramValues);
+
+ if (result is DataSet) {
+ DataSet dset = (DataSet) result;
+ if (dset.Tables.Count == 0)
+ throw new InvalidOperationException ("The select method returnet a DataSet which doesn't contain any table.");
+ result = dset.Tables [0];
+ }
+
+ if (result is DataTable) {
+ DataView dview = new DataView ((DataTable)result);
+ if (arguments.SortExpression != null && arguments.SortExpression.Length > 0) {
+ dview.Sort = arguments.SortExpression;
+ }
+ if (FilterExpression.Length > 0) {
+ IOrderedDictionary fparams = FilterParameters.GetValues (context, owner);
+ ObjectDataSourceFilteringEventArgs fargs = new ObjectDataSourceFilteringEventArgs (fparams);
+ OnFiltering (fargs);
+ if (!fargs.Cancel) {
+ object[] formatValues = new object [fparams.Count];
+ for (int n=0; n<formatValues.Length; n++) {
+ formatValues [n] = fparams [n];
+ if (formatValues [n] == null) return dview;
+ }
+ dview.RowFilter = string.Format (FilterExpression, formatValues);
+ }
+ }
+ return dview;
+ }
+
+ if (result is IEnumerable)
+ return (IEnumerable) result;
+ else
+ return new object[] { result };
+ }
+
+ int QueryTotalRowCount (IOrderedDictionary mergedParameters, DataSourceSelectArguments arguments)
+ {
+ ObjectDataSourceSelectingEventArgs countArgs = new ObjectDataSourceSelectingEventArgs (mergedParameters, arguments, true);
+ OnSelecting (countArgs);
+ if (countArgs.Cancel)
+ return 0;
+
+ object count = InvokeSelect (SelectCountMethod, mergedParameters);
+ return (int) Convert.ChangeType (count, typeof(int));
+ }
+
+ object InvokeSelect (string methodName, IOrderedDictionary paramValues)
+ {
+ MethodInfo method = GetObjectMethod (methodName, paramValues);
+ ObjectDataSourceStatusEventArgs rargs = InvokeMethod (method, paramValues);
+ OnSelected (rargs);
+
+ if (rargs.Exception != null && !rargs.ExceptionHandled)
+ throw rargs.Exception;
+
+ return rargs.ReturnValue;
+ }
+
+ ObjectDataSourceStatusEventArgs InvokeMethod (MethodInfo method, IOrderedDictionary paramValues)
+ {
+ object instance = null;
+
+ if (!method.IsStatic)
+ instance = CreateObjectInstance ();
+
+ ParameterInfo[] pars = method.GetParameters ();
+
+ ArrayList outParamInfos;
+ object[] methodArgs = GetParameterArray (pars, paramValues, out outParamInfos);
+
+ if (methodArgs == null)
+ throw CreateMethodException (method.Name, paramValues);
+
+ object result = null;
+ Hashtable outParams = null;
+
+ try {
+ result = method.Invoke (instance, methodArgs);
+ if (outParamInfos != null) {
+ outParams = new Hashtable ();
+ foreach (ParameterInfo op in outParamInfos)
+ outParams [op.Name] = methodArgs [op.Position - 1];
+ }
+ return new ObjectDataSourceStatusEventArgs (result, outParams, null);
+ }
+ catch (Exception ex) {
+ return new ObjectDataSourceStatusEventArgs (result, outParams, ex);
+ }
+ finally {
+ if (instance != null)
+ DisposeObjectInstance (instance);
+ }
+ }
+
+ MethodInfo GetObjectMethod (string methodName, IOrderedDictionary parameters)
+ {
+ MemberInfo[] methods = ObjectType.GetMember (methodName);
+ if (methods.Length > 1) {
+ // MSDN: The ObjectDataSource resolves method overloads by method name and number
+ // of parameters; the names and types of the parameters are not considered.
+ foreach (MemberInfo mi in methods) {
+ MethodInfo me = mi as MethodInfo;
+ if (me != null && me.GetParameters().Length == parameters.Count)
+ return me;
+ }
+ }
+ else if (methods.Length == 1) {
+ MethodInfo me = methods[0] as MethodInfo;
+ if (me != null && me.GetParameters().Length == parameters.Count)
+ return me;
+ }
+
+ throw CreateMethodException (methodName, parameters);
+ }
+
+ MethodInfo ResolveDataObjectMethod (string methodName, IDictionary values, IDictionary oldValues, out IOrderedDictionary paramValues)
+ {
+ MethodInfo method;
+ if (oldValues != null)
+ method = ObjectType.GetMethod (methodName, new Type[] { DataObjectType, DataObjectType });
+ else
+ method = ObjectType.GetMethod (methodName, new Type[] { DataObjectType });
+
+ if (method == null)
+ throw new InvalidOperationException ("ObjectDataSource " + owner.ID + " could not find a method named '" + methodName + "' with parameters of type '" + DataObjectType + "' in '" + ObjectType + "'.");
+
+ paramValues = new OrderedDictionary ();
+ ParameterInfo[] ps = method.GetParameters ();
+
+ if (oldValues != null) {
+ if (FormatOldParameter (ps[0].Name) == ps[1].Name) {
+ paramValues [ps[0].Name] = CreateDataObject (values);
+ paramValues [ps[1].Name] = CreateDataObject (oldValues);
+ } else if (FormatOldParameter (ps[1].Name) == ps[0].Name) {
+ paramValues [ps[0].Name] = CreateDataObject (oldValues);
+ paramValues [ps[1].Name] = CreateDataObject (values);
+ } else
+ throw new InvalidOperationException ("Method '" + methodName + "' does not have any parameter that fits the value of OldValuesParameterFormatString.");
+ } else {
+ paramValues [ps[0].Name] = CreateDataObject (values);
+ }
+ return method;
+ }
+
+ Exception CreateMethodException (string methodName, IOrderedDictionary parameters)
+ {
+ string s = "";
+ foreach (string p in parameters.Keys) {
+ s += p + ", ";
+ }
+ return new InvalidOperationException ("ObjectDataSource " + owner.ID + " could not find a method named '" + methodName + "' with parameters " + s + "in type '" + ObjectType + "'.");
+ }
+
+ object CreateDataObject (IDictionary values)
+ {
+ object ob = Activator.CreateInstance (DataObjectType);
+ foreach (DictionaryEntry de in values) {
+ PropertyInfo p = DataObjectType.GetProperty ((string)de.Key);
+ if (p == null) throw new InvalidOperationException ("Property " + de.Key + " not found in type '" +DataObjectType + "'.");
+ p.SetValue (ob, ConvertParameter (p.PropertyType, de.Value), null);
+ }
+ return ob;
+ }
+
+ object CreateObjectInstance ()
+ {
+ ObjectDataSourceEventArgs args = new ObjectDataSourceEventArgs (null);
+ OnObjectCreating (args);
+
+ if (args.ObjectInstance != null)
+ return args.ObjectInstance;
+
+ object ob = Activator.CreateInstance (ObjectType);
+
+ args.ObjectInstance = ob;
+ OnObjectCreated (args);
+
+ return args.ObjectInstance;
+ }
+
+ void DisposeObjectInstance (object obj)
+ {
+ ObjectDataSourceDisposingEventArgs args = new ObjectDataSourceDisposingEventArgs (obj);
+ OnObjectDisposing (args);
+
+ if (!args.Cancel) {
+ IDisposable disp = obj as IDisposable;
+ if (disp != null) disp.Dispose ();
+ }
+ }
+
+ IOrderedDictionary MergeParameterValues (ParameterCollection viewParams, IDictionary values, IDictionary oldValues, bool allwaysAddNewValues)
+ {
+ OrderedDictionary mergedValues = new OrderedDictionary ();
+ foreach (Parameter p in viewParams) {
+ bool oldAdded = false;
+ if (oldValues != null && oldValues.Contains (p.Name)) {
+ object val = Convert.ChangeType (oldValues [p.Name], p.Type);
+ mergedValues [FormatOldParameter (p.Name)] = val;
+ oldAdded = true;
+ }
+
+ if (values != null && values.Contains (p.Name)) {
+ object val = Convert.ChangeType (values [p.Name], p.Type);
+ mergedValues [p.Name] = val;
+ } else if (!oldAdded || allwaysAddNewValues) {
+ object val = p.GetValue (context, owner);
+ mergedValues [p.Name] = val;
+ }
+ }
+
+ if (values != null) {
+ foreach (DictionaryEntry de in values)
+ if (!mergedValues.Contains (de.Key))
+ mergedValues [de.Key] = de.Value;
+ }
+
+ if (oldValues != null) {
+ foreach (DictionaryEntry de in oldValues)
+ if (!mergedValues.Contains (FormatOldParameter ((string)de.Key)))
+ mergedValues [FormatOldParameter ((string)de.Key)] = de.Value;
+ }
+
+ return mergedValues;
+ }
+
+ object[] GetParameterArray (ParameterInfo[] methodParams, IOrderedDictionary viewParams, out ArrayList outParamInfos)
+ {
+ // FIXME: make this case insensitive
+
+ outParamInfos = null;
+ object[] values = new object [methodParams.Length];
+ foreach (ParameterInfo mp in methodParams) {
+
+ // Parameter names must match
+ if (!viewParams.Contains (mp.Name)) return null;
+
+ values [mp.Position] = ConvertParameter (mp.ParameterType, viewParams [mp.Name]);
+ if (mp.ParameterType.IsByRef) {
+ if (outParamInfos == null) outParamInfos = new ArrayList ();
+ outParamInfos.Add (mp);
+ }
+ }
+ return values;
+ }
+
+ object ConvertParameter (Type targetType, object value)
+ {
+ return ConvertParameter (Type.GetTypeCode (targetType), value);
+ }
+
+ object ConvertParameter (TypeCode targetType, object value)
+ {
+ if (value == null) {
+ if (targetType != TypeCode.Object && targetType != TypeCode.String)
+ value = 0;
+ else if (targetType == TypeCode.Object && ConvertNullToDBNull)
+ return DBNull.Value;
+ }
+ if (targetType == TypeCode.Object)
+ return value;
+ else
+ return Convert.ChangeType (value, targetType);
+ }
+
+ string FormatOldParameter (string name)
+ {
+ string f = OldValuesParameterFormatString;
+ if (f.Length > 0)
+ return String.Format (f, name);
+ else
+ return name;
+ }
+
+ void OnParametersChanged (object sender, EventArgs args)
+ {
+ OnDataSourceViewChanged (EventArgs.Empty);
+ }
+
+ protected virtual void LoadViewState (object savedState)
+ {
+ object[] state = (savedState == null) ? new object [6] : (object[]) savedState;
+ viewState.LoadViewState (state[0]);
+ ((IStateManager)SelectParameters).LoadViewState (state[1]);
+ ((IStateManager)UpdateParameters).LoadViewState (state[2]);
+ ((IStateManager)DeleteParameters).LoadViewState (state[3]);
+ ((IStateManager)InsertParameters).LoadViewState (state[4]);
+ ((IStateManager)FilterParameters).LoadViewState (state[5]);
+ }
+
+ protected virtual object SaveViewState()
+ {
+ object[] state = new object [6];
+ state [0] = viewState.SaveViewState ();
+
+ if (selectParameters != null)
+ state [1] = ((IStateManager)selectParameters).SaveViewState ();
+ if (updateParameters != null)
+ state [2] = ((IStateManager)updateParameters).SaveViewState ();
+ if (deleteParameters != null)
+ state [3] = ((IStateManager)deleteParameters).SaveViewState ();
+ if (insertParameters != null)
+ state [4] = ((IStateManager)insertParameters).SaveViewState ();
+ if (filterParameters != null)
+ state [5] = ((IStateManager)filterParameters).SaveViewState ();
+
+ foreach (object ob in state)
+ if (ob != null) return state;
+
+ return null;
+ }
+
+ protected virtual void TrackViewState()
+ {
+ viewState.TrackViewState ();
+ if (selectParameters != null) ((IStateManager)selectParameters).TrackViewState ();
+ if (updateParameters != null) ((IStateManager)updateParameters).TrackViewState ();
+ if (deleteParameters != null) ((IStateManager)deleteParameters).TrackViewState ();
+ if (insertParameters != null) ((IStateManager)insertParameters).TrackViewState ();
+ if (filterParameters != null) ((IStateManager)filterParameters).TrackViewState ();
+ }
+
+ protected virtual bool IsTrackingViewState
+ {
+ get { return viewState.IsTrackingViewState; }
+ }
+
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get { return IsTrackingViewState; }
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ TrackViewState ();
+ }
+
+ void IStateManager.LoadViewState (object savedState)
+ {
+ LoadViewState (savedState);
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ return SaveViewState ();
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Orientation.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Orientation.cs
new file mode 100644
index 00000000000..9343091347e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Orientation.cs
@@ -0,0 +1,35 @@
+//
+// System.Web.UI.WebControls.Orientation.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum Orientation {
+ Horizontal = 0,
+ Vertical = 1
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs
new file mode 100644
index 00000000000..d6357e1f485
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs
@@ -0,0 +1,554 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: PagedDataSource
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class PagedDataSource : ICollection, IEnumerable, ITypedList
+ {
+ private int pageSize;
+ private bool allowPaging;
+ private int currentPageIndex;
+ private bool allowCustomPaging;
+ private int virtualCount;
+
+#if NET_2_0
+ DataSourceSelectArguments arguments;
+ DataSourceView view;
+ bool serverPaging;
+#endif
+
+ private IEnumerable dataSource;
+
+ public PagedDataSource()
+ {
+ Initialize();
+ }
+
+ private void Initialize()
+ {
+ pageSize = 10;
+ allowPaging = false;
+ currentPageIndex = 0;
+ allowCustomPaging = false;
+ virtualCount = 0;
+ }
+
+#if NET_2_0
+ public DataSourceSelectArguments DataSourceSelectArguments {
+ get { return arguments; }
+ set { arguments = value; }
+ }
+
+ public DataSourceView DataSourceView {
+ get { return view; }
+ set { view = value; }
+ }
+
+ public bool AllowServerPaging {
+ get { return serverPaging; }
+ set { serverPaging = value; }
+ }
+
+ public bool IsServerPagingEnabled {
+ get { return allowPaging && serverPaging; }
+ }
+
+ public void SetItemCountFromPageIndex (int highestPageIndex)
+ {
+ arguments.StartRowIndex = CurrentPageIndex * PageSize;
+ arguments.MaximumRows = (highestPageIndex - CurrentPageIndex) * PageSize + 1;
+ IEnumerable data = view.ExecuteSelect (arguments);
+
+ virtualCount = CurrentPageIndex * PageSize;
+ if (data is ICollection) {
+ virtualCount += ((ICollection)data).Count;
+ } else {
+ IEnumerator e = data.GetEnumerator ();
+ while (e.MoveNext())
+ virtualCount++;
+ }
+ }
+
+#endif
+
+ public bool AllowCustomPaging
+ {
+ get
+ {
+ return allowCustomPaging;
+ }
+ set
+ {
+ allowCustomPaging = value;
+ }
+ }
+
+ public bool AllowPaging
+ {
+ get
+ {
+ return allowPaging;
+ }
+ set
+ {
+ allowPaging = value;
+ }
+ }
+
+ public int Count
+ {
+ get
+ {
+ if(dataSource != null)
+ {
+ if(!IsPagingEnabled)
+ {
+ return DataSourceCount;
+ }
+ if(IsCustomPagingEnabled)
+ {
+ return pageSize;
+ }
+
+ if(IsLastPage)
+ {
+ int n = DataSourceCount;
+ if (n == 0) return 0;
+ else return (n - FirstIndexInPage);
+ }
+ return pageSize;
+ }
+ return 0;
+ }
+ }
+
+ public int CurrentPageIndex
+ {
+ get
+ {
+ return currentPageIndex;
+ }
+
+ set
+ {
+ currentPageIndex = value;
+ }
+ }
+
+ public IEnumerable DataSource
+ {
+ get
+ {
+ return dataSource;
+ }
+ set
+ {
+ dataSource = value;
+ }
+ }
+
+ public int DataSourceCount
+ {
+ get
+ {
+ if(dataSource != null)
+ {
+#if NET_2_0
+ if (serverPaging)
+ {
+ return virtualCount;
+ }
+#endif
+ if(IsCustomPagingEnabled)
+ {
+ return virtualCount;
+ }
+ if(dataSource is ICollection)
+ {
+ return ((ICollection)dataSource).Count;
+ }
+ throw new HttpException(HttpRuntime.FormatResourceString("PagedDataSource_Cannot_Get_Count"));
+ }
+ return 0;
+ }
+ }
+
+ public int FirstIndexInPage
+ {
+ get
+ {
+ if(dataSource != null && IsPagingEnabled && !IsCustomPagingEnabled)
+ {
+ return (currentPageIndex * pageSize);
+ }
+ return 0;
+ }
+ }
+
+ public bool IsCustomPagingEnabled
+ {
+ get
+ {
+ return (IsPagingEnabled && allowCustomPaging);
+ }
+ }
+
+ public bool IsFirstPage
+ {
+ get
+ {
+ return (!IsPagingEnabled || (CurrentPageIndex == 0));
+ }
+ }
+
+ public bool IsLastPage
+ {
+ get
+ {
+ return (!IsPagingEnabled || (CurrentPageIndex == (PageCount - 1)) || PageCount <= 1);
+ }
+ }
+
+ public bool IsPagingEnabled
+ {
+ get
+ {
+ return (allowPaging && pageSize != 0);
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public int PageCount
+ {
+ get
+ {
+ if(dataSource != null) {
+ if(!IsPagingEnabled)
+ return 1;
+
+ int total = DataSourceCount;
+ return (total + pageSize - 1)/pageSize;
+ }
+ return 0;
+ }
+ }
+
+ public int PageSize
+ {
+ get
+ {
+ return pageSize;
+ }
+ set
+ {
+ pageSize = value;
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public int VirtualCount
+ {
+ get
+ {
+ return virtualCount;
+ }
+ set
+ {
+ virtualCount = value;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ IEnumerator enumerator = this.GetEnumerator();
+ if(enumerator == null) return;
+
+ while(enumerator.MoveNext())
+ array.SetValue(enumerator.Current, index++);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+#if NET_2_0
+ int fInd = serverPaging ? 0 : FirstIndexInPage;
+#else
+ int fInd = FirstIndexInPage;
+#endif
+ int count = -1;
+
+ if(dataSource is ICollection)
+ {
+ count = Count;
+ }
+
+ if(dataSource is IList)
+ {
+ return (new PrivateListEnumerator((IList)dataSource, fInd, count));
+ }
+ if(dataSource is Array)
+ {
+ return (new PrivateArrayEnumerator((object[])dataSource, fInd, count));
+ }
+ if(dataSource is ICollection)
+ {
+ return (new PrivateICollectionEnumerator((ICollection)dataSource, fInd, count));
+ }
+ if(allowCustomPaging)
+ {
+ return (new PrivateIEnumeratorEnumerator(dataSource.GetEnumerator(), Count));
+ }
+ return dataSource.GetEnumerator();
+ }
+
+ class PrivateIEnumeratorEnumerator : IEnumerator
+ {
+ private int index;
+ private int max;
+
+ private IEnumerator enumerator;
+
+ public PrivateIEnumeratorEnumerator(IEnumerator enumerator, int count)
+ {
+ this.enumerator = enumerator;
+ index = -1;
+ max = count;
+ }
+
+ public bool MoveNext()
+ {
+ enumerator.MoveNext();
+ index++;
+ return (index < max);
+ }
+
+ public void Reset()
+ {
+ index = -1;
+ enumerator.Reset();
+ }
+
+ public object Current
+ {
+ get
+ {
+ return enumerator.Current;
+ }
+ }
+ }
+
+ class PrivateICollectionEnumerator : IEnumerator
+ {
+ private int index;
+ private int start;
+ private int max;
+
+ private ICollection collection;
+ private IEnumerator collEnum;
+
+ public PrivateICollectionEnumerator(ICollection collection, int start, int count)
+ {
+ this.collection = collection;
+ this.start = start;
+ index = -1;
+ max = start + count;
+ if(max > collection.Count)
+ {
+ max = collection.Count;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ if(collEnum == null)
+ {
+ int cIndex = 0;
+ collEnum = collection.GetEnumerator();
+ while(cIndex < start)
+ {
+ collEnum.MoveNext();
+ cIndex++;
+ }
+ }
+ collEnum.MoveNext();
+ index++;
+ return (start + index < max);
+ }
+
+ public void Reset()
+ {
+ index = -1;
+ collEnum = null;
+ }
+
+ public object Current
+ {
+ get
+ {
+ return collEnum.Current;
+ }
+ }
+ }
+
+ class PrivateArrayEnumerator : IEnumerator
+ {
+ private int index;
+ private int start;
+ private int max;
+ private object[] values;
+
+ public PrivateArrayEnumerator(object[] values, int start, int count)
+ {
+ this.values = values;
+ this.start = start;
+ index = -1;
+ max = start + count;
+ if(max > this.values.Length)
+ {
+ max = this.values.Length;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ index++;
+ return (index + start < max);
+ }
+
+ public void Reset()
+ {
+ index = -1;
+ }
+
+ public object Current
+ {
+ get
+ {
+ if(index >= 0)
+ {
+ return values[index + start];
+ }
+ throw new InvalidOperationException("Enumerator_MoveNext_Not_Called");
+ }
+ }
+ }
+
+ class PrivateListEnumerator : IEnumerator
+ {
+ private int index;
+ private int start;
+ private int max;
+ private IList collection;
+
+ public PrivateListEnumerator(IList list, int start, int count)
+ {
+ collection = list;
+ this.start = start;
+ index = -1;
+ max = start + count;
+ if(max > list.Count)
+ {
+ max = list.Count;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ index++;
+ return (index + start < max);
+ }
+
+ public void Reset()
+ {
+ index = -1;
+ }
+
+ public object Current
+ {
+ get
+ {
+ if(index >= 0)
+ {
+ return collection[index + start];
+ }
+ throw new InvalidOperationException("Enumerator_MoveNext_Not_Called");
+ }
+ }
+ }
+
+ public string GetListName(PropertyDescriptor[] listAccessors)
+ {
+ return String.Empty;
+ }
+
+ public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors)
+ {
+ if(dataSource != null)
+ {
+ if(dataSource is ITypedList)
+ {
+ return ((ITypedList)dataSource).GetItemProperties(listAccessors);
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PagerButtons.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PagerButtons.cs
new file mode 100644
index 00000000000..c6df5190a9f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PagerButtons.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.UI.WebControls.PagerButtons.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum PagerButtons {
+ NextPrevious = 0,
+ Numeric = 1,
+ NextPreviousFirstLast = 2,
+ NumericFirstLast = 3
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PagerMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PagerMode.cs
new file mode 100755
index 00000000000..6ac212251a1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PagerMode.cs
@@ -0,0 +1,42 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: PagerMode
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum PagerMode
+ {
+ NextPrev,
+ NumericPages
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PagerPosition.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PagerPosition.cs
new file mode 100755
index 00000000000..386d7c18b77
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PagerPosition.cs
@@ -0,0 +1,43 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: PagerPosition
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum PagerPosition
+ {
+ Bottom,
+ Top,
+ TopAndBottom
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PagerSettings.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PagerSettings.cs
new file mode 100644
index 00000000000..2913fcf63cf
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PagerSettings.cs
@@ -0,0 +1,307 @@
+//
+// System.Web.UI.WebControls.PagerSettings.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+using System.Security.Permissions;
+
+namespace System.Web.UI.WebControls
+{
+ [TypeConverterAttribute (typeof(ExpandableObjectConverter))]
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public sealed class PagerSettings: IStateManager
+ {
+ StateBag ViewState = new StateBag ();
+ Control ctrl;
+
+ public PagerSettings ()
+ {
+ }
+
+ internal PagerSettings (Control ctrl)
+ {
+ this.ctrl = ctrl;
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [NotifyParentPropertyAttribute (true)]
+ [UrlPropertyAttribute]
+ [DefaultValueAttribute ("")]
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public string FirstPageImageUrl {
+ get {
+ object ob = ViewState ["FirstPageImageUrl"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["FirstPageImageUrl"] = value;
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("&lt;&lt;")]
+ [NotifyParentPropertyAttribute (true)]
+ public string FirstPageText {
+ get {
+ object ob = ViewState ["FirstPageText"];
+ if (ob != null) return (string) ob;
+ return "&lt;&lt;";
+ }
+ set {
+ ViewState ["FirstPageText"] = value;
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [NotifyParentPropertyAttribute (true)]
+ [UrlPropertyAttribute]
+ [DefaultValueAttribute ("")]
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public string LastPageImageUrl {
+ get {
+ object ob = ViewState ["LastPageImageUrl"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["LastPageImageUrl"] = value;
+ }
+ }
+
+ [NotifyParentPropertyAttribute (true)]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("&gt;&gt;")]
+ public string LastPageText {
+ get {
+ object ob = ViewState ["LastPageText"];
+ if (ob != null) return (string) ob;
+ return "&gt;&gt;";
+ }
+ set {
+ ViewState ["LastPageText"] = value;
+ }
+ }
+
+ [NotifyParentPropertyAttribute (true)]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute (PagerButtons.Numeric)]
+ public PagerButtons Mode {
+ get {
+ object ob = ViewState ["Mode"];
+ if (ob != null) return (PagerButtons) ob;
+ return PagerButtons.Numeric;
+ }
+ set {
+ ViewState ["Mode"] = value;
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [NotifyParentPropertyAttribute (true)]
+ [UrlPropertyAttribute]
+ [DefaultValueAttribute ("")]
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public string NextPageImageUrl {
+ get {
+ object ob = ViewState ["NextPageImageUrl"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["NextPageImageUrl"] = value;
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [NotifyParentPropertyAttribute (true)]
+ [DefaultValueAttribute ("&gt;")]
+ public string NextPageText {
+ get {
+ object ob = ViewState ["NextPageText"];
+ if (ob != null) return (string) ob;
+ return "&gt;";
+ }
+ set {
+ ViewState ["NextPageText"] = value;
+ }
+ }
+
+ [WebCategoryAttribute ("Behavior")]
+ [NotifyParentPropertyAttribute (true)]
+ [DefaultValueAttribute (10)]
+ public int PageButtonCount {
+ get {
+ object ob = ViewState ["PageButtonCount"];
+ if (ob != null) return (int) ob;
+ return 10;
+ }
+ set {
+ ViewState ["PageButtonCount"] = value;
+ }
+ }
+
+ [WebCategoryAttribute ("Layout")]
+ [DefaultValueAttribute (PagerPosition.Bottom)]
+ [NotifyParentPropertyAttribute (true)]
+ public PagerPosition Position {
+ get {
+ object ob = ViewState ["Position"];
+ if (ob != null) return (PagerPosition) ob;
+ return PagerPosition.Bottom;
+ }
+ set {
+ ViewState ["Position"] = value;
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [NotifyParentPropertyAttribute (true)]
+ [UrlPropertyAttribute]
+ [DefaultValueAttribute ("")]
+ [EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public string PreviousPageImageUrl {
+ get {
+ object ob = ViewState ["PreviousPageImageUrl"];
+ if (ob != null) return (string) ob;
+ return string.Empty;
+ }
+ set {
+ ViewState ["PreviousPageImageUrl"] = value;
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("&lt;")]
+ [NotifyParentPropertyAttribute (true)]
+ public string PreviousPageText {
+ get {
+ object ob = ViewState ["PreviousPageText"];
+ if (ob != null) return (string) ob;
+ return "&lt;";
+ }
+ set {
+ ViewState ["PreviousPageText"] = value;
+ }
+ }
+
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute (true)]
+ [NotifyParentPropertyAttribute (true)]
+ public bool Visible {
+ get {
+ object ob = ViewState ["Visible"];
+ if (ob != null) return (bool) ob;
+ return true;
+ }
+ set {
+ ViewState ["Visible"] = value;
+ }
+ }
+
+ public override string ToString ()
+ {
+ return string.Empty;
+ }
+
+ void IStateManager.LoadViewState (object savedState)
+ {
+ ViewState.LoadViewState (savedState);
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ return ViewState.SaveViewState();
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ ViewState.TrackViewState();
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get { return ViewState.IsTrackingViewState; }
+ }
+
+ internal Table CreatePagerControl (int currentPage, int pageCount)
+ {
+ Table table = new Table ();
+ TableRow row = new TableRow ();
+ table.Rows.Add (row);
+
+ if (Mode == PagerButtons.NextPrevious || Mode == PagerButtons.NextPreviousFirstLast)
+ {
+ if (currentPage > 0) {
+ if (Mode == PagerButtons.NextPreviousFirstLast)
+ row.Cells.Add (CreateCell (FirstPageText, FirstPageImageUrl, "Page", "First"));
+ row.Cells.Add (CreateCell (PreviousPageText, PreviousPageImageUrl, "Page", "Prev"));
+ }
+ if (currentPage < pageCount - 1) {
+ row.Cells.Add (CreateCell (NextPageText, NextPageImageUrl, "Page", "Next"));
+ if (Mode == PagerButtons.NextPreviousFirstLast)
+ row.Cells.Add (CreateCell (LastPageText, LastPageImageUrl, "Page", "Last"));
+ }
+ }
+ else if (Mode == PagerButtons.Numeric || Mode == PagerButtons.NumericFirstLast)
+ {
+ int first = currentPage / PageButtonCount;
+ int last = first + PageButtonCount;
+ if (last >= pageCount) last = pageCount;
+
+ if (first > 0) {
+ if (Mode == PagerButtons.NumericFirstLast)
+ row.Cells.Add (CreateCell (FirstPageText, FirstPageImageUrl, "Page", "First"));
+ row.Cells.Add (CreateCell (PreviousPageText, PreviousPageImageUrl, "Page", "Prev"));
+ }
+
+ for (int n = first; n < last; n++)
+ row.Cells.Add (CreateCell ((n+1).ToString(), string.Empty, (n != currentPage) ? "Page" : "", (n+1).ToString()));
+
+ if (last < pageCount - 1) {
+ row.Cells.Add (CreateCell (NextPageText, NextPageImageUrl, "Page", "Next"));
+ if (Mode == PagerButtons.NumericFirstLast)
+ row.Cells.Add (CreateCell (LastPageText, LastPageImageUrl, "Page", "Last"));
+ }
+ }
+ return table;
+ }
+
+ TableCell CreateCell (string text, string image, string command, string argument)
+ {
+ TableCell cell = new TableCell ();
+ cell.Controls.Add (new DataControlButton (ctrl, text, image, command, argument, true));
+ return cell;
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs
new file mode 100644
index 00000000000..c75898f4251
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs
@@ -0,0 +1,135 @@
+//
+// System.Web.UI.WebControls.Panel.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [Designer ("System.Web.UI.Design.WebControls.PanelDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ [ParseChildren(false)]
+ [PersistChildren(true)]
+ [ToolboxData("<{0}:Panel runat=\"server\">Panel</{0}:Panel>")]
+ public class Panel: WebControl
+ {
+ public Panel(): base(HtmlTextWriterTag.Div)
+ {
+ }
+
+#if NET_2_0
+ [UrlProperty]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Appearance")]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [WebSysDescription ("An Url specifying the background image for the panel.")]
+ public virtual string BackImageUrl
+ {
+ get
+ {
+ object o = ViewState["BackImageUrl"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["BackImageUrl"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (HorizontalAlign), "NotSet"), WebCategory ("Layout")]
+ [WebSysDescription ("The horizonal alignment of the panel.")]
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get
+ {
+ object o = ViewState["HorizontalAlign"];
+ if(o != null)
+ return (HorizontalAlign)o;
+ return HorizontalAlign.NotSet;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(HorizontalAlign), value))
+ {
+ throw new ArgumentOutOfRangeException ("value", "Only valid enumeration members are allowed");
+ }
+ ViewState["HorizontalAlign"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (true), WebCategory ("Layout")]
+ [WebSysDescription ("Determines if the content wraps at line-end.")]
+ public virtual bool Wrap
+ {
+ get
+ {
+ object o = ViewState["Wrap"];
+ if(o != null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["Wrap"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(BackImageUrl.Length > 0)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundImage, "url(" + ResolveUrl(BackImageUrl) + ")");
+ }
+ if(HorizontalAlign != HorizontalAlign.NotSet)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Align, TypeDescriptor.GetConverter(typeof(HorizontalAlign)).ConvertToString(HorizontalAlign));
+ }
+ if(!Wrap)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap");
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Parameter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Parameter.cs
new file mode 100644
index 00000000000..9240a1e7861
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Parameter.cs
@@ -0,0 +1,287 @@
+//
+// System.Web.UI.WebControls.Parameter
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2003 Ben Maurer
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Data;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+ [DefaultPropertyAttribute ("DefaultValue")]
+ public class Parameter : ICloneable, IStateManager {
+
+ public Parameter () : base ()
+ {
+ }
+
+ protected Parameter (Parameter original)
+ {
+ this.DefaultValue = original.DefaultValue;
+ this.Direction = original.Direction;
+ this.ConvertEmptyStringToNull = original.ConvertEmptyStringToNull;
+ this.Type = original.Type;
+ this.Name = original.Name;
+ }
+
+ public Parameter (string name)
+ {
+ this.Name = name;
+ }
+
+ public Parameter(string name, TypeCode type) : this (name)
+ {
+ this.Type = type;
+ }
+
+ public Parameter (string name, TypeCode type, string defaultValue) : this (name, type)
+ {
+ this.DefaultValue = defaultValue;
+ }
+
+ protected virtual Parameter Clone ()
+ {
+ return new Parameter (this);
+ }
+
+ protected void OnParameterChanged ()
+ {
+ if (_owner != null)
+ _owner.CallOnParameterChanged ();
+ }
+
+ protected virtual void LoadViewState (object savedState)
+ {
+ ViewState.LoadViewState (savedState);
+ }
+
+ protected virtual object SaveViewState ()
+ {
+ return ViewState.SaveViewState ();
+ }
+
+ protected virtual void TrackViewState ()
+ {
+ isTrackingViewState = true;
+ if (viewState != null)
+ viewState.TrackViewState ();
+ }
+
+ object ICloneable.Clone ()
+ {
+ return this.Clone ();
+ }
+
+ void IStateManager.LoadViewState (object savedState)
+ {
+ this.LoadViewState (savedState);
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ return this.SaveViewState ();
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ this.TrackViewState ();
+ }
+
+ bool IStateManager.IsTrackingViewState {
+ get { return this.IsTrackingViewState; }
+ }
+
+ public override string ToString ()
+ {
+ return Name;
+ }
+
+ [WebCategoryAttribute ("Parameter"), DefaultValueAttribute (""),
+ WebSysDescriptionAttribute ("Default value to be used in case value is null.") ]
+ public string DefaultValue {
+ get {
+ return ViewState ["DefaultValue"] as string;
+ }
+ set {
+
+ if (DefaultValue != value) {
+ ViewState ["DefaultValue"] = value;
+ OnParameterChanged ();
+ }
+ }
+ }
+
+ [WebCategoryAttribute ("Parameter"), DefaultValueAttribute ("Input"),
+ WebSysDescriptionAttribute ("Parameter's direction.")]
+ public ParameterDirection Direction
+ {
+ get {
+ object o = ViewState ["Direction"];
+ if (o != null)
+ return (ParameterDirection) o;
+
+ return ParameterDirection.Input;
+ }
+ set {
+ if (Direction != value) {
+ ViewState ["Direction"] = value;
+ OnParameterChanged ();
+ }
+ }
+ }
+
+
+ [WebCategoryAttribute ("Parameter"), DefaultValueAttribute (""),
+ WebSysDescriptionAttribute ("Parameter's name.")]
+ public string Name
+ {
+ get {
+ string s = ViewState ["Name"] as string;
+ if (s != null)
+ return s;
+
+ return "";
+ }
+ set {
+
+ if (Name != value) {
+ ViewState ["Name"] = value;
+ OnParameterChanged ();
+ }
+ }
+ }
+
+ [WebCategoryAttribute ("Parameter"), DefaultValueAttribute (true),
+ WebSysDescriptionAttribute ("Checks whether an empty string is treated as a null value.")]
+ public bool ConvertEmptyStringToNull
+ {
+ get {
+ object o = ViewState["ConvertEmptyStringToNull"];
+ if (o != null)
+ return (bool) o;
+
+ return true;
+ }
+ set {
+ if (ConvertEmptyStringToNull != value) {
+ ViewState["ConvertEmptyStringToNull"] = value;
+ OnParameterChanged ();
+ }
+ }
+ }
+
+ [DefaultValueAttribute (TypeCode.Object)]
+ [WebCategoryAttribute ("Parameter"),
+ WebSysDescriptionAttribute("Represents type of the parameter.")]
+ public TypeCode Type
+ {
+ get {
+ object o = ViewState ["Type"];
+ if (o != null)
+ return (TypeCode) o;
+
+ return TypeCode.Object;
+ }
+ set {
+
+ if (Type != value) {
+ ViewState ["Type"] = value;
+ OnParameterChanged ();
+ }
+ }
+ }
+
+ StateBag viewState;
+
+ [BrowsableAttribute (false),
+ DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ protected StateBag ViewState {
+ get {
+ if (viewState == null) {
+ viewState = new StateBag ();
+ if (IsTrackingViewState)
+ viewState.TrackViewState ();
+ }
+ return viewState;
+ }
+ }
+
+ bool isTrackingViewState = false;
+ protected bool IsTrackingViewState {
+ get { return isTrackingViewState; }
+ }
+
+ protected virtual object Evaluate (HttpContext context, Control control)
+ {
+ return this.DefaultValue;
+ }
+
+ internal object GetValue (HttpContext context, Control control)
+ {
+ object oldValue = ViewState ["ParameterValue"];
+
+ object newValue = ConvertValue (Evaluate (context, control));
+ if (newValue == null)
+ newValue = ConvertValue (DefaultValue);
+
+ if (!object.Equals (oldValue, newValue)) {
+ ViewState ["ParameterValue"] = newValue;
+ OnParameterChanged ();
+ }
+ return newValue;
+ }
+
+ object ConvertValue (object val)
+ {
+ if (val == null) return null;
+ if (ConvertEmptyStringToNull && val.Equals (string.Empty))
+ return null;
+ return Convert.ChangeType (val, Type);
+ }
+
+ protected internal virtual void SetDirty()
+ {
+ ViewState.SetDirty ();
+ }
+
+
+ private ParameterCollection _owner;
+
+ internal void SetOwnerCollection (ParameterCollection own)
+ {
+ _owner = own;
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ParameterCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ParameterCollection.cs
new file mode 100644
index 00000000000..3a1de3dabe5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ParameterCollection.cs
@@ -0,0 +1,234 @@
+//
+// System.Web.UI.WebControls/ParameterCollection.cs
+//
+// Author: Todd Berman <tberman@gentoo.org>
+//
+// (C) 2003 Todd Berman
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System.Web.UI;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+
+ public class ParameterCollection : StateManagedCollection
+ {
+
+ private static Type[] _knownTypes = new Type[] {
+ typeof (ControlParameter),
+ typeof (CookieParameter),
+ typeof (FormParameter),
+ typeof (Parameter),
+ typeof (QueryStringParameter),
+ typeof (SessionParameter) };
+
+ private EventHandler _parametersChanged;
+
+ public int Add (Parameter param)
+ {
+ return ((IList)this).Add (param);
+ }
+
+ public int Add (string name, string value)
+ {
+ return ((IList)this).Add (new Parameter (name, TypeCode.Object, value));
+ }
+
+ public int Add (string name, TypeCode type, string value)
+ {
+ return ((IList)this).Add (new Parameter (name, type, value));
+ }
+
+ protected override object CreateKnownType (int idx)
+ {
+ switch (idx) {
+ case 0:
+ return new ControlParameter ();
+ case 1:
+ return new CookieParameter ();
+ case 2:
+ return new FormParameter ();
+ case 3:
+ return new Parameter ();
+ case 4:
+ return new QueryStringParameter ();
+ case 5:
+ return new SessionParameter ();
+ }
+
+ throw new ArgumentOutOfRangeException ("index");
+ }
+
+ protected override Type[] GetKnownTypes ()
+ {
+ return _knownTypes;
+ }
+
+ public IOrderedDictionary GetValues (HttpContext context, Control control)
+ {
+ OrderedDictionary values = new OrderedDictionary ();
+ foreach (Parameter param in this)
+ {
+ string name = param.Name;
+ for (int i = 1; values.Contains (name); i++)
+ name = param.Name + i.ToString ();
+ values.Add (name, param.GetValue (context, control));
+ }
+ return values;
+ }
+
+ public void UpdateValues (HttpContext context, Control control)
+ {
+ foreach (Parameter param in this)
+ param.GetValue (context, control);
+ }
+
+ public void Insert (int idx, Parameter param)
+ {
+ ((IList)this).Insert (idx, param);
+ }
+
+ protected override void OnClearComplete ()
+ {
+ base.OnClearComplete ();
+ OnParametersChanged (EventArgs.Empty);
+ }
+
+ protected override void OnInsert (int idx, object value)
+ {
+ base.OnInsert (idx, value);
+ ((Parameter)value).SetOwnerCollection (this);
+ }
+
+ protected override void OnInsertComplete (int idx, object value)
+ {
+ base.OnInsertComplete (idx, value);
+ OnParametersChanged (EventArgs.Empty);
+ }
+
+ protected virtual void OnParametersChanged (EventArgs e)
+ {
+ if (_parametersChanged != null)
+ _parametersChanged(this, e);
+ }
+
+ protected override void OnValidate (object o)
+ {
+ base.OnValidate (o);
+
+ if ((o is Parameter) == false)
+ throw new ArgumentException ("o is not a Parameter");
+ }
+
+ public void Remove (Parameter param)
+ {
+ ((IList)this).Remove (param);
+ }
+
+ public void RemoveAt (int idx)
+ {
+ ((IList)this).RemoveAt (idx);
+ }
+
+ protected override void SetDirtyObject (object o)
+ {
+ Parameter param = (Parameter)o;
+ if (Contains (param))
+ param.SetDirty ();
+ }
+
+ internal void CallOnParameterChanged ()
+ {
+ OnParametersChanged (EventArgs.Empty);
+ }
+
+ private int IndexOfString (string name)
+ {
+ for (int i = 0; i < Count; i++)
+ {
+ if (((Parameter)((IList)this)[i]).Name == name)
+ return i;
+ }
+ return -1;
+ }
+
+ public Parameter this[int idx] {
+ get {
+ return (Parameter) ((IList)this)[idx];
+ }
+ set {
+ ((IList)this)[idx] = value;
+ }
+ }
+
+ public Parameter this[string name] {
+ get {
+ int idx = IndexOfString (name);
+ if (idx == -1)
+ return null;
+ return ((Parameter) ((IList)this)[idx]);
+ }
+ set {
+ int idx = IndexOfString (name);
+ if (idx == -1) {
+ Add (value);
+ return;
+ }
+ ((IList)this)[idx] = value;
+ }
+ }
+
+ public event EventHandler ParametersChanged {
+ add { _parametersChanged += value; }
+ remove { _parametersChanged -= value; }
+ }
+
+ public bool Contains (Parameter param)
+ {
+ return ((IList)this).Contains (param);
+ }
+
+ public void CopyTo (Parameter[] paramArray, int index)
+ {
+ ((IList)this).CopyTo (paramArray, index);
+ }
+
+ public int IndexOf (Parameter param)
+ {
+ return ((IList)this).IndexOf (param);
+ }
+
+ protected override void OnRemoveComplete (int index, object value)
+ {
+ base.OnRemoveComplete (index, value);
+ OnParametersChanged (EventArgs.Empty);
+ }
+
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PathDirection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PathDirection.cs
new file mode 100644
index 00000000000..8f2025b9440
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PathDirection.cs
@@ -0,0 +1,35 @@
+//
+// System.Web.UI.WebControls.PathDirection.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum PathDirection {
+ RootToCurrent = 0,
+ CurrentToRoot = 1
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolder.cs
new file mode 100644
index 00000000000..c8571d07f15
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolder.cs
@@ -0,0 +1,49 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: PlaceHolder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ControlBuilder(typeof(PlaceHolderControlBuilder))]
+ public class PlaceHolder : Control
+ {
+ public PlaceHolder(): base()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolderControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolderControlBuilder.cs
new file mode 100644
index 00000000000..32b8a48e285
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolderControlBuilder.cs
@@ -0,0 +1,52 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: PlaceHolderControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class PlaceHolderControlBuilder : ControlBuilder
+ {
+ public PlaceHolderControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/QueryStringParameter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/QueryStringParameter.cs
new file mode 100644
index 00000000000..4cf2e71cb08
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/QueryStringParameter.cs
@@ -0,0 +1,94 @@
+//
+// System.Web.UI.WebControls.QueryStringParameter
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+
+ [DefaultPropertyAttribute ("QueryStringField")]
+ public class QueryStringParameter : Parameter {
+
+ public QueryStringParameter () : base ()
+ {
+ }
+
+ protected QueryStringParameter (QueryStringParameter original) : base (original)
+ {
+ this.QueryStringField = original.QueryStringField;
+
+ }
+
+ public QueryStringParameter (string name, string queryStringField) : base (name)
+ {
+ QueryStringField = queryStringField;
+ }
+
+ public QueryStringParameter (string name, TypeCode type, string queryStringField) : base (name, type)
+ {
+ QueryStringField = queryStringField;
+ }
+
+ protected override Parameter Clone ()
+ {
+ return new QueryStringParameter (this);
+ }
+
+ protected override object Evaluate (HttpContext ctx, Control control)
+ {
+ if (control == null || ctx.Request == null)
+ return null;
+
+ return ctx.Request.QueryString [QueryStringField];
+ }
+
+ [DefaultValueAttribute ("")]
+ public string QueryStringField {
+ get {
+ string s = ViewState ["QueryStringField"] as string;
+ if (s != null)
+ return s;
+
+ return "";
+ }
+ set {
+ if (QueryStringField != value) {
+ ViewState ["QueryStringField"] = value;
+ OnParameterChanged ();
+ }
+ }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs
new file mode 100644
index 00000000000..88e300d2c3e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs
@@ -0,0 +1,178 @@
+//
+// System.Web.UI.WebControls.RadioButton.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+
+namespace System.Web.UI.WebControls
+{
+ [Designer ("System.Web.UI.Design.WebControls.CheckBoxDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ public class RadioButton : CheckBox, IPostBackDataHandler
+ {
+ public RadioButton () : base ()
+ {
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (""), WebCategory ("Behavior")]
+ [WebSysDescription ("The name of the group that this control belongs to.")]
+ public virtual string GroupName
+ {
+ get {
+ object o = ViewState ["GroupName"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["GroupName"] = value; }
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+ if (Page != null && Enabled && !Checked)
+ Page.RegisterRequiresPostBack (this);
+
+ if(GroupName.Length == 0)
+ GroupName = UniqueID;
+ }
+
+ internal override void RenderInputTag (HtmlTextWriter writer, string id)
+ {
+ writer.AddAttribute (HtmlTextWriterAttribute.Id, id);
+ writer.AddAttribute (HtmlTextWriterAttribute.Type, "radio");
+ writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueGroupNamePrivate);
+ writer.AddAttribute (HtmlTextWriterAttribute.Value, ValueAttributePrivate);
+
+ if (Checked)
+ writer.AddAttribute (HtmlTextWriterAttribute.Checked, "checked");
+
+ if (!Enabled)
+ writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+
+ if (AutoPostBack){
+ writer.AddAttribute (HtmlTextWriterAttribute.Onclick,
+ Page.ClientScript.GetPostBackClientEvent (this, ""));
+ writer.AddAttribute ("language", "javascript");
+ }
+
+ if (AccessKey.Length > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Accesskey, AccessKey);
+
+ if (TabIndex != 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Tabindex,
+ TabIndex.ToString (NumberFormatInfo.InvariantInfo));
+
+ writer.RenderBeginTag (System.Web.UI.HtmlTextWriterTag.Input);
+ writer.RenderEndTag ();
+ }
+
+ private string UniqueGroupNamePrivate
+ {
+ get {
+ string retVal;
+ string uid = UniqueID;
+ int unique = uid.LastIndexOf (':');
+ if (unique == -1) {
+ retVal = GroupName;
+ } else {
+ retVal = uid.Substring (0, unique + 1) + GroupName;
+ }
+
+ return retVal;
+ }
+ }
+
+ private string ValueAttributePrivate
+ {
+ get {
+ string retVal = Attributes ["value"];
+ if (retVal != null)
+ return retVal;
+
+ if (ID != null)
+ return ID;
+
+ return UniqueID;
+ }
+ }
+
+
+#if NET_2_0
+ bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+ {
+ return LoadPostData (postDataKey, postCollection);
+ }
+
+ protected override bool LoadPostData (string postDataKey, NameValueCollection postCollection)
+#else
+ bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+#endif
+ {
+ bool _checked = Checked;
+ if (postCollection [UniqueGroupNamePrivate] == ValueAttributePrivate){
+ if (_checked)
+ return false;
+ Checked = true;
+ return true;
+ }
+
+ if (_checked)
+ Checked = false;
+ return true;
+ }
+
+#if NET_2_0
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ RaisePostDataChangedEvent ();
+ }
+
+ protected override void RaisePostDataChangedEvent ()
+ {
+ OnCheckedChanged (EventArgs.Empty);
+ }
+#else
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnCheckedChanged (EventArgs.Empty);
+ }
+#endif
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs
new file mode 100644
index 00000000000..03231fc5669
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs
@@ -0,0 +1,364 @@
+//
+// System.Web.UI.WebControls.RadioButtonList.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ValidationProperty("SelectedItem")]
+ public class RadioButtonList : ListControl, IRepeatInfoUser, INamingContainer, IPostBackDataHandler
+ {
+ private bool selectionIndexChanged;
+ private short tabIndex;
+
+ public RadioButtonList(): base()
+ {
+ selectionIndexChanged = false;
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (-1), WebCategory ("Layout")]
+ [WebSysDescription ("The border left within a RadioButton.")]
+ public virtual int CellPadding
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ {
+ return (int)(((TableStyle)ControlStyle).CellPadding);
+ }
+ return -1;
+ }
+ set {
+ if (value < -1)
+ throw new ArgumentOutOfRangeException ("value", "CellPadding value has to be -1 for 'not set' or > -1.");
+ ((TableStyle)ControlStyle).CellPadding = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (-1), WebCategory ("Layout")]
+ [WebSysDescription ("The border left between RadioButtons.")]
+ public virtual int CellSpacing
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ {
+ return (int)(((TableStyle)ControlStyle).CellSpacing);
+ }
+ return -1;
+ }
+ set {
+ if (value < -1)
+ throw new ArgumentOutOfRangeException ("value", "CellSpacing value has to be -1 for 'not set' or > -1.");
+ ((TableStyle)ControlStyle).CellSpacing = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (0), WebCategory ("Layout")]
+ [WebSysDescription ("The number of columns that should be used to display the RadioButtons.")]
+ public virtual int RepeatColumns
+ {
+ get
+ {
+ object o = ViewState["RepeatColumns"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ set {
+ if (value < 0)
+ throw new ArgumentOutOfRangeException ("value", "RepeatColumns value has to be 0 for 'not set' or > 0.");
+ ViewState["RepeatColumns"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (RepeatDirection), "Vertical"), WebCategory ("Layout")]
+ [WebSysDescription ("The direction that is followed when doing the layout.")]
+ public virtual RepeatDirection RepeatDirection
+ {
+ get
+ {
+ object o = ViewState["RepeatDirection"];
+ if(o != null)
+ return (RepeatDirection)o;
+ return RepeatDirection.Vertical;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(RepeatDirection), value))
+ throw new ArgumentOutOfRangeException ("value", "Only valid enumeration members are allowed");
+ ViewState["RepeatDirection"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (RepeatLayout), "Table"), WebCategory ("Layout")]
+ [WebSysDescription ("The method used to create the layout.")]
+ public virtual RepeatLayout RepeatLayout
+ {
+ get
+ {
+ object o = ViewState["RepeatLayout"];
+ if(o != null)
+ return (RepeatLayout)o;
+ return RepeatLayout.Table;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(RepeatLayout), value))
+ throw new ArgumentOutOfRangeException ("value", "Only valid enumeration members are allowed");
+ ViewState["RepeatLayout"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (TextAlign), "Right"), WebCategory ("Appearance")]
+ [WebSysDescription ("The alignment of the RadioButton text.")]
+ public virtual TextAlign TextAlign
+ {
+ get
+ {
+ object o = ViewState["TextAlign"];
+ if(o != null)
+ return (TextAlign)o;
+ return TextAlign.Right;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(TextAlign), value))
+ throw new ArgumentOutOfRangeException ("value", "Only valid enumeration members are allowed");
+ ViewState["TextAlign"] = value;
+ }
+ }
+
+ protected override Style CreateControlStyle()
+ {
+ return new TableStyle(ViewState);
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ RepeatInfo info = new RepeatInfo();
+ Style cStyle = (ControlStyleCreated ? ControlStyle : null);
+ bool dirty = false;
+ tabIndex = TabIndex;
+ if(tabIndex != 0)
+ {
+ dirty = !ViewState.IsItemDirty("TabIndex");
+ TabIndex = 0;
+ }
+ info.RepeatColumns = RepeatColumns;
+ info.RepeatDirection = RepeatDirection;
+ info.RepeatLayout = RepeatLayout;
+ info.RenderRepeater(writer, this, cStyle, this);
+ if(tabIndex != 0)
+ {
+ TabIndex = tabIndex;
+ }
+ if(dirty)
+ {
+ ViewState.SetItemDirty("TabIndex", false);
+ }
+ }
+
+#if NET_2_0
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ return LoadPostData (postDataKey, postCollection);
+ }
+
+ protected virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection)
+#else
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+#endif
+ {
+ string value = postCollection [postDataKey];
+ int c = Items.Count;
+ for (int i = 0; i < c; i++) {
+ if (Items [i].Value != value)
+ continue;
+
+ if (i != SelectedIndex) {
+ SelectedIndex = i;
+ selectionIndexChanged = true;
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+#if NET_2_0
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ RaisePostDataChangedEvent ();
+ }
+
+ protected virtual void RaisePostDataChangedEvent ()
+ {
+ if (CausesValidation)
+ Page.Validate (ValidationGroup);
+
+ if(selectionIndexChanged)
+ OnSelectedIndexChanged(EventArgs.Empty);
+ }
+#else
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ if(selectionIndexChanged)
+ OnSelectedIndexChanged(EventArgs.Empty);
+ }
+#endif
+
+
+#if NET_2_0
+ Style IRepeatInfoUser.GetItemStyle(System.Web.UI.WebControls.ListItemType itemType, int repeatIndex)
+ {
+ return GetItemStyle (itemType, repeatIndex);
+ }
+ protected virtual Style GetItemStyle(System.Web.UI.WebControls.ListItemType itemType, int repeatIndex)
+ {
+ return null;
+ }
+#else
+ Style IRepeatInfoUser.GetItemStyle(System.Web.UI.WebControls.ListItemType itemType, int repeatIndex)
+ {
+ return null;
+ }
+#endif
+
+#if NET_2_0
+ void IRepeatInfoUser.RenderItem (System.Web.UI.WebControls.ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
+ {
+ RenderItem (itemType, repeatIndex, repeatInfo, writer);
+ }
+
+ protected virtual void RenderItem (System.Web.UI.WebControls.ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
+#else
+ void IRepeatInfoUser.RenderItem (System.Web.UI.WebControls.ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
+#endif
+ {
+ /* Create a new RadioButton as if it was defined in the page and render it */
+ RadioButton button = new RadioButton ();
+ button.Page = Page;
+ button.GroupName = UniqueID;
+ button.TextAlign = TextAlign;
+ button.AutoPostBack = AutoPostBack;
+ button.ID = ClientID + "_" + repeatIndex.ToString (NumberFormatInfo.InvariantInfo);;
+ button.TabIndex = tabIndex;
+ ListItem current = Items [repeatIndex];
+ button.Text = current.Text;
+ button.Attributes ["value"] = current.Value;
+ button.Checked = current.Selected;
+ button.Enabled = Enabled;
+ button.RenderControl (writer);
+ }
+
+#if NET_2_0
+ bool IRepeatInfoUser.HasFooter {
+ get { return HasFooter; }
+ }
+
+ protected virtual bool HasFooter {
+ get { return false; }
+ }
+#else
+ bool IRepeatInfoUser.HasFooter {
+ get { return false; }
+ }
+#endif
+
+#if NET_2_0
+ bool IRepeatInfoUser.HasHeader {
+ get { return HasHeader; }
+ }
+
+ protected virtual bool HasHeader {
+ get { return false; }
+ }
+#else
+ bool IRepeatInfoUser.HasHeader {
+ get { return false; }
+ }
+#endif
+
+#if NET_2_0
+ bool IRepeatInfoUser.HasSeparators {
+ get { return HasSeparators; }
+ }
+
+ protected virtual bool HasSeparators {
+ get { return false; }
+ }
+#else
+ bool IRepeatInfoUser.HasSeparators {
+ get { return false; }
+ }
+#endif
+
+#if NET_2_0
+ int IRepeatInfoUser.RepeatedItemCount {
+ get { return RepeatedItemCount; }
+ }
+
+ protected virtual int RepeatedItemCount {
+ get { return Items.Count; }
+ }
+#else
+ int IRepeatInfoUser.RepeatedItemCount {
+ get { return Items.Count; }
+ }
+#endif
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs
new file mode 100644
index 00000000000..010ae6ed7cc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs
@@ -0,0 +1,159 @@
+//
+// System.Web.UI.WebControls.RangeValidator.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Xml;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxData("<{0}:RangeValidator runat=\"server\" "
+ + "ErrorMessage=\"RangeValidator\"></{0}:RangeValidator>")]
+ public class RangeValidator : BaseCompareValidator
+ {
+ public RangeValidator(): base()
+ {
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Behavior")]
+ [WebSysDescription ("The maximum value that the validated control can be assigned.")]
+ public string MaximumValue
+ {
+ get
+ {
+ object o = ViewState["MaximumValue"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["MaximumValue"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Behavior")]
+ [WebSysDescription ("The minimum value that the validated control can be assigned.")]
+ public string MinimumValue
+ {
+ get
+ {
+ object o = ViewState["MinimumValue"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["MinimumValue"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(base.RenderUplevel)
+ {
+ writer.AddAttribute("evaluationfunction", "RangeValidatorEvaluateIsValid");
+ writer.AddAttribute("maximumvalue", MaximumValue);
+ writer.AddAttribute("minimumvalue", MinimumValue);
+ }
+ }
+
+ protected override bool ControlPropertiesValid()
+ {
+ string max = MaximumValue;
+ if(!CanConvert(max, Type))
+ {
+ string[] fmt = new string[4];
+ fmt[0] = max;
+ fmt[1] = "MaximumValue";
+ fmt[2] = ID;
+ fmt[3] = PropertyConverter.EnumToString(typeof(ValidationDataType), Type);
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_value_bad_type", fmt));
+ }
+ string min = MinimumValue;
+ if(!CanConvert(min, Type))
+ {
+ string[] fmt = new string[4];
+ fmt[0] = min;
+ fmt[1] = "MinimumValue";
+ fmt[2] = ID;
+ fmt[3] = PropertyConverter.EnumToString(typeof(ValidationDataType), Type);
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_value_bad_type", fmt));
+ }
+
+ if(Compare(min,max, ValidationCompareOperator.GreaterThan, Type))
+ {
+ string[] fmt = new string[3];
+ fmt[0] = min;
+ fmt[1] = max;
+ fmt[2] = PropertyConverter.EnumToString(typeof(ValidationDataType), Type);
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_range_overalap", fmt));
+ }
+ return base.ControlPropertiesValid();
+ }
+
+ protected override bool EvaluateIsValid()
+ {
+ string ctrl = GetControlValidationValue(ControlToValidate);
+ if(ctrl == null || ctrl.Trim().Length == 0)
+ {
+ return true;
+ }
+ bool retVal = Compare(ctrl, MinimumValue, ValidationCompareOperator.GreaterThanEqual,
+ this.Type);
+ if(retVal)
+ {
+ retVal = Compare(ctrl, MaximumValue, ValidationCompareOperator.LessThanEqual,
+ this.Type);
+ }
+ return retVal;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RegularExpressionValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RegularExpressionValidator.cs
new file mode 100644
index 00000000000..e6e3ae3ed49
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RegularExpressionValidator.cs
@@ -0,0 +1,111 @@
+//
+// System.Web.UI.WebControls.RegularExpressionValidator.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Text.RegularExpressions;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxData("<{0}:RegularExpressionValidator runat=\"server\" "
+ + "ErrorMessage=\"RegularExpressionValidator\">"
+ + "</{0}:RegularExpressionValidator>")]
+ public class RegularExpressionValidator : BaseValidator
+ {
+ public RegularExpressionValidator(): base()
+ {
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Behavior")]
+ [Editor ("System.Web.UI.Design.WebControls.RegexTypeEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [WebSysDescription ("A regular expression that is used to validate.")]
+ public string ValidationExpression
+ {
+ get
+ {
+ object o = ViewState["ValidationExpression"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ try
+ {
+ Regex.IsMatch("", value);
+ } catch(Exception)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_bad_regex", value));
+ }
+ ViewState["ValidationExpression"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(base.RenderUplevel)
+ {
+ writer.AddAttribute("evaluationfunction", "RegularExpressionValidatorEvaluateIsValid");
+ string exp = ValidationExpression;
+ if(exp.Length > 0)
+ {
+ writer.AddAttribute("validationexpression", exp);
+ }
+ }
+ }
+
+ protected override bool EvaluateIsValid ()
+ {
+ string ctrl = GetControlValidationValue (ControlToValidate);
+ if (ctrl == null || ctrl.Trim ().Length == 0)
+ return true;
+
+ bool retVal;
+ try {
+ retVal = Regex.IsMatch (ctrl, "^" + ValidationExpression + "$");
+ } catch (Exception) {
+ retVal = true;
+ }
+ return retVal;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeatDirection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatDirection.cs
new file mode 100755
index 00000000000..30e8d128c9f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatDirection.cs
@@ -0,0 +1,42 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: RepeatDirection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum RepeatDirection
+ {
+ Horizontal,
+ Vertical
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs
new file mode 100644
index 00000000000..f295bad1228
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs
@@ -0,0 +1,408 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RepeatInfo
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class RepeatInfo
+ {
+ private bool outerTableImp;
+ private int repeatColumns;
+ private RepeatDirection repeatDirection;
+ private RepeatLayout repeatLayout;
+
+ public RepeatInfo()
+ {
+ outerTableImp = false;
+ repeatColumns = 0;
+ repeatDirection = RepeatDirection.Vertical;
+ repeatLayout = RepeatLayout.Table;
+ }
+
+ public bool OuterTableImplied
+ {
+ get
+ {
+ return outerTableImp;
+ }
+ set
+ {
+ outerTableImp = value;
+ }
+ }
+
+ public int RepeatColumns
+ {
+ get
+ {
+ return repeatColumns;
+ }
+ set
+ {
+ repeatColumns = value;
+ }
+ }
+
+ public RepeatDirection RepeatDirection
+ {
+ get
+ {
+ return repeatDirection;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(RepeatDirection), value))
+ throw new ArgumentException();
+ repeatDirection = value;
+ }
+ }
+
+ public RepeatLayout RepeatLayout
+ {
+ get
+ {
+ return repeatLayout;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(RepeatLayout), value))
+ throw new ArgumentException();
+ repeatLayout = value;
+ }
+ }
+
+ public void RenderRepeater(HtmlTextWriter writer, IRepeatInfoUser user, Style controlStyle, WebControl baseControl)
+ {
+ if(RepeatDirection == RepeatDirection.Vertical)
+ {
+ DoVerticalRendering(writer, user, controlStyle, baseControl);
+ } else
+ {
+ DoHorizontalRendering(writer, user, controlStyle, baseControl);
+ }
+ }
+
+ private void DoVerticalRendering(HtmlTextWriter writer, IRepeatInfoUser user, Style controlStyle, WebControl baseControl)
+ {
+ int total = user.RepeatedItemCount;
+ int colsCount;
+ int rowsCount;
+ if(repeatColumns == 0 || repeatColumns==1)
+ {
+ colsCount = 1;
+ rowsCount = total;
+ } else
+ {
+ colsCount = repeatColumns;
+ rowsCount = (total + repeatColumns - 1) / repeatColumns;
+ if(rowsCount ==0 && total != 0)
+ {
+ rowsCount = 1;
+ colsCount = total;
+ }
+ }
+ WebControl ctrl = null;
+ bool isTable = false;
+ bool hasSeps = user.HasSeparators;
+ if(!outerTableImp)
+ {
+ if(RepeatLayout == RepeatLayout.Table)
+ {
+ ctrl = new Table();
+ isTable = true;
+ } else
+ {
+ ctrl = new WebControl(HtmlTextWriterTag.Span);
+ }
+ }
+
+ if(ctrl != null)
+ {
+ ctrl.ID = baseControl.ClientID;
+ ctrl.CopyBaseAttributes(baseControl);
+ ctrl.ApplyStyle(controlStyle);
+ ctrl.RenderBeginTag(writer);
+ }
+
+ Style itemStyle;
+ int colSpan = 0;
+ if(user.HasHeader)
+ {
+ if(isTable)
+ {
+ writer.RenderBeginTag(HtmlTextWriterTag.Tr);
+ if(colsCount != 1)
+ {
+ colSpan = colsCount;
+ if(hasSeps)
+ colSpan += colsCount;
+ writer.AddAttribute(HtmlTextWriterAttribute.Colspan, colSpan.ToString(NumberFormatInfo.InvariantInfo));
+ }
+ itemStyle = user.GetItemStyle(ListItemType.Header, -1);
+ if(itemStyle != null)
+ {
+ itemStyle.AddAttributesToRender(writer);
+ }
+ writer.RenderBeginTag(HtmlTextWriterTag.Td);
+ }
+ user.RenderItem(ListItemType.Header, -1, this, writer);
+ if(isTable)
+ {
+ writer.RenderEndTag();
+ writer.RenderEndTag();
+ } else
+ {
+ if(!outerTableImp)
+ {
+ writer.WriteFullBeginTag("br");
+ }
+ }
+ }
+
+ int rowIndex = 0;
+ int colIndex = 0;
+ int index = 0;
+ int diff = colsCount - (rowsCount*colsCount - total);
+
+ while(rowIndex < rowsCount)
+ {
+ if(isTable)
+ writer.RenderBeginTag(HtmlTextWriterTag.Tr);
+ colIndex = 0;
+ while(colIndex < colsCount)
+ {
+ if (rowIndex == rowsCount-1 && colIndex >= diff)
+ break;
+
+ if (colIndex < diff)
+ index = rowIndex + colIndex * rowsCount;
+ else
+ index = rowIndex + colIndex * (rowsCount-1) + diff;
+
+ if(index < total)
+ {
+ if(isTable)
+ {
+ itemStyle = user.GetItemStyle(ListItemType.Item, index);
+ if(itemStyle != null)
+ {
+ itemStyle.AddAttributesToRender(writer);
+ }
+ writer.RenderBeginTag(HtmlTextWriterTag.Td);
+ }
+ user.RenderItem(ListItemType.Item, index, this, writer);
+ if(isTable)
+ writer.RenderEndTag();
+ if(hasSeps && index != (total - 1))
+ {
+ if(isTable && colsCount == 1)
+ {
+ writer.RenderEndTag();
+ writer.RenderBeginTag(HtmlTextWriterTag.Tr);
+ } else
+ {
+ writer.WriteFullBeginTag("br");
+ }
+ if(isTable)
+ {
+ itemStyle = user.GetItemStyle(ListItemType.Separator, index);
+ if(itemStyle != null)
+ itemStyle.AddAttributesToRender(writer);
+ writer.RenderBeginTag(HtmlTextWriterTag.Td);
+ }
+ user.RenderItem(ListItemType.Separator, index, this, writer);
+ if(isTable)
+ writer.RenderEndTag();
+ }
+ }
+ colIndex++;
+ }
+ if(isTable)
+ writer.RenderEndTag();
+ else
+ if((rowIndex != (rowsCount - 1) || user.HasFooter) && !outerTableImp)
+ writer.WriteFullBeginTag("br");
+ rowIndex++;
+ }
+ if(user.HasFooter)
+ {
+ if(isTable)
+ {
+ writer.RenderBeginTag(HtmlTextWriterTag.Tr);
+ if(colsCount != 1)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Colspan, colSpan.ToString(NumberFormatInfo.InvariantInfo));
+ }
+ itemStyle = user.GetItemStyle(ListItemType.Footer, -1);
+ if(itemStyle != null)
+ {
+ itemStyle.AddAttributesToRender(writer);
+ }
+ writer.RenderBeginTag(HtmlTextWriterTag.Td);
+ }
+ user.RenderItem(ListItemType.Footer, -1, this, writer);
+ if(isTable)
+ {
+ writer.RenderEndTag();
+ writer.RenderEndTag();
+ }
+ }
+ if(ctrl != null)
+ {
+ ctrl.RenderEndTag(writer);
+ }
+ }
+
+ private void DoHorizontalRendering (HtmlTextWriter writer,
+ IRepeatInfoUser user,
+ Style controlStyle,
+ WebControl baseControl)
+ {
+ /* Based on DoVerticalRendering */
+ int total = user.RepeatedItemCount;
+ int colsCount = 0;
+ int rowsCount = 0;
+ WebControl ctrl = null;
+ bool isTable = true;
+ bool hasSeps = user.HasSeparators;
+ if (!outerTableImp){
+ isTable = (RepeatLayout == RepeatLayout.Table);
+ ctrl = (isTable) ? new Table () : new WebControl (HtmlTextWriterTag.Span);
+ ctrl.ID = baseControl.ClientID;
+ ctrl.CopyBaseAttributes (baseControl);
+ ctrl.ApplyStyle (controlStyle);
+ ctrl.RenderBeginTag (writer);
+ }
+
+ Style itemStyle;
+ int colSpan = 0;
+ if (user.HasHeader){
+ if (isTable){
+ writer.RenderBeginTag (HtmlTextWriterTag.Tr);
+ if (colsCount != 1){
+ colSpan = colsCount;
+ if (hasSeps)
+ colSpan += colsCount;
+ writer.AddAttribute (HtmlTextWriterAttribute.Colspan,
+ colSpan.ToString (NumberFormatInfo.InvariantInfo));
+ }
+ itemStyle = user.GetItemStyle (ListItemType.Header, -1);
+ if (itemStyle != null)
+ itemStyle.AddAttributesToRender (writer);
+ writer.RenderBeginTag (HtmlTextWriterTag.Td);
+ }
+
+ user.RenderItem (ListItemType.Header, -1, this, writer);
+
+ if (isTable){
+ writer.RenderEndTag();
+ writer.RenderEndTag();
+ } else if (repeatColumns < user.RepeatedItemCount)
+ writer.WriteFullBeginTag ("br");
+ }
+
+ for (int index = 0; index < total; index++){
+ if (isTable && index == 0)
+ writer.RenderBeginTag (HtmlTextWriterTag.Tr);
+
+ if (isTable){
+ itemStyle = user.GetItemStyle (ListItemType.Item, index);
+ if (itemStyle != null)
+ itemStyle.AddAttributesToRender(writer);
+ writer.RenderBeginTag(HtmlTextWriterTag.Td);
+ }
+
+ user.RenderItem(ListItemType.Item, index, this, writer);
+ if (isTable)
+ writer.RenderEndTag ();
+
+ if (hasSeps && index != (total - 1)){
+ if (isTable){
+ itemStyle = user.GetItemStyle (ListItemType.Separator, index);
+ if (itemStyle != null)
+ itemStyle.AddAttributesToRender (writer);
+ writer.RenderBeginTag (HtmlTextWriterTag.Td);
+ }
+ user.RenderItem (ListItemType.Separator, index, this, writer);
+ if (isTable)
+ writer.RenderEndTag ();
+ }
+
+ colsCount++;
+ if (colsCount == repeatColumns) {
+ if (isTable) {
+ writer.RenderEndTag ();
+ writer.RenderBeginTag (HtmlTextWriterTag.Tr);
+ }
+ else if (rowsCount < total)
+ writer.WriteFullBeginTag ("br");
+ colsCount = 0;
+ }
+
+ if (index == (total - 1)) {
+ if (isTable)
+ writer.RenderEndTag ();
+ else if (rowsCount < total)
+ writer.WriteFullBeginTag ("br");
+ }
+ }
+
+ if (user.HasFooter){
+ if (isTable){
+ writer.RenderBeginTag (HtmlTextWriterTag.Tr);
+ if (colsCount != 1)
+ writer.AddAttribute (HtmlTextWriterAttribute.Colspan,
+ colSpan.ToString(NumberFormatInfo.InvariantInfo));
+
+ itemStyle = user.GetItemStyle (ListItemType.Footer, -1);
+ if(itemStyle != null)
+ itemStyle.AddAttributesToRender (writer);
+ writer.RenderBeginTag (HtmlTextWriterTag.Td);
+ }
+ user.RenderItem (ListItemType.Footer, -1, this, writer);
+ if (isTable){
+ writer.RenderEndTag ();
+ writer.RenderEndTag ();
+ }
+ }
+
+ if (ctrl != null)
+ ctrl.RenderEndTag(writer);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeatLayout.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatLayout.cs
new file mode 100755
index 00000000000..d613f60b373
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatLayout.cs
@@ -0,0 +1,42 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: RepeatLayout
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum RepeatLayout
+ {
+ Table,
+ Flow
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs
new file mode 100644
index 00000000000..6df7bf99f31
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs
@@ -0,0 +1,593 @@
+//
+// System.Web.UI.WebControls.Repeater.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+// (C) 2004 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
+// "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;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.Web.Util;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("ItemCommand")]
+ [DefaultProperty("DataSource")]
+ [Designer ("System.Web.UI.Design.WebControls.RepeaterDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ [ParseChildren(true)]
+ [PersistChildren(false)]
+ public class Repeater : Control, INamingContainer
+ {
+ private static readonly object ItemCommandEvent = new object();
+ private static readonly object ItemCreatedEvent = new object();
+ private static readonly object ItemDataBoundEvent = new object();
+
+ private static readonly string ITEMCOUNT = "Repeater_Item_Count";
+
+ private ITemplate alternatingItemTemplate;
+ private ITemplate footerTemplate;
+ private ITemplate headerTemplate;
+ private ITemplate itemTemplate;
+ private ITemplate separatorTemplate;
+ private object dataSource;
+
+ private RepeaterItemCollection items;
+ private ArrayList itemsArrayList;
+
+#if NET_2_0
+ bool inited;
+ IDataSource currentSource;
+ DataSourceSelectArguments selectArguments = null;
+ bool requiresDataBinding;
+#endif
+
+ public Repeater(): base()
+ {
+ }
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when a command is executed in the DataList.")]
+ public event RepeaterCommandEventHandler ItemCommand
+ {
+ add
+ {
+ Events.AddHandler(ItemCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemCommandEvent, value);
+ }
+ }
+
+ [WebCategory ("Behavior")]
+ [WebSysDescription ("Raised when an item gets created.")]
+ public event RepeaterItemEventHandler ItemCreated
+ {
+ add
+ {
+ Events.AddHandler(ItemCreatedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemCreatedEvent, value);
+ }
+ }
+
+ [WebCategory ("Behavior")]
+ [WebSysDescription ("Raised when an item gets data-bound.")]
+ public event RepeaterItemEventHandler ItemDataBound
+ {
+ add
+ {
+ Events.AddHandler(ItemDataBoundEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemDataBoundEvent, value);
+ }
+ }
+
+ [DefaultValue (null), Browsable (false), PersistenceMode (PersistenceMode.InnerProperty)]
+ [TemplateContainer (typeof (RepeaterItem))]
+ [WebSysDescription ("The template that is used to create an alternating item.")]
+ public virtual ITemplate AlternatingItemTemplate
+ {
+ get
+ {
+ return alternatingItemTemplate;
+ }
+ set
+ {
+ alternatingItemTemplate = value;
+ }
+ }
+
+ public override ControlCollection Controls
+ {
+ get
+ {
+ EnsureChildControls();
+ return base.Controls;
+ }
+ }
+
+ [DefaultValue (""), WebCategory ("Data")]
+ [WebSysDescription ("The name of the table that is used for binding when a DataSource is specified.")]
+ public virtual string DataMember
+ {
+ get
+ {
+ object o = ViewState["DataMember"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataMember"] = value;
+ }
+ }
+
+ [DefaultValue (null), Bindable (true), WebCategory ("Data")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The DataSource that is used for data-binding.")]
+ public virtual object DataSource
+ {
+ get
+ {
+ return dataSource;
+ }
+ set
+ {
+ if ((value!=null) && !(value is IListSource) && !(value is IEnumerable))
+ throw new ArgumentException ("An invalid data source is being used for " +
+ ID + ". A valid data source must implement either " +
+ "IListSource or IEnumerable.");
+
+ dataSource = value;
+ }
+ }
+
+ [DefaultValue (null), Browsable (false), PersistenceMode (PersistenceMode.InnerProperty)]
+ [TemplateContainer (typeof (RepeaterItem))]
+ [WebSysDescription ("The template that is used to create a footer.")]
+ public virtual ITemplate FooterTemplate
+ {
+ get
+ {
+ return footerTemplate;
+ }
+ set
+ {
+ footerTemplate = value;
+ }
+ }
+
+ [DefaultValue (null), Browsable (false), PersistenceMode (PersistenceMode.InnerProperty)]
+ [TemplateContainer (typeof (RepeaterItem))]
+ [WebSysDescription ("The template that is used to create a header.")]
+ public virtual ITemplate HeaderTemplate
+ {
+ get
+ {
+ return headerTemplate;
+ }
+ set
+ {
+ headerTemplate = value;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("A collection containing all items.")]
+ public virtual RepeaterItemCollection Items
+ {
+ get
+ {
+ if(items == null)
+ {
+ if(itemsArrayList == null)
+ {
+ EnsureChildControls();
+ }
+ items = new RepeaterItemCollection(itemsArrayList);
+ }
+ return items;
+ }
+ }
+
+ [DefaultValue (null), Browsable (false), PersistenceMode (PersistenceMode.InnerProperty)]
+ [TemplateContainer (typeof (RepeaterItem))]
+ [WebSysDescription ("The template that is used to create an item.")]
+ public virtual ITemplate ItemTemplate
+ {
+ get
+ {
+ return itemTemplate;
+ }
+ set
+ {
+ itemTemplate = value;
+ }
+ }
+
+ [DefaultValue (null), Browsable (false), PersistenceMode (PersistenceMode.InnerProperty)]
+ [TemplateContainer (typeof (RepeaterItem))]
+ [WebSysDescription ("The template that is used to create a seperator.")]
+ public virtual ITemplate SeparatorTemplate
+ {
+ get
+ {
+ return separatorTemplate;
+ }
+ set
+ {
+ separatorTemplate = value;
+ }
+ }
+
+ public override void DataBind ()
+ {
+ #if NET_2_0
+ RequiresDataBinding = false;
+ #endif
+ OnDataBinding (EventArgs.Empty);
+ }
+
+ protected override void CreateChildControls()
+ {
+ Controls.Clear ();
+ if (ViewState[ITEMCOUNT] != null) {
+ CreateControlHierarchy (false);
+ } else {
+ itemsArrayList = new ArrayList ();
+ ClearChildViewState ();
+ }
+ }
+
+ private RepeaterItem CreateItem (int itemIndex,
+ ListItemType itemType,
+ bool dataBind,
+ object dataItem)
+ {
+ RepeaterItem repeaterItem = new RepeaterItem (itemIndex, itemType);
+ RepeaterItemEventArgs repeaterEventArgs = new RepeaterItemEventArgs (repeaterItem);
+ InstantiateItem (repeaterItem);
+ if (dataBind)
+ repeaterItem.DataItem = dataItem;
+ OnItemCreated (repeaterEventArgs);
+ Controls.Add (repeaterItem);
+ if (dataBind) {
+ repeaterItem.DataBind ();
+ OnItemDataBound (repeaterEventArgs);
+ repeaterItem.DataItem = null;
+ }
+ return repeaterItem;
+ }
+
+ private void InstantiateItem (RepeaterItem item)
+ {
+ ITemplate template;
+ switch (item.ItemType) {
+ case ListItemType.Header:
+ template = this.headerTemplate;
+ break;
+ case ListItemType.Footer:
+ template = this.footerTemplate;
+ break;
+ case ListItemType.Item:
+ template = this.itemTemplate;
+ break;
+ case ListItemType.AlternatingItem:
+ template = (alternatingItemTemplate != null ? this.alternatingItemTemplate : itemTemplate);
+ break;
+ case ListItemType.Separator:
+ template = this.separatorTemplate;
+ break;
+ default:
+ throw new HttpException ("Unknown ListItemType: " + item.ItemType);
+ }
+
+ if (template != null)
+ template.InstantiateIn (item);
+ }
+
+ protected virtual void CreateControlHierarchy (bool useDataSource)
+ {
+ if (itemsArrayList != null) {
+ itemsArrayList.Clear ();
+ } else {
+ itemsArrayList = new ArrayList ();
+ }
+
+ IEnumerable ds = null;
+ if (useDataSource) {
+ ds = GetResolvedDataSource ();
+ } else {
+ int itemCount = (int) ViewState [ITEMCOUNT];
+ if (itemCount != -1)
+ ds = new DataSourceInternal (itemCount);
+ }
+
+ int index = 0;
+ if (ds != null) {
+ if (headerTemplate != null)
+ CreateItem (-1, ListItemType.Header, useDataSource, null);
+
+ bool even = true;
+ foreach (object item in ds){
+ if (separatorTemplate != null && index > 0)
+ CreateItem (index - 1, ListItemType.Separator,
+ useDataSource, null);
+
+ RepeaterItem repeaterItem;
+ ListItemType lType;
+ if (!even)
+ lType = ListItemType.AlternatingItem;
+ else
+ lType = ListItemType.Item;
+
+ repeaterItem = CreateItem (index, lType, useDataSource, item);
+ itemsArrayList.Add (repeaterItem);
+ index++;
+ even = !even;
+ }
+
+ if (footerTemplate != null)
+ CreateItem (-1, ListItemType.Footer, useDataSource, null);
+ }
+
+ if (useDataSource)
+ ViewState [ITEMCOUNT] = (ds == null) ? -1 : index;
+ }
+
+ protected override bool OnBubbleEvent(object sender, EventArgs e)
+ {
+ bool retVal = false;
+ if(e is RepeaterCommandEventArgs)
+ {
+ OnItemCommand((RepeaterCommandEventArgs)e);
+ retVal = true;
+ }
+ return retVal;
+ }
+
+ protected override void OnDataBinding(EventArgs e)
+ {
+ base.OnDataBinding(e);
+ Controls.Clear();
+ ClearChildViewState();
+ CreateControlHierarchy(true);
+ ChildControlsCreated = true;
+ }
+
+ protected virtual void OnItemCommand(RepeaterCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ RepeaterCommandEventHandler rceh = (RepeaterCommandEventHandler)
+ Events [ItemCommandEvent];
+ if(rceh != null)
+ {
+ rceh(this, e);
+ }
+ }
+ }
+
+ protected virtual void OnItemCreated(RepeaterItemEventArgs e)
+ {
+ if(Events != null)
+ {
+ RepeaterItemEventHandler rceh = (RepeaterItemEventHandler)
+ Events [ItemCreatedEvent];
+ if(rceh != null)
+ {
+ rceh(this, e);
+ }
+ }
+ }
+
+ protected virtual void OnItemDataBound(RepeaterItemEventArgs e)
+ {
+ if(Events != null)
+ {
+ RepeaterItemEventHandler rceh = (RepeaterItemEventHandler)
+ Events [ItemDataBoundEvent];
+ if(rceh != null)
+ {
+ rceh(this, e);
+ }
+ }
+ }
+
+ protected virtual RepeaterItem CreateItem (int itemIndex, ListItemType itemType)
+ {
+ return new RepeaterItem (itemIndex, itemType);
+ }
+
+ protected virtual void InitializeItem (RepeaterItem item)
+ {
+ InstantiateItem (item);
+ }
+
+ #if NET_2_0
+
+ protected override void OnInit (EventArgs e)
+ {
+ base.OnInit(e);
+ Page.PreLoad += new EventHandler (OnPagePreLoad);
+ }
+
+ void OnPagePreLoad (object sender, EventArgs e)
+ {
+ SubscribeSourceChangeEvent ();
+ inited = true;
+ }
+
+ void SubscribeSourceChangeEvent ()
+ {
+ IDataSource ds = GetDataSource ();
+
+ if (currentSource != ds) {
+ currentSource.DataSourceChanged -= new EventHandler (OnDataSourceViewChanged);
+ currentSource = ds;
+ }
+
+ if (ds != null)
+ ds.DataSourceChanged += new EventHandler (OnDataSourceViewChanged);
+ }
+
+ protected override void OnLoad (EventArgs e)
+ {
+ if (IsBoundUsingDataSourceID && (!Page.IsPostBack || !EnableViewState))
+ RequiresDataBinding = true;
+
+ base.OnLoad(e);
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ EnsureDataBound ();
+ base.OnPreRender (e);
+ }
+
+ protected bool IsBoundUsingDataSourceID {
+ get { return DataSourceID.Length > 0; }
+ }
+
+ protected void EnsureDataBound ()
+ {
+ if (RequiresDataBinding && IsBoundUsingDataSourceID)
+ DataBind ();
+ }
+
+ IDataSource GetDataSource ()
+ {
+ if (IsBoundUsingDataSourceID) {
+ Control ctrl = NamingContainer.FindControl (DataSourceID);
+ if (ctrl == null)
+ throw new HttpException (string.Format ("A control with ID '{0}' could not be found.", DataSourceID));
+ if (!(ctrl is IDataSource))
+ throw new HttpException (string.Format ("The control with ID '{0}' is not a control of type IDataSource.", DataSourceID));
+ return (IDataSource) ctrl;
+ }
+ return DataSource as IDataSource;
+ }
+
+ protected IEnumerable GetData ()
+ {
+ if (DataSource != null && IsBoundUsingDataSourceID)
+ throw new HttpException ("Control bound using both DataSourceID and DataSource properties.");
+
+ IDataSource ds = GetDataSource ();
+ if (ds != null)
+ return ds.GetView (DataMember).ExecuteSelect (SelectArguments);
+
+ IEnumerable ie = DataSourceHelper.GetResolvedDataSource (DataSource, DataMember);
+ if (ie != null) return ie;
+
+ throw new HttpException (string.Format ("Unexpected data source type: {0}", DataSource.GetType()));
+ }
+
+ protected virtual void OnDataSourceViewChanged (object sender, EventArgs e)
+ {
+ RequiresDataBinding = true;
+ }
+
+ protected virtual void OnDataPropertyChanged ()
+ {
+ RequiresDataBinding = true;
+ SubscribeSourceChangeEvent ();
+ }
+
+ [DefaultValueAttribute ("")]
+ [IDReferencePropertyAttribute (typeof(System.Web.UI.DataSourceControl))]
+ [ThemeableAttribute (false)]
+ public virtual string DataSourceID {
+ get {
+ object o = ViewState ["DataSourceID"];
+ if (o != null)
+ return (string)o;
+
+ return String.Empty;
+ }
+ set {
+ ViewState ["DataSourceID"] = value;
+ if (inited) OnDataPropertyChanged ();
+ }
+ }
+
+ protected bool Initialized {
+ get { return inited; }
+ }
+
+ protected bool RequiresDataBinding {
+ get { return requiresDataBinding; }
+ set { requiresDataBinding = value; }
+ }
+
+ protected virtual DataSourceSelectArguments CreateDataSourceSelectArguments ()
+ {
+ return DataSourceSelectArguments.Empty;
+ }
+
+ protected DataSourceSelectArguments SelectArguments {
+ get {
+ if (selectArguments == null)
+ selectArguments = CreateDataSourceSelectArguments ();
+ return selectArguments;
+ }
+ }
+
+ internal IEnumerable GetResolvedDataSource ()
+ {
+ return GetData ();
+ }
+
+ #else
+ IEnumerable GetResolvedDataSource ()
+ {
+ if (DataSource != null)
+ return DataSourceHelper.GetResolvedDataSource (DataSource, DataMember);
+ else
+ return null;
+ }
+ #endif
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventArgs.cs
new file mode 100644
index 00000000000..1a9e9793967
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventArgs.cs
@@ -0,0 +1,70 @@
+
+//
+// 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.
+//
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: RepeaterCommandEventArgs
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+#if !NET_2_0
+ sealed
+#endif
+ public class RepeaterCommandEventArgs: CommandEventArgs
+ {
+ private RepeaterItem rItem;
+ private object cmdSrc;
+
+ public RepeaterCommandEventArgs(RepeaterItem item, object commandSource, CommandEventArgs originalArgs): base(originalArgs)
+ {
+ rItem = item;
+ cmdSrc = commandSource;
+ }
+
+ public object CommandSource
+ {
+ get
+ {
+ return cmdSrc;
+ }
+ }
+
+ public RepeaterItem Item
+ {
+ get
+ {
+ return rItem;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventHandler.cs
new file mode 100644
index 00000000000..a4cf957a99f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventHandler.cs
@@ -0,0 +1,37 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void RepeaterCommandEventHandler(object sender, RepeaterCommandEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItem.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItem.cs
new file mode 100644
index 00000000000..b853f4840c1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItem.cs
@@ -0,0 +1,96 @@
+
+//
+// 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.
+//
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: RepeaterItem
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxItem(false)]
+ public class RepeaterItem: Control, INamingContainer
+#if NET_2_0
+ , IDataItemContainer
+#endif
+ {
+ private int itemIndex;
+ private ListItemType itemType;
+ private object dataItem;
+
+ public RepeaterItem(int itemIndex, ListItemType itemType)
+ {
+ this.itemIndex = itemIndex;
+ this.itemType = itemType;
+ }
+
+ public virtual object DataItem
+ {
+ get
+ {
+ return dataItem;
+ }
+ set
+ {
+ dataItem = value;
+ }
+ }
+
+ public virtual int ItemIndex
+ {
+ get
+ {
+ return itemIndex;
+ }
+ }
+
+ public virtual ListItemType ItemType
+ {
+ get
+ {
+ return itemType;
+ }
+ }
+
+ protected override bool OnBubbleEvent(object source, EventArgs e)
+ {
+ if(e is CommandEventArgs)
+ {
+ RepeaterCommandEventArgs rcea = new RepeaterCommandEventArgs(this, source, (CommandEventArgs)e);
+ RaiseBubbleEvent(source, rcea);
+ return true;
+ }
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemCollection.cs
new file mode 100644
index 00000000000..7c96b21a6ae
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemCollection.cs
@@ -0,0 +1,104 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RepeaterItemCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class RepeaterItemCollection : ICollection, IEnumerable
+ {
+ private ArrayList items;
+
+ public RepeaterItemCollection(ArrayList items)
+ {
+ this.items = items;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return items.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public RepeaterItem this[int index]
+ {
+ get
+ {
+ return (RepeaterItem)(items[index]);
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(RepeaterItem current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return items.GetEnumerator();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventArgs.cs
new file mode 100644
index 00000000000..8a0ac50d84d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventArgs.cs
@@ -0,0 +1,61 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RepeaterItemEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+#if !NET_2_0
+ sealed
+#endif
+ public class RepeaterItemEventArgs : EventArgs
+ {
+ private RepeaterItem item;
+
+ public RepeaterItemEventArgs(RepeaterItem item)
+ {
+ this.item = item;
+ }
+
+ public RepeaterItem Item
+ {
+ get
+ {
+ return item;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventHandler.cs
new file mode 100644
index 00000000000..61dfd4328ad
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventHandler.cs
@@ -0,0 +1,37 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void RepeaterItemEventHandler(object sender, RepeaterItemEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs
new file mode 100644
index 00000000000..107d5eb481a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs
@@ -0,0 +1,90 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RequiredFieldValidator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxData("<{0}:RequiredFieldValidator runat=\"server\" "
+ + "ErrorMessage=\"RequiredFieldValidator\">"
+ + "</{0}:RequiredFieldValidator>")]
+ public class RequiredFieldValidator : BaseValidator
+ {
+ public RequiredFieldValidator(): base()
+ {
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Behavior")]
+ [WebSysDescription ("The initial value for the required field.")]
+ public string InitialValue
+ {
+ get
+ {
+ object o = ViewState["InitialValue"];
+ if(o != null)
+ return (String)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["InitialValue"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(RenderUplevel)
+ {
+ writer.AddAttribute("evaluationfunction", "RequiredFieldValidatorEvaluateIsValid");
+ writer.AddAttribute("initialvalue", InitialValue);
+ }
+ }
+
+ protected override bool EvaluateIsValid()
+ {
+ string val = GetControlValidationValue(ControlToValidate);
+ if(val != null)
+ {
+ return (val.Trim() != InitialValue.Trim());
+ }
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ScrollBars.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ScrollBars.cs
new file mode 100644
index 00000000000..6c8200ce667
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ScrollBars.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.UI.WebControls.ScrollBars.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ [FlagsAttribute]
+ public enum ScrollBars {
+ None = 0,
+ Horizontal = 1,
+ Vertical = 2,
+ Both = 3,
+ Auto = 4
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SelectedDatesCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SelectedDatesCollection.cs
new file mode 100644
index 00000000000..f75af336bd0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SelectedDatesCollection.cs
@@ -0,0 +1,146 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: SelectedDatesCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class SelectedDatesCollection : ICollection, IEnumerable
+ {
+ ArrayList dateList;
+
+ public SelectedDatesCollection(ArrayList dateList)
+ {
+ this.dateList = dateList;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return dateList.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public DateTime this[int index]
+ {
+ get
+ {
+ return (DateTime)(dateList[index]);
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void Add(DateTime date)
+ {
+ dateList.Add(date);
+ }
+
+ public void Clear()
+ {
+ dateList.Clear();
+ }
+
+ public bool Contains(DateTime date)
+ {
+ return dateList.Contains(date);
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(DateTime current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return dateList.GetEnumerator();
+ }
+
+ public void Remove(DateTime date)
+ {
+ dateList.Remove(date);
+ }
+
+ public void SelectRange(DateTime fromDate, DateTime toDate)
+ {
+ dateList.Clear();
+ //FIXME: Probable bug in MS implementation. It SHOULD NOT
+ // clear the list if fromDate > toDate
+ if(fromDate > toDate)
+ {
+ return;
+ }
+ DateTime local = fromDate;
+ do
+ {
+ dateList.Add(local);
+ local = local.AddDays(1);
+ } while(local <= toDate);
+ }
+
+ internal ArrayList GetDateList ()
+ {
+ return dateList;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SendMailErrorEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SendMailErrorEventArgs.cs
new file mode 100644
index 00000000000..ff5f4dd6920
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SendMailErrorEventArgs.cs
@@ -0,0 +1,57 @@
+//
+// System.Web.UI.WebControls.SendMailErrorEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls
+{
+ public class SendMailErrorEventArgs : EventArgs
+ {
+ private Exception exception;
+ private bool exceptionHandled;
+
+ public SendMailErrorEventArgs (Exception e)
+ {
+ this.exception = e;
+ this.exceptionHandled = true;
+ }
+
+ public Exception Exception {
+ get { return exception; }
+ set { exception = value;}
+ }
+
+ public bool Handled {
+ get { return exceptionHandled; }
+ set { exceptionHandled = value; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SendMailErrorEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SendMailErrorEventHandler.cs
new file mode 100644
index 00000000000..7fca5d78290
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SendMailErrorEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebContrls.SendMailErrorEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void SendMailErrorEventHandler (object sender, SendMailErrorEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventArgs.cs
new file mode 100644
index 00000000000..260600527e8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventArgs.cs
@@ -0,0 +1,66 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ServerValidateEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+#if !NET_2_0
+ sealed
+#endif
+ public class ServerValidateEventArgs : EventArgs
+ {
+ private bool isValid;
+ private string value;
+
+ public ServerValidateEventArgs(string value, bool isValid)
+ {
+ this.value = value;
+ this.isValid = isValid;
+ }
+
+ public bool IsValid
+ {
+ get { return isValid; }
+ set { isValid = value; }
+ }
+
+ public string Value
+ {
+ get { return value; }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventHandler.cs
new file mode 100644
index 00000000000..cd265ba3a7c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventHandler.cs
@@ -0,0 +1,37 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void ServerValidateEventHandler(object sender, ServerValidateEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SessionParameter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SessionParameter.cs
new file mode 100644
index 00000000000..e56bfe1891f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SessionParameter.cs
@@ -0,0 +1,94 @@
+//
+// System.Web.UI.WebControls.SessionParameter
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+
+ [DefaultPropertyAttribute ("SessionField")]
+ public class SessionParameter : Parameter {
+
+ public SessionParameter () : base ()
+ {
+ }
+
+ protected SessionParameter (SessionParameter original) : base (original)
+ {
+ this.SessionField = original.SessionField;
+ }
+
+ public SessionParameter (string name, string sessionField) : base (name)
+ {
+ SessionField = sessionField;
+ }
+
+ public SessionParameter (string name, TypeCode type, string sessionField) : base (name, type)
+ {
+ SessionField = sessionField;
+ }
+
+ protected override Parameter Clone ()
+ {
+ return new SessionParameter (this);
+ }
+
+ protected override object Evaluate (HttpContext ctx, Control control)
+ {
+ if (control == null || ctx.Session == null)
+ return null;
+
+ return ctx.Session [SessionField];
+ }
+
+ [DefaultValueAttribute ("")]
+ [WebCategoryAttribute ("Parameter")]
+ public string SessionField {
+ get {
+ string s = ViewState ["SessionField"] as string;
+ if (s != null)
+ return s;
+
+ return "";
+ }
+ set {
+ if (SessionField != value) {
+ ViewState ["SessionField"] = value;
+ OnParameterChanged ();
+ }
+ }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapDataSource.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapDataSource.cs
new file mode 100644
index 00000000000..269cb62006e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapDataSource.cs
@@ -0,0 +1,79 @@
+//
+// System.Web.UI.WebControls.SiteMapDataSource.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [PersistChildrenAttribute (false)]
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.SiteMapDataSourceDesigner, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+ [ParseChildrenAttribute (true)]
+ public class SiteMapDataSource : HierarchicalDataSourceControl, IDataSource, IListSource
+ {
+ [MonoTODO]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public DataSourceView GetView (string viewName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ICollection GetViewNames ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IList GetList ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool ContainsListCollection {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public event EventHandler DataSourceChanged {
+ add { throw new NotImplementedException (); }
+ remove { throw new NotImplementedException (); }
+ }
+ }
+}
+
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapDataSourceView.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapDataSourceView.cs
new file mode 100644
index 00000000000..3d1cb531398
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapDataSourceView.cs
@@ -0,0 +1,68 @@
+//
+// System.Web.UI.WebControls.SiteMapDataSourceView
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2003 Ben Maurer
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls {
+ public class SiteMapDataSourceView : DataSourceView {
+ public SiteMapDataSourceView (SiteMapDataSource owner, string viewName, SiteMapNode node) : this (owner, viewName, new SiteMapNodeCollection (node)) {}
+ public SiteMapDataSourceView (SiteMapDataSource owner, string viewName, SiteMapNodeCollection collection)
+ {
+ this.collection = collection;
+ this.viewName = viewName;
+ this.owner = owner;
+ }
+
+ [MonoTODO]
+ public IEnumerable Select (DataSourceSelectArguments arguments)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override IEnumerable ExecuteSelect (
+ DataSourceSelectArguments arguments)
+ {
+ throw new NotImplementedException ();
+ }
+
+ SiteMapNodeCollection collection;
+ string viewName;
+ SiteMapDataSource owner;
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapHierarchicalDataSourceView.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapHierarchicalDataSourceView.cs
new file mode 100644
index 00000000000..8de1b8d982b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapHierarchicalDataSourceView.cs
@@ -0,0 +1,54 @@
+//
+// System.Web.UI.WebControls.SiteMapHierarchicalDataSourceView
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+
+namespace System.Web.UI.WebControls
+{
+ public class SiteMapHierarchicalDataSourceView : HierarchicalDataSourceView
+ {
+ public SiteMapHierarchicalDataSourceView (SiteMapNode node) : this (new SiteMapNodeCollection (node)) {}
+ public SiteMapHierarchicalDataSourceView (SiteMapNodeCollection collection)
+ {
+ this.collection = collection;
+ }
+
+ [MonoTODO]
+ public override IHierarchicalEnumerable Select ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ SiteMapNodeCollection collection;
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapNodeItemEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapNodeItemEventArgs.cs
new file mode 100644
index 00000000000..9a32f9d5bdd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapNodeItemEventArgs.cs
@@ -0,0 +1,49 @@
+//
+// System.Web.UI.WebControls.SiteMapNodeItemEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls
+{
+ public class SiteMapNodeItemEventArgs : EventArgs
+ {
+ private SiteMapNodeItem item;
+
+ public SiteMapNodeItemEventArgs (SiteMapNodeItem item)
+ {
+ this.item = item;
+ }
+
+ public SiteMapNodeItem Item {
+ get { return item; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapNodeItemEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapNodeItemEventHandler.cs
new file mode 100644
index 00000000000..64fd5615870
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapNodeItemEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.SiteMapNodeItemEventHandler.cs;
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void SiteMapNodeItemEventHandler (object sender, SiteMapNodeItemEventArgs e);
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapNodeItemType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapNodeItemType.cs
new file mode 100644
index 00000000000..ec03d258d26
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapNodeItemType.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.UI.WebControls.SiteMapNodeItemType.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum SiteMapNodeItemType {
+ Root = 0,
+ Parent = 1,
+ Current = 2,
+ PathSeparator = 3
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapNodeType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapNodeType.cs
new file mode 100644
index 00000000000..3b57029304a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapNodeType.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.SiteMapNodeType.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum SiteMapNodeType {
+ Root = 0,
+ Parent = 1,
+ Current = 2,
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapViewType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapViewType.cs
new file mode 100644
index 00000000000..b9c04a50fb2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SiteMapViewType.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.UI.WebControls.SiteMapViewType.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum SiteMapViewType {
+ Automatic = 0,
+ Flat = 1,
+ Path = 2,
+ Tree = 3
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SortDirection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SortDirection.cs
new file mode 100644
index 00000000000..c35f9c5c588
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SortDirection.cs
@@ -0,0 +1,35 @@
+//
+// System.Web.UI.WebControls.SortDirection.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum SortDirection {
+ Ascending = 1,
+ Descending = 2
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSource.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSource.cs
new file mode 100644
index 00000000000..e884d8e851a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSource.cs
@@ -0,0 +1,299 @@
+//
+// System.Web.UI.WebControls.SqlDataSource
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2003 Ben Maurer
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+
+ [ParseChildrenAttribute (true)]
+ [PersistChildrenAttribute (false)]
+ [DefaultPropertyAttribute ("SelectQuery")]
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.SqlDataSourceDesigner, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+ [DefaultEventAttribute ("Selecting")]
+ public class SqlDataSource : DataSourceControl {
+
+ public SqlDataSource ()
+ {
+ }
+
+ public SqlDataSource (string connectionString, string selectCommand)
+ {
+ ConnectionString = connectionString;
+ SelectCommand = selectCommand;
+ }
+
+ public SqlDataSource (string providerName, string connectionString, string selectCommand)
+ {
+ ProviderName = providerName;
+ ConnectionString = connectionString;
+ SelectCommand = selectCommand;
+ }
+
+ protected override DataSourceView GetView (string viewName)
+ {
+ if (viewName == "" || viewName == null)
+ return View;
+ else
+ throw new ArgumentException ("viewName");
+ }
+
+ protected virtual SqlDataSourceView CreateDataSourceView (string viewName)
+ {
+ SqlDataSourceView view = new SqlDataSourceView (this, viewName, this.Context);
+ view.DataSourceViewChanged += new EventHandler (ViewChanged);
+ if (IsTrackingViewState)
+ ((IStateManager) view).TrackViewState ();
+ return view;
+ }
+
+
+ protected override ICollection GetViewNames ()
+ {
+ return new string [] { "DefaultView" };
+ }
+
+ public int Insert ()
+ {
+ return View.Insert (null);
+ }
+
+ public int Delete ()
+ {
+ return View.Delete (null, null);
+ }
+
+ public IEnumerable Select (DataSourceSelectArguments args)
+ {
+ return View.Select (args);
+ }
+
+ public int Update ()
+ {
+ return View.Update (null, null, null);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ Pair p = savedState as Pair;
+ if (p != null) {
+ base.LoadViewState (p.First);
+ ((IStateManager) View).LoadViewState (p.Second);
+ }
+ }
+
+ protected override object SaveViewState ()
+ {
+ object me = base.SaveViewState (), view = ((IStateManager) View).SaveViewState ();
+ if (me != null || view != null)
+ return new Pair (me, view);
+ else
+ return null;
+ }
+
+ protected override void TrackViewState ()
+ {
+ base.TrackViewState ();
+ ((IStateManager) View).TrackViewState ();
+ }
+
+ //protected virtual DataSourceCache Cache { get; }
+ //public virtual int CacheDuration { get; set; }
+ //public virtual DataSourceCacheExpiry CacheExpirationPolicy { get; set; }
+ //public virtual string CacheKeyDependency { get; set; }
+ //public virtual string SqlCacheDependency { get; set; }
+ //public virtual bool EnableCaching { get; set; }
+
+ [DefaultValueAttribute ("")]
+// [TypeConverterAttribute (typeof (System.Web.UI.Design.WebControls.DataProviderNameConverter)]
+ public virtual string ProviderName {
+ get {
+ string val = ViewState ["ProviderName"] as string;
+ return val == null ? "System.Data.SqlClient" : val;
+ }
+ set { ViewState ["ProviderName"] = value; }
+ }
+
+
+ [EditorAttribute ("System.Web.UI.Design.ConnectionStringEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [DefaultValueAttribute ("")]
+ public virtual string ConnectionString {
+ get {
+ string val = ViewState ["ConnectionString"] as string;
+ return val == null ? "" : val;
+ }
+ set { ViewState ["ConnectionString"] = value; }
+ }
+
+ [DefaultValueAttribute (SqlDataSourceMode.DataSet)]
+ public SqlDataSourceMode DataSourceMode {
+ get {
+ object val = ViewState ["DataSourceMode"];
+ return val == null ? SqlDataSourceMode.DataSet : (SqlDataSourceMode) val;
+ }
+ set { ViewState ["DataSourceMode"] = value; }
+ }
+
+ [DefaultValueAttribute ("")]
+ public string DeleteCommand {
+ get { return View.DeleteCommand; }
+ set { View.DeleteCommand = value; }
+ }
+
+ [EditorAttribute ("System.Web.UI.Design.WebControls.ParameterCollectionEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [MergablePropertyAttribute (false)]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [DefaultValueAttribute (null)]
+ public ParameterCollection DeleteParameters {
+ get { return View.DeleteParameters; }
+ }
+
+ [DefaultValueAttribute (null)]
+ [EditorAttribute ("System.Web.UI.Design.WebControls.ParameterCollectionEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [MergablePropertyAttribute (false)]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ public ParameterCollection FilterParameters {
+ get { return View.FilterParameters; }
+ }
+
+ [DefaultValueAttribute ("")]
+ public string InsertCommand {
+ get { return View.InsertCommand; }
+ set { View.InsertCommand = value; }
+ }
+
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [DefaultValueAttribute (null)]
+ [MergablePropertyAttribute (false)]
+ [EditorAttribute ("System.Web.UI.Design.WebControls.ParameterCollectionEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public ParameterCollection InsertParameters {
+ get { return View.InsertParameters; }
+ }
+
+ [DefaultValueAttribute ("")]
+ public string SelectCommand {
+ get { return View.SelectCommand; }
+ set { View.SelectCommand = value; }
+ }
+
+ [DefaultValueAttribute (null)]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [MergablePropertyAttribute (false)]
+ [EditorAttribute ("System.Web.UI.Design.WebControls.ParameterCollectionEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public ParameterCollection SelectParameters {
+ get { return View.SelectParameters; }
+ }
+
+ [DefaultValueAttribute ("")]
+ public string UpdateCommand {
+ get { return View.UpdateCommand; }
+ set { View.UpdateCommand = value; }
+ }
+
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [EditorAttribute ("System.Web.UI.Design.WebControls.ParameterCollectionEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [MergablePropertyAttribute (false)]
+ [DefaultValueAttribute (null)]
+ public ParameterCollection UpdateParameters {
+ get { return View.UpdateParameters; }
+ }
+
+ [DefaultValueAttribute ("")]
+ public string FilterExpression {
+ get { return View.FilterExpression; }
+ set { View.FilterExpression = value; }
+ }
+
+ public event SqlDataSourceStatusEventHandler Deleted {
+ add { View.Deleted += value; }
+ remove { View.Deleted -= value; }
+ }
+
+ public event SqlDataSourceCommandEventHandler Deleting {
+ add { View.Deleting += value; }
+ remove { View.Deleting -= value; }
+ }
+
+ public event SqlDataSourceStatusEventHandler Inserted {
+ add { View.Inserted += value; }
+ remove { View.Inserted -= value; }
+ }
+
+ public event SqlDataSourceCommandEventHandler Inserting {
+ add { View.Inserting += value; }
+ remove { View.Inserting -= value; }
+ }
+
+ public event SqlDataSourceStatusEventHandler Selected {
+ add { View.Selected += value; }
+ remove { View.Selected -= value; }
+ }
+
+ public event SqlDataSourceCommandEventHandler Selecting {
+ add { View.Selecting += value; }
+ remove { View.Selecting -= value; }
+ }
+
+ public event SqlDataSourceStatusEventHandler Updated {
+ add { View.Updated += value; }
+ remove { View.Updated -= value; }
+ }
+
+ public event SqlDataSourceCommandEventHandler Updating {
+ add { View.Updating += value; }
+ remove { View.Updating -= value; }
+ }
+
+ SqlDataSourceView view;
+ SqlDataSourceView View {
+ get {
+ if (view == null) {
+ view = new SqlDataSourceView (this, "DefaultView", this.Context);
+ view.DataSourceViewChanged += new EventHandler (ViewChanged);
+ if (IsTrackingViewState)
+ ((IStateManager) view).TrackViewState ();
+ }
+ return view;
+ }
+ }
+
+ void ViewChanged (object source, EventArgs e)
+ {
+ OnDataSourceChanged (e);
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceCommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceCommandEventArgs.cs
new file mode 100644
index 00000000000..3ed61d2305e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceCommandEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.UI.WebControls.SqlDataSourceCommandEventArgs
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Data.Common;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+ public class SqlDataSourceCommandEventArgs : CancelEventArgs {
+
+ public SqlDataSourceCommandEventArgs (DbCommand command)
+ {
+ this.command = command;
+ }
+
+ DbCommand command;
+ public DbCommand Command {
+ get { return command; }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceCommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceCommandEventHandler.cs
new file mode 100644
index 00000000000..01ce64a683d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceCommandEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.SqlDataSourceCommandEventHandler
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void SqlDataSourceCommandEventHandler (object source, SqlDataSourceCommandEventArgs e);
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceMode.cs
new file mode 100644
index 00000000000..5e349491a53
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceMode.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.WebControls.SqlDataSourceMode
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.UI.WebControls {
+ public enum SqlDataSourceMode {
+ DataReader,
+ DataSet
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceSelectingEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceSelectingEventArgs.cs
new file mode 100644
index 00000000000..b4fba8b9204
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceSelectingEventArgs.cs
@@ -0,0 +1,55 @@
+//
+// System.Web.UI.WebControls.SqlDataSourceSelectinEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls {
+ public class SqlDataSourceSelectingEventArgs : SqlDataSourceCommandEventArgs {
+ DataSourceSelectArguments arguments;
+ bool executeSelect;
+
+ public SqlDataSourceSelectingEventArgs (IDbCommand command, DataSourceSelectArguments argument,
+ bool executeSelect) : base (command)
+ {
+ this.arguments = argument;
+ this.executeSelect = executeSelect;
+ }
+
+ public DataSourceSelectArguments Arguments {
+ get { return arguments; }
+ }
+
+ public bool ExecutingSelectCount {
+ get { return executeSelect; }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceSelectingEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceSelectingEventHandler.cs
new file mode 100644
index 00000000000..773a9d526a6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceSelectingEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.SqlDataSourceSelectingEventHandler
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void SqlDataSourceSelectingEventHandler (object source, SqlDataSourceSelectingEventArgs e);
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceStatusEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceStatusEventArgs.cs
new file mode 100644
index 00000000000..0d22709dd4f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceStatusEventArgs.cs
@@ -0,0 +1,73 @@
+//
+// System.Web.UI.WebControls.SqlDataSourceStatusEventArgs
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2003 Ben Maurer
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Data.Common;
+
+namespace System.Web.UI.WebControls {
+ public class SqlDataSourceStatusEventArgs : EventArgs {
+ public SqlDataSourceStatusEventArgs (DbCommand command, int rowsAffected, Exception exception)
+ {
+ this.command = command;
+ this.rowsAffected = rowsAffected;
+ this.exception = exception;
+ this.exceptionHandled = false;
+ }
+
+ DbCommand command;
+ Exception exception;
+ int rowsAffected;
+ bool exceptionHandled;
+
+ public DbCommand Command {
+ get { return command; }
+ }
+
+ public Exception Exception {
+ get { return exception; }
+ }
+
+ public int AffectedRows {
+ get { return rowsAffected; }
+ }
+
+ public bool ExceptionHandled {
+ get { return exceptionHandled; }
+ set { exceptionHandled = value; }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceStatusEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceStatusEventHandler.cs
new file mode 100644
index 00000000000..90ed1c2ac8a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceStatusEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.SqlDataSourceStatusEventHandler
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void SqlDataSourceStatusEventHandler (object source, SqlDataSourceStatusEventArgs e);
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceView.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceView.cs
new file mode 100644
index 00000000000..c65e1f69449
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceView.cs
@@ -0,0 +1,519 @@
+//
+// System.Web.UI.WebControls.SqlDataSourceView
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2003 Ben Maurer
+// (C) 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Data;
+using System.ComponentModel;
+using System.Data.SqlClient;
+
+namespace System.Web.UI.WebControls {
+ public class SqlDataSourceView : DataSourceView, IStateManager {
+
+ SqlCommand command;
+ SqlConnection connection;
+ HttpContext context;
+
+ public SqlDataSourceView (SqlDataSource owner, string name, HttpContext context)
+ {
+ this.owner = owner;
+ this.name = name;
+ this.context = context;
+ connection = new SqlConnection (owner.ConnectionString);
+ }
+
+ public int Delete (IDictionary keys, IDictionary oldValues)
+ {
+ return ExecuteDelete (keys, oldValues);
+ }
+
+ [MonoTODO ("Handle keys, oldValues, parameters and check for path for AccessDBFile")]
+ protected override int ExecuteDelete(IDictionary keys, IDictionary oldValues)
+ {
+ if (!CanDelete)
+ throw new NotSupportedException("Delete operation is not supported");
+ if (oldValues == null && conflictOptions == ConflictOptions.CompareAllValues)
+ throw new InvalidOperationException ("oldValues parameters should be specified when ConflictOptions is set to CompareAllValues");
+ command = new SqlCommand (this.DeleteCommand, connection);
+ SqlDataSourceCommandEventArgs cmdEventArgs = new SqlDataSourceCommandEventArgs (command);
+ OnDeleting (cmdEventArgs);
+ connection.Open ();
+ Exception exception = null;
+ int result = -1;;
+ try {
+ result = command.ExecuteNonQuery();
+ } catch (Exception e) {
+ exception = e;
+ }
+ SqlDataSourceStatusEventArgs statusEventArgs = new SqlDataSourceStatusEventArgs (command, result, exception);
+ OnDeleted (statusEventArgs);
+ if (exception != null)
+ throw exception;
+ return result;
+ }
+
+ public int Insert (IDictionary values)
+ {
+ return Insert (values);
+ }
+
+ [MonoTODO ("Handle values and parameters")]
+ protected override int ExecuteInsert (IDictionary values)
+ {
+ if (!CanInsert)
+ throw new NotSupportedException ("Insert operation is not supported");
+ command = new SqlCommand (this.InsertCommand, connection);
+ SqlDataSourceCommandEventArgs cmdEventArgs = new SqlDataSourceCommandEventArgs (command);
+ OnInserting (cmdEventArgs);
+ connection.Open();
+ Exception exception = null;
+ int result = -1;
+ try {
+ result = command.ExecuteNonQuery();
+ }catch (Exception e) {
+ exception = e;
+ }
+ SqlDataSourceStatusEventArgs statusEventArgs = new SqlDataSourceStatusEventArgs (command, result, exception);
+ OnInserted (statusEventArgs);
+ if (exception != null)
+ throw exception;
+ return result;
+ }
+
+ public IEnumerable Select (DataSourceSelectArguments arguments)
+ {
+
+ return ExecuteSelect (arguments);
+ }
+
+ [MonoTODO ("Handle arguments")]
+ protected internal override IEnumerable ExecuteSelect (
+ DataSourceSelectArguments arguments)
+ {
+ command = new SqlCommand (this.SelectCommand, connection);
+ SqlDataSourceCommandEventArgs cmdEventArgs = new SqlDataSourceCommandEventArgs (command);
+ OnSelecting (cmdEventArgs);
+ connection.Open ();
+ SqlDataReader reader = command.ExecuteReader ();
+
+ IEnumerable enums = null;
+ Exception exception = null;
+ try {
+ //enums = reader.GetEnumerator();
+ throw new NotImplementedException ("SqlDataReader doesnt implements GetEnumerator method yet");
+ } catch (Exception e) {
+ exception = e;
+ }
+ SqlDataSourceStatusEventArgs statusEventArgs =
+ new SqlDataSourceStatusEventArgs (command, reader.RecordsAffected, exception);
+ OnSelected (statusEventArgs);
+ if (exception !=null)
+ throw exception;
+ return enums;
+
+ }
+
+ public int Update(IDictionary keys, IDictionary values,
+ IDictionary oldValues)
+ {
+ return ExecuteUpdate (keys, values, oldValues);
+ }
+
+ [MonoTODO ("Handle keys, values and oldValues")]
+ protected override int ExecuteUpdate (IDictionary keys,
+ IDictionary values, IDictionary oldValues)
+ {
+ if (!CanUpdate)
+ throw new NotSupportedException ("Update operation is not supported");
+ if (oldValues == null && conflictOptions == ConflictOptions.CompareAllValues)
+ throw new InvalidOperationException ("oldValues parameters should be specified when ConflictOptions is set to CompareAllValues");
+ command = new SqlCommand(this.UpdateCommand, connection);
+ SqlDataSourceCommandEventArgs cmdEventArgs = new SqlDataSourceCommandEventArgs (command);
+ OnUpdating (cmdEventArgs);
+ connection.Open ();
+ Exception exception = null;
+ int result = -1;
+ try {
+ result = command.ExecuteNonQuery ();
+ }catch (Exception e) {
+ exception = e;
+ }
+ SqlDataSourceStatusEventArgs statusEventArgs = new SqlDataSourceStatusEventArgs (command, result, exception);
+ OnUpdated (statusEventArgs);
+ if (exception != null)
+ throw exception;
+ return result;
+ }
+
+ void IStateManager.LoadViewState (object savedState)
+ {
+ LoadViewState (savedState);
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ return SaveViewState ();
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ TrackViewState ();
+ }
+
+ protected virtual void LoadViewState (object savedState)
+ {
+ object [] vs = savedState as object [];
+ if (vs == null)
+ return;
+
+ if (vs [0] != null) ((IStateManager) deleteParameters).LoadViewState (vs [0]);
+ if (vs [1] != null) ((IStateManager) filterParameters).LoadViewState (vs [1]);
+ if (vs [2] != null) ((IStateManager) insertParameters).LoadViewState (vs [2]);
+ if (vs [3] != null) ((IStateManager) selectParameters).LoadViewState (vs [3]);
+ if (vs [4] != null) ((IStateManager) updateParameters).LoadViewState (vs [4]);
+ if (vs [5] != null) ((IStateManager) viewState).LoadViewState (vs [5]);
+ }
+
+ protected virtual object SaveViewState ()
+ {
+ object [] vs = new object [6];
+
+ if (deleteParameters != null) vs [0] = ((IStateManager) deleteParameters).SaveViewState ();
+ if (filterParameters != null) vs [1] = ((IStateManager) filterParameters).SaveViewState ();
+ if (insertParameters != null) vs [2] = ((IStateManager) insertParameters).SaveViewState ();
+ if (selectParameters != null) vs [3] = ((IStateManager) selectParameters).SaveViewState ();
+ if (updateParameters != null) vs [4] = ((IStateManager) updateParameters).SaveViewState ();
+ if (viewState != null) vs [5] = ((IStateManager) viewState).SaveViewState ();
+
+ foreach (object o in vs)
+ if (o != null) return vs;
+ return null;
+ }
+
+ protected virtual void TrackViewState ()
+ {
+ tracking = true;
+
+ if (deleteParameters != null) ((IStateManager) deleteParameters).TrackViewState ();
+ if (filterParameters != null) ((IStateManager) filterParameters).TrackViewState ();
+ if (insertParameters != null) ((IStateManager) insertParameters).TrackViewState ();
+ if (selectParameters != null) ((IStateManager) selectParameters).TrackViewState ();
+ if (updateParameters != null) ((IStateManager) updateParameters).TrackViewState ();
+ if (viewState != null) ((IStateManager) viewState).TrackViewState ();
+ }
+
+ protected bool IsTrackingViewState {
+ get { return tracking; }
+ }
+
+ bool IStateManager.IsTrackingViewState {
+ get { return IsTrackingViewState; }
+ }
+
+ public string DeleteCommand {
+ get {
+ string val = ViewState ["DeleteCommand"] as string;
+ return val == null ? "" : val;
+ }
+ set { ViewState ["DeleteCommand"] = value; }
+ }
+
+ public string FilterExpression {
+ get {
+ string val = ViewState ["FilterExpression"] as string;
+ return val == null ? "" : val;
+ }
+ set { ViewState ["FilterExpression"] = value; }
+ }
+
+ public string InsertCommand {
+ get {
+ string val = ViewState ["InsertCommand"] as string;
+ return val == null ? "" : val;
+ }
+ set { ViewState ["InsertCommand"] = value; }
+ }
+
+ public string SelectCommand {
+ get {
+ string val = ViewState ["SelectCommand"] as string;
+ return val == null ? "" : val;
+ }
+ set { ViewState ["SelectCommand"] = value; }
+ }
+
+ public string UpdateCommand {
+ get {
+ string val = ViewState ["UpdateCommand"] as string;
+ return val == null ? "" : val;
+ }
+ set { ViewState ["UpdateCommand"] = value; }
+ }
+
+ public string SortExpression {
+ get {
+ string val = ViewState ["SortExpression"] as string;
+ return val == null ? "" : val;
+ }
+ set { ViewState ["SortExpression"] = value; }
+ }
+
+ public override bool CanDelete {
+ get { return DeleteCommand != ""; }
+ }
+
+ public override bool CanInsert {
+ get { return UpdateCommand != ""; }
+ }
+
+ public override bool CanSort {
+ get { return owner.DataSourceMode == SqlDataSourceMode.DataSet; }
+ }
+
+ public override bool CanUpdate {
+ get { return UpdateCommand != ""; }
+ }
+
+ ConflictOptions conflictOptions = ConflictOptions.OverwriteChanges;
+ public ConflictOptions ConflictDetection {
+ get { return conflictOptions; }
+ set { conflictOptions = value; }
+ }
+
+ void ParametersChanged (object source, EventArgs args)
+ {
+ OnDataSourceViewChanged (EventArgs.Empty);
+ }
+
+ ParameterCollection GetParameterCollection (ref ParameterCollection output)
+ {
+ if (output != null)
+ return output;
+
+ output = new ParameterCollection ();
+ output.ParametersChanged += new EventHandler (ParametersChanged);
+
+ if (IsTrackingViewState)
+ ((IStateManager) output).TrackViewState ();
+
+ return output;
+ }
+
+ [DefaultValueAttribute (null)]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [EditorAttribute ("System.Web.UI.Design.WebControls.ParameterCollectionEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public ParameterCollection DeleteParameters {
+ get { return GetParameterCollection (ref deleteParameters); }
+ }
+
+ [EditorAttribute ("System.Web.UI.Design.WebControls.ParameterCollectionEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [DefaultValueAttribute (null)]
+ public ParameterCollection FilterParameters {
+ get { return GetParameterCollection (ref filterParameters); }
+ }
+
+ [EditorAttribute ("System.Web.UI.Design.WebControls.ParameterCollectionEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [DefaultValueAttribute (null)]
+ public ParameterCollection InsertParameters {
+ get { return GetParameterCollection (ref insertParameters); }
+ }
+
+ public ParameterCollection SelectParameters {
+ get { return GetParameterCollection (ref selectParameters); }
+ }
+
+ [EditorAttribute ("System.Web.UI.Design.WebControls.ParameterCollectionEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [DefaultValueAttribute (null)]
+ public ParameterCollection UpdateParameters {
+ get { return GetParameterCollection (ref updateParameters); }
+ }
+
+
+ public override string Name {
+ get { return name; }
+ }
+
+ protected virtual string ParameterPrefix {
+ get { return "@"; }
+ }
+
+ StateBag viewState;
+ protected StateBag ViewState {
+ get {
+ if (viewState != null)
+ return viewState;
+
+ viewState = new StateBag ();
+ if (IsTrackingViewState)
+ viewState.TrackViewState ();
+
+ return viewState;
+ }
+ }
+
+ ParameterCollection deleteParameters;
+ ParameterCollection filterParameters;
+ ParameterCollection insertParameters;
+ ParameterCollection selectParameters;
+ ParameterCollection updateParameters;
+
+ bool tracking;
+
+ string name;
+ SqlDataSource owner;
+
+ #region OnDelete
+ static readonly object EventDeleted = new object ();
+ protected virtual void OnDeleted (SqlDataSourceStatusEventArgs e)
+ {
+ if (!HasEvents ()) return;
+ SqlDataSourceStatusEventHandler h = Events [EventDeleted] as SqlDataSourceStatusEventHandler;
+ if (h != null)
+ h (this, e);
+ }
+
+ public event SqlDataSourceStatusEventHandler Deleted {
+ add { Events.AddHandler (EventDeleted, value); }
+ remove { Events.RemoveHandler (EventDeleted, value); }
+ }
+
+ static readonly object EventDeleting = new object ();
+ protected virtual void OnDeleting (SqlDataSourceCommandEventArgs e)
+ {
+ if (!HasEvents ()) return;
+ SqlDataSourceCommandEventHandler h = Events [EventDeleting] as SqlDataSourceCommandEventHandler;
+ if (h != null)
+ h (this, e);
+ }
+ public event SqlDataSourceCommandEventHandler Deleting {
+ add { Events.AddHandler (EventDeleting, value); }
+ remove { Events.RemoveHandler (EventDeleting, value); }
+ }
+ #endregion
+
+ #region OnInsert
+ static readonly object EventInserted = new object ();
+ protected virtual void OnInserted (SqlDataSourceStatusEventArgs e)
+ {
+ if (!HasEvents ()) return;
+ SqlDataSourceStatusEventHandler h = Events [EventInserted] as SqlDataSourceStatusEventHandler;
+ if (h != null)
+ h (this, e);
+ }
+
+ public event SqlDataSourceStatusEventHandler Inserted {
+ add { Events.AddHandler (EventInserted, value); }
+ remove { Events.RemoveHandler (EventInserted, value); }
+ }
+
+ static readonly object EventInserting = new object ();
+ protected virtual void OnInserting (SqlDataSourceCommandEventArgs e)
+ {
+ if (!HasEvents ()) return;
+ SqlDataSourceCommandEventHandler h = Events [EventInserting] as SqlDataSourceCommandEventHandler;
+ if (h != null)
+ h (this, e);
+ }
+ public event SqlDataSourceCommandEventHandler Inserting {
+ add { Events.AddHandler (EventInserting, value); }
+ remove { Events.RemoveHandler (EventInserting, value); }
+ }
+ #endregion
+
+ #region OnSelect
+ static readonly object EventSelected = new object ();
+ protected virtual void OnSelected (SqlDataSourceStatusEventArgs e)
+ {
+ if (!HasEvents ()) return;
+ SqlDataSourceStatusEventHandler h = Events [EventSelected] as SqlDataSourceStatusEventHandler;
+ if (h != null)
+ h (this, e);
+ }
+
+ public event SqlDataSourceStatusEventHandler Selected {
+ add { Events.AddHandler (EventSelected, value); }
+ remove { Events.RemoveHandler (EventSelected, value); }
+ }
+
+ static readonly object EventSelecting = new object ();
+ protected virtual void OnSelecting (SqlDataSourceCommandEventArgs e)
+ {
+ if (!HasEvents ()) return;
+ SqlDataSourceCommandEventHandler h = Events [EventSelecting] as SqlDataSourceCommandEventHandler;
+ if (h != null)
+ h (this, e);
+ }
+ public event SqlDataSourceCommandEventHandler Selecting {
+ add { Events.AddHandler (EventSelecting, value); }
+ remove { Events.RemoveHandler (EventSelecting, value); }
+ }
+ #endregion
+
+ #region OnUpdate
+ static readonly object EventUpdated = new object ();
+ protected virtual void OnUpdated (SqlDataSourceStatusEventArgs e)
+ {
+ if (!HasEvents ()) return;
+ SqlDataSourceStatusEventHandler h = Events [EventUpdated] as SqlDataSourceStatusEventHandler;
+ if (h != null)
+ h (this, e);
+ }
+
+ public event SqlDataSourceStatusEventHandler Updated {
+ add { Events.AddHandler (EventUpdated, value); }
+ remove { Events.RemoveHandler (EventUpdated, value); }
+ }
+
+ static readonly object EventUpdating = new object ();
+ protected virtual void OnUpdating (SqlDataSourceCommandEventArgs e)
+ {
+ if (!HasEvents ()) return;
+ SqlDataSourceCommandEventHandler h = Events [EventUpdating] as SqlDataSourceCommandEventHandler;
+ if (h != null)
+ h (this, e);
+ }
+ public event SqlDataSourceCommandEventHandler Updating {
+ add { Events.AddHandler (EventUpdating, value); }
+ remove { Events.RemoveHandler (EventUpdating, value); }
+ }
+ #endregion
+
+ }
+
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/StringArrayConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/StringArrayConverter.cs
new file mode 100644
index 00000000000..c38dea60cf2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/StringArrayConverter.cs
@@ -0,0 +1,63 @@
+//
+// System.Web.UI.WebControls.StringArrayConverter.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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;
+using System.Globalization;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class StringArrayConverter : TypeConverter
+ {
+ public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+ {
+ if(sourceType == typeof(string))
+ return true;
+ return base.CanConvertFrom (context, sourceType);
+ }
+
+ public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ if (value == null)
+ return null;
+
+ if (value is string)
+ return ((string)value).Split (',');
+
+ return base.ConvertFrom (context, culture, value);
+ }
+
+ public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ if (value is string[] && destinationType == typeof (string))
+ return string.Join (",", ((string[])value));
+
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs
new file mode 100644
index 00000000000..e14dc26e907
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs
@@ -0,0 +1,608 @@
+//
+// System.Web.UI.WebControls.Style.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Text;
+using System.Collections;
+using System.Drawing;
+using System.Globalization;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxItem(false)]
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public class Style : Component , IStateManager
+ {
+ internal static int MARKED = (0x01 << 0);
+ internal static int BACKCOLOR = (0x01 << 1);
+ internal static int BORDERCOLOR = (0x01 << 2);
+ internal static int BORDERSTYLE = (0x01 << 3);
+ internal static int BORDERWIDTH = (0x01 << 4);
+ internal static int CSSCLASS = (0x01 << 5);
+ internal static int FORECOLOR = (0x01 << 6);
+ internal static int HEIGHT = (0x01 << 7);
+ internal static int WIDTH = (0x01 << 8);
+ internal static int FONT_BOLD = (0x01 << 9);
+ internal static int FONT_ITALIC = (0x01 << 10);
+ internal static int FONT_NAMES = (0x01 << 11);
+ internal static int FONT_SIZE = (0x01 << 12);
+ internal static int FONT_STRIKE = (0x01 << 13);
+ internal static int FONT_OLINE = (0x01 << 14);
+ internal static int FONT_ULINE = (0x01 << 15);
+
+ internal static string selectionBitString = "_SBS";
+
+ StateBag viewState;
+ int selectionBits;
+ bool selfStateBag;
+ bool marked;
+
+#if NET_2_0
+ string regClass;
+#endif
+
+ private FontInfo font;
+
+ public Style ()
+ {
+ Initialize(null);
+ selfStateBag = true;
+ }
+
+ public Style (StateBag bag)
+ {
+ Initialize (bag);
+ selfStateBag = false;
+ }
+
+ private void Initialize (StateBag bag)
+ {
+ viewState = bag;
+ selectionBits = 0x00;
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ protected internal StateBag ViewState {
+ get {
+ if (viewState == null) {
+ viewState = new StateBag (false);
+ if (IsTrackingViewState)
+ viewState.TrackViewState ();
+ }
+ return viewState;
+ }
+ }
+
+ internal bool IsSet (int bit)
+ {
+ return ((selectionBits & bit) != 0x00);
+ }
+
+ internal virtual void Set (int bit)
+ {
+ selectionBits |= bit;
+ if (IsTrackingViewState)
+ selectionBits |= MARKED;
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [NotifyParentProperty (true)]
+ [DefaultValue (null), WebCategory ("Appearance")]
+ [TypeConverter (typeof (WebColorConverter))]
+ [WebSysDescription ("The background color for the WebControl.")]
+ public Color BackColor {
+ get {
+ if(IsSet(BACKCOLOR))
+ return (Color)ViewState["BackColor"];
+ return Color.Empty;
+ }
+ set {
+ ViewState["BackColor"] = value;
+ Set(BACKCOLOR);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [NotifyParentProperty (true)]
+ [DefaultValue (null), WebCategory ("Appearance")]
+ [TypeConverter (typeof (WebColorConverter))]
+ [WebSysDescription ("The border color for the WebControl.")]
+ public Color BorderColor {
+ get {
+ if (IsSet (BORDERCOLOR))
+ return (Color) ViewState ["BorderColor"];
+ return Color.Empty;
+ }
+ set {
+ ViewState ["BorderColor"] = value;
+ Set (BORDERCOLOR);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [NotifyParentProperty (true)]
+ [DefaultValue (typeof(BorderStyle), "NotSet"), WebCategory ("Appearance")]
+ [WebSysDescription ("The style/type of the border used for the WebControl.")]
+ public BorderStyle BorderStyle {
+ get {
+ if (IsSet (BORDERSTYLE))
+ return (BorderStyle) ViewState ["BorderStyle"];
+ return BorderStyle.NotSet;
+ }
+ set {
+ ViewState ["BorderStyle"] = value;
+ Set (BORDERSTYLE);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [NotifyParentProperty (true)]
+ [DefaultValue (null), WebCategory ("Appearance")]
+ [WebSysDescription ("The width of the border used for the WebControl.")]
+ public Unit BorderWidth {
+ get {
+ if (IsSet (BORDERWIDTH))
+ return (Unit) ViewState ["BorderWidth"];
+ return Unit.Empty;
+ }
+ set {
+ ViewState ["BorderWidth"] = value;
+ Set (BORDERWIDTH);
+ }
+ }
+
+ [NotifyParentProperty (true)]
+ [DefaultValue (""), WebCategory ("Appearance")]
+ [WebSysDescription ("The cascading stylesheet class that is associated with this WebControl.")]
+ public string CssClass {
+ get {
+ if (IsSet (CSSCLASS))
+ return (string) ViewState["CssClass"];
+ return string.Empty;
+ }
+ set {
+ ViewState ["CssClass"] = value;
+ Set (CSSCLASS);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [NotifyParentProperty (true)]
+ [DefaultValue (null), WebCategory ("Appearance")]
+ [TypeConverter (typeof (WebColorConverter))]
+ [WebSysDescription ("The color that is used to paint the primary display of the WebControl.")]
+ public Color ForeColor {
+ get {
+ if (IsSet (FORECOLOR))
+ return (Color) ViewState ["ForeColor"];
+ return Color.Empty;
+ }
+ set {
+ ViewState ["ForeColor"] = value;
+ Set (FORECOLOR);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [NotifyParentProperty (true)]
+ [DefaultValue (null), WebCategory ("Layout")]
+ [WebSysDescription ("The height of this WebControl.")]
+ public Unit Height {
+ get {
+ if (IsSet (HEIGHT))
+ return (Unit) ViewState ["Height"];
+ return Unit.Empty;
+ }
+ set {
+ ViewState ["Height"] = value;
+ Set (HEIGHT);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [NotifyParentProperty (true)]
+ [DefaultValue (null), WebCategory ("Layout")]
+ [WebSysDescription ("The width of this WebControl.")]
+ public Unit Width {
+ get {
+ if (IsSet(WIDTH))
+ return (Unit) ViewState ["Width"];
+ return Unit.Empty;
+ }
+ set {
+ ViewState ["Width"] = value;
+ Set (WIDTH);
+ }
+ }
+
+ [NotifyParentProperty (true)]
+ [WebCategory ("Appearance")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [WebSysDescription ("The font of this WebControl.")]
+ public FontInfo Font {
+ get {
+ if (font==null)
+ font = new FontInfo (this);
+ return font;
+ }
+ }
+
+ protected internal virtual bool IsEmpty
+ {
+ get { return (selectionBits == 0); }
+ }
+
+ private void AddColor (CssStyleCollection attributes, HtmlTextWriterStyle style, Color color)
+ {
+ if (!color.IsEmpty)
+ attributes.Add (style, ColorTranslator.ToHtml (color));
+ }
+
+ private static string StringArrayToString (string [] array, char separator)
+ {
+ if (array.Length == 0)
+ return String.Empty;
+ StringBuilder sb = new StringBuilder ();
+ for (int i = 0; i < array.Length; i++) {
+ if (i == 0) {
+ sb.Append (array [0]);
+ } else {
+ sb.Append (separator);
+ sb.Append (array [i]);
+ }
+ }
+ return sb.ToString ();
+ }
+
+ public void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ AddAttributesToRender (writer, null);
+ }
+
+ public virtual void AddAttributesToRender (HtmlTextWriter writer, WebControl owner)
+ {
+ if (IsSet (CSSCLASS)) {
+ string cssClass = (string) ViewState ["CssClass"];
+ if (cssClass.Length > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Class, cssClass);
+ }
+
+ CssStyleCollection ats = new CssStyleCollection ();
+#if NET_2_0
+ FillStyleAttributes (ats, owner);
+#else
+ FillAttributes (ats);
+#endif
+ foreach (string key in ats.Keys)
+ writer.AddStyleAttribute (key, ats [key]);
+ }
+
+#if NET_2_0
+ public CssStyleCollection GetStyleAttributes (IUrlResolutionService urlResolver)
+ {
+ CssStyleCollection ats = new CssStyleCollection ();
+ FillStyleAttributes (ats, urlResolver);
+ return ats;
+ }
+ protected virtual void FillStyleAttributes (CssStyleCollection attributes, IUrlResolutionService urlResolver)
+ {
+ FillAttributes (attributes);
+ }
+#endif
+
+ void FillAttributes (CssStyleCollection attributes)
+ {
+ if (IsSet (BACKCOLOR))
+ AddColor (attributes, HtmlTextWriterStyle.BackgroundColor, BackColor);
+
+ if (IsSet(BORDERCOLOR))
+ AddColor (attributes, HtmlTextWriterStyle.BorderColor, BorderColor);
+
+ if (IsSet (FORECOLOR))
+ AddColor (attributes, HtmlTextWriterStyle.Color, ForeColor);
+
+ if (!BorderWidth.IsEmpty) {
+ attributes.Add (HtmlTextWriterStyle.BorderWidth,
+ BorderWidth.ToString (CultureInfo.InvariantCulture));
+
+ if (BorderStyle != BorderStyle.NotSet) {
+ attributes.Add (HtmlTextWriterStyle.BorderStyle,
+ Enum.Format (typeof (BorderStyle), BorderStyle, "G"));
+ } else {
+ if (BorderWidth.Value != 0.0)
+ attributes.Add (HtmlTextWriterStyle.BorderStyle, "solid");
+ }
+ } else {
+ if (BorderStyle != BorderStyle.NotSet)
+ attributes.Add (HtmlTextWriterStyle.BorderStyle,
+ Enum.Format (typeof (BorderStyle), BorderStyle, "G"));
+ }
+
+ if (Font.Names.Length > 0)
+ attributes.Add (HtmlTextWriterStyle.FontFamily,
+ StringArrayToString (Font.Names, ','));
+
+ if (!Font.Size.IsEmpty)
+ attributes.Add (HtmlTextWriterStyle.FontSize,
+ Font.Size.ToString (CultureInfo.InvariantCulture));
+
+ if (Font.Bold)
+ attributes.Add (HtmlTextWriterStyle.FontWeight, "bold");
+
+ if (Font.Italic)
+ attributes.Add (HtmlTextWriterStyle.FontStyle, "italic");
+
+ string textDecoration = String.Empty;
+ if (Font.Strikeout)
+ textDecoration += " line-through";
+
+ if (Font.Underline)
+ textDecoration += " underline";
+
+ if (Font.Overline)
+ textDecoration += " overline";
+
+ if (textDecoration.Length > 0)
+ attributes.Add (HtmlTextWriterStyle.TextDecoration, textDecoration);
+
+ Unit u = Unit.Empty;
+ if (IsSet (HEIGHT)) {
+ u = (Unit) ViewState ["Height"];
+ if (!u.IsEmpty)
+ attributes.Add (HtmlTextWriterStyle.Height,
+ u.ToString (CultureInfo.InvariantCulture));
+ }
+
+ if (IsSet (WIDTH)) {
+ u = (Unit) ViewState ["Width"];
+ if (!u.IsEmpty)
+ attributes.Add (HtmlTextWriterStyle.Width,
+ u.ToString (CultureInfo.InvariantCulture));
+ }
+ }
+
+ public virtual void CopyFrom (Style source)
+ {
+ if (source == null || source.IsEmpty)
+ return;
+
+ Font.CopyFrom (source.Font);
+ if (source.IsSet (HEIGHT)&& (source.Height != Unit.Empty))
+ Height = source.Height;
+
+ if (source.IsSet (WIDTH)&& (source.Width != Unit.Empty))
+ Width = source.Width;
+
+ if (source.IsSet (BORDERCOLOR)&& (source.BorderColor != Color.Empty))
+ BorderColor = source.BorderColor;
+
+ if (source.IsSet (BORDERWIDTH)&& (source.BorderWidth != Unit.Empty))
+ BorderWidth = source.BorderWidth;
+
+ if (source.IsSet (BORDERSTYLE))
+ BorderStyle = source.BorderStyle;
+
+ if (source.IsSet (BACKCOLOR)&& (source.BackColor != Color.Empty))
+ BackColor = source.BackColor;
+
+ if (source.IsSet (CSSCLASS))
+ CssClass = source.CssClass;
+
+ if (source.IsSet (FORECOLOR)&& (source.ForeColor != Color.Empty))
+ ForeColor = source.ForeColor;
+
+ }
+
+ public virtual void MergeWith (Style with)
+ {
+ if (with == null || with.IsEmpty)
+ return;
+
+ if (IsEmpty) {
+ CopyFrom (with);
+ return;
+ }
+
+ Font.MergeWith (with.Font);
+ if (!IsSet (HEIGHT) && with.Height != Unit.Empty)
+ Height = with.Height;
+
+ if (!IsSet(WIDTH) && with.Width != Unit.Empty)
+ Width = with.Width;
+
+ if (!IsSet (BORDERCOLOR) && with.BorderColor != Color.Empty)
+ BorderColor = with.BorderColor;
+
+ if (!IsSet (BORDERWIDTH) && with.BorderWidth != Unit.Empty)
+ BorderWidth = with.BorderWidth;
+
+ if (!IsSet (BORDERSTYLE) && with.BorderStyle != BorderStyle.NotSet)
+ BorderStyle = with.BorderStyle;
+
+ if (!IsSet (BACKCOLOR) && with.BackColor != Color.Empty)
+ BackColor = with.BackColor;
+
+ if (!IsSet (CSSCLASS) && with.CssClass != String.Empty)
+ CssClass = with.CssClass;
+
+ if (!IsSet (FORECOLOR) && with.ForeColor != Color.Empty)
+ ForeColor = with.ForeColor;
+ }
+
+ public virtual void Reset ()
+ {
+ if (IsSet (BACKCOLOR))
+ ViewState.Remove ("BackColor");
+
+ if (IsSet (BORDERCOLOR))
+ ViewState.Remove ("BorderColor");
+
+ if (IsSet (BORDERSTYLE))
+ ViewState.Remove ("BorderStyle");
+
+ if (IsSet (BORDERWIDTH))
+ ViewState.Remove ("BorderWidth");
+
+ if (IsSet (CSSCLASS))
+ ViewState.Remove ("CssClass");
+
+ if (IsSet (FORECOLOR))
+ ViewState.Remove ("ForeColor");
+
+ if (IsSet (HEIGHT))
+ ViewState.Remove ("Height");
+
+ if (IsSet (WIDTH))
+ ViewState.Remove( "Width");
+
+ if (font != null)
+ font.Reset ();
+
+ selectionBits = 0x00;
+ }
+
+ protected bool IsTrackingViewState {
+ get { return marked; }
+ }
+
+ protected internal virtual void TrackViewState ()
+ {
+ if (selfStateBag)
+ ViewState.TrackViewState ();
+
+ marked = true;
+ }
+
+ protected internal virtual object SaveViewState ()
+ {
+ if (viewState != null) {
+ if (marked && IsSet (MARKED))
+ ViewState [selectionBitString] = selectionBits;
+
+ if (selfStateBag)
+ return ViewState.SaveViewState ();
+ }
+
+ return null;
+ }
+
+ protected internal void LoadViewState (object state)
+ {
+ if (state != null && selfStateBag)
+ ViewState.LoadViewState (state);
+
+ if (viewState != null) {
+ object o = ViewState [selectionBitString];
+ if (o != null)
+ selectionBits = (int) o;
+ }
+ }
+
+ void IStateManager.LoadViewState(object state)
+ {
+ LoadViewState(state);
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ return SaveViewState ();
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ TrackViewState ();
+ }
+
+ bool IStateManager.IsTrackingViewState {
+ get { return IsTrackingViewState; }
+ }
+
+#if !NET_2_0
+ public override string ToString ()
+ {
+ return String.Empty;
+ }
+#endif
+
+ protected internal void SetBit (int bit)
+ {
+ Set (bit);
+ }
+
+ internal virtual void CopyTextStylesFrom (Style source)
+ {
+ if (source.IsSet (FORECOLOR)&& (source.ForeColor != Color.Empty))
+ ForeColor = source.ForeColor;
+ }
+
+#if NET_2_0
+ public void SetDirty ()
+ {
+ if (selectionBits != 0x00)
+ Set (MARKED);
+ if (viewState != null)
+ viewState.SetDirty ();
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ [EditorBrowsableAttribute (EditorBrowsableState.Advanced)]
+ public string RegisteredCssClass {
+ get { return regClass; }
+ }
+
+ internal void SetRegisteredCssClass (string name)
+ {
+ regClass = name;
+ }
+#endif
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SubMenuStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SubMenuStyle.cs
new file mode 100644
index 00000000000..bc579830982
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SubMenuStyle.cs
@@ -0,0 +1,139 @@
+//
+// System.Web.UI.WebControls.SubMenuStyle.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class SubMenuStyle: Style
+ {
+ private static int HORZ_PADD = (0x01 << 16);
+ private static int VERT_PADD = (0x01 << 17);
+
+ [DefaultValue (0)]
+ [NotifyParentProperty (true)]
+ public int HorizontalPadding {
+ get {
+ if(IsSet(HORZ_PADD))
+ return (int)(ViewState["HorizontalPadding"]);
+ return 0;
+ }
+ set {
+ ViewState["HorizontalPadding"] = value;
+ Set(HORZ_PADD);
+ }
+ }
+
+ [DefaultValue (0)]
+ [NotifyParentProperty (true)]
+ public int VerticalPadding {
+ get {
+ if(IsSet(VERT_PADD))
+ return (int)(ViewState["VerticalPadding"]);
+ return 0;
+ }
+ set {
+ ViewState["VerticalPadding"] = value;
+ Set(VERT_PADD);
+ }
+ }
+
+ protected internal override bool IsEmpty {
+ get { return base.IsEmpty; }
+ }
+
+ public override void CopyFrom (Style s)
+ {
+ if (s == null || s.IsEmpty)
+ return;
+
+ base.CopyFrom (s);
+ SubMenuStyle from = s as SubMenuStyle;
+ if (from == null)
+ return;
+
+ if (from.IsSet (HORZ_PADD))
+ HorizontalPadding = from.HorizontalPadding;
+
+ if (from.IsSet (VERT_PADD))
+ VerticalPadding = from.VerticalPadding;
+ }
+
+ public override void MergeWith(Style s)
+ {
+ if(s != null && !s.IsEmpty)
+ {
+ if (IsEmpty) {
+ CopyFrom (s);
+ return;
+ }
+ base.MergeWith(s);
+
+ SubMenuStyle with = s as SubMenuStyle;
+ if (with == null) return;
+
+ if (with.IsSet(HORZ_PADD) && !IsSet(HORZ_PADD)) {
+ HorizontalPadding = with.HorizontalPadding;
+ }
+ if (with.IsSet(VERT_PADD) && !IsSet(VERT_PADD)) {
+ VerticalPadding = with.VerticalPadding;
+ }
+ }
+ }
+
+ public override void Reset()
+ {
+ if(IsSet(HORZ_PADD))
+ ViewState.Remove("HorizontalPadding");
+ if(IsSet(VERT_PADD))
+ ViewState.Remove("VerticalPadding");
+ base.Reset();
+ }
+
+ protected override void FillStyleAttributes (CssStyleCollection attributes, IUrlResolutionService urlResolver)
+ {
+ base.FillStyleAttributes (attributes, urlResolver);
+ if (IsSet (HORZ_PADD)) {
+ attributes.Add (HtmlTextWriterStyle.PaddingLeft, HorizontalPadding.ToString () + "px");
+ attributes.Add (HtmlTextWriterStyle.PaddingRight, HorizontalPadding.ToString () + "px");
+ }
+ if (IsSet (VERT_PADD)) {
+ attributes.Add (HtmlTextWriterStyle.PaddingTop, VerticalPadding.ToString () + "px");
+ attributes.Add (HtmlTextWriterStyle.PaddingBottom, VerticalPadding.ToString () + "px");
+ }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Table.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Table.cs
new file mode 100644
index 00000000000..1c97e4ccba9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Table.cs
@@ -0,0 +1,250 @@
+//
+// System.Web.UI.WebControls.Table.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Drawing;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("Rows")]
+ [Designer ("System.Web.UI.Design.WebControls.TableDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ [ParseChildren(true, "Rows")]
+ public class Table: WebControl
+ {
+ private TableRowCollection rows;
+
+ private class TableRowControlCollection : ControlCollection
+ {
+ public TableRowControlCollection (Control owner) : base (owner)
+ {
+ }
+
+ public override void Add (Control child)
+ {
+ if (!(child is TableRow))
+ throw new ArgumentException (HttpRuntime.FormatResourceString (
+ "Cannot_Have_Children_Of_Type",
+ "Table",
+ child.GetType ().Name.ToString ()));
+ base.Add (child);
+ }
+
+ public override void AddAt(int index, Control child)
+ {
+ if (!(child is TableRow))
+ throw new ArgumentException (HttpRuntime.FormatResourceString (
+ "Cannot_Have_Children_Of_Type",
+ "Table",
+ child.GetType ().Name.ToString ()));
+ base.AddAt (index, child);
+ }
+ }
+
+ public Table () : base (HtmlTextWriterTag.Table)
+ {
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#else
+ [UrlProperty]
+#endif
+ [DefaultValue (""), WebCategory ("Appearance")]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [WebSysDescription ("An Url specifying the background image for the table.")]
+ public virtual string BackImageUrl
+ {
+ get {
+ if (ControlStyleCreated)
+ return ((TableStyle) ControlStyle).BackImageUrl;
+ return String.Empty;
+ }
+
+ set { ((TableStyle) ControlStyle).BackImageUrl = value; }
+ }
+
+#if NET_2_0
+ [DefaultValue (""), WebCategory ("Accessibility"), Localizable (true)]
+ public virtual string Caption
+ {
+ get {
+ object o = ViewState ["Caption"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["Caption"] = value;
+ }
+ }
+
+ [DefaultValue (TableCaptionAlign.NotSet), WebCategory ("Accessibility")]
+ public virtual TableCaptionAlign CaptionAlign
+ {
+ get {
+ object o = ViewState ["CaptionAlign"];
+ if(o != null) return (TableCaptionAlign) o;
+ return TableCaptionAlign.NotSet;
+ }
+ set {
+ ViewState ["CaptionAlign"] = value;
+ }
+ }
+#endif
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (-1), WebCategory ("Appearance")]
+ [WebSysDescription ("The space left around the borders within a cell.")]
+ public virtual int CellPadding
+ {
+ get {
+ if (ControlStyleCreated)
+ return ((TableStyle) ControlStyle).CellPadding;
+ return -1;
+ }
+
+ set { ((TableStyle) ControlStyle).CellPadding = value; }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (-1), WebCategory ("Appearance")]
+ [WebSysDescription ("The space left between cells.")]
+ public virtual int CellSpacing
+ {
+ get {
+ if (ControlStyleCreated)
+ return ((TableStyle) ControlStyle).CellSpacing;
+ return -1;
+ }
+
+ set { ((TableStyle) ControlStyle).CellSpacing = value; }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (GridLines), "None"), WebCategory ("Appearance")]
+ [WebSysDescription ("The type of grid that a table uses.")]
+ public virtual GridLines GridLines
+ {
+ get {
+ if (ControlStyleCreated)
+ return ((TableStyle) ControlStyle).GridLines;
+ return GridLines.None;
+ }
+
+ set { ((TableStyle) ControlStyle).GridLines = value; }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (HorizontalAlign), "NotSet"), WebCategory ("Layout")]
+ [WebSysDescription ("The horizonal alignment of the table.")]
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get {
+ if (ControlStyleCreated)
+ return ((TableStyle) ControlStyle).HorizontalAlign;
+ return HorizontalAlign.NotSet;
+ }
+
+ set { ((TableStyle) ControlStyle).HorizontalAlign = value; }
+ }
+
+ [MergableProperty (false), PersistenceMode (PersistenceMode.InnerDefaultProperty)]
+ [WebSysDescription ("The rows of this table.")]
+ public virtual TableRowCollection Rows
+ {
+ get {
+ if (rows == null)
+ rows = new TableRowCollection (this);
+ return rows;
+ }
+ }
+
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender (writer);
+ if(!BorderColor.IsEmpty)
+ writer.AddAttribute (HtmlTextWriterAttribute.Bordercolor,
+ ColorTranslator.ToHtml (BorderColor));
+
+ Unit bw = BorderWidth;
+ if (GridLines == GridLines.None)
+ bw = Unit.Pixel (0);
+ else if (bw.IsEmpty || bw.Type != UnitType.Pixel)
+ bw = Unit.Pixel(1);
+
+ writer.AddAttribute (HtmlTextWriterAttribute.Border,
+ ((int) bw.Value).ToString (NumberFormatInfo.InvariantInfo));
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new TableRowControlCollection (this);
+ }
+
+ protected override Style CreateControlStyle ()
+ {
+ return new TableStyle (ViewState);
+ }
+
+#if NET_2_0
+ public override void RenderBeginTag (HtmlTextWriter writer)
+ {
+ base.RenderBeginTag (writer);
+ if (Caption != "") {
+ writer.AddAttribute ("align", CaptionAlign.ToString());
+ writer.RenderBeginTag (HtmlTextWriterTag.Caption);
+ writer.Write (Caption);
+ writer.RenderEndTag ();
+ }
+ }
+#endif
+
+ protected override void RenderContents (HtmlTextWriter writer)
+ {
+ foreach (TableRow current in Rows)
+ current.RenderControl (writer);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableCaptionAlign.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableCaptionAlign.cs
new file mode 100644
index 00000000000..fb8cbbc6492
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableCaptionAlign.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.UI.WebControls.TableCaptionAlign.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum TableCaptionAlign {
+ NotSet = 0,
+ Top = 1,
+ Bottom = 2,
+ Left = 3,
+ Right = 4
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs
new file mode 100644
index 00000000000..348bdb514ce
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs
@@ -0,0 +1,215 @@
+//
+// System.Web.UI.WebControls.TableCell.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+#if NET_2_0
+ [Bindable (false)]
+#else
+ [PersistChildren(true)]
+#endif
+ [DefaultProperty("Text")]
+ [ToolboxItem(false)]
+ [ControlBuilder(typeof(TableCellControlBuilder))]
+ [ParseChildren(false)]
+ public class TableCell: WebControl
+ {
+ public TableCell () : base (HtmlTextWriterTag.Td)
+ {
+ PreventAutoID ();
+ }
+
+ internal TableCell (HtmlTextWriterTag tag) : base (tag)
+ {
+ PreventAutoID ();
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (0), WebCategory ("Appearance")]
+ [WebSysDescription ("The number of columns spanned by this cell.")]
+ public virtual int ColumnSpan
+ {
+ get {
+ object o = ViewState ["ColumnSpan"];
+ return (o == null) ? 0 : (int) o;
+ }
+
+ set {
+ if (value < 0)
+ throw new ArgumentOutOfRangeException ("value", "ColumnSpan value has to be >= 0.");
+ ViewState ["ColumnSpan"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (0), WebCategory ("Layout")]
+ [WebSysDescription ("The number of rows spanned by this cell.")]
+ public virtual int RowSpan
+ {
+ get {
+ object o = ViewState ["RowSpan"];
+ return (o == null) ? 0 : (int) o;
+ }
+
+ set {
+ if (value < 0)
+ throw new ArgumentOutOfRangeException ("value", "RowSpan value has to be >= 0.");
+ ViewState ["RowSpan"] = value;
+ }
+ }
+
+#if NET_2_0
+ [LocalizableAttribute (true)]
+ [PersistenceModeAttribute (PersistenceMode.EncodedInnerDefaultProperty)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Appearance")]
+ [WebSysDescription ("The text that is shown in this cell.")]
+ public virtual string Text
+ {
+ get {
+ object o = ViewState ["Text"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set {
+ if (HasControls ())
+ Controls.Clear ();
+ ViewState ["Text"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (HorizontalAlign), "NotSet"), WebCategory ("Layout")]
+ [WebSysDescription ("The horizontal alignment for this cell.")]
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get {
+ if (ControlStyleCreated)
+ return ((TableItemStyle) ControlStyle).HorizontalAlign;
+ return HorizontalAlign.NotSet;
+ }
+ set { ((TableItemStyle) ControlStyle).HorizontalAlign = value; }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (VerticalAlign), "NotSet"), WebCategory ("Layout")]
+ [WebSysDescription ("The horizontal alignment for this cell.")]
+ public virtual VerticalAlign VerticalAlign
+ {
+ get {
+ if (ControlStyleCreated)
+ return ((TableItemStyle) ControlStyle).VerticalAlign;
+ return VerticalAlign.NotSet;
+ }
+
+ set { ((TableItemStyle) ControlStyle).VerticalAlign = value; }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (true), WebCategory ("Layout")]
+ [WebSysDescription ("Determines if the text in the cell should be wraped at line-end.")]
+ public virtual bool Wrap
+ {
+ get {
+ if (ControlStyleCreated)
+ return ((TableItemStyle) ControlStyle).Wrap;
+ return true;
+ }
+ set { ((TableItemStyle) ControlStyle).Wrap = value; }
+ }
+
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender (writer);
+ if (ColumnSpan > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Colspan,
+ ColumnSpan.ToString (NumberFormatInfo.InvariantInfo));
+
+ if (RowSpan > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Rowspan,
+ RowSpan.ToString (NumberFormatInfo.InvariantInfo));
+ }
+
+ protected override void AddParsedSubObject (object obj)
+ {
+ if (HasControls ()){
+ base.AddParsedSubObject (obj);
+ return;
+ }
+
+ if (obj is LiteralControl){
+ Text = ((LiteralControl) obj).Text;
+ return;
+ }
+
+ string text = Text;
+ if (text.Length > 0){
+ Text = String.Empty;
+ base.AddParsedSubObject (new LiteralControl (text));
+ }
+
+ base.AddParsedSubObject (obj);
+ }
+
+ protected override Style CreateControlStyle ()
+ {
+ return new TableItemStyle (ViewState);
+ }
+
+ protected override void RenderContents (HtmlTextWriter writer)
+ {
+ if (HasControls () || HasRenderMethodDelegate ())
+ base.RenderContents (writer);
+ else
+ writer.Write (Text);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableCellCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableCellCollection.cs
new file mode 100644
index 00000000000..7ebe7dd5b86
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableCellCollection.cs
@@ -0,0 +1,202 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableCellCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [Editor ("System.Web.UI.Design.WebControls.TableCellsCollectionEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public sealed class TableCellCollection: IList, ICollection, IEnumerable
+ {
+ private TableRow owner;
+
+ internal TableCellCollection(TableRow owner)
+ {
+ if(owner == null)
+ {
+ throw new ArgumentNullException();
+ }
+ this.owner = owner;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return owner.Controls.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public TableCell this[int index]
+ {
+ get
+ {
+ return (TableCell)owner.Controls[index];
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public int Add(TableCell cell)
+ {
+ AddAt(-1, cell);
+ return owner.Controls.Count - 1;
+ }
+
+ public void AddAt(int index, TableCell cell)
+ {
+ owner.Controls.AddAt(index, cell);
+ }
+
+ public void AddRange(TableCell[] cells)
+ {
+ foreach(TableCell cell in cells)
+ {
+ Add(cell);
+ }
+ }
+
+ public void Clear()
+ {
+ if(owner.HasControls())
+ {
+ owner.Controls.Clear();
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(object cell in this)
+ {
+ array.SetValue(cell, index++);
+ }
+ }
+
+ public int GetCellIndex(TableCell cell)
+ {
+ if(!owner.HasControls())
+ {
+ return -1;
+ }
+ return owner.Controls.IndexOf(cell);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return owner.Controls.GetEnumerator();
+ }
+
+ public void Remove(TableCell cell)
+ {
+ owner.Controls.Remove(cell);
+ }
+
+ public void RemoveAt(int index)
+ {
+ owner.Controls.RemoveAt(index);
+ }
+
+ int IList.Add(object o)
+ {
+ return Add((TableCell)o);
+ }
+
+ bool IList.Contains(object o)
+ {
+ return owner.Controls.Contains((TableCell)o);
+ }
+
+ int IList.IndexOf(object o)
+ {
+ return owner.Controls.IndexOf((TableCell)o);
+ }
+
+ void IList.Insert(int index, object o)
+ {
+ owner.Controls.AddAt(index, (TableCell)o);
+ }
+
+ void IList.Remove(object o)
+ {
+ owner.Controls.Remove((TableCell)o);
+ }
+
+ bool IList.IsFixedSize
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ object IList.this[int index]
+ {
+ get
+ {
+ return this[index];
+ }
+ set
+ {
+ RemoveAt(index);
+ AddAt(index, (TableCell)value);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableCellControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableCellControlBuilder.cs
new file mode 100644
index 00000000000..48925641e3e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableCellControlBuilder.cs
@@ -0,0 +1,52 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableCellControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TableCellControlBuilder: ControlBuilder
+ {
+ public TableCellControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderCell.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderCell.cs
new file mode 100644
index 00000000000..14eb46951ac
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderCell.cs
@@ -0,0 +1,47 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableHeaderCell
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TableHeaderCell: TableCell
+ {
+ public TableHeaderCell(): base(HtmlTextWriterTag.Th)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderScope.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderScope.cs
new file mode 100644
index 00000000000..caec65b5a6d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderScope.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.TableHeaderScope.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum TableHeaderScope {
+ NotSet = 0,
+ Row = 1,
+ Column = 2
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableItemStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableItemStyle.cs
new file mode 100644
index 00000000000..c0ed4db0361
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableItemStyle.cs
@@ -0,0 +1,216 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableItemStyle
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TableItemStyle: Style
+ {
+ private static int H_ALIGN = (0x01 << 16);
+ private static int V_ALIGN = (0x01 << 17);
+ private static int WRAP = (0x01 << 18);
+
+ public TableItemStyle(): base()
+ {
+ }
+
+ public TableItemStyle(StateBag bag): base(bag)
+ {
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue(HorizontalAlign.NotSet)]
+ [NotifyParentProperty(true)]
+ [WebCategory("Layout")]
+ [WebSysDescription("TableItemStyle_HorizontalAlign")]
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get
+ {
+ if(IsSet(H_ALIGN))
+ return (HorizontalAlign)ViewState["HorizontalAlign"];
+ return HorizontalAlign.NotSet;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(HorizontalAlign), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["HorizontalAlign"] = value;
+ Set(H_ALIGN);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue(VerticalAlign.NotSet)]
+ [NotifyParentProperty(true)]
+ [WebCategory("Layout")]
+ [WebSysDescription("TableItemStyle_VerticalAlign")]
+ public virtual VerticalAlign VerticalAlign
+ {
+ get
+ {
+ if(IsSet(V_ALIGN))
+ return (VerticalAlign)ViewState["VerticalAlign"];
+ return VerticalAlign.NotSet;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(VerticalAlign), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["VerticalAlign"] = value;
+ Set(V_ALIGN);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue(VerticalAlign.NotSet)]
+ [NotifyParentProperty(true)]
+ [WebCategory("Layout")]
+ [WebSysDescription("TableItemStyle_Wrap")]
+ public virtual bool Wrap
+ {
+ get
+ {
+ if(IsSet(WRAP))
+ return (bool)ViewState["Wrap"];
+ return true;
+ }
+ set
+ {
+ ViewState["Wrap"] = value;
+ Set(WRAP);
+ }
+ }
+
+ public override void CopyFrom(Style s)
+ {
+ if(s!=null && !s.IsEmpty)
+ {
+ base.CopyFrom(s);
+
+ if (!(s is TableItemStyle))
+ return;
+
+ TableItemStyle from = (TableItemStyle)s;
+ if(from.IsSet(H_ALIGN))
+ {
+ HorizontalAlign = from.HorizontalAlign;
+ }
+ if(from.IsSet(V_ALIGN))
+ {
+ VerticalAlign = from.VerticalAlign;
+ }
+ if(from.IsSet(WRAP))
+ {
+ Wrap = from.Wrap;
+ }
+ }
+ }
+
+ public override void MergeWith(Style s)
+ {
+ if(s!=null && !s.IsEmpty)
+ {
+ if (IsEmpty) {
+ CopyFrom (s);
+ return;
+ }
+ base.MergeWith(s);
+
+ if (!(s is TableItemStyle))
+ return;
+
+ TableItemStyle with = (TableItemStyle)s;
+ if(with.IsSet(H_ALIGN) && !IsSet(H_ALIGN))
+ {
+ HorizontalAlign = with.HorizontalAlign;
+ }
+ if(with.IsSet(V_ALIGN) && !IsSet(V_ALIGN))
+ {
+ VerticalAlign = with.VerticalAlign;
+ }
+ if(with.IsSet(WRAP) && !IsSet(WRAP))
+ {
+ Wrap = with.Wrap;
+ }
+ }
+ }
+
+ public override void Reset()
+ {
+ if(IsSet(H_ALIGN))
+ ViewState.Remove("HorizontalAlign");
+ if(IsSet(V_ALIGN))
+ ViewState.Remove("VerticalAlign");
+ if(IsSet(WRAP))
+ ViewState.Remove("Wrap");
+ base.Reset();
+ }
+
+ public override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
+ {
+ base.AddAttributesToRender(writer, owner);
+ if(!Wrap)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap");
+ }
+ if(HorizontalAlign != HorizontalAlign.NotSet)
+ {
+ // Temporarily commented out. I'm having problems in cygwin.
+ //writer.AddAttribute(HtmlTextWriterAttribute.Align, TypeDescriptor.GetConverter(typeof(HorizontalAlign)).ConvertToString(HorizontalAlign));
+ writer.AddAttribute(HtmlTextWriterAttribute.Align, HorizontalAlign.ToString ());
+ }
+ if(VerticalAlign != VerticalAlign.NotSet)
+ {
+ // Temporarily commented out. I'm having problems in cygwin.
+ //writer.AddAttribute(HtmlTextWriterAttribute.Valign, TypeDescriptor.GetConverter(typeof(VerticalAlign)).ConvertToString(VerticalAlign));
+ writer.AddAttribute(HtmlTextWriterAttribute.Valign, VerticalAlign.ToString ());
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableRow.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableRow.cs
new file mode 100644
index 00000000000..afa5b15208c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableRow.cs
@@ -0,0 +1,136 @@
+//
+// System.Web.UI.WebControls.TableRow.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+#if NET_2_0
+ [Bindable (false)]
+#endif
+ [DefaultProperty("Cells")]
+ [ParseChildren(true, "Cells")]
+ [ToolboxItem (false)]
+ public class TableRow: WebControl
+ {
+ private TableCellCollection cells;
+
+ public TableRow() : base (HtmlTextWriterTag.Tr)
+ {
+ PreventAutoID ();
+ }
+
+ [MergableProperty (false), PersistenceMode (PersistenceMode.InnerDefaultProperty)]
+ [WebSysDescription ("All cells that exist in a table row.")]
+ public virtual TableCellCollection Cells
+ {
+ get {
+ if (cells == null)
+ cells = new TableCellCollection (this);
+ return cells;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (HorizontalAlign), "NotSet"), WebCategory ("Layout")]
+ [WebSysDescription ("The horizontal alignment for all table cells in that row.")]
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get {
+ if (!ControlStyleCreated)
+ return HorizontalAlign.NotSet;
+ return ((TableItemStyle)ControlStyle).HorizontalAlign;
+ }
+
+ set { ((TableItemStyle)ControlStyle).HorizontalAlign = value; }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (VerticalAlign), "NotSet"), WebCategory ("Layout")]
+ [WebSysDescription ("The verical alignment for all table cells in that row.")]
+ public virtual VerticalAlign VerticalAlign
+ {
+ get {
+ if (!ControlStyleCreated)
+ return VerticalAlign.NotSet;
+ return ((TableItemStyle)ControlStyle).VerticalAlign;
+ }
+
+ set { ((TableItemStyle)ControlStyle).VerticalAlign = value; }
+ }
+
+ protected override Style CreateControlStyle ()
+ {
+ return new TableItemStyle (ViewState);
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new CellControlCollection (this);
+ }
+
+ protected class CellControlCollection : ControlCollection
+ {
+ internal CellControlCollection (Control owner) : base (owner)
+ {
+ }
+
+ public override void Add (Control child)
+ {
+ if (!(child is TableCell))
+ throw new ArgumentException (HttpRuntime.FormatResourceString (
+ "Cannot_Have_Children_Of_Type",
+ "TableRow",
+ GetType ().Name.ToString ()));
+ base.Add (child);
+ }
+
+ public override void AddAt(int index, Control child)
+ {
+ if (!(child is TableCell))
+ throw new ArgumentException (HttpRuntime.FormatResourceString (
+ "Cannot_Have_Children_Of_Type",
+ "TableRow",
+ GetType ().Name.ToString ()));
+ base.AddAt (index, child);
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableRowCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableRowCollection.cs
new file mode 100644
index 00000000000..d58d97ef404
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableRowCollection.cs
@@ -0,0 +1,202 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableRowCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Collections;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [Editor ("System.Web.UI.Design.WebControls.TableRowsCollectionEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public sealed class TableRowCollection: IList, ICollection, IEnumerable
+ {
+ Table owner;
+
+ internal TableRowCollection(Table owner)
+ {
+ if(owner == null)
+ {
+ throw new ArgumentNullException();
+ }
+ this.owner = owner;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return owner.Controls.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public TableRow this[int index]
+ {
+ get
+ {
+ return (TableRow)owner.Controls[index];
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public int Add(TableRow row)
+ {
+ AddAt(-1, row);
+ return owner.Controls.Count - 1;
+ }
+
+ public void AddAt(int index, TableRow row)
+ {
+ owner.Controls.AddAt(index, row);
+ }
+
+ public void AddRange(TableRow[] rows)
+ {
+ foreach(TableRow row in rows)
+ {
+ Add(row);
+ }
+ }
+
+ public void Clear()
+ {
+ if(owner.HasControls())
+ {
+ owner.Controls.Clear();
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(object current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public int GetRowIndex(TableRow row)
+ {
+ if(!owner.HasControls())
+ {
+ return -1;
+ }
+ return owner.Controls.IndexOf(row);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return owner.Controls.GetEnumerator();
+ }
+
+ public void Remove(TableRow row)
+ {
+ owner.Controls.Remove(row);
+ }
+
+ public void RemoveAt(int index)
+ {
+ owner.Controls.RemoveAt(index);
+ }
+
+ int IList.Add(object o)
+ {
+ return Add((TableRow)o);
+ }
+
+ bool IList.Contains(object o)
+ {
+ return owner.Controls.Contains((TableRow)o);
+ }
+
+ int IList.IndexOf(object o)
+ {
+ return owner.Controls.IndexOf((TableRow)o);
+ }
+
+ void IList.Insert(int index, object o)
+ {
+ owner.Controls.AddAt(index, (TableRow)o);
+ }
+
+ void IList.Remove(object o)
+ {
+ owner.Controls.Remove((TableRow)o);
+ }
+
+ bool IList.IsFixedSize
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ object IList.this[int index]
+ {
+ get
+ {
+ return this[index];
+ }
+ set
+ {
+ RemoveAt(index);
+ AddAt(index, (TableRow)value);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableRowSection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableRowSection.cs
new file mode 100644
index 00000000000..5442dcdf380
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableRowSection.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.UI.WebControls.TableRowSection.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ [SerializableAttribute]
+ public enum TableRowSection {
+ TableBody = 0,
+ TableHeader = 1,
+ TableFooter = 2
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs
new file mode 100644
index 00000000000..de80d2561dd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs
@@ -0,0 +1,294 @@
+//
+// System.Web.UI.WebControls.TableStyle.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TableStyle : Style
+ {
+ private static int IMAGE_URL = (0x01 << 16);
+ private static int CELL_PADD = (0x01 << 17);
+ private static int CELL_SPAC = (0x01 << 18);
+ private static int GRID_LINE = (0x01 << 19);
+ private static int HOR_ALIGN = (0x01 << 20);
+
+ public TableStyle(): base()
+ {
+ }
+
+ public TableStyle(StateBag bag): base(bag)
+ {
+ }
+
+#if NET_2_0
+ [NotifyParentPropertyAttribute (true)]
+ [UrlPropertyAttribute]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Appearance")]
+ [WebSysDescription ("An Url specifying the background image for the table.")]
+ public virtual string BackImageUrl
+ {
+ get
+ {
+ if(IsSet(IMAGE_URL))
+ return (string)(ViewState["BackImageUrl"]);
+ return String.Empty;
+ }
+ set
+ {
+ if(value == null)
+ throw new ArgumentNullException("value");
+ ViewState["BackImageUrl"] = value;
+ Set(IMAGE_URL);
+ }
+ }
+
+#if NET_2_0
+ [NotifyParentPropertyAttribute (true)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (-1), WebCategory ("Appearance")]
+ [WebSysDescription ("The space left around the borders within a cell.")]
+ public virtual int CellPadding
+ {
+ get
+ {
+ if(IsSet(CELL_PADD))
+ return (int)(ViewState["CellPadding"]);
+ return -1;
+ }
+ set
+ {
+ if(value < -1)
+ throw new ArgumentOutOfRangeException("value", "CellPadding value has to be -1 for 'not set' or a value >= 0");
+ ViewState["CellPadding"] = value;
+ Set(CELL_PADD);
+ }
+ }
+
+#if NET_2_0
+ [NotifyParentPropertyAttribute (true)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (-1), WebCategory ("Appearance")]
+ [WebSysDescription ("The space left between cells.")]
+ public virtual int CellSpacing
+ {
+ get
+ {
+ if(IsSet(CELL_SPAC))
+ return (int)(ViewState["CellSpacing"]);
+ return -1;
+ }
+ set
+ {
+ if(value < -1)
+ throw new ArgumentOutOfRangeException("value"," CellSpacing value has to be -1 for 'not set' or a value >= 0");
+ ViewState["CellSpacing"] = value;
+ Set(CELL_SPAC);
+ }
+ }
+
+#if NET_2_0
+ [NotifyParentPropertyAttribute (true)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (GridLines), "None"), WebCategory ("Appearance")]
+ [WebSysDescription ("The type of grid that a table uses.")]
+ public virtual GridLines GridLines
+ {
+ get
+ {
+ if(IsSet(GRID_LINE))
+ return (GridLines)(ViewState["GridLines"]);
+ return GridLines.None;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(GridLines), value))
+ throw new ArgumentOutOfRangeException("value"," Gridlines value has to be a valid enumeration member");
+ ViewState["GridLines"] = value;
+ Set(GRID_LINE);
+ }
+ }
+
+#if NET_2_0
+ [NotifyParentPropertyAttribute (true)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (HorizontalAlign), "NotSet"), WebCategory ("Layout")]
+ [WebSysDescription ("The horizonal alignment of the table.")]
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get
+ {
+ if(IsSet(HOR_ALIGN))
+ return (HorizontalAlign)(ViewState["HorizontalAlign"]);
+ return HorizontalAlign.NotSet;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(HorizontalAlign), value))
+ throw new ArgumentOutOfRangeException("value"," Gridlines value has to be a valid enumeration member");
+ ViewState["HorizontalAlign"] = value;
+ Set(HOR_ALIGN);
+ }
+ }
+
+ public override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
+ {
+ base.AddAttributesToRender(writer, owner);
+ if(BackImageUrl.Length > 0)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundImage, "url(" + owner.ResolveUrl(BackImageUrl) + ")");
+ }
+ if(CellSpacing >= 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, CellSpacing.ToString(NumberFormatInfo.InvariantInfo));
+ if(CellSpacing == 0)
+ writer.AddStyleAttribute(HtmlTextWriterStyle.BorderCollapse, "collapse");
+
+ }
+ if(CellPadding >= 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, CellPadding.ToString(NumberFormatInfo.InvariantInfo));
+ }
+ if(HorizontalAlign != HorizontalAlign.NotSet)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Align, Enum.Format(typeof(HorizontalAlign), HorizontalAlign, "G"));
+ }
+ string gd = null;
+ switch(GridLines)
+ {
+ case GridLines.None: break;
+ case GridLines.Horizontal: gd = "rows";
+ break;
+ case GridLines.Vertical: gd = "cols";
+ break;
+ case GridLines.Both: gd = "all";
+ break;
+ }
+
+ if (gd != null)
+ writer.AddAttribute(HtmlTextWriterAttribute.Rules, gd);
+ }
+
+ public override void CopyFrom(Style s)
+ {
+ if (s == null || s.IsEmpty)
+ return;
+
+ base.CopyFrom (s);
+ TableStyle from = s as TableStyle;
+ if (from == null)
+ return;
+
+ if (from.IsSet (HOR_ALIGN))
+ HorizontalAlign = from.HorizontalAlign;
+
+ if (from.IsSet (IMAGE_URL))
+ BackImageUrl = from.BackImageUrl;
+
+ if (from.IsSet (CELL_PADD))
+ CellPadding = from.CellPadding;
+
+ if (from.IsSet (CELL_SPAC))
+ CellSpacing = from.CellSpacing;
+
+ if (from.IsSet (GRID_LINE))
+ GridLines = from.GridLines;
+ }
+
+ public override void MergeWith(Style s)
+ {
+ if(s != null && !s.IsEmpty)
+ {
+ if (IsEmpty) {
+ CopyFrom (s);
+ return;
+ }
+ base.MergeWith(s);
+
+ if (!(s is TableStyle))
+ return;
+
+ TableStyle with = (TableStyle)s;
+ if(with.IsSet(HOR_ALIGN) && !IsSet(HOR_ALIGN))
+ {
+ HorizontalAlign = with.HorizontalAlign;
+ }
+ if(with.IsSet(IMAGE_URL) && !IsSet(IMAGE_URL))
+ {
+ BackImageUrl = with.BackImageUrl;
+ }
+ if(with.IsSet(CELL_PADD) && !IsSet(CELL_PADD))
+ {
+ CellPadding = with.CellPadding;
+ }
+ if(with.IsSet(CELL_SPAC) && !IsSet(CELL_SPAC))
+ {
+ CellSpacing = with.CellSpacing;
+ }
+ if(with.IsSet(GRID_LINE) && !IsSet(GRID_LINE))
+ {
+ GridLines = with.GridLines;
+ }
+ }
+ }
+
+ public override void Reset()
+ {
+ if(IsSet(IMAGE_URL))
+ ViewState.Remove("BackImageUrl");
+ if(IsSet(HOR_ALIGN))
+ ViewState.Remove("HorizontalAlign");
+ if(IsSet(CELL_PADD))
+ ViewState.Remove("CellPadding");
+ if(IsSet(CELL_SPAC))
+ ViewState.Remove("CellSpacing");
+ if(IsSet(GRID_LINE))
+ ViewState.Remove("GridLines");
+ base.Reset();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableViewMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableViewMode.cs
new file mode 100644
index 00000000000..a19f59a6a6f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableViewMode.cs
@@ -0,0 +1,35 @@
+//
+// System.Web.UI.WebControls.TableViewMode.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum TableViewMode {
+ Summary = 0,
+ Details = 1
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TargetConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TargetConverter.cs
new file mode 100644
index 00000000000..e6e36c7fee2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TargetConverter.cs
@@ -0,0 +1,76 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TargetConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TargetConverter : StringConverter
+ {
+ private StandardValuesCollection standardValues;
+ private string[] values = {
+ "_parent",
+ "_self",
+ "_blank",
+ "_search",
+ "_top"
+ };
+
+ public TargetConverter(): base()
+ {
+ }
+
+ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+ {
+ if(standardValues == null)
+ {
+ standardValues = new StandardValuesCollection(values);
+ }
+ return standardValues;
+ }
+
+ public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
+ {
+ return false;
+ }
+
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TemplateColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TemplateColumn.cs
new file mode 100644
index 00000000000..58a94a05a39
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TemplateColumn.cs
@@ -0,0 +1,141 @@
+//
+// System.Web.UI.WebControls.TemplateColumn.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TemplateColumn : DataGridColumn
+ {
+ private ITemplate editItemTemplate;
+ private ITemplate footerTemplate;
+ private ITemplate headerTemplate;
+ private ITemplate itemTemplate;
+
+ public TemplateColumn(): base()
+ {
+ }
+
+ [DefaultValue (null), Browsable (false)]
+ [PersistenceMode (PersistenceMode.InnerProperty), TemplateContainer (typeof (DataGridItem))]
+ [WebSysDescription ("The template that is used to build that are being edited rows for this column.")]
+ public virtual ITemplate EditItemTemplate
+ {
+ get
+ {
+ return editItemTemplate;
+ }
+ set
+ {
+ editItemTemplate = value;
+ OnColumnChanged();
+ }
+ }
+
+ [DefaultValue (null), Browsable (false)]
+ [PersistenceMode (PersistenceMode.InnerProperty), TemplateContainer (typeof (DataGridItem))]
+ [WebSysDescription ("The template that is used to build the footer for this column.")]
+ public virtual ITemplate FooterTemplate
+ {
+ get
+ {
+ return footerTemplate;
+ }
+ set
+ {
+ footerTemplate = value;
+ OnColumnChanged();
+ }
+ }
+
+ [DefaultValue (null), Browsable (false)]
+ [PersistenceMode (PersistenceMode.InnerProperty), TemplateContainer (typeof (DataGridItem))]
+ [WebSysDescription ("The template that is used to build the header for this column.")]
+ public virtual ITemplate HeaderTemplate
+ {
+ get
+ {
+ return headerTemplate;
+ }
+ set
+ {
+ headerTemplate = value;
+ OnColumnChanged();
+ }
+ }
+
+ [DefaultValue (null), Browsable (false)]
+ [PersistenceMode (PersistenceMode.InnerProperty), TemplateContainer (typeof (DataGridItem))]
+ [WebSysDescription ("The template that is used to build rows for this column.")]
+ public virtual ITemplate ItemTemplate
+ {
+ get
+ {
+ return itemTemplate;
+ }
+ set
+ {
+ itemTemplate = value;
+ OnColumnChanged();
+ }
+ }
+
+ public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ base.InitializeCell(cell, columnIndex, itemType);
+ ITemplate toRender = null;
+ switch(itemType)
+ {
+ case ListItemType.Header: toRender = headerTemplate;
+ break;
+ case ListItemType.Footer: toRender = footerTemplate;
+ break;
+ case ListItemType.SelectedItem:
+ case ListItemType.AlternatingItem:
+ case ListItemType.Item: toRender = itemTemplate;
+ break;
+ case ListItemType.EditItem:
+ toRender = (editItemTemplate != null ? editItemTemplate : itemTemplate);
+ break;
+ }
+ if(toRender != null)
+ {
+ cell.Text = String.Empty;
+ toRender.InstantiateIn(cell);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TemplateField.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TemplateField.cs
new file mode 100644
index 00000000000..ac8fc7d1d74
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TemplateField.cs
@@ -0,0 +1,201 @@
+//
+// System.Web.UI.WebControls.TemplateField.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web.UI;
+using System.Security.Permissions;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ public class TemplateField : DataControlField
+ {
+ ITemplate alternatingItemTemplate;
+ ITemplate editItemTemplate;
+ ITemplate footerTemplate;
+ ITemplate headerTemplate;
+ ITemplate insertItemTemplate;
+ ITemplate itemTemplate;
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(IDataItemContainer), BindingDirection.TwoWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate AlternatingItemTemplate {
+ get { return alternatingItemTemplate; }
+ set { alternatingItemTemplate = value; OnFieldChanged (); }
+ }
+
+ [DefaultValueAttribute (true)]
+ [WebCategoryAttribute ("Behavior")]
+ public virtual bool ConvertEmptyStringToNull {
+ get {
+ object ob = ViewState ["ConvertEmptyStringToNull"];
+ if (ob != null) return (bool) ob;
+ return true;
+ }
+ set {
+ ViewState ["ConvertEmptyStringToNull"] = value;
+ OnFieldChanged ();
+ }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(IDataItemContainer), BindingDirection.TwoWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate EditItemTemplate {
+ get { return editItemTemplate; }
+ set { editItemTemplate = value; OnFieldChanged (); }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(IDataItemContainer), BindingDirection.OneWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate FooterTemplate {
+ get { return footerTemplate; }
+ set { footerTemplate = value; OnFieldChanged (); }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(IDataItemContainer), BindingDirection.OneWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate HeaderTemplate {
+ get { return headerTemplate; }
+ set { headerTemplate = value; OnFieldChanged (); }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(IDataItemContainer), BindingDirection.TwoWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate InsertItemTemplate {
+ get { return insertItemTemplate; }
+ set { insertItemTemplate = value; OnFieldChanged (); }
+ }
+
+ [DefaultValue (null)]
+ [TemplateContainer (typeof(IDataItemContainer), BindingDirection.TwoWay)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Browsable (false)]
+ public ITemplate ItemTemplate {
+ get { return itemTemplate; }
+ set { itemTemplate = value; OnFieldChanged (); }
+ }
+
+ public override void InitializeCell (DataControlFieldCell cell,
+ DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
+ {
+ if (cellType == DataControlCellType.Header) {
+ if (headerTemplate != null && ShowHeader) {
+ headerTemplate.InstantiateIn (cell);
+ return;
+ }
+ } else if (cellType == DataControlCellType.Footer) {
+ if (footerTemplate != null) {
+ footerTemplate.InstantiateIn (cell);
+ return;
+ }
+ } else {
+ if ((rowState & DataControlRowState.Insert) != 0) {
+ if (insertItemTemplate != null) {
+ insertItemTemplate.InstantiateIn (cell);
+ return;
+ }
+ }
+ else if ((rowState & DataControlRowState.Edit) != 0) {
+ if (editItemTemplate != null) {
+ editItemTemplate.InstantiateIn (cell);
+ return;
+ }
+ }
+ else if ((rowState & DataControlRowState.Alternate) != 0 && alternatingItemTemplate != null) {
+ alternatingItemTemplate.InstantiateIn (cell);
+ return;
+ }
+ else if (itemTemplate != null) {
+ itemTemplate.InstantiateIn (cell);
+ return;
+ }
+ }
+
+ base.InitializeCell (cell, cellType, rowState, rowIndex);
+ }
+
+ public override void ExtractValuesFromCell (IOrderedDictionary dictionary,
+ DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
+ {
+ IBindableTemplate bt;
+
+ if ((rowState & DataControlRowState.Insert) != 0)
+ bt = insertItemTemplate as IBindableTemplate;
+ else if ((rowState & DataControlRowState.Edit) != 0)
+ bt = editItemTemplate as IBindableTemplate;
+ else
+ return;
+
+ if (bt != null) {
+ IOrderedDictionary values = bt.ExtractValues (cell);
+ foreach (DictionaryEntry e in values)
+ dictionary [e.Key] = e.Value;
+ }
+ }
+
+ public override void ValidateSupportsCallback ()
+ {
+ throw new NotSupportedException ("Callback not supported on TemplateField. Turn disable callbacks on '" + Control.ID + "'.");
+ }
+
+ protected override DataControlField CreateField ()
+ {
+ return new TemplateField ();
+ }
+
+ protected override void CopyProperties (DataControlField newField)
+ {
+ base.CopyProperties (newField);
+ TemplateField field = (TemplateField) newField;
+ field.AlternatingItemTemplate = AlternatingItemTemplate;
+ field.ConvertEmptyStringToNull = ConvertEmptyStringToNull;
+ field.EditItemTemplate = EditItemTemplate;
+ field.FooterTemplate = FooterTemplate;
+ field.HeaderTemplate = HeaderTemplate;
+ field.InsertItemTemplate = InsertItemTemplate;
+ field.ItemTemplate = ItemTemplate;
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TextAlign.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TextAlign.cs
new file mode 100755
index 00000000000..45b2b0cbb20
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TextAlign.cs
@@ -0,0 +1,42 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: TextAlign
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum TextAlign
+ {
+ Left = 1,
+ Right
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs
new file mode 100644
index 00000000000..19a231016c7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs
@@ -0,0 +1,340 @@
+//
+// System.Web.UI.WebControls.TextBox.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+#if NET_2_0
+ [ControlValuePropertyAttribute ("Text")]
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.PreviewControlDesigner, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+#endif
+ [ControlBuilder (typeof (TextBoxControlBuilder))]
+ [DefaultEvent("TextChanged")]
+ [DefaultProperty("Text")]
+ [ParseChildren(false)]
+ [ValidationProperty("Text")]
+ [DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
+ public class TextBox : WebControl, IPostBackDataHandler
+ {
+ static readonly object TextChangedEvent = new object ();
+
+ public TextBox() : base (HtmlTextWriterTag.Input)
+ {
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (false), WebCategory ("Behavior")]
+ [WebSysDescription ("The control automatically posts back after changing the text.")]
+ public virtual bool AutoPostBack {
+ get {
+ object o = ViewState ["AutoPostBack"];
+ return (o == null) ? false : (bool) o;
+ }
+
+ set { ViewState ["AutoPostBack"] = value; }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (0), WebCategory ("Appearance")]
+ [WebSysDescription ("The width of this control specified in characters.")]
+ public virtual int Columns {
+ get {
+ object o = ViewState ["Columns"];
+ return (o == null) ? 0 : (int) o;
+ }
+
+ set {
+ if (value < 0)
+ throw new ArgumentOutOfRangeException ("value",
+ "Columns value has to be 0 for 'not set' or bigger than 0.");
+
+ ViewState ["Columns"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (0), WebCategory ("Behavior")]
+ [WebSysDescription ("The maximum number of characters you can enter in this control.")]
+ public virtual int MaxLength {
+ get {
+ object o = ViewState ["MaxLength"];
+ return (o == null) ? 0 : (int) o;
+ }
+
+ set {
+ if (value < 0)
+ throw new ArgumentOutOfRangeException ("value",
+ "MaxLength value has to be 0 for 'not set' or bigger than 0.");
+
+ ViewState ["MaxLength"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (false), Bindable (true), WebCategory ("Behavior")]
+ [WebSysDescription ("If the control is ReadOnly you cannot enter new text.")]
+ public virtual bool ReadOnly {
+ get {
+ object o = ViewState ["ReadOnly"];
+ return (o == null) ? false : (bool) o;
+ }
+ set { ViewState ["ReadOnly"] = value; }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (0), WebCategory ("Behavior")]
+ [WebSysDescription ("The number of lines that this multiline contol spans.")]
+ public virtual int Rows {
+ get {
+ object o = ViewState ["Rows"];
+ return (o == null) ? 0 : (int) o;
+ }
+
+ set {
+ if (value < 0)
+ throw new ArgumentOutOfRangeException ("value",
+ "Rows value has to be 0 for 'not set' or bigger than 0.");
+ ViewState ["Rows"] = value;
+ }
+ }
+
+#if NET_2_0
+ [LocalizableAttribute (true)]
+ [EditorAttribute ("System.ComponentModel.Design.MultilineStringEditor,System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+#endif
+ [DefaultValue (""), Bindable (true), WebCategory ("Appearance")]
+ [PersistenceMode (PersistenceMode.EncodedInnerDefaultProperty)]
+ [WebSysDescription ("The text that this control initially displays.")]
+ public virtual string Text {
+ get {
+ object o = ViewState ["Text"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["Text"] = value; }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (typeof (TextBoxMode), "SingleLine"), WebCategory ("Behavior")]
+ [WebSysDescription ("A mode of how the control operates.")]
+ public virtual TextBoxMode TextMode {
+ get {
+ object o = ViewState ["TextMode"];
+ return (o == null) ? TextBoxMode.SingleLine : (TextBoxMode) o;
+ }
+
+ set {
+ if(!Enum.IsDefined (typeof(TextBoxMode), value))
+ throw new ArgumentOutOfRangeException ("value",
+ "Only existing modes are allowed");
+
+ ViewState ["TextMode"] = value;
+ }
+ }
+
+ [DefaultValue (true), WebCategory ("Layout")]
+ [WebSysDescription ("Determines if a line wraps at line-end.")]
+ public virtual bool Wrap {
+ get {
+ object o = ViewState ["Wrap"];
+ return (o == null) ? true : (bool) o;
+ }
+
+ set { ViewState ["Wrap"] = value; }
+ }
+
+
+ [WebCategory ("Action")]
+ [WebSysDescription ("Raised when the text is changed.")]
+ public event EventHandler TextChanged {
+ add { Events.AddHandler (TextChangedEvent, value); }
+ remove { Events.RemoveHandler (TextChangedEvent, value); }
+ }
+
+ protected override HtmlTextWriterTag TagKey {
+ get {
+ if(TextMode == TextBoxMode.MultiLine)
+ return HtmlTextWriterTag.Textarea;
+ return HtmlTextWriterTag.Input;
+ }
+ }
+
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ if(Page != null)
+ Page.VerifyRenderingInServerForm (this);
+
+ NumberFormatInfo invar = NumberFormatInfo.InvariantInfo;
+
+ writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
+ if (TextMode == TextBoxMode.MultiLine) {
+ if (Rows > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Rows,
+ Rows.ToString (invar));
+
+ if (Columns > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Cols,
+ Columns.ToString (invar));
+
+ if (!Wrap)
+ writer.AddAttribute(HtmlTextWriterAttribute.Wrap, "off");
+ } else {
+ string mode;
+ if (TextMode == TextBoxMode.Password) {
+ mode = "password";
+ } else {
+ mode = "text";
+ if (Text.Length > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Value, Text);
+ }
+
+ writer.AddAttribute (HtmlTextWriterAttribute.Type, mode);
+ if (MaxLength > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Maxlength,
+ MaxLength.ToString (invar));
+
+ if (Columns > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Size,
+ Columns.ToString (invar));
+ }
+
+ if (ReadOnly)
+ writer.AddAttribute (HtmlTextWriterAttribute.ReadOnly, "readonly");
+
+ base.AddAttributesToRender (writer);
+
+ if (AutoPostBack && Page != null){
+ writer.AddAttribute (HtmlTextWriterAttribute.Onchange,
+ Page.ClientScript.GetPostBackClientEvent (this, ""));
+ writer.AddAttribute ("language", "javascript");
+ }
+ }
+
+ protected override void AddParsedSubObject(object obj)
+ {
+ if(!(obj is LiteralControl))
+ throw new HttpException ("Cannot have children of type" + obj.GetType ());
+
+ Text = ((LiteralControl) obj).Text;
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+ bool enabled = Enabled;
+ if (Page != null) {
+ if (AutoPostBack && enabled)
+ Page.RequiresPostBackScript ();
+ }
+
+ /* Don't save passwords in ViewState */
+ if (TextMode == TextBoxMode.Password ||
+ (enabled && Visible && Events [TextChangedEvent] == null))
+ ViewState.SetItemDirty ("Text", false);
+ }
+
+ protected virtual void OnTextChanged (EventArgs e)
+ {
+ if(Events != null){
+ EventHandler eh = (EventHandler) (Events [TextChangedEvent]);
+ if(eh != null)
+ eh (this, e);
+ }
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ RenderBeginTag(writer);
+ if (TextMode == TextBoxMode.MultiLine)
+ HttpUtility.HtmlEncode (Text, writer);
+ RenderEndTag(writer);
+ }
+
+#if NET_2_0
+ bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+ {
+ return LoadPostData (postDataKey, postCollection);
+ }
+
+ protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
+#else
+ bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+#endif
+ {
+ if (postCollection [postDataKey] != Text){
+ Text = postCollection [postDataKey];
+ return true;
+ }
+ return false;
+ }
+
+#if NET_2_0
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ RaisePostDataChangedEvent ();
+ }
+
+ protected virtual void RaisePostDataChangedEvent ()
+ {
+ OnTextChanged (EventArgs.Empty);
+ }
+#else
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnTextChanged (EventArgs.Empty);
+ }
+#endif
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxControlBuilder.cs
new file mode 100644
index 00000000000..2c9512c386d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxControlBuilder.cs
@@ -0,0 +1,57 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TextBoxControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TextBoxControlBuilder : ControlBuilder
+ {
+ public TextBoxControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+
+ public override bool HtmlDecodeLiterals()
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxMode.cs
new file mode 100755
index 00000000000..63eb07a9ac6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxMode.cs
@@ -0,0 +1,43 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: TextBoxMode
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum TextBoxMode
+ {
+ SingleLine,
+ MultiLine,
+ Password
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TitleFormat.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TitleFormat.cs
new file mode 100755
index 00000000000..9448b35cc42
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TitleFormat.cs
@@ -0,0 +1,42 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: TitleFormat
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum TitleFormat
+ {
+ Month,
+ MonthYear
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TreeNode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNode.cs
new file mode 100644
index 00000000000..e5b5f557977
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNode.cs
@@ -0,0 +1,682 @@
+//
+// System.Web.UI.WebControls.TreeNode.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Text;
+using System.ComponentModel;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ParseChildrenAttribute (true, "ChildNodes")]
+ public class TreeNode: IStateManager, ICloneable
+ {
+ StateBag ViewState = new StateBag ();
+ TreeNodeCollection nodes;
+ bool marked;
+ TreeView tree;
+ TreeNode parent;
+ int index;
+ string path;
+ int depth = -1;
+
+ IHierarchyData hierarchyData;
+ bool gotBinding;
+ TreeNodeBinding binding;
+ PropertyDescriptorCollection boundProperties;
+
+ internal TreeNode (TreeView tree)
+ {
+ Tree = tree;
+ }
+
+ public TreeNode ()
+ {
+ }
+
+ public TreeNode (string text)
+ {
+ Text = text;
+ }
+
+ public TreeNode (string text, string value)
+ {
+ Text = text;
+ Value = value;
+ }
+
+ public TreeNode (string text, string value, string imageUrl)
+ {
+ Text = text;
+ Value = value;
+ ImageUrl = imageUrl;
+ }
+
+ public TreeNode (string text, string value, string imageUrl, string navigateUrl, string target)
+ {
+ Text = text;
+ Value = value;
+ ImageUrl = imageUrl;
+ NavigateUrl = navigateUrl;
+ Target = target;
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public int Depth {
+ get {
+ if (depth != -1) return depth;
+ depth = 0;
+ TreeNode nod = parent;
+ while (nod != null) {
+ depth++;
+ nod = nod.parent;
+ }
+ return depth;
+ }
+ }
+
+ void ResetPathData ()
+ {
+ path = null;
+ depth = -1;
+ gotBinding = false;
+ }
+
+ internal TreeView Tree {
+ get { return tree; }
+ set {
+ if (SelectedFlag) {
+ if (value != null)
+ value.SetSelectedNode (this, false);
+ else if (tree != null)
+ tree.SetSelectedNode (null, false);
+ }
+ tree = value;
+ if (nodes != null)
+ nodes.SetTree (tree);
+ ResetPathData ();
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [DefaultValue (false)]
+ [Browsable (false)]
+ public bool DataBound {
+ get { return hierarchyData != null; }
+ }
+
+ [DefaultValue (null)]
+ [Browsable (false)]
+ public object DataItem {
+ get {
+ if (hierarchyData == null) throw new InvalidOperationException ("TreeNode is not data bound.");
+ return hierarchyData.Item;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [DefaultValue ("")]
+ [Browsable (false)]
+ public string DataPath {
+ get {
+ if (hierarchyData == null) throw new InvalidOperationException ("TreeNode is not data bound.");
+ return hierarchyData.Path;
+ }
+ }
+
+ [DefaultValue (false)]
+ public virtual bool Checked {
+ get {
+ object o = ViewState ["Checked"];
+ if (o != null) return (bool)o;
+ return false;
+ }
+ set {
+ ViewState ["Checked"] = value;
+ if (tree != null)
+ tree.NotifyCheckChanged (this);
+ }
+ }
+
+ [DefaultValue (null)]
+ [MergableProperty (false)]
+ [Browsable (false)]
+ [PersistenceMode (PersistenceMode.InnerDefaultProperty)]
+ public virtual TreeNodeCollection ChildNodes {
+ get {
+ if (nodes == null) {
+ if (PopulateOnDemand && tree == null)
+ return null;
+
+ if (DataBound)
+ FillBoundChildren ();
+ else
+ nodes = new TreeNodeCollection (this);
+
+ if (IsTrackingViewState)
+ ((IStateManager)nodes).TrackViewState();
+
+ if (PopulateOnDemand && !Populated) {
+ Populated = true;
+ Populate ();
+ }
+ }
+ return nodes;
+ }
+ }
+
+ [DefaultValue (false)]
+ public virtual bool Expanded {
+ get {
+ object o = ViewState ["Expanded"];
+ if (o != null) return (bool)o;
+ return false;
+ }
+ set {
+ ViewState ["Expanded"] = value;
+ if (tree != null)
+ tree.NotifyExpandedChanged (this);
+ }
+ }
+
+ [Localizable (true)]
+ [DefaultValue ("")]
+ public virtual string ImageToolTip {
+ get {
+ object o = ViewState ["ImageToolTip"];
+ if (o != null) return (string)o;
+ if (DataBound) {
+ TreeNodeBinding bin = GetBinding ();
+ if (bin != null) {
+ if (bin.ImageToolTipField != "")
+ return (string) GetBoundPropertyValue (bin.ImageToolTipField);
+ return bin.ImageToolTip;
+ }
+ }
+ return "";
+ }
+ set {
+ ViewState ["ImageToolTip"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual string ImageUrl {
+ get {
+ object o = ViewState ["ImageUrl"];
+ if (o != null) return (string)o;
+ if (DataBound) {
+ TreeNodeBinding bin = GetBinding ();
+ if (bin != null) {
+ if (bin.ImageUrlField != "")
+ return (string) GetBoundPropertyValue (bin.ImageUrlField);
+ return bin.ImageUrl;
+ }
+ }
+ return "";
+ }
+ set {
+ ViewState ["ImageUrl"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual string NavigateUrl {
+ get {
+ object o = ViewState ["NavigateUrl"];
+ if (o != null) return (string)o;
+ if (DataBound) {
+ TreeNodeBinding bin = GetBinding ();
+ if (bin != null) {
+ if (bin.NavigateUrlField != "")
+ return (string) GetBoundPropertyValue (bin.NavigateUrlField);
+ return bin.NavigateUrl;
+ }
+ }
+ return "";
+ }
+ set {
+ ViewState ["NavigateUrl"] = value;
+ }
+ }
+
+ [DefaultValue (false)]
+ public bool PopulateOnDemand {
+ get {
+ object o = ViewState ["PopulateOnDemand"];
+ if (o != null) return (bool)o;
+ if (DataBound) {
+ TreeNodeBinding bin = GetBinding ();
+ if (bin != null)
+ return bin.PopulateOnDemand;
+ }
+ return false;
+ }
+ set {
+ ViewState ["PopulateOnDemand"] = value;
+ }
+ }
+
+ [DefaultValue (TreeNodeSelectAction.Select)]
+ public TreeNodeSelectAction SelectAction {
+ get {
+ object o = ViewState ["SelectAction"];
+ if (o != null) return (TreeNodeSelectAction)o;
+ if (DataBound) {
+ TreeNodeBinding bin = GetBinding ();
+ if (bin != null)
+ return bin.SelectAction;
+ }
+ return TreeNodeSelectAction.Select;
+ }
+ set {
+ ViewState ["SelectAction"] = value;
+ }
+ }
+
+ [DefaultValue (false)]
+ public bool ShowCheckBox {
+ get {
+ object o = ViewState ["ShowCheckBox"];
+ if (o != null) return (bool)o;
+ if (DataBound) {
+ TreeNodeBinding bin = GetBinding ();
+ if (bin != null)
+ return bin.ShowCheckBox;
+ }
+ return false;
+ }
+ set {
+ ViewState ["ShowCheckBox"] = value;
+ }
+ }
+
+ internal bool IsShowCheckBoxSet {
+ get { return ViewState ["ShowCheckBox"] != null; }
+ }
+
+ [DefaultValue ("")]
+ public virtual string Target {
+ get {
+ object o = ViewState ["Target"];
+ if(o != null) return (string)o;
+ if (DataBound) {
+ TreeNodeBinding bin = GetBinding ();
+ if (bin != null) {
+ if (bin.TargetField != "")
+ return (string) GetBoundPropertyValue (bin.TargetField);
+ return bin.Target;
+ }
+ }
+ return "";
+ }
+ set {
+ ViewState ["Target"] = value;
+ }
+ }
+
+ [Localizable (true)]
+ [DefaultValue ("")]
+ [WebSysDescription ("The display text of the tree node.")]
+ public virtual string Text {
+ get {
+ object o = ViewState ["Text"];
+ if (o != null) return (string)o;
+ if (DataBound) {
+ TreeNodeBinding bin = GetBinding ();
+ if (bin != null) {
+ string text;
+ if (bin.TextField != "")
+ text = (string) GetBoundPropertyValue (bin.TextField);
+ else if (bin.Text != "")
+ text = bin.Text;
+ else
+ text = hierarchyData.ToString ();
+
+ if (bin.FormatString.Length != 0)
+ text = string.Format (bin.FormatString, text);
+ return text;
+ }
+ return hierarchyData.ToString ();
+ }
+ return "";
+ }
+ set {
+ ViewState ["Text"] = value;
+ }
+ }
+
+ [Localizable (true)]
+ [DefaultValue ("")]
+ public virtual string ToolTip {
+ get {
+ object o = ViewState ["ToolTip"];
+ if(o != null) return (string)o;
+ if (DataBound) {
+ TreeNodeBinding bin = GetBinding ();
+ if (bin != null) {
+ if (bin.ToolTipField != "")
+ return (string) GetBoundPropertyValue (bin.ToolTipField);
+ return bin.ToolTip;
+ }
+ }
+ return "";
+ }
+ set {
+ ViewState ["ToolTip"] = value;
+ }
+ }
+
+ [Localizable (true)]
+ [DefaultValue ("")]
+ public virtual string Value {
+ get {
+ object o = ViewState ["Value"];
+ if(o != null) return (string)o;
+ if (DataBound) {
+ TreeNodeBinding bin = GetBinding ();
+ if (bin != null) {
+ if (bin.ValueField != "")
+ return (string) GetBoundPropertyValue (bin.ValueField);
+ if (bin.Value != "")
+ return bin.Value;
+ }
+ return hierarchyData.ToString ();
+ }
+ return "";
+ }
+ set {
+ ViewState ["Value"] = value;
+ }
+ }
+
+ [DefaultValue (false)]
+ public virtual bool Selected {
+ get {
+ return SelectedFlag;
+ }
+ set {
+ if (tree != null) {
+ if (!value && tree.SelectedNode == this)
+ tree.SetSelectedNode (null, false);
+ else if (value)
+ tree.SetSelectedNode (this, false);
+ }
+ else
+ SelectedFlag = value;
+ }
+ }
+
+ internal virtual bool SelectedFlag {
+ get {
+ object o = ViewState ["Selected"];
+ if(o != null) return (bool)o;
+ return false;
+ }
+ set {
+ ViewState ["Selected"] = value;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public TreeNode Parent {
+ get { return parent; }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public string ValuePath {
+ get {
+ if (tree == null) return Value;
+
+ StringBuilder sb = new StringBuilder (Value);
+ TreeNode node = parent;
+ while (node != null) {
+ sb.Insert (0, tree.PathSeparator);
+ sb.Insert (0, node.Value);
+ node = node.Parent;
+ }
+ return sb.ToString ();
+ }
+ }
+
+ internal int Index {
+ get { return index; }
+ set { index = value; ResetPathData (); }
+ }
+
+ internal void SetParent (TreeNode node) {
+ parent = node;
+ ResetPathData ();
+ }
+
+ internal string Path {
+ get {
+ if (path != null) return path;
+ StringBuilder sb = new StringBuilder (index.ToString());
+ TreeNode node = parent;
+ while (node != null) {
+ sb.Insert (0, '_');
+ sb.Insert (0, node.Index.ToString ());
+ node = node.Parent;
+ }
+ path = sb.ToString ();
+ return path;
+ }
+ }
+
+ internal bool Populated {
+ get {
+ object o = ViewState ["Populated"];
+ if (o != null) return (bool) o;
+ return false;
+ }
+ set {
+ ViewState ["Populated"] = value;
+ }
+ }
+
+ internal bool HasChildData {
+ get { return nodes != null; }
+ }
+
+ protected virtual void Populate ()
+ {
+ tree.NotifyPopulateRequired (this);
+ }
+
+ public void Collapse ()
+ {
+ Expanded = false;
+ }
+
+ public void CollapseAll ()
+ {
+ SetExpandedRec (false, -1);
+ }
+
+ public void Expand ()
+ {
+ Expanded = true;
+ }
+
+ internal void Expand (int depth)
+ {
+ SetExpandedRec (true, depth);
+ }
+
+ public void ExpandAll ()
+ {
+ SetExpandedRec (true, -1);
+ }
+
+ void SetExpandedRec (bool expanded, int depth)
+ {
+ Expanded = expanded;
+ if (depth == 0) return;
+
+ foreach (TreeNode nod in ChildNodes)
+ nod.SetExpandedRec (expanded, depth - 1);
+ }
+
+ public void Select ()
+ {
+ Selected = true;
+ }
+
+ public void ToggleExpandState ()
+ {
+ Expanded = !Expanded;
+ }
+
+ public void LoadViewState (object savedState)
+ {
+ if (savedState == null)
+ return;
+
+ object[] states = (object[]) savedState;
+ ViewState.LoadViewState (states [0]);
+
+ if (tree != null && SelectedFlag)
+ tree.SetSelectedNode (this, true);
+
+ if (!PopulateOnDemand || Populated)
+ ((IStateManager)ChildNodes).LoadViewState (states [1]);
+ }
+
+ public object SaveViewState ()
+ {
+ object[] states = new object[2];
+ states[0] = ViewState.SaveViewState();
+ states[1] = (nodes == null ? null : ((IStateManager)nodes).SaveViewState());
+
+ for (int i = 0; i < states.Length; i++) {
+ if (states [i] != null)
+ return states;
+ }
+ return null;
+ }
+
+ public void TrackViewState ()
+ {
+ if (marked) return;
+ marked = true;
+ ViewState.TrackViewState();
+
+ if (nodes != null)
+ ((IStateManager)nodes).TrackViewState ();
+ }
+
+ public bool IsTrackingViewState
+ {
+ get { return marked; }
+ }
+
+ internal void SetDirty ()
+ {
+ ViewState.SetDirty ();
+ }
+
+ public object Clone ()
+ {
+ TreeNode nod = new TreeNode ();
+ foreach (DictionaryEntry e in ViewState)
+ nod.ViewState [(string)e.Key] = e.Value;
+
+ foreach (TreeNode c in ChildNodes)
+ nod.ChildNodes.Add ((TreeNode)c.Clone ());
+
+ return nod;
+ }
+
+ internal void Bind (IHierarchyData hierarchyData)
+ {
+ this.hierarchyData = hierarchyData;
+ }
+
+ internal bool IsParentNode {
+ get { return ChildNodes.Count > 0 && Parent != null; }
+ }
+
+ internal bool IsLeafNode {
+ get { return ChildNodes.Count == 0; }
+ }
+
+ internal bool IsRootNode {
+ get { return ChildNodes.Count > 0 && Parent == null; }
+ }
+
+ TreeNodeBinding GetBinding ()
+ {
+ if (tree == null) return null;
+ if (gotBinding) return binding;
+ binding = tree.FindBindingForNode (hierarchyData.Type, Depth);
+ gotBinding = true;
+ return binding;
+ }
+
+ object GetBoundPropertyValue (string name)
+ {
+ if (boundProperties == null)
+ boundProperties = TypeDescriptor.GetProperties (hierarchyData);
+
+ PropertyDescriptor prop = boundProperties.Find (name, true);
+ if (prop == null)
+ throw new InvalidOperationException ("Property '" + name + "' not found in data bound item");
+ return prop.GetValue (hierarchyData);
+ }
+
+ void FillBoundChildren ()
+ {
+ nodes = new TreeNodeCollection (this);
+ if (!hierarchyData.HasChildren) return;
+ if (tree.MaxDataBindDepth != -1 && Depth >= tree.MaxDataBindDepth) return;
+
+ IHierarchicalEnumerable e = hierarchyData.GetChildren ();
+ foreach (object obj in e) {
+ IHierarchyData hdata = e.GetHierarchyData (obj);
+ TreeNode node = new TreeNode ();
+ node.Bind (hdata);
+ nodes.Add (node);
+ }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeBinding.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeBinding.cs
new file mode 100644
index 00000000000..7caebca6a7c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeBinding.cs
@@ -0,0 +1,344 @@
+//
+// System.Web.UI.WebControls.TreeNodeBinding.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty ("TextField")]
+ public sealed class TreeNodeBinding: IStateManager, ICloneable, IDataSourceViewSchemaAccessor
+ {
+ StateBag ViewState = new StateBag ();
+
+ [DefaultValue ("")]
+ public string DataMember {
+ get {
+ object o = ViewState ["DataMember"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["DataMember"] = value;
+ }
+ }
+
+ [DefaultValue (-1)]
+ public int Depth {
+ get {
+ object o = ViewState ["Depth"];
+ if (o != null) return (int) o;
+ return -1;
+ }
+ set {
+ ViewState ["Depth"] = value;
+ }
+ }
+
+ [Localizable (true)]
+ [DefaultValue ("")]
+ [UrlProperty]
+ public string FormatString {
+ get {
+ object o = ViewState ["FormatString"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["FormatString"] = value;
+ }
+ }
+
+ [Localizable (true)]
+ [DefaultValue ("")]
+ public string ImageToolTip {
+ get {
+ object o = ViewState ["ImageToolTip"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["ImageToolTip"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
+ public string ImageToolTipField {
+ get {
+ object o = ViewState ["ImageToolTipField"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["ImageToolTipField"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public string ImageUrl {
+ get {
+ object o = ViewState ["ImageUrl"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["ImageUrl"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
+ public string ImageUrlField {
+ get {
+ object o = ViewState ["ImageUrlField"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["ImageUrlField"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [Editor ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public string NavigateUrl {
+ get {
+ object o = ViewState ["NavigateUrl"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["NavigateUrl"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
+ public string NavigateUrlField {
+ get {
+ object o = ViewState ["NavigateUrlField"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["NavigateUrlField"] = value;
+ }
+ }
+
+ [DefaultValue (false)]
+ public bool PopulateOnDemand {
+ get {
+ object o = ViewState ["PopulateOnDemand"];
+ if (o != null) return (bool) o;
+ return false;
+ }
+ set {
+ ViewState ["PopulateOnDemand"] = value;
+ }
+ }
+
+ [DefaultValue (TreeNodeSelectAction.Select)]
+ public TreeNodeSelectAction SelectAction {
+ get {
+ object o = ViewState ["SelectAction"];
+ if (o != null) return (TreeNodeSelectAction)o;
+ return TreeNodeSelectAction.Select;
+ }
+ set {
+ ViewState ["SelectAction"] = value;
+ }
+ }
+
+ [DefaultValue (false)]
+ public bool ShowCheckBox {
+ get {
+ object o = ViewState ["ShowCheckBox"];
+ if (o != null) return (bool)o;
+ return false;
+ }
+ set {
+ ViewState ["ShowCheckBox"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ public string Target {
+ get {
+ object o = ViewState ["Target"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["Target"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
+ public string TargetField {
+ get {
+ object o = ViewState ["TargetField"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["TargetField"] = value;
+ }
+ }
+
+ [Localizable (true)]
+ [DefaultValue ("")]
+ [WebSysDescription ("The display text of the tree node.")]
+ public string Text {
+ get {
+ object o = ViewState ["Text"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["Text"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
+ public string TextField {
+ get {
+ object o = ViewState ["TextField"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["TextField"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [Localizable (true)]
+ public string ToolTip {
+ get {
+ object o = ViewState ["ToolTip"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["ToolTip"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
+ public string ToolTipField {
+ get {
+ object o = ViewState ["ToolTipField"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["ToolTipField"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [Localizable (true)]
+ public string Value {
+ get {
+ object o = ViewState ["Value"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["Value"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
+ public string ValueField {
+ get {
+ object o = ViewState ["ValueField"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["ValueField"] = value;
+ }
+ }
+
+ void IStateManager.LoadViewState (object savedState)
+ {
+ ViewState.LoadViewState (savedState);
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ return ViewState.SaveViewState();
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ ViewState.TrackViewState ();
+ }
+
+ bool IStateManager.IsTrackingViewState {
+ get { return ViewState.IsTrackingViewState; }
+ }
+
+ [MonoTODO]
+ object IDataSourceViewSchemaAccessor.DataSourceViewSchema {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ object ICloneable.Clone ()
+ {
+ TreeNodeBinding bin = new TreeNodeBinding ();
+ foreach (DictionaryEntry e in ViewState)
+ bin.ViewState [(string)e.Key] = e.Value;
+ return bin;
+ }
+
+ internal void SetDirty ()
+ {
+ foreach (string key in ViewState.Keys)
+ ViewState.SetItemDirty (key, true);
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeBindingCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeBindingCollection.cs
new file mode 100644
index 00000000000..4763e0ed182
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeBindingCollection.cs
@@ -0,0 +1,104 @@
+//
+// System.Web.UI.WebControls.TreeNodeBindingCollection.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class TreeNodeBindingCollection: StateManagedCollection
+ {
+ static Type[] types = new Type[] { typeof (TreeNodeBinding) };
+
+ internal TreeNodeBindingCollection ()
+ {
+ }
+
+ public int Add (TreeNodeBinding binding)
+ {
+ return ((IList)this).Add (binding);
+ }
+
+ public bool Contains (TreeNodeBinding binding)
+ {
+ return ((IList)this).Contains (binding);
+ }
+
+ public void CopyTo (TreeNodeBinding[] array, int index)
+ {
+ ((IList)this).CopyTo (array, index);
+ }
+
+ protected override object CreateKnownType (int index)
+ {
+ return new TreeNodeBinding ();
+ }
+
+ protected override Type[] GetKnownTypes ()
+ {
+ return types;
+ }
+
+ public int IndexOf (TreeNodeBinding binding)
+ {
+ return ((IList)this).IndexOf (binding);
+ }
+
+ public void Insert (int index, TreeNodeBinding binding)
+ {
+ ((IList)this).Insert (index, binding);
+ }
+
+ public void Remove (TreeNodeBinding binding)
+ {
+ ((IList)this).Remove (binding);
+ }
+
+ public void RemoveAt (int index)
+ {
+ ((IList)this).RemoveAt (index);
+ }
+
+ public TreeNodeBinding this [int i] {
+ get { return (TreeNodeBinding) ((IList)this) [i]; }
+ set { ((IList)this) [i] = value; }
+ }
+
+ protected override void SetDirtyObject (object o)
+ {
+ ((TreeNodeBinding)o).SetDirty ();
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeCollection.cs
new file mode 100644
index 00000000000..79899ead9a6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeCollection.cs
@@ -0,0 +1,243 @@
+//
+// System.Web.UI.WebControls.TreeNodeCollection.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Web.UI;
+using System.Collections;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class TreeNodeCollection: ICollection, IEnumerable, IStateManager
+ {
+ TreeNode[] originalItems;
+ ArrayList items = new ArrayList ();
+ TreeView tree;
+ TreeNode parent;
+ bool marked;
+ bool dirty;
+
+ public TreeNodeCollection ()
+ {
+ }
+
+ public TreeNodeCollection (TreeNode owner)
+ {
+ this.parent = owner;
+ this.tree = owner.Tree;
+ }
+
+ internal TreeNodeCollection (TreeView tree)
+ {
+ this.tree = tree;
+ }
+
+ internal void SetTree (TreeView tree)
+ {
+ this.tree = tree;
+ foreach (TreeNode node in items)
+ node.Tree = tree;
+ }
+
+ public TreeNode this [int i] {
+ get { return (TreeNode) items [i]; }
+ }
+
+ public void Add (TreeNode child)
+ {
+ child.Index = items.Add (child);
+ child.Tree = tree;
+ child.SetParent (parent);
+ if (marked) {
+ child.TrackViewState ();
+ child.SetDirty ();
+ dirty = true;
+ }
+ }
+
+ public void AddAt (int index, TreeNode child)
+ {
+ items.Insert (index, child);
+ child.Index = index;
+ child.Tree = tree;
+ child.SetParent (parent);
+ for (int n=index+1; n<items.Count; n++)
+ ((TreeNode)items[n]).Index = n;
+ if (marked) {
+ child.TrackViewState ();
+ child.SetDirty ();
+ dirty = true;
+ }
+ }
+
+ public void Clear ()
+ {
+ if (tree != null || parent != null) {
+ foreach (TreeNode nod in items) {
+ nod.Tree = null;
+ nod.SetParent (null);
+ }
+ }
+ items.Clear ();
+ dirty = true;
+ }
+
+ public bool Contains (TreeNode child)
+ {
+ return items.Contains (child);
+ }
+
+ public void CopyTo (TreeNode[] nodeArray, int index)
+ {
+ items.CopyTo (nodeArray, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return items.GetEnumerator ();
+ }
+
+ public int IndexOf (TreeNode node)
+ {
+ return items.IndexOf (node);
+ }
+
+ public void Remove (TreeNode node)
+ {
+ int i = IndexOf (node);
+ if (i == -1) return;
+ items.RemoveAt (i);
+ if (tree != null)
+ node.Tree = null;
+ dirty = true;
+ }
+
+ public void RemoveAt (int index)
+ {
+ TreeNode node = (TreeNode) items [index];
+ items.RemoveAt (index);
+ if (tree != null)
+ node.Tree = null;
+ dirty = true;
+ }
+
+ public int Count {
+ get { return items.Count; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public object SyncRoot {
+ get { return items; }
+ }
+
+ void System.Collections.ICollection.CopyTo (Array array, int index)
+ {
+ items.CopyTo (array, index);
+ }
+
+ void IStateManager.LoadViewState (object state)
+ {
+ if (state == null) return;
+ object[] its = (object[]) state;
+
+ dirty = (bool)its [0];
+
+ if (dirty)
+ items.Clear ();
+
+ for (int n=1; n<its.Length; n++) {
+ Pair pair = (Pair) its [n];
+ int oi = (int) pair.First;
+ TreeNode node;
+ if (oi != -1) node = originalItems [oi];
+ else node = new TreeNode ();
+ if (dirty) Add (node);
+ node.LoadViewState (pair.Second);
+ }
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ object[] state = null;
+ bool hasData = false;
+
+ if (dirty) {
+ state = new object [items.Count + 1];
+ state [0] = true;
+ for (int n=0; n<items.Count; n++) {
+ TreeNode node = items[n] as TreeNode;
+ int oi = Array.IndexOf (originalItems, node);
+ object ns = node.SaveViewState ();
+ if (ns != null) hasData = true;
+ state [n + 1] = new Pair (oi, ns);
+ }
+ } else {
+ ArrayList list = new ArrayList ();
+ for (int n=0; n<items.Count; n++) {
+ TreeNode node = items[n] as TreeNode;
+ object ns = node.SaveViewState ();
+ if (ns != null) {
+ hasData = true;
+ list.Add (new Pair (n, ns));
+ }
+ }
+ if (hasData) {
+ list.Insert (0, false);
+ state = list.ToArray ();
+ }
+ }
+
+ if (hasData)
+ return state;
+ else
+ return null;
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ marked = true;
+ originalItems = new TreeNode [items.Count];
+ for (int n=0; n<items.Count; n++) {
+ originalItems [n] = (TreeNode) items [n];
+ originalItems [n].TrackViewState ();
+ }
+ }
+
+ bool IStateManager.IsTrackingViewState {
+ get { return marked; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeEventArgs.cs
new file mode 100644
index 00000000000..1c9125ceb31
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeEventArgs.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.UI.WebControls.TreeNodeEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class TreeNodeEventArgs : EventArgs
+ {
+ private TreeNode node;
+
+ public TreeNodeEventArgs (TreeNode node)
+ {
+ this.node = node;
+ }
+
+ public TreeNode Node {
+ get { return node; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeEventHandler.cs
new file mode 100644
index 00000000000..3cd413d480b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.TreeNodeEventHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void TreeNodeEventHandler (object source, TreeNodeEventArgs e);
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeSelectAction.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeSelectAction.cs
new file mode 100644
index 00000000000..ee8153aad9e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeSelectAction.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.UI.WebControls.TreeNodeSelectAction.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum TreeNodeSelectAction {
+ Select = 0,
+ Expand = 1,
+ SelectExpand = 2,
+ None = 3
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeStyle.cs
new file mode 100644
index 00000000000..329014564a0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeStyle.cs
@@ -0,0 +1,199 @@
+//
+// System.Web.UI.WebControls.TreeNodeStyle.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class TreeNodeStyle: Style
+ {
+ private static int CHILD_PADD = (0x01 << 16);
+ private static int HORZ_PADD = (0x01 << 17);
+ private static int IMG_URL = (0x01 << 18);
+ private static int SPACING = (0x01 << 19);
+ private static int VERT_PADD = (0x01 << 20);
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [NotifyParentProperty (true)]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public string ImageUrl {
+ get {
+ if(IsSet(IMG_URL))
+ return (string)(ViewState["ImageUrl"]);
+ return String.Empty;
+ }
+ set {
+ if(value == null)
+ throw new ArgumentNullException("value");
+ ViewState["ImageUrl"] = value;
+ Set(IMG_URL);
+ }
+ }
+
+ [DefaultValue (0)]
+ [NotifyParentProperty (true)]
+ public int ChildNodesPadding {
+ get {
+ if(IsSet(CHILD_PADD))
+ return (int)(ViewState["ChildNodesPadding"]);
+ return 0;
+ }
+ set {
+ ViewState["ChildNodesPadding"] = value;
+ Set(CHILD_PADD);
+ }
+ }
+
+ [DefaultValue (0)]
+ [NotifyParentProperty (true)]
+ public int HorizontalPadding {
+ get {
+ if(IsSet(HORZ_PADD))
+ return (int)(ViewState["HorizontalPadding"]);
+ return 0;
+ }
+ set {
+ ViewState["HorizontalPadding"] = value;
+ Set(HORZ_PADD);
+ }
+ }
+
+ [DefaultValue (0)]
+ [NotifyParentProperty (true)]
+ public int VerticalPadding {
+ get {
+ if(IsSet(VERT_PADD))
+ return (int)(ViewState["VerticalPadding"]);
+ return 0;
+ }
+ set {
+ ViewState["VerticalPadding"] = value;
+ Set(VERT_PADD);
+ }
+ }
+
+ [DefaultValue (0)]
+ [NotifyParentProperty (true)]
+ public int NodeSpacing {
+ get {
+ if(IsSet(SPACING))
+ return (int)(ViewState["NodeSpacing"]);
+ return 0;
+ }
+ set {
+ ViewState["NodeSpacing"] = value;
+ Set(SPACING);
+ }
+ }
+
+ protected internal override bool IsEmpty {
+ get { return base.IsEmpty; }
+ }
+
+ public override void CopyFrom (Style s)
+ {
+ if (s == null || s.IsEmpty)
+ return;
+
+ base.CopyFrom (s);
+ TreeNodeStyle from = s as TreeNodeStyle;
+ if (from == null)
+ return;
+
+ if (from.IsSet (CHILD_PADD))
+ ChildNodesPadding = from.ChildNodesPadding;
+
+ if (from.IsSet (HORZ_PADD))
+ HorizontalPadding = from.HorizontalPadding;
+
+ if (from.IsSet (IMG_URL))
+ ImageUrl = from.ImageUrl;
+
+ if (from.IsSet (SPACING))
+ NodeSpacing = from.NodeSpacing;
+
+ if (from.IsSet (VERT_PADD))
+ VerticalPadding = from.VerticalPadding;
+ }
+
+ public override void MergeWith(Style s)
+ {
+ if(s != null && !s.IsEmpty)
+ {
+ if (IsEmpty) {
+ CopyFrom (s);
+ return;
+ }
+ base.MergeWith(s);
+
+ TreeNodeStyle with = s as TreeNodeStyle;
+ if (with == null) return;
+
+ if (with.IsSet(CHILD_PADD) && !IsSet(CHILD_PADD)) {
+ ChildNodesPadding = with.ChildNodesPadding;
+ }
+ if (with.IsSet(HORZ_PADD) && !IsSet(HORZ_PADD)) {
+ HorizontalPadding = with.HorizontalPadding;
+ }
+ if (with.IsSet(IMG_URL) && !IsSet(IMG_URL)) {
+ ImageUrl = with.ImageUrl;
+ }
+ if (with.IsSet(SPACING) && !IsSet(SPACING)) {
+ NodeSpacing = with.NodeSpacing;
+ }
+ if (with.IsSet(VERT_PADD) && !IsSet(VERT_PADD)) {
+ VerticalPadding = with.VerticalPadding;
+ }
+ }
+ }
+
+ public override void Reset()
+ {
+ if(IsSet(CHILD_PADD))
+ ViewState.Remove("ChildNodesPadding");
+ if(IsSet(HORZ_PADD))
+ ViewState.Remove("HorizontalPadding");
+ if(IsSet(IMG_URL))
+ ViewState.Remove("ImageUrl");
+ if(IsSet(SPACING))
+ ViewState.Remove("NodeSpacing");
+ if(IsSet(VERT_PADD))
+ ViewState.Remove("VerticalPadding");
+ base.Reset();
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeStyleCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeStyleCollection.cs
new file mode 100644
index 00000000000..73d421a96b6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeStyleCollection.cs
@@ -0,0 +1,104 @@
+//
+// System.Web.UI.WebControls.TreeNodeStyleCollection.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class TreeNodeStyleCollection: StateManagedCollection
+ {
+ static Type[] types = new Type[] { typeof (TreeNodeStyle) };
+
+ internal TreeNodeStyleCollection ()
+ {
+ }
+
+ public int Add (TreeNodeStyle style)
+ {
+ return ((IList)this).Add (style);
+ }
+
+ public bool Contains (TreeNodeStyle style)
+ {
+ return ((IList)this).Contains (style);
+ }
+
+ public void CopyTo (TreeNodeStyle[] array, int index)
+ {
+ ((IList)this).CopyTo (array, index);
+ }
+
+ protected override object CreateKnownType (int index)
+ {
+ return new TreeNodeStyle ();
+ }
+
+ protected override Type[] GetKnownTypes ()
+ {
+ return types;
+ }
+
+ public int IndexOf (TreeNodeStyle style)
+ {
+ return ((IList)this).IndexOf (style);
+ }
+
+ public void Insert (int index, TreeNodeStyle style)
+ {
+ ((IList)this).Insert (index, style);
+ }
+
+ public void Remove (TreeNodeStyle style)
+ {
+ ((IList)this).Remove (style);
+ }
+
+ public void RemoveAt (int index)
+ {
+ ((IList)this).RemoveAt (index);
+ }
+
+ public TreeNodeStyle this [int i] {
+ get { return (TreeNodeStyle) ((IList)this) [i]; }
+ set { ((IList)this) [i] = value; }
+ }
+
+ protected override void SetDirtyObject (object o)
+ {
+ ((TreeNodeStyle)o).SetDirty ();
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeTypes.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeTypes.cs
new file mode 100644
index 00000000000..f02fdf5bcb6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeTypes.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.UI.WebControls.TreeNodeTypes.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ [FlagsAttribute]
+ public enum TreeNodeTypes {
+ None = 0,
+ Root = 1,
+ Parent = 2,
+ Leaf = 4,
+ All = 7
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TreeView.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TreeView.cs
new file mode 100644
index 00000000000..a95078ee3d2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TreeView.cs
@@ -0,0 +1,1371 @@
+//
+// System.Web.UI.WebControls.TreeView.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Text;
+using System.ComponentModel;
+using System.Web.UI;
+using System.Web.Handlers;
+using System.Collections.Specialized;
+using System.IO;
+
+namespace System.Web.UI.WebControls
+{
+ [ControlValueProperty ("SelectedValue")]
+ [DefaultEvent ("SelectedNodeChanged")]
+ public class TreeView: HierarchicalDataBoundControl, IPostBackEventHandler, IPostBackDataHandler, ICallbackEventHandler
+ {
+ Style hoverNodeStyle;
+ TreeNodeStyle leafNodeStyle;
+ TreeNodeStyle nodeStyle;
+ TreeNodeStyle parentNodeStyle;
+ TreeNodeStyle rootNodeStyle;
+ TreeNodeStyle selectedNodeStyle;
+
+ TreeNodeStyleCollection levelStyles;
+ TreeNodeCollection nodes;
+ TreeNodeBindingCollection dataBindings;
+
+ TreeNode selectedNode;
+ Hashtable bindings;
+
+ private static readonly object TreeNodeCheckChangedEvent = new object();
+ private static readonly object SelectedNodeChangedEvent = new object();
+ private static readonly object TreeNodeCollapsedEvent = new object();
+ private static readonly object TreeNodeDataBoundEvent = new object();
+ private static readonly object TreeNodeExpandedEvent = new object();
+ private static readonly object TreeNodePopulateEvent = new object();
+
+ static Hashtable imageStyles = new Hashtable ();
+
+ class ImageStyle
+ {
+ public ImageStyle (string expand, string collapse, string noExpand, string icon, string iconLeaf, string iconRoot) {
+ Expand = expand;
+ Collapse = collapse;
+ NoExpand = noExpand;
+ RootIcon = iconRoot;
+ ParentIcon = icon;
+ LeafIcon = iconLeaf;
+ }
+
+ public string Expand;
+ public string Collapse;
+ public string NoExpand;
+ public string RootIcon;
+ public string ParentIcon;
+ public string LeafIcon;
+ }
+
+ static TreeView ()
+ {
+ imageStyles [TreeViewImageSet.Arrows] = new ImageStyle ("arrow_plus", "arrow_minus", "arrow_noexpand", null, null, null);
+ imageStyles [TreeViewImageSet.BulletedList] = new ImageStyle (null, null, null, "dot_full", "dot_empty", "dot_full");
+ imageStyles [TreeViewImageSet.BulletedList2] = new ImageStyle (null, null, null, "box_full", "box_empty", "box_full");
+ imageStyles [TreeViewImageSet.BulletedList3] = new ImageStyle (null, null, null, "star_full", "star_empty", "star_full");
+ imageStyles [TreeViewImageSet.BulletedList4] = new ImageStyle (null, null, null, "star_full", "star_empty", "dots");
+ imageStyles [TreeViewImageSet.Contacts] = new ImageStyle ("TreeView_plus", "TreeView_minus", "contact", null, null, null);
+ imageStyles [TreeViewImageSet.Events] = new ImageStyle ("TreeView_plus", "TreeView_minus", "TreeView_noexpand", null, "warning", null);
+ imageStyles [TreeViewImageSet.Inbox] = new ImageStyle ("TreeView_plus", "TreeView_minus", "TreeView_noexpand", "inbox", "inbox", "inbox");
+ imageStyles [TreeViewImageSet.Msdn] = new ImageStyle ("box_plus", "box_minus", "box_noexpand", null, null, null);
+ imageStyles [TreeViewImageSet.Simple] = new ImageStyle ("TreeView_plus", "TreeView_minus", "box_full", null, null, null);
+ imageStyles [TreeViewImageSet.Simple2] = new ImageStyle ("TreeView_plus", "TreeView_minus", "box_empty", null, null, null);
+
+ // TODO
+ imageStyles [TreeViewImageSet.News] = new ImageStyle ("TreeView_plus", "TreeView_minus", "TreeView_noexpand", null, null, null);
+ imageStyles [TreeViewImageSet.Faq] = new ImageStyle ("TreeView_plus", "TreeView_minus", "TreeView_noexpand", null, null, null);
+ imageStyles [TreeViewImageSet.WindowsHelp] = new ImageStyle ("TreeView_plus", "TreeView_minus", "TreeView_noexpand", null, null, null);
+ imageStyles [TreeViewImageSet.XPFileExplorer] = new ImageStyle ("TreeView_plus", "TreeView_minus", "TreeView_noexpand", null, null, null);
+ }
+
+ public event TreeNodeEventHandler TreeNodeCheckChanged {
+ add { Events.AddHandler (TreeNodeCheckChangedEvent, value); }
+ remove { Events.RemoveHandler (TreeNodeCheckChangedEvent, value); }
+ }
+
+ public event EventHandler SelectedNodeChanged {
+ add { Events.AddHandler (SelectedNodeChangedEvent, value); }
+ remove { Events.RemoveHandler (SelectedNodeChangedEvent, value); }
+ }
+
+ public event TreeNodeEventHandler TreeNodeCollapsed {
+ add { Events.AddHandler (TreeNodeCollapsedEvent, value); }
+ remove { Events.RemoveHandler (TreeNodeCollapsedEvent, value); }
+ }
+
+ public event TreeNodeEventHandler TreeNodeDataBound {
+ add { Events.AddHandler (TreeNodeDataBoundEvent, value); }
+ remove { Events.RemoveHandler (TreeNodeDataBoundEvent, value); }
+ }
+
+ public event TreeNodeEventHandler TreeNodeExpanded {
+ add { Events.AddHandler (TreeNodeExpandedEvent, value); }
+ remove { Events.RemoveHandler (TreeNodeExpandedEvent, value); }
+ }
+
+ public event TreeNodeEventHandler TreeNodePopulate {
+ add { Events.AddHandler (TreeNodePopulateEvent, value); }
+ remove { Events.RemoveHandler (TreeNodePopulateEvent, value); }
+ }
+
+ protected virtual void OnTreeNodeCheckChanged (TreeNodeEventArgs e)
+ {
+ if (Events != null) {
+ TreeNodeEventHandler eh = (TreeNodeEventHandler) Events [TreeNodeCheckChangedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnSelectedNodeChanged (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) Events [SelectedNodeChangedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnTreeNodeCollapsed (TreeNodeEventArgs e)
+ {
+ if (Events != null) {
+ TreeNodeEventHandler eh = (TreeNodeEventHandler) Events [TreeNodeCollapsedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnTreeNodeDataBound (TreeNodeEventArgs e)
+ {
+ if (Events != null) {
+ TreeNodeEventHandler eh = (TreeNodeEventHandler) Events [TreeNodeDataBoundEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnTreeNodeExpanded (TreeNodeEventArgs e)
+ {
+ if (Events != null) {
+ TreeNodeEventHandler eh = (TreeNodeEventHandler) Events [TreeNodeExpandedEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnTreeNodePopulate (TreeNodeEventArgs e)
+ {
+ if (Events != null) {
+ TreeNodeEventHandler eh = (TreeNodeEventHandler) Events [TreeNodePopulateEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+
+ [Localizable (true)]
+ public virtual string CollapseImageToolTip {
+ get {
+ object o = ViewState ["CollapseImageToolTip"];
+ if (o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState["CollapseImageToolTip"] = value;
+ }
+ }
+
+ [MonoTODO ("Implement support for this")]
+ [WebCategory ("Behavior")]
+ [WebSysDescription ("Whether the tree will automatically generate bindings.")]
+ [DefaultValue (true)]
+ public virtual bool AutoGenerateDataBindings {
+ get {
+ object o = ViewState ["AutoGenerateDataBindings"];
+ if (o != null) return (bool)o;
+ return true;
+ }
+ set {
+ ViewState["AutoGenerateDataBindings"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [WebSysDescription ("The url of the image to show when a node can be collapsed.")]
+ [UrlProperty]
+ [WebCategory ("Appearance")]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual string CollapseImageUrl {
+ get {
+ object o = ViewState ["CollapseImageUrl"];
+ if (o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState["CollapseImageUrl"] = value;
+ }
+ }
+
+ [WebCategory ("Data")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("Bindings for tree nodes.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [Editor ("System.Web.UI.Design.TreeViewBindingsEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual TreeNodeBindingCollection DataBindings {
+ get {
+ if (dataBindings == null) {
+ dataBindings = new TreeNodeBindingCollection ();
+ if (IsTrackingViewState)
+ ((IStateManager)dataBindings).TrackViewState();
+ }
+ return dataBindings;
+ }
+ }
+
+ [WebCategory ("Behavior")]
+ [WebSysDescription ("Whether the tree view can use client-side script to expand and collapse nodes.")]
+ [Themeable (false)]
+ [DefaultValue (true)]
+ public virtual bool EnableClientScript {
+ get {
+ object o = ViewState ["EnableClientScript"];
+ if (o != null) return (bool)o;
+ return true;
+ }
+ set {
+ ViewState["EnableClientScript"] = value;
+ }
+ }
+
+ [DefaultValue (-1)]
+ [WebCategory ("Behavior")]
+ [WebSysDescription ("The initial expand depth.")]
+ public virtual int ExpandDepth {
+ get {
+ object o = ViewState ["ExpandDepth"];
+ if (o != null) return (int)o;
+ return -1;
+ }
+ set {
+ ViewState["ExpandDepth"] = value;
+ }
+ }
+
+ [Localizable (true)]
+ public virtual string ExpandImageToolTip {
+ get {
+ object o = ViewState ["ExpandImageToolTip"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState["ExpandImageToolTip"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
+ [UrlProperty]
+ [WebSysDescription ("The url of the image to show when a node can be expanded.")]
+ [WebCategory ("Appearance")]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual string ExpandImageUrl {
+ get {
+ object o = ViewState ["ExpandImageUrl"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState["ExpandImageUrl"] = value;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [WebCategory ("Styles")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual Style HoverNodeStyle {
+ get {
+ if (hoverNodeStyle == null) {
+ hoverNodeStyle = new Style();
+ if (IsTrackingViewState)
+ hoverNodeStyle.TrackViewState();
+ }
+ return hoverNodeStyle;
+ }
+ }
+
+ [DefaultValue (TreeViewImageSet.Custom)]
+ public virtual TreeViewImageSet ImageSet {
+ get {
+ object o = ViewState ["ImageSet"];
+ if(o != null) return (TreeViewImageSet)o;
+ return TreeViewImageSet.Custom;
+ }
+ set {
+ ViewState["ImageSet"] = value;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [WebCategory ("Styles")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TreeNodeStyle LeafNodeStyle {
+ get {
+ if (leafNodeStyle == null) {
+ leafNodeStyle = new TreeNodeStyle ();
+ if (IsTrackingViewState)
+ leafNodeStyle.TrackViewState();
+ }
+ return leafNodeStyle;
+ }
+ }
+
+ [DefaultValue (null)]
+ [WebCategory ("Styles")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [Editor ("System.Web.UI.Design.TreeNodeStyleCollectionEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual TreeNodeStyleCollection LevelStyles {
+ get {
+ if (levelStyles == null) {
+ levelStyles = new TreeNodeStyleCollection ();
+ if (IsTrackingViewState)
+ ((IStateManager)levelStyles).TrackViewState();
+ }
+ return levelStyles;
+ }
+ }
+
+ [DefaultValue ("")]
+ public virtual string LineImagesFolder {
+ get {
+ object o = ViewState ["LineImagesFolder"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState["LineImagesFolder"] = value;
+ }
+ }
+
+ [DefaultValue (-1)]
+ public virtual int MaxDataBindDepth {
+ get {
+ object o = ViewState ["MaxDataBindDepth"];
+ if(o != null) return (int)o;
+ return -1;
+ }
+ set {
+ ViewState["MaxDataBindDepth"] = value;
+ }
+ }
+
+ [DefaultValue (20)]
+ public virtual int NodeIndent {
+ get {
+ object o = ViewState ["NodeIndent"];
+ if(o != null) return (int)o;
+ return 20;
+ }
+ set {
+ ViewState["NodeIndent"] = value;
+ }
+ }
+
+ [WebSysDescription ("The collection of nodes of the tree.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [Editor ("System.Web.UI.Design.TreeNodeCollectionEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual TreeNodeCollection Nodes {
+ get {
+ if (nodes == null) {
+ nodes = new TreeNodeCollection (this);
+ if (IsTrackingViewState)
+ ((IStateManager)nodes).TrackViewState();
+ }
+ return nodes;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [WebCategory ("Styles")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TreeNodeStyle NodeStyle {
+ get {
+ if (nodeStyle == null) {
+ nodeStyle = new TreeNodeStyle ();
+ if (IsTrackingViewState)
+ nodeStyle.TrackViewState();
+ }
+ return nodeStyle;
+ }
+ }
+
+ [DefaultValue (false)]
+ public virtual bool NodeWrap {
+ get {
+ object o = ViewState ["NodeWrap"];
+ if(o != null) return (bool)o;
+ return false;
+ }
+ set {
+ ViewState ["NodeWrap"] = value;
+ }
+ }
+
+ [UrlProperty]
+ [DefaultValue ("")]
+ [WebSysDescription ("The url of the image to show for leaf nodes.")]
+ [WebCategory ("Appearance")]
+ [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public virtual string NoExpandImageUrl {
+ get {
+ object o = ViewState ["NoExpandImageUrl"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["NoExpandImageUrl"] = value;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [WebCategory ("Styles")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TreeNodeStyle ParentNodeStyle {
+ get {
+ if (parentNodeStyle == null) {
+ parentNodeStyle = new TreeNodeStyle ();
+ if (IsTrackingViewState)
+ parentNodeStyle.TrackViewState();
+ }
+ return parentNodeStyle;
+ }
+ }
+
+ [DefaultValue ('/')]
+ public virtual char PathSeparator {
+ get {
+ object o = ViewState ["PathSeparator"];
+ if(o != null) return (char)o;
+ return '/';
+ }
+ set {
+ ViewState ["PathSeparator"] = value;
+ }
+ }
+
+ [DefaultValue (true)]
+ public virtual bool PopulateNodesFromClient {
+ get {
+ object o = ViewState ["PopulateNodesFromClient"];
+ if(o != null) return (bool)o;
+ return true;
+ }
+ set {
+ ViewState ["PopulateNodesFromClient"] = value;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [WebCategory ("Styles")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TreeNodeStyle RootNodeStyle {
+ get {
+ if (rootNodeStyle == null) {
+ rootNodeStyle = new TreeNodeStyle ();
+ if (IsTrackingViewState)
+ rootNodeStyle.TrackViewState();
+ }
+ return rootNodeStyle;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [NotifyParentProperty (true)]
+ [DefaultValue (null)]
+ [WebCategory ("Styles")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public virtual TreeNodeStyle SelectedNodeStyle {
+ get {
+ if (selectedNodeStyle == null) {
+ selectedNodeStyle = new TreeNodeStyle ();
+ if (IsTrackingViewState)
+ selectedNodeStyle.TrackViewState();
+ }
+ return selectedNodeStyle;
+ }
+ }
+
+ [DefaultValue (TreeNodeTypes.None)]
+ public virtual TreeNodeTypes ShowCheckBoxes {
+ get {
+ object o = ViewState ["ShowCheckBoxes"];
+ if(o != null) return (TreeNodeTypes) o;
+ return TreeNodeTypes.None;
+ }
+ set {
+ ViewState ["ShowCheckBoxes"] = value;
+ }
+ }
+
+ [DefaultValue (true)]
+ public virtual bool ShowExpandCollapse {
+ get {
+ object o = ViewState ["ShowExpandCollapse"];
+ if(o != null) return (bool)o;
+ return true;
+ }
+ set {
+ ViewState ["ShowExpandCollapse"] = value;
+ }
+ }
+
+ [DefaultValue (false)]
+ public virtual bool ShowLines {
+ get {
+ object o = ViewState ["ShowLines"];
+ if(o != null) return (bool)o;
+ return false;
+ }
+ set {
+ ViewState ["ShowLines"] = value;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public TreeNode SelectedNode {
+ get { return selectedNode; }
+ }
+
+ [Browsable (false)]
+ [DefaultValue ("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string SelectedValue {
+ get { return selectedNode != null ? selectedNode.Value : ""; }
+ }
+
+ [DefaultValue ("")]
+ public virtual string Target {
+ get {
+ object o = ViewState ["Target"];
+ if(o != null) return (string)o;
+ return "";
+ }
+ set {
+ ViewState ["Target"] = value;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public TreeNodeCollection CheckedNodes {
+ get {
+ TreeNodeCollection col = new TreeNodeCollection ();
+ FindCheckedNodes (Nodes, col);
+ return col;
+ }
+ }
+
+ void FindCheckedNodes (TreeNodeCollection nodeList, TreeNodeCollection result)
+ {
+ foreach (TreeNode node in nodeList) {
+ if (node.Checked) result.Add (node);
+ FindCheckedNodes (node.ChildNodes, result);
+ }
+ }
+
+ public void ExpandAll ()
+ {
+ foreach (TreeNode node in Nodes)
+ node.ExpandAll ();
+ }
+
+ public void CollapseAll ()
+ {
+ foreach (TreeNode node in Nodes)
+ node.CollapseAll ();
+ }
+
+ public TreeNode FindNode (string valuePath)
+ {
+ if (valuePath == null) throw new ArgumentNullException ("valuePath");
+ string[] path = valuePath.Split (PathSeparator);
+ int n = 0;
+ TreeNodeCollection col = Nodes;
+ bool foundBranch = true;
+ while (col.Count > 0 && foundBranch) {
+ foundBranch = false;
+ foreach (TreeNode node in col) {
+ if (node.Value == path [n]) {
+ if (++n == path.Length) return node;
+ col = node.ChildNodes;
+ foundBranch = true;
+ break;
+ }
+ }
+ }
+ return null;
+ }
+
+ ImageStyle GetImageStyle ()
+ {
+ if (ImageSet != TreeViewImageSet.Custom)
+ return (ImageStyle) imageStyles [ImageSet];
+ else
+ return null;
+ }
+
+ protected override HtmlTextWriterTag TagKey {
+ get { return HtmlTextWriterTag.Div; }
+ }
+
+ internal void SetSelectedNode (TreeNode node, bool loading)
+ {
+ if (selectedNode == node) return;
+ if (selectedNode != null)
+ selectedNode.SelectedFlag = false;
+ selectedNode = node;
+ selectedNode.SelectedFlag = true;
+ if (!loading)
+ OnSelectedNodeChanged (new TreeNodeEventArgs (selectedNode));
+ }
+
+ internal void NotifyCheckChanged (TreeNode node)
+ {
+ OnTreeNodeCheckChanged (new TreeNodeEventArgs (node));
+ }
+
+ internal void NotifyExpandedChanged (TreeNode node)
+ {
+ if (node.Expanded)
+ OnTreeNodeExpanded (new TreeNodeEventArgs (node));
+ else
+ OnTreeNodeCollapsed (new TreeNodeEventArgs (node));
+ }
+
+ internal void NotifyPopulateRequired (TreeNode node)
+ {
+ OnTreeNodePopulate (new TreeNodeEventArgs (node));
+ }
+
+ protected override void TrackViewState()
+ {
+ EnsureDataBound ();
+
+ base.TrackViewState();
+ if (hoverNodeStyle != null) {
+ hoverNodeStyle.TrackViewState();
+ }
+ if (leafNodeStyle != null) {
+ leafNodeStyle.TrackViewState();
+ }
+ if (levelStyles != null) {
+ ((IStateManager)levelStyles).TrackViewState();
+ }
+ if (nodeStyle != null) {
+ nodeStyle.TrackViewState();
+ }
+ if (parentNodeStyle != null) {
+ parentNodeStyle.TrackViewState();
+ }
+ if (rootNodeStyle != null) {
+ rootNodeStyle.TrackViewState();
+ }
+ if (selectedNodeStyle != null) {
+ selectedNodeStyle.TrackViewState();
+ }
+ if (dataBindings != null) {
+ ((IStateManager)dataBindings).TrackViewState ();
+ }
+ if (nodes != null) {
+ ((IStateManager)nodes).TrackViewState();;
+ }
+ }
+
+ protected override object SaveViewState()
+ {
+ object[] states = new object [10];
+ states[0] = base.SaveViewState();
+ states[1] = (hoverNodeStyle == null ? null : hoverNodeStyle.SaveViewState());
+ states[2] = (leafNodeStyle == null ? null : leafNodeStyle.SaveViewState());
+ states[3] = (levelStyles == null ? null : ((IStateManager)levelStyles).SaveViewState());
+ states[4] = (nodeStyle == null ? null : nodeStyle.SaveViewState());
+ states[5] = (parentNodeStyle == null ? null : parentNodeStyle.SaveViewState());
+ states[6] = (rootNodeStyle == null ? null : rootNodeStyle.SaveViewState());
+ states[7] = (selectedNodeStyle == null ? null : selectedNodeStyle.SaveViewState());
+ states[8] = (dataBindings == null ? null : ((IStateManager)dataBindings).SaveViewState());
+ states[9] = (nodes == null ? null : ((IStateManager)nodes).SaveViewState());
+
+ for (int i = states.Length - 1; i >= 0; i--) {
+ if (states [i] != null)
+ return states;
+ }
+
+ return null;
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState == null)
+ return;
+
+ object [] states = (object []) savedState;
+ base.LoadViewState (states[0]);
+
+ if (states[1] != null)
+ HoverNodeStyle.LoadViewState (states[1]);
+ if (states[2] != null)
+ LeafNodeStyle.LoadViewState(states[2]);
+ if (states[3] != null)
+ ((IStateManager)LevelStyles).LoadViewState(states[3]);
+ if (states[4] != null)
+ NodeStyle.LoadViewState(states[4]);
+ if (states[5] != null)
+ ParentNodeStyle.LoadViewState(states[5]);
+ if (states[6] != null)
+ RootNodeStyle.LoadViewState(states[6]);
+ if (states[7] != null)
+ SelectedNodeStyle.LoadViewState(states[7]);
+ if (states[8] != null)
+ ((IStateManager)DataBindings).LoadViewState(states[8]);
+ if (states[9] != null)
+ ((IStateManager)Nodes).LoadViewState(states[9]);
+ }
+
+ void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
+ {
+ string[] args = eventArgument.Split ('|');
+ TreeNode node = FindNodeByPos (args[1]);
+ if (node == null) return;
+
+ if (args [0] == "sel")
+ HandleSelectEvent (node);
+ else if (args [0] == "ec")
+ HandleExpandCollapseEvent (node);
+ }
+
+ void HandleSelectEvent (TreeNode node)
+ {
+ switch (node.SelectAction) {
+ case TreeNodeSelectAction.Select:
+ node.Select ();
+ break;
+ case TreeNodeSelectAction.Expand:
+ node.Expand ();
+ break;
+ case TreeNodeSelectAction.SelectExpand:
+ node.Select ();
+ node.Expand ();
+ break;
+ }
+ }
+
+ void HandleExpandCollapseEvent (TreeNode node)
+ {
+ node.ToggleExpandState ();
+ }
+
+ [MonoTODO]
+ bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+ {
+ Console.WriteLine ("LoadPostData " + postDataKey);
+ return true;
+ }
+
+ [MonoTODO]
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ Console.WriteLine ("RaisePostDataChangedEvent");
+ }
+
+ string ICallbackEventHandler.RaiseCallbackEvent (string eventArgs)
+ {
+ TreeNode node = FindNodeByPos (eventArgs);
+ ArrayList levelLines = new ArrayList ();
+ TreeNode nd = node;
+ while (nd != null) {
+ int childCount = nd.Parent != null ? nd.Parent.ChildNodes.Count : Nodes.Count;
+ levelLines.Insert (0, (nd.Index < childCount - 1) ? this : null);
+ nd = nd.Parent;
+ }
+
+ StringWriter sw = new StringWriter ();
+ HtmlTextWriter writer = new HtmlTextWriter (sw);
+
+ int num = node.ChildNodes.Count;
+ for (int n=0; n<num; n++)
+ RenderNode (writer, node.ChildNodes [n], node.Depth + 1, levelLines, true, n<num-1);
+
+ string res = sw.ToString ();
+ return res != "" ? res : "*";
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new EmptyControlCollection (this);
+ }
+
+ protected internal override void PerformDataBinding ()
+ {
+ base.PerformDataBinding ();
+ HierarchicalDataSourceView data = GetData ("");
+ IHierarchicalEnumerable e = data.Select ();
+ foreach (object obj in e) {
+ IHierarchyData hdata = e.GetHierarchyData (obj);
+ TreeNode node = new TreeNode ();
+ node.Bind (hdata);
+ Nodes.Add (node);
+ }
+ }
+
+ protected override void OnLoad (EventArgs e)
+ {
+ EnsureDataBound ();
+
+ if (!Page.IsPostBack && ExpandDepth != 0) {
+ foreach (TreeNode node in Nodes)
+ node.Expand (ExpandDepth - 1);
+ }
+
+ if (Page.IsPostBack) {
+ if (ShowCheckBoxes != TreeNodeTypes.None) {
+ UnsetCheckStates (Nodes, Context.Request.Form);
+ SetCheckStates (Context.Request.Form);
+ }
+
+ if (EnableClientScript) {
+ string states = Context.Request [ClientID + "_ExpandStates"];
+ if (states != null) {
+ string[] ids = states.Split ('|');
+ UnsetExpandStates (Nodes, ids);
+ SetExpandStates (ids);
+ }
+ else
+ UnsetExpandStates (Nodes, new string[0]);
+ }
+ }
+
+ base.OnLoad (e);
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+
+ if (EnableClientScript && !Page.ClientScript.IsClientScriptIncludeRegistered (typeof(TreeView), "TreeView.js")) {
+ string url = Page.ClientScript.GetWebResourceUrl (typeof(TreeView), "TreeView.js");
+ Page.ClientScript.RegisterClientScriptInclude (typeof(TreeView), "TreeView.js", url);
+
+ string ctree = ClientID + "_data";
+ string script = string.Format ("var {0} = new Object ();\n", ctree);
+ script += string.Format ("{0}.showImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (ShowExpandCollapse));
+
+ if (ShowExpandCollapse) {
+ bool defaultImages = ShowLines || ImageSet != TreeViewImageSet.Custom || (ExpandImageUrl == "" && CollapseImageUrl == "");
+ script += string.Format ("{0}.defaultImages = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (defaultImages));
+ ImageStyle imageStyle = GetImageStyle ();
+ if (!defaultImages) {
+ script += string.Format ("{0}.expandImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageUrl ("plus", imageStyle)));
+ script += string.Format ("{0}.collapseImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageUrl ("minus", imageStyle)));
+ }
+ if (PopulateNodesFromClient)
+ script += string.Format ("{0}.noExpandImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageUrl ("noexpand", imageStyle)));
+ }
+ script += string.Format ("{0}.populateFromClient = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (PopulateNodesFromClient));
+ script += string.Format ("{0}.expandAlt = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageToolTip (true, null)));
+ script += string.Format ("{0}.collapseAlt = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageToolTip (false, null)));
+ Page.ClientScript.RegisterStartupScript (typeof(TreeView), this.UniqueID, script, true);
+ }
+
+ if (EnableClientScript) {
+ Page.ClientScript.RegisterHiddenField (ClientID + "_ExpandStates", GetExpandStates ());
+
+ // Make sure the basic script infrastructure is rendered
+ Page.ClientScript.GetCallbackEventReference (this, "null", "", "null");
+ Page.ClientScript.GetPostBackClientHyperlink (this, "");
+ }
+
+ if (dataBindings != null && dataBindings.Count > 0) {
+ bindings = new Hashtable ();
+ foreach (TreeNodeBinding bin in dataBindings) {
+ string key = GetBindingKey (bin.DataMember, bin.Depth);
+ bindings [key] = bin;
+ }
+ }
+ else
+ bindings = null;
+ }
+
+ string GetBindingKey (string dataMember, int depth)
+ {
+ return dataMember + " " + depth;
+ }
+
+ internal TreeNodeBinding FindBindingForNode (string type, int depth)
+ {
+ if (bindings == null) return null;
+
+ TreeNodeBinding bin = (TreeNodeBinding) bindings [GetBindingKey (type, depth)];
+ if (bin != null) return bin;
+
+ bin = (TreeNodeBinding) bindings [GetBindingKey (type, -1)];
+ if (bin != null) return bin;
+
+ bin = (TreeNodeBinding) bindings [GetBindingKey ("", depth)];
+ if (bin != null) return bin;
+
+ bin = (TreeNodeBinding) bindings [GetBindingKey ("", -1)];
+ return bin;
+ }
+
+ protected override void RenderContents (HtmlTextWriter writer)
+ {
+ ArrayList levelLines = new ArrayList ();
+ int num = Nodes.Count;
+ for (int n=0; n<num; n++)
+ RenderNode (writer, Nodes [n], 0, levelLines, n>0, n<num-1);
+ }
+
+ void RenderNode (HtmlTextWriter writer, TreeNode node, int level, ArrayList levelLines, bool hasPrevious, bool hasNext)
+ {
+ string nodeImage;
+ bool clientExpand = EnableClientScript && Events [TreeNodeCollapsedEvent] == null && Events [TreeNodeExpandedEvent] == null;
+ ImageStyle imageStyle = GetImageStyle ();
+ bool renderChildNodes = node.Expanded;
+
+ if (clientExpand && !renderChildNodes)
+ renderChildNodes = (!PopulateNodesFromClient || HasChildInputData (node));
+
+ bool hasChildNodes;
+
+ if (renderChildNodes)
+ hasChildNodes = node.ChildNodes.Count > 0;
+ else
+ hasChildNodes = (node.PopulateOnDemand && !node.Populated) || node.ChildNodes.Count > 0;
+
+ writer.AddAttribute ("cellpadding", "0");
+ writer.AddAttribute ("cellspacing", "0");
+ writer.AddStyleAttribute ("border-width", "0");
+ writer.RenderBeginTag (HtmlTextWriterTag.Table);
+ writer.RenderBeginTag (HtmlTextWriterTag.Tr);
+
+ // Vertical lines from previous levels
+
+ for (int n=0; n<level; n++) {
+ writer.RenderBeginTag (HtmlTextWriterTag.Td);
+ if (ShowLines) {
+ if (levelLines [n] == null)
+ nodeImage = GetNodeImageUrl ("noexpand", imageStyle);
+ else
+ nodeImage = GetNodeImageUrl ("i", imageStyle);
+
+ writer.AddAttribute ("src", nodeImage);
+ writer.AddAttribute ("border", "0");
+ writer.RenderBeginTag (HtmlTextWriterTag.Img);
+ writer.RenderEndTag ();
+
+ writer.RenderEndTag (); // TD
+ writer.RenderBeginTag (HtmlTextWriterTag.Td);
+ }
+ writer.AddStyleAttribute ("width", NodeIndent + "px");
+ writer.RenderBeginTag (HtmlTextWriterTag.Div);
+ writer.RenderEndTag ();
+ writer.RenderEndTag (); // TD
+ }
+
+ // Node image + line
+
+ if (ShowExpandCollapse || ShowLines) {
+ bool buttonImage = false;
+ string tooltip = null;
+ string shape;
+
+ if (ShowLines) {
+ if (hasPrevious && hasNext) shape = "t";
+ else if (hasPrevious && !hasNext) shape = "l";
+ else if (!hasPrevious && hasNext) shape = "r";
+ else shape = "dash";
+ } else
+ shape = "";
+
+ if (ShowExpandCollapse) {
+ if (hasChildNodes) {
+ buttonImage = true;
+ if (node.Expanded) shape += "minus";
+ else shape += "plus";
+ tooltip = GetNodeImageToolTip (!node.Expanded, node.Text);
+ } else if (!ShowLines)
+ shape = "noexpand";
+ }
+
+ if (shape != "") {
+ nodeImage = GetNodeImageUrl (shape, imageStyle);
+ writer.RenderBeginTag (HtmlTextWriterTag.Td); // TD
+
+ if (buttonImage) {
+ if (!clientExpand)
+ writer.AddAttribute ("href", GetClientEvent (node, "ec"));
+ else
+ writer.AddAttribute ("href", GetClientExpandEvent(node));
+ writer.RenderBeginTag (HtmlTextWriterTag.A); // Anchor
+ }
+
+ if (tooltip != null)
+ writer.AddAttribute ("alt", tooltip);
+ if (buttonImage && clientExpand)
+ writer.AddAttribute ("id", GetNodeClientId (node, "img"));
+ writer.AddAttribute ("src", nodeImage);
+ writer.AddAttribute ("border", "0");
+ writer.RenderBeginTag (HtmlTextWriterTag.Img);
+ writer.RenderEndTag ();
+
+ if (buttonImage)
+ writer.RenderEndTag (); // Anchor
+
+ writer.RenderEndTag (); // TD
+ }
+ }
+
+ // Node icon
+
+ string imageUrl = node.ImageUrl;
+ if (imageUrl == "" && imageStyle != null) {
+ if (imageStyle.RootIcon != null && node.IsRootNode)
+ imageUrl = GetNodeIconUrl (imageStyle.RootIcon);
+ else if (imageStyle.ParentIcon != null && node.IsParentNode)
+ imageUrl = GetNodeIconUrl (imageStyle.ParentIcon);
+ else if (imageStyle.LeafIcon != null && node.IsLeafNode)
+ imageUrl = GetNodeIconUrl (imageStyle.LeafIcon);
+ }
+
+ if (imageUrl != "") {
+ writer.RenderBeginTag (HtmlTextWriterTag.Td); // TD
+ BeginNodeTag (writer, node, clientExpand);
+ writer.AddAttribute ("src", imageUrl);
+ writer.AddAttribute ("border", "0");
+ if (node.ImageToolTip != "") writer.AddAttribute ("alt", node.ImageToolTip);
+ writer.RenderBeginTag (HtmlTextWriterTag.Img);
+ writer.RenderEndTag (); // IMG
+ writer.RenderEndTag (); // style tag
+ writer.RenderEndTag (); // TD
+ }
+
+ // Checkbox
+
+ bool showChecks;
+ if (node.IsShowCheckBoxSet)
+ showChecks = node.ShowCheckBox;
+ else
+ showChecks = (ShowCheckBoxes == TreeNodeTypes.All) ||
+ (ShowCheckBoxes == TreeNodeTypes.Leaf && node.ChildNodes.Count == 0) ||
+ (ShowCheckBoxes == TreeNodeTypes.Parent && node.ChildNodes.Count > 0 && node.Parent != null) ||
+ (ShowCheckBoxes == TreeNodeTypes.Root && node.Parent == null && node.ChildNodes.Count > 0);
+
+ if (showChecks) {
+ AddNodeStyle (writer, node, level);
+ writer.RenderBeginTag (HtmlTextWriterTag.Td); // TD
+ writer.AddAttribute ("name", ClientID + "_cs_" + node.Path);
+ writer.AddAttribute ("type", "checkbox");
+ if (node.Checked) writer.AddAttribute ("checked", "checked");
+ writer.RenderBeginTag (HtmlTextWriterTag.Input); // INPUT
+ writer.RenderEndTag (); // INPUT
+ writer.RenderEndTag (); // TD
+ }
+
+ // Text
+
+ if (!NodeWrap)
+ writer.AddAttribute ("nowrap", "nowrap");
+ writer.RenderBeginTag (HtmlTextWriterTag.Td); // TD
+
+ AddNodeStyle (writer, node, level);
+ if (clientExpand)
+ writer.AddAttribute ("id", GetNodeClientId (node, "txt"));
+ BeginNodeTag (writer, node, clientExpand);
+ writer.Write (node.Text);
+ writer.RenderEndTag (); // style tag
+
+ writer.RenderEndTag (); // TD
+
+ writer.RenderEndTag (); // TR
+ writer.RenderEndTag (); // TABLE
+
+ // Children
+
+ if (hasChildNodes)
+ {
+ if (level >= levelLines.Count) {
+ if (hasNext) levelLines.Add (this);
+ else levelLines.Add (null);
+ } else {
+ if (hasNext) levelLines [level] = this;
+ else levelLines [level] = null;
+ }
+
+ if (clientExpand) {
+ if (!node.Expanded) writer.AddStyleAttribute ("display", "none");
+ else writer.AddStyleAttribute ("display", "block");
+ writer.AddAttribute ("id", GetNodeClientId (node, null));
+ writer.RenderBeginTag (HtmlTextWriterTag.Span);
+
+ if (renderChildNodes) {
+ int num = node.ChildNodes.Count;
+ for (int n=0; n<num; n++)
+ RenderNode (writer, node.ChildNodes [n], level + 1, levelLines, true, n<num-1);
+ }
+ writer.RenderEndTag (); // SPAN
+ }
+ else if (renderChildNodes) {
+ int num = node.ChildNodes.Count;
+ for (int n=0; n<num; n++)
+ RenderNode (writer, node.ChildNodes [n], level + 1, levelLines, true, n<num-1);
+ }
+ }
+ }
+
+ void AddNodeStyle (HtmlTextWriter writer, TreeNode node, int level)
+ {
+ if (nodeStyle != null)
+ nodeStyle.AddAttributesToRender (writer);
+
+ if (levelStyles != null && level < levelStyles.Count)
+ levelStyles [level].AddAttributesToRender (writer);
+ else {
+ if (rootNodeStyle != null && node.IsRootNode)
+ rootNodeStyle.AddAttributesToRender (writer);
+
+ if (leafNodeStyle != null && node.IsLeafNode)
+ leafNodeStyle.AddAttributesToRender (writer);
+
+ if (parentNodeStyle != null && node.IsParentNode)
+ parentNodeStyle.AddAttributesToRender (writer);
+ }
+
+ if (node.Selected && selectedNodeStyle != null)
+ selectedNodeStyle.AddAttributesToRender (writer);
+ }
+
+ void BeginNodeTag (HtmlTextWriter writer, TreeNode node, bool clientExpand)
+ {
+ if (node.NavigateUrl != "") {
+ writer.AddAttribute ("href", node.NavigateUrl);
+ if (node.Target != null)
+ writer.AddAttribute ("target", node.Target);
+ writer.AddStyleAttribute ("text-decoration", "none");
+ writer.RenderBeginTag (HtmlTextWriterTag.A);
+ }
+ else if (node.SelectAction != TreeNodeSelectAction.None) {
+ if (node.SelectAction == TreeNodeSelectAction.Expand && clientExpand)
+ writer.AddAttribute ("href", GetClientExpandEvent (node));
+ else
+ writer.AddAttribute ("href", GetClientEvent (node, "sel"));
+ writer.AddStyleAttribute ("text-decoration", "none");
+ writer.RenderBeginTag (HtmlTextWriterTag.A);
+ }
+ else
+ writer.RenderBeginTag (HtmlTextWriterTag.Span);
+ }
+
+ bool HasChildInputData (TreeNode node)
+ {
+ // Returns true if this node contain childs whose state is hold in
+ // input elements that are rendered together with the node.
+
+ if (node.Checked) return true;
+ if (!node.HasChildData) return false;
+
+ foreach (TreeNode n in node.ChildNodes)
+ if (HasChildInputData (n)) return true;
+ return false;
+ }
+
+ string GetNodeImageToolTip (bool expand, string txt) {
+ if (expand) {
+ if (ExpandImageToolTip != "")
+ return ExpandImageToolTip;
+ else if (txt != null)
+ return "Expand " + txt;
+ else
+ return "Expand {0}";
+ } else {
+ if (CollapseImageToolTip != "")
+ return CollapseImageToolTip;
+ else if (txt != null)
+ return "Collapse " + txt;
+ else
+ return "Collapse {0}";
+ }
+ }
+
+ string GetNodeClientId (TreeNode node, string sufix)
+ {
+ return ClientID + "_" + node.Path + (sufix != null ? "_" + sufix : "");
+ }
+
+ string GetNodeImageUrl (string shape, ImageStyle imageStyle)
+ {
+ if (ShowLines) {
+ if (LineImagesFolder != "")
+ return LineImagesFolder + "/" + shape + ".gif";
+ } else {
+ if (shape == "plus") {
+ if (ExpandImageUrl != "")
+ return ExpandImageUrl;
+ if (imageStyle != null && imageStyle.Expand != null)
+ return imageStyle.Expand;
+ }
+ else if (shape == "minus") {
+ if (CollapseImageUrl != "")
+ return CollapseImageUrl;
+ if (imageStyle != null && imageStyle.Collapse != null)
+ return imageStyle.Collapse;
+ }
+ else if (shape == "noexpand") {
+ if (NoExpandImageUrl != "")
+ return NoExpandImageUrl;
+ if (imageStyle != null && imageStyle.NoExpand != null)
+ return imageStyle.NoExpand;
+ }
+ }
+ return AssemblyResourceLoader.GetResourceUrl (typeof(TreeView), "TreeView_" + shape + ".gif");
+ }
+
+ string GetNodeIconUrl (string icon)
+ {
+ return AssemblyResourceLoader.GetResourceUrl (typeof(TreeView), icon + ".gif");
+ }
+
+ string GetClientEvent (TreeNode node, string ev)
+ {
+ return Page.ClientScript.GetPostBackClientHyperlink (this, ev + "|" + node.Path);
+ }
+
+ string GetClientExpandEvent (TreeNode node)
+ {
+ return "javascript:TreeView_ToggleExpand ('" + ClientID + "', '" + node.Path + "')";
+ }
+
+ TreeNode FindNodeByPos (string path)
+ {
+ string[] indexes = path.Split ('_');
+ TreeNode node = null;
+
+ foreach (string index in indexes) {
+ int i = int.Parse (index);
+ if (node == null) {
+ if (i >= Nodes.Count) return null;
+ node = Nodes [i];
+ } else {
+ if (i >= node.ChildNodes.Count) return null;
+ node = node.ChildNodes [i];
+ }
+ }
+ return node;
+ }
+
+ void UnsetCheckStates (TreeNodeCollection col, NameValueCollection states)
+ {
+ foreach (TreeNode node in col) {
+ if (node.Checked) {
+ string val = states [ClientID + "_cs_" + node.Path];
+ if (val != "on") node.Checked = false;
+ }
+ if (node.HasChildData)
+ UnsetCheckStates (node.ChildNodes, states);
+ }
+ }
+
+ void SetCheckStates (NameValueCollection states)
+ {
+ string keyPrefix = ClientID + "_cs_";
+ foreach (string key in states) {
+ if (key.StartsWith (keyPrefix)) {
+ string id = key.Substring (keyPrefix.Length);
+ TreeNode node = FindNodeByPos (id);
+ if (node != null)
+ node.Checked = (Context.Request.Form [key] == "on");
+ }
+ }
+ }
+
+ void UnsetExpandStates (TreeNodeCollection col, string[] states)
+ {
+ foreach (TreeNode node in col) {
+ if (node.Expanded) {
+ bool expand = (Array.IndexOf (states, node.Path) != -1);
+ if (!expand) node.Expanded = false;
+ }
+ if (node.HasChildData)
+ UnsetExpandStates (node.ChildNodes, states);
+ }
+ }
+
+ void SetExpandStates (string[] states)
+ {
+ foreach (string id in states) {
+ if (id == null || id == "") continue;
+ TreeNode node = FindNodeByPos (id);
+ node.Expanded = true;
+ }
+ }
+
+ string GetExpandStates ()
+ {
+ StringBuilder sb = new StringBuilder ("|");
+
+ foreach (TreeNode node in Nodes)
+ GetExpandStates (sb, node);
+
+ return sb.ToString ();
+ }
+
+ void GetExpandStates (StringBuilder sb, TreeNode node)
+ {
+ if (node.Expanded) {
+ sb.Append (node.Path);
+ sb.Append ('|');
+ }
+ if (node.HasChildData) {
+ foreach (TreeNode child in node.ChildNodes)
+ GetExpandStates (sb, child);
+ }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TreeView.js b/mcs/class/System.Web/System.Web.UI.WebControls/TreeView.js
new file mode 100644
index 00000000000..96c63dab71c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TreeView.js
@@ -0,0 +1,77 @@
+
+function TreeView_ToggleExpand (treeId, nodeId) {
+ var tree = getTree (treeId);
+ var spanId = treeId + "_" + nodeId;
+ var node = document.getElementById (spanId);
+ var expand = node.style.display == "none";
+
+ if (tree.populateFromClient && expand && node.populated != true && (node.innerHTML.length == 0 || node.hasError)) {
+ WebForm_DoCallback (treeId, nodeId, TreeView_PopulateCallback, treeId + " " + nodeId, TreeView_ErrorCallback)
+ return;
+ }
+
+ if (!node.hasError)
+ node.populated = true;
+
+ node.style.display = expand ? "block" : "none";
+
+ var inputStates = document.forms[0][treeId + "_ExpandStates"];
+ TreeView_SetNodeFlag (inputStates, nodeId, expand);
+
+ if (tree.showImage) {
+ var image = document.getElementById (spanId + "_img");
+ if (tree.defaultImages) {
+ if (expand) image.src = image.src.replace ("plus","minus");
+ else image.src = image.src.replace ("minus","plus");
+ } else {
+ if (expand) image.src = tree.collapseImage;
+ else image.src = tree.expandImage;
+ }
+ var alt;
+ if (expand) alt = tree.collapseAlt;
+ else alt = tree.expandAlt;
+
+ if (alt.indexOf ("{0}") != -1) {
+ var txt = document.getElementById (spanId + "_txt").innerText;
+ alt = alt.replace ("{0}", txt);
+ }
+ image.alt = alt;
+ }
+}
+
+function TreeView_SetNodeFlag (flagInput, nodeId, set)
+{
+ if (!set) flagInput.value = flagInput.value.replace ("|" + nodeId + "|", "|");
+ else flagInput.value = flagInput.value + nodeId + "|";
+}
+
+function TreeView_PopulateCallback (data, ids)
+{
+ var idArray = ids.split (" ");
+ var tree = getTree (idArray[0]);
+ var spanId = idArray[0] + "_" + idArray[1];
+ var node = document.getElementById (spanId);
+ node.populated = true;
+ if (data != "*") {
+ node.innerHTML = data;
+ TreeView_ToggleExpand (idArray[0], idArray[1]);
+ } else {
+ if (tree.showImage && tree.noExpandImage != null) {
+ var image = document.getElementById (spanId + "_img");
+ image.src = tree.noExpandImage;
+ }
+ }
+}
+
+function TreeView_ErrorCallback (data, ids)
+{
+ var idArray = ids.split (" ");
+ var node = document.getElementById (idArray[0] + "_" + idArray[1]);
+ node.innerHTML = data;
+ node.populated = true;
+ TreeView_ToggleExpand (idArray[0], idArray[1]);
+ node.populated = false;
+ node.hasError = true;
+}
+
+function getTree (treeId) { return eval (treeId + "_data"); }
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TreeViewImageSet.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TreeViewImageSet.cs
new file mode 100644
index 00000000000..7234fa50d2e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TreeViewImageSet.cs
@@ -0,0 +1,49 @@
+//
+// System.Web.UI.WebControls.TreeViewImageSet.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum TreeViewImageSet {
+ Custom = 0,
+ XPFileExplorer = 1,
+ Msdn = 2,
+ WindowsHelp = 3,
+ Simple = 4,
+ Simple2 = 5,
+ BulletedList = 6,
+ BulletedList2 = 7,
+ BulletedList3 = 8,
+ BulletedList4 = 9,
+ Arrows = 10,
+ News = 11,
+ Contacts = 12,
+ Inbox = 13,
+ Events = 14,
+ Faq = 15
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs
new file mode 100644
index 00000000000..a988cf93d37
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs
@@ -0,0 +1,292 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Struct: Unit
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Globalization;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [TypeConverter(typeof(UnitConverter))]
+ [Serializable]
+ public struct Unit
+ {
+ public static readonly Unit Empty = new Unit();
+
+ private static int Min = -32768;
+ private static int Max = +32767;
+
+ private UnitType type;
+ private double val;
+
+ public static Unit Parse(string s)
+ {
+ return new Unit(s);
+ }
+
+ public static Unit Parse(string s, CultureInfo culture)
+ {
+ return new Unit(s, culture);
+ }
+
+ public static Unit Percentage(double n)
+ {
+ return new Unit (n, UnitType.Percentage);
+ }
+
+ public static Unit Pixel(int n)
+ {
+ return new Unit (n, UnitType.Pixel);
+ }
+
+ public static Unit Point(int n)
+ {
+ return new Unit(n, UnitType.Point);
+ }
+
+ public static bool operator ==(Unit left, Unit right)
+ {
+ return (left.type == right.type && left.val == right.val);
+ }
+
+ public static bool operator !=(Unit left, Unit right)
+ {
+ return !(left == right);
+ }
+
+ public static implicit operator Unit(int n)
+ {
+ return new Unit(n);
+ }
+
+ public Unit(double value)
+ {
+ if(value < Min || value > Max)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+ val = value;
+ type = UnitType.Pixel;
+ }
+
+ public Unit(int value)
+ {
+ if(value < Min || value > Max)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+ val = value;
+ type = UnitType.Pixel;
+ }
+
+ public Unit(string value): this(value, CultureInfo.CurrentCulture)
+ {
+ }
+
+ public Unit(double value, UnitType type)
+ {
+ if(value < Min || value > Max)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+ val = value;
+ this.type = type;
+ }
+
+ public Unit(string value, CultureInfo culture): this(value, culture, UnitType.Pixel)
+ {
+ }
+
+ internal Unit(string value, CultureInfo culture, UnitType defType)
+ {
+ string valueTrim;
+ if (value == null || (valueTrim = value.Trim ()).Length == 0) {
+ val = 0;
+ type = (UnitType)0;
+ return;
+ }
+
+ if (culture == null)
+ culture = CultureInfo.CurrentCulture;
+
+ string strVal = valueTrim.ToLower ();
+ int length = strVal.Length;
+ char c;
+ int start = -1;
+ for (int i = 0; i < length; i++) {
+ c = strVal [i];
+ if( (c >= '0' && c <= '9') || (c == '-' || c == '.' || c == ',') )
+ start = i;
+ }
+
+ if (start == -1)
+ throw new ArgumentException("No digits in 'value'");
+
+ start++;
+ if (start < length) {
+ type = GetTypeFromString (strVal.Substring (start).Trim ());
+ val = 0;
+ } else {
+ type = defType;
+ }
+
+ try {
+ string numbers = strVal.Substring (0, start);
+ if (type == UnitType.Pixel)
+ val = (double) Int32.Parse (numbers, culture);
+ else
+ val = (double) Single.Parse (numbers, culture);
+ } catch (Exception) {
+ throw new FormatException ("Error parsing " + value);
+ }
+
+ if (val < Min || val > Max)
+ throw new ArgumentOutOfRangeException ();
+ }
+
+ private static UnitType GetTypeFromString(string s)
+ {
+ if(s == null || s.Length == 0)
+ return UnitType.Pixel;
+ switch(s)
+ {
+ case "px":
+ return UnitType.Pixel;
+ case "pt":
+ return UnitType.Point;
+ case "pc":
+ return UnitType.Pica;
+ case "in":
+ return UnitType.Inch;
+ case "mm":
+ return UnitType.Mm;
+ case "cm":
+ return UnitType.Cm;
+ case "%":
+ return UnitType.Percentage;
+ case "em":
+ return UnitType.Em;
+ case "ex":
+ return UnitType.Ex;
+ default:
+ return UnitType.Pixel;
+ }
+ }
+
+ private string GetStringFromPixel(UnitType ut)
+ {
+ switch(ut)
+ {
+ case UnitType.Pixel:
+ return "px";
+ case UnitType.Point:
+ return "pt";
+ case UnitType.Pica:
+ return "pc";
+ case UnitType.Inch:
+ return "in";
+ case UnitType.Mm:
+ return "mm";
+ case UnitType.Cm:
+ return "cm";
+ case UnitType.Percentage:
+ return "%";
+ case UnitType.Em:
+ return "em";
+ case UnitType.Ex:
+ return "ex";
+ default:
+ return String.Empty;
+ }
+ }
+
+ public bool IsEmpty
+ {
+ get
+ {
+ return (type == 0);
+ }
+ }
+
+ public UnitType Type
+ {
+ get
+ {
+ if(IsEmpty)
+ return UnitType.Pixel;
+ return type;
+ }
+ }
+
+ public double Value
+ {
+ get
+ {
+ return val;
+ }
+ }
+
+ public override bool Equals(object obj)
+ {
+ if(obj != null && obj is Unit)
+ {
+ Unit that = (Unit)obj;
+ return ( this.type == that.type && this.val == that.val );
+ }
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return ( (type.GetHashCode() << 2) | (val.GetHashCode()) );
+ }
+
+ public override string ToString()
+ {
+ if(IsEmpty)
+ return String.Empty;
+ return ( val.ToString() + GetStringFromPixel(type) );
+ }
+
+ public string ToString(CultureInfo culture)
+ {
+ if(IsEmpty)
+ return String.Empty;
+
+ return (val.ToString(culture) + GetStringFromPixel(type));
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/UnitConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/UnitConverter.cs
new file mode 100644
index 00000000000..b2fca7ba050
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/UnitConverter.cs
@@ -0,0 +1,115 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: UnitConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Globalization;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel.Design.Serialization;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls
+{
+ public class UnitConverter : TypeConverter
+ {
+ public UnitConverter(): base()
+ {
+ }
+
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ if(sourceType == typeof(string))
+ return true;
+ return CanConvertFrom(context, sourceType);
+ }
+
+#if NET_2_0
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+ {
+ if (destinationType == typeof (string))
+ return true;
+
+ if (destinationType == typeof (InstanceDescriptor))
+ return true;
+
+ return base.CanConvertTo (context, destinationType);
+ }
+#endif
+
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ if(value == null)
+ return null;
+ if(value is string)
+ {
+ string val = ((string)value).Trim();
+ if(val.Length == 0)
+ {
+ return Unit.Empty;
+ }
+ return (culture == null ? Unit.Parse(val) : Unit.Parse(val, culture));
+ }
+ return ConvertFrom(context, culture, value);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ if(destinationType == typeof(string))
+ {
+ Unit val = (Unit)value;
+ if(val == Unit.Empty)
+ {
+ return String.Empty;
+ }
+ return val.ToString(culture);
+ }
+
+#if NET_2_0
+ if (destinationType == typeof (InstanceDescriptor) && value is Unit) {
+ Unit s = (Unit) value;
+ MethodInfo met = typeof(Unit).GetMethod ("Parse", new Type[] {typeof(string)});
+ return new InstanceDescriptor (met, new object[] {s.ToString ()});
+ }
+
+ if (destinationType == typeof (InstanceDescriptor) && value is string) {
+ MethodInfo met = typeof(Unit).GetMethod ("Parse", new Type[] {typeof(string)});
+ return new InstanceDescriptor (met, new object[] {value});
+ }
+#endif
+
+ return ConvertTo(context, culture, value, destinationType);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/UnitType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/UnitType.cs
new file mode 100755
index 00000000000..837e49ae21b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/UnitType.cs
@@ -0,0 +1,49 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: UnitType
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum UnitType
+ {
+ Pixel = 1,
+ Point,
+ Pica,
+ Inch,
+ Mm,
+ Cm,
+ Percentage,
+ Em,
+ Ex
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidatedControlConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidatedControlConverter.cs
new file mode 100644
index 00000000000..71f5f0b3bca
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidatedControlConverter.cs
@@ -0,0 +1,119 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ValidatedControlConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ * Modifier: Sanjay Gupta
+ * Contact: gsanjay@novell.com
+ * (C) Gaurav Vaish (2002)
+ * (C) 2004 Novell, Inc. (http://www.novell.com)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class ValidatedControlConverter :
+#if NET_2_0
+ ControlIDConverter
+#else
+ StringConverter
+#endif
+ {
+ public ValidatedControlConverter(): base()
+ {
+ }
+#if NET_2_0
+ protected override bool FilterControl(Control control)
+ {
+ //GetCustomAttributes (false);
+ //What shall we use above method or the one used
+ object [] attribs = control.GetType ().GetCustomAttributes
+ (typeof (ValidationPropertyAttribute), false);
+
+ foreach (Attribute attr in attribs)
+ if (attr is ValidationPropertyAttribute)
+ return true;
+
+ return false;
+ }
+#else
+ private object[] GetValues(IContainer container)
+ {
+ ArrayList values = new ArrayList();
+ IEnumerator ie = container.Components.GetEnumerator();
+ try
+ {
+ foreach(IComponent current in container.Components)
+ {
+ Control ctrl = (Control)current;
+ if(ctrl == null || ctrl.ID == null || ctrl.ID.Length == 0)
+ continue;
+ ValidationPropertyAttribute attrib = (ValidationPropertyAttribute)((TypeDescriptor.GetAttributes(ctrl))[typeof(ValidationPropertyAttribute)]);
+ if(attrib == null || attrib.Name == null)
+ continue;
+ values.Add(String.Copy(ctrl.ID));
+ }
+ }finally
+ {
+ if(ie is IDisposable)
+ ((IDisposable)ie).Dispose();
+ }
+ values.Sort();
+ return values.ToArray();
+ }
+
+ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+ {
+ if(context != null && context.Container != null)
+ {
+ object[] values = GetValues(context.Container);
+ if(values != null)
+ {
+ return new StandardValuesCollection(values);
+ }
+ }
+ return null;
+ }
+
+ public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
+ {
+ return false;
+ }
+
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+ {
+ return true;
+ }
+#endif
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidationCompareOperator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationCompareOperator.cs
new file mode 100755
index 00000000000..05f0aac6142
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationCompareOperator.cs
@@ -0,0 +1,47 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ValidationCompareOperator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ValidationCompareOperator
+ {
+ Equal,
+ NotEqual,
+ GreaterThan,
+ GreaterThanEqual,
+ LessThan,
+ LessThanEqual,
+ DataTypeCheck
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidationDataType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationDataType.cs
new file mode 100755
index 00000000000..cb61dc535da
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationDataType.cs
@@ -0,0 +1,45 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ValidationDataType
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ValidationDataType
+ {
+ String,
+ Integer,
+ Double,
+ Date,
+ Currency
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummary.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummary.cs
new file mode 100644
index 00000000000..0f9f0a0caf5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummary.cs
@@ -0,0 +1,306 @@
+//
+// System.Web.UI.WebControls.ValidationSummary.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+using System.Drawing;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class ValidationSummary : WebControl
+ {
+ private bool uplevelRender;
+
+ public ValidationSummary(): base(HtmlTextWriterTag.Div)
+ {
+ uplevelRender = false;
+ ForeColor = Color.Red;
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof (ValidationSummaryDisplayMode), "BulletList"), WebCategory ("Appearance")]
+ [WebSysDescription ("The type of how validation summaries should be displayed.")]
+ public ValidationSummaryDisplayMode DisplayMode
+ {
+ get
+ {
+ object o = ViewState["DisplayMode"];
+ if(o != null)
+ return (ValidationSummaryDisplayMode)o;
+ return ValidationSummaryDisplayMode.BulletList;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(ValidationSummaryDisplayMode), value))
+ throw new ArgumentException();
+ ViewState["DisplayMode"] = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (true), WebCategory ("Behavior")]
+ [WebSysDescription ("Determines if the validation summary should be updated directly on the client using script code.")]
+ public bool EnableClientScript
+ {
+ get
+ {
+ object o = ViewState["EnableClientScript"];
+ if(o != null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["EnableClientScript"] = value;
+ }
+ }
+
+ [DefaultValue (null)]
+ public override Color ForeColor
+ {
+ get
+ {
+ return base.ForeColor;
+ }
+ set
+ {
+ base.ForeColor = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (false), WebCategory ("Behavior")]
+ [WebSysDescription ("Determines if the validation summary should display a message box on the client if an uplevel browser is used.")]
+ public bool ShowMessageBox
+ {
+ get
+ {
+ object o = ViewState["ShowMessageBox"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["ShowMessageBox"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (true), WebCategory ("Behavior")]
+ [WebSysDescription ("Determines if the validation summary should display a summary.")]
+ public bool ShowSummary
+ {
+ get
+ {
+ object o = ViewState["ShowSummary"];
+ if(o != null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["ShowSummary"] = value;
+ }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#endif
+ [DefaultValue (""), Bindable (true), WebCategory ("Appearance")]
+ [WebSysDescription ("A text that is diplayed as a header for the validation report.")]
+ public string HeaderText
+ {
+ get
+ {
+ object o = ViewState["HeaderText"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["HeaderText"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(uplevelRender)
+ {
+ if(ID == null || ID.Length == 0)
+ writer.AddAttribute("id", ClientID);
+ if(HeaderText.Length > 0)
+ writer.AddAttribute("headertext", HeaderText, true);
+ if(ShowMessageBox)
+ writer.AddAttribute("showmessagebox", "True");
+ if(!ShowSummary)
+ writer.AddAttribute("showsummary", "False");
+ if(DisplayMode != ValidationSummaryDisplayMode.BulletList)
+ {
+ writer.AddAttribute("displaymode", PropertyConverter.EnumToString(typeof(ValidationSummaryDisplayMode), DisplayMode));
+ }
+ }
+ }
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ if (!base.Enabled) return;
+
+ string[] messages;
+ bool toDisplay;
+ bool showSummary;
+
+ if (base.Site != null && base.Site.DesignMode)
+ {
+ showSummary = true;
+ messages = new string[]{HttpRuntime.FormatResourceString("ValSummary_error_message_1"),
+ HttpRuntime.FormatResourceString("ValSummary_error_message_2")};
+ toDisplay = true;
+ uplevelRender = false;
+ }
+ else
+ {
+ showSummary = false;
+ messages = null;
+
+ //Messages count
+ int numOfMsg = 0;
+ for (int i = 0; i < base.Page.Validators.Count; i++)
+ {
+ IValidator currentValidator = base.Page.Validators[i];
+ if (!currentValidator.IsValid)
+ {
+ showSummary = true;
+ if (currentValidator.ErrorMessage != null &&
+ currentValidator.ErrorMessage.Length != 0)
+ numOfMsg++;
+ }
+ }
+
+ if (numOfMsg != 0)
+ {
+ messages = new string[(int)numOfMsg];
+ int cur_msg = 0;
+ for (int i = 0; i < base.Page.Validators.Count; i++)
+ {
+ IValidator currentValidator = base.Page.Validators[i];
+ if (!currentValidator.IsValid &&
+ currentValidator.ErrorMessage != null &&
+ currentValidator.ErrorMessage.Length != 0)
+ messages[cur_msg++] = String.Copy(currentValidator.ErrorMessage);
+ }
+ }
+
+ toDisplay = ShowSummary ? showSummary : false;
+ if (!toDisplay && uplevelRender)
+ base.Style["display"] = "none";
+ }
+ if (base.Page != null)
+ {
+ base.Page.VerifyRenderingInServerForm(this);
+ }
+ bool tagRequired = !uplevelRender ? toDisplay : true;
+ if (tagRequired)
+ {
+ base.RenderBeginTag(writer);
+ }
+ if (toDisplay)
+ {
+ string str1, str2, str3, str4, str5;
+
+
+ switch (DisplayMode)
+ {
+ case ValidationSummaryDisplayMode.List:
+ str1 = "<br>";
+ str2 = "";
+ str3 = "";
+ str4 = "<br>";
+ str5 = "";
+ break;
+
+ case ValidationSummaryDisplayMode.SingleParagraph:
+ str1 = " ";
+ str2 = "";
+ str3 = "";
+ str4 = " ";
+ str5 = "<br>";
+ break;
+
+ default:
+ str1 = "";
+ str2 = "<ul>";
+ str3 = "<li>";
+ str4 = "</li>";
+ str5 = "</ul>";
+ break;
+ }
+ if (HeaderText.Length > 0)
+ {
+ writer.Write(HeaderText);
+ writer.Write(str1);
+ }
+ writer.Write(str2);
+ if (messages != null)
+ {
+ for (int i = 0; i < (int)messages.Length; i++)
+ {
+ writer.Write(str3);
+ writer.Write(messages[i]);
+ writer.Write(str4);
+ }
+ }
+ writer.Write(str5);
+ }
+ if (tagRequired)
+ {
+ base.RenderEndTag(writer);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummaryDisplayMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummaryDisplayMode.cs
new file mode 100755
index 00000000000..40a02ee8441
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummaryDisplayMode.cs
@@ -0,0 +1,43 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ValidationSummaryDisplayMode
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ValidationSummaryDisplayMode
+ {
+ List,
+ BulletList,
+ SingleParagraph
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidatorDisplay.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidatorDisplay.cs
new file mode 100755
index 00000000000..c9012bc2dfd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidatorDisplay.cs
@@ -0,0 +1,43 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ValidatorDisplay
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ValidatorDisplay
+ {
+ None,
+ Static,
+ Dynamic
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlign.cs b/mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlign.cs
new file mode 100755
index 00000000000..a96db721aa2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlign.cs
@@ -0,0 +1,47 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: VerticalAlign
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [TypeConverter(typeof(VerticalAlignConverter))]
+ public enum VerticalAlign
+ {
+ NotSet,
+ Top,
+ Middle,
+ Bottom
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlignConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlignConverter.cs
new file mode 100644
index 00000000000..ca6abef25bc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlignConverter.cs
@@ -0,0 +1,72 @@
+//
+// System.Web.UI.WebControls.VerticalAlignConverter
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.Globalization;
+
+namespace System.Web.UI.WebControls
+{
+ class VerticalAlignConverter : EnumConverter
+ {
+ public VerticalAlignConverter () : base (typeof(VerticalAlign))
+ {
+ }
+
+ // The base class is enough to handle everything.
+ // The methods are here just to make the class status page happy.
+ // Add some optimizations?
+
+ public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+ {
+ return base.CanConvertFrom (context, sourceType);
+ }
+
+ public override object ConvertFrom (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value)
+ {
+ return base.ConvertFrom (context, culture, value);
+ }
+
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+ {
+ return base.CanConvertTo (context, destinationType);
+ }
+
+ public override object ConvertTo (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value,
+ Type destinationType)
+ {
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/View.cs b/mcs/class/System.Web/System.Web.UI.WebControls/View.cs
new file mode 100644
index 00000000000..e9f835b0c6f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/View.cs
@@ -0,0 +1,83 @@
+//
+// System.Web.UI.WebControls.View.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [ParseChildrenAttribute (false)]
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.ViewDesigner, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+ [ToolboxDataAttribute ("<{0}:View runat=\"server\"></{0}:View>")]
+ public class View: Control
+ {
+ private static readonly object ActivateEvent = new object();
+ private static readonly object DeactivateEvent = new object();
+
+ internal void NotifyActivation (bool activated)
+ {
+ if (activated) OnActivate (EventArgs.Empty);
+ else OnDeactivate (EventArgs.Empty);
+ }
+
+ public event EventHandler Activate {
+ add { Events.AddHandler (ActivateEvent, value); }
+ remove { Events.RemoveHandler (ActivateEvent, value); }
+ }
+
+ public event EventHandler Deactivate {
+ add { Events.AddHandler (DeactivateEvent, value); }
+ remove { Events.RemoveHandler (DeactivateEvent, value); }
+ }
+
+ protected virtual void OnActivate (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) Events [ActivateEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnDeactivate (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) Events [DeactivateEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ViewCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ViewCollection.cs
new file mode 100644
index 00000000000..490dcd62558
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ViewCollection.cs
@@ -0,0 +1,67 @@
+//
+// System.Web.UI.WebControls.ViewCollection.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public class ViewCollection: ControlCollection
+ {
+ internal ViewCollection (Control owner): base (owner)
+ {
+ }
+
+ public override void Add (Control v)
+ {
+ if (!(v is View))
+ throw new ArgumentException ("The parameter is not a View control");
+ base.Add (v);
+ }
+
+ public override void AddAt (int index, Control v)
+ {
+ if (!(v is View))
+ throw new ArgumentException ("The parameter is not a View control");
+ base.AddAt (index, v);
+ }
+
+ public new View this [int i] {
+ get { return (View) base [i]; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/WebColorConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/WebColorConverter.cs
new file mode 100644
index 00000000000..fdd5624fd94
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/WebColorConverter.cs
@@ -0,0 +1,95 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: WebColorConverter
+ *
+ * Author: Gaurav Vaish, Gonzalo Paniagua Javier
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>, <gonzalo@ximian.com>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ * (c) 2002 Ximian, Inc. (http://www.ximian.com)
+ */
+
+using System;
+using System.Globalization;
+using System.ComponentModel;
+using System.Drawing;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class WebColorConverter : ColorConverter
+ {
+ public override object ConvertFrom (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value)
+ {
+ if (value is string) {
+ string val = ((string) value).Trim ();
+ if(val == String.Empty || val.Length == 0)
+ return Color.Empty;
+
+ NumberStyles style = (val [0] == '#') ? NumberStyles.HexNumber :
+ NumberStyles.None;
+
+ try {
+ int n = Int32.Parse (val.Substring (1), style);
+ return Color.FromArgb (n);
+ } catch {
+ Color c = Color.FromName (val);
+ if (c.A != 0 || c.R != 0 || c.B != 0 || c.G != 0)
+ return c;
+ }
+ }
+
+ return base.ConvertFrom(context, culture, value);
+ }
+
+ public override object ConvertTo (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value,
+ Type destinationType)
+ {
+ if (destinationType == null)
+ throw new ArgumentNullException ("destinationType");
+
+ if (destinationType == typeof (String) && value != null) {
+ Color c = (Color) value;
+ if (c == Color.Empty)
+ return String.Empty;
+
+ if (c.IsNamedColor || c.IsSystemColor)
+ return c.Name;
+
+ return String.Format ("#{0:X2}{1:X2}{2:X2}{3:X2}", c.A, c.R, c.G, c.B);
+ }
+
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs b/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs
new file mode 100755
index 00000000000..0b0fc0ae127
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs
@@ -0,0 +1,577 @@
+//
+// System.Web.UI.WebControls.WebControl.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Collections;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Drawing;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+#if NET_2_0
+ [ThemeableAttribute (true)]
+#endif
+ [PersistChildrenAttribute(false)]
+ [ParseChildrenAttribute(true)]
+ public class WebControl : Control, IAttributeAccessor
+ {
+ HtmlTextWriterTag tagKey;
+ AttributeCollection attributes;
+ StateBag attributeState;
+ Style controlStyle;
+ bool enabled = true;
+ string tagName;
+
+ protected WebControl () : this (HtmlTextWriterTag.Span)
+ {
+ }
+
+ public WebControl (HtmlTextWriterTag tag)
+ {
+ tagKey = tag;
+ }
+
+ protected WebControl (string tag)
+ {
+ tagName = tag;
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Behavior")]
+ [WebSysDescription ("A keyboard shortcut for the WebControl.")]
+ public virtual string AccessKey
+ {
+ get
+ {
+ object o = ViewState["AccessKey"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ if (value != null && value.Length > 1)
+ throw new ArgumentOutOfRangeException ("value");
+ ViewState["AccessKey"] = value;
+ }
+ }
+
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("Attribute tags for the Webcontrol.")]
+ public AttributeCollection Attributes
+ {
+ get
+ {
+ if(attributes==null)
+ {
+ //FIXME: From where to get StateBag and how? I think this method is OK!
+ if(attributeState == null)
+ {
+ attributeState = new StateBag(true);
+ if(IsTrackingViewState)
+ {
+ attributeState.TrackViewState();
+ }
+ }
+ attributes = new AttributeCollection(attributeState);
+ }
+ return attributes;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (null), WebCategory ("Appearance")]
+ [TypeConverter (typeof (WebColorConverter))]
+ [WebSysDescription ("The background color for the WebControl.")]
+ public virtual Color BackColor
+ {
+ get {
+ if (!ControlStyleCreated)
+ return Color.Empty;
+ return ControlStyle.BackColor;
+ }
+
+ set {
+ ControlStyle.BackColor = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (null), WebCategory ("Appearance")]
+ [TypeConverter (typeof (WebColorConverter))]
+ [WebSysDescription ("The border color for the WebControl.")]
+ public virtual Color BorderColor
+ {
+ get {
+ if (!ControlStyleCreated)
+ return Color.Empty;
+ return ControlStyle.BorderColor;
+ }
+
+ set {
+ ControlStyle.BorderColor = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (typeof(BorderStyle), "NotSet"), WebCategory ("Appearance")]
+ [WebSysDescription ("The style/type of the border used for the WebControl.")]
+ public virtual BorderStyle BorderStyle
+ {
+ get {
+ if (!ControlStyleCreated)
+ return BorderStyle.NotSet;
+ return ControlStyle.BorderStyle;
+ }
+
+ set {
+ ControlStyle.BorderStyle = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (null), WebCategory ("Appearance")]
+ [WebSysDescription ("The width of the border used for the WebControl.")]
+ public virtual Unit BorderWidth
+ {
+ get {
+ if (!ControlStyleCreated)
+ return Unit.Empty;
+ return ControlStyle.BorderWidth;
+ }
+
+ set {
+ if (value.Value < 0)
+ throw new ArgumentOutOfRangeException ("value");
+ ControlStyle.BorderWidth = value;
+ }
+ }
+
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The style used to display this Webcontrol.")]
+ public Style ControlStyle
+ {
+ get
+ {
+ if(controlStyle == null)
+ {
+ controlStyle = CreateControlStyle();
+ if(IsTrackingViewState)
+ {
+ controlStyle.TrackViewState();
+ }
+ controlStyle.LoadViewState(null);
+ }
+ return controlStyle;
+ }
+ }
+
+#if NET_2_0
+ [EditorBrowsableAttribute (EditorBrowsableState.Advanced)]
+#endif
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("Determines if a style exists for this Webcontrol.")]
+ public bool ControlStyleCreated
+ {
+ get
+ {
+ return (controlStyle!=null);
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Appearance")]
+ [WebSysDescription ("The cascading stylesheet class that is associated with this WebControl.")]
+ public virtual string CssClass
+ {
+ get
+ {
+ return ControlStyle.CssClass;
+ }
+ set
+ {
+ ControlStyle.CssClass = value;
+ }
+ }
+
+#if NET_2_0
+ [ThemeableAttribute (false)]
+#endif
+ [DefaultValue (true), Bindable (true), WebCategory ("Behavior")]
+ [WebSysDescription ("The activation state of this WebControl.")]
+ public virtual bool Enabled {
+ get {
+ return enabled;
+ }
+ set {
+ if (enabled != value) {
+ ViewState ["Enabled"] = value;
+ if (IsTrackingViewState)
+ EnableViewState = true;
+ }
+
+ enabled = value;
+ }
+ }
+
+#if !NET_2_0
+ [DefaultValue (null)]
+#endif
+ [NotifyParentProperty (true), WebCategory ("Appearance")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [WebSysDescription ("The font of this WebControl.")]
+ public virtual FontInfo Font
+ {
+ get
+ {
+ return ControlStyle.Font;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (null), WebCategory ("Appearance")]
+ [TypeConverter (typeof (WebColorConverter))]
+ [WebSysDescription ("The color that is used to paint the primary display of the WebControl.")]
+ public virtual Color ForeColor
+ {
+ get {
+ if (!ControlStyleCreated)
+ return Color.Empty;
+ return ControlStyle.ForeColor;
+ }
+
+ set {
+ ControlStyle.ForeColor = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (null), WebCategory ("Layout")]
+ [WebSysDescription ("The height of this WebControl.")]
+ public virtual Unit Height
+ {
+ get
+ {
+ return ControlStyle.Height;
+ }
+ set
+ {
+ if (value.Value < 0)
+ throw new ArgumentOutOfRangeException ("value");
+ ControlStyle.Height = value;
+ }
+ }
+
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("Direct access to the styles used for this Webcontrol.")]
+ public CssStyleCollection Style
+ {
+ get
+ {
+ return Attributes.CssStyle;
+ }
+ }
+
+ [DefaultValue (0), WebCategory ("Behavior")]
+ [WebSysDescription ("The order in which this WebControl gets tabbed through.")]
+ public virtual short TabIndex
+ {
+ get
+ {
+ object o = ViewState["TabIndex"];
+ if(o!=null)
+ return (short)o;
+ return 0;
+ }
+ set
+ {
+ if(value < short.MinValue || value > short.MaxValue)
+ throw new ArgumentOutOfRangeException ("value");
+ ViewState["TabIndex"] = value;
+ }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Behavior")]
+ [WebSysDescription ("A tooltip that is shown when hovering the mouse above the WebControl.")]
+ public virtual string ToolTip
+ {
+ get
+ {
+ object o = ViewState["ToolTip"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ToolTip"] = value;
+ }
+ }
+
+#if !NET_2_0
+ [Bindable (true)]
+#endif
+ [DefaultValue (null), WebCategory ("Layout")]
+ [WebSysDescription ("The width of this WebControl.")]
+ public virtual Unit Width
+ {
+ get
+ {
+ return ControlStyle.Width;
+ }
+ set
+ {
+ if (value.Value < 0)
+ throw new ArgumentOutOfRangeException ("value");
+ ControlStyle.Width = value;
+ }
+ }
+
+ public void ApplyStyle(Style s)
+ {
+ if (s != null && !s.IsEmpty)
+ ControlStyle.CopyFrom (s);
+ }
+
+ public void CopyBaseAttributes(WebControl controlSrc)
+ {
+ /*
+ * AccessKey, Enabled, ToolTip, TabIndex, Attributes
+ */
+ AccessKey = controlSrc.AccessKey;
+ Enabled = controlSrc.Enabled;
+ ToolTip = controlSrc.ToolTip;
+ TabIndex = controlSrc.TabIndex;
+ AttributeCollection otherAtt = controlSrc.Attributes;
+ foreach (string key in otherAtt.Keys)
+ Attributes [key] = otherAtt [key];
+ }
+
+ public void MergeStyle(Style s)
+ {
+ ControlStyle.MergeWith(s);
+ }
+
+ public virtual void RenderBeginTag (HtmlTextWriter writer)
+ {
+ AddAttributesToRender (writer);
+ HtmlTextWriterTag tkey = TagKey;
+ // The tagkey goes takes precedence if TagKey != 0 and TagName != null
+ if (tkey != 0)
+ writer.RenderBeginTag (tkey);
+ else
+ writer.RenderBeginTag (TagName);
+ }
+
+ public virtual void RenderEndTag(HtmlTextWriter writer)
+ {
+ writer.RenderEndTag();
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ protected virtual HtmlTextWriterTag TagKey
+ {
+ get
+ {
+ return tagKey;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ protected virtual string TagName
+ {
+ get
+ {
+ if(tagName == null && TagKey != 0)
+ {
+ tagName = Enum.Format(typeof(HtmlTextWriterTag), TagKey, "G").ToString();
+ }
+ // What if tagName is null and tagKey 0?
+ // Got the answer: nothing is rendered, empty, null
+ return tagName;
+ }
+ }
+
+ protected virtual void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ if(ID!=null)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);
+ }
+ if(AccessKey.Length>0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey);
+ }
+ if(!Enabled)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
+ }
+ if(ToolTip.Length>0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Title, ToolTip);
+ }
+ if(TabIndex != 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString());
+ }
+ if(ControlStyleCreated)
+ {
+ if(!ControlStyle.IsEmpty)
+ {
+ ControlStyle.AddAttributesToRender(writer, this);
+ }
+ }
+ if(attributeState != null){
+ IEnumerator ie = Attributes.Keys.GetEnumerator ();
+ while (ie.MoveNext ()){
+ string key = (string) ie.Current;
+ writer.AddAttribute (key, Attributes [key]);
+ }
+ }
+ }
+
+ protected virtual Style CreateControlStyle ()
+ {
+ return new Style (ViewState);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState == null)
+ return;
+
+ Pair saved = (Pair) savedState;
+ base.LoadViewState (saved.First);
+
+ if (ControlStyleCreated || ViewState [System.Web.UI.WebControls.Style.selectionBitString] != null)
+ ControlStyle.LoadViewState (null);
+
+ if (saved.Second != null)
+ {
+ if (attributeState == null)
+ {
+ attributeState = new StateBag(true);
+ attributeState.TrackViewState();
+ }
+ attributeState.LoadViewState (saved.Second);
+ }
+
+ object enable = ViewState["Enabled"];
+ if (enable!=null)
+ {
+ Enabled = (bool)enable;
+ EnableViewState = true;
+ }
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ RenderBeginTag (writer);
+ RenderContents (writer);
+ RenderEndTag (writer);
+ }
+
+ protected virtual void RenderContents(HtmlTextWriter writer)
+ {
+ base.Render (writer);
+ }
+
+ protected override object SaveViewState()
+ {
+ if (EnableViewState)
+ ViewState["Enabled"] = enabled;
+ if (ControlStyleCreated)
+ ControlStyle.SaveViewState ();
+
+ object baseView = base.SaveViewState ();
+ object attrView = null;
+ if (attributeState != null)
+ attrView = attributeState.SaveViewState ();
+
+ if (baseView == null && attrView == null)
+ return null;
+
+ return new Pair (baseView, attrView);
+ }
+
+ protected override void TrackViewState()
+ {
+ base.TrackViewState();
+ if (ControlStyleCreated)
+ ControlStyle.TrackViewState ();
+ if (attributeState != null)
+ attributeState.TrackViewState ();
+ }
+
+ string IAttributeAccessor.GetAttribute(string key)
+ {
+ if (attributes != null)
+ return Attributes [key] as string;
+
+ return null;
+ }
+
+ void IAttributeAccessor.SetAttribute(string key, string value)
+ {
+ Attributes [key] = value;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/WizardNavigationEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/WizardNavigationEventArgs.cs
new file mode 100644
index 00000000000..550eb43cb55
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/WizardNavigationEventArgs.cs
@@ -0,0 +1,62 @@
+//
+// System.Web.UI.WebControls.WizardNavigationEventArgs.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+namespace System.Web.UI.WebControls
+{
+ public class WizardNavigationEventArgs : EventArgs
+ {
+ private int curStepIndex;
+ private int nxtStepIndex;
+ private bool cancel;
+
+ public WizardNavigationEventArgs (int currentIndex, int nextIndex)
+ {
+ this.curStepIndex = currentIndex;
+ this.nxtStepIndex = nextIndex;
+ cancel = false;
+ }
+
+ public bool Cancel {
+ get { return cancel; }
+ set { cancel = value; }
+ }
+
+ public int CurrentStepIndex {
+ get { return curStepIndex; }
+ }
+
+ public int NextStepIndex {
+ get { return nxtStepIndex; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/WizardNavigationEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/WizardNavigationEventHandler.cs
new file mode 100644
index 00000000000..2e9b85aa8f3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/WizardNavigationEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebControls.WizardNavigationEventHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public delegate void WizardNavigationEventHandler (object source, WizardNavigationEventArgs e);
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/WizardStepType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/WizardStepType.cs
new file mode 100644
index 00000000000..476bc1759c2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/WizardStepType.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.UI.WebControls.WizardStepType.cs
+//
+// Author: Sanjay Gupta (gsanjay@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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web.UI.WebControls {
+ public enum WizardStepType {
+ Auto = 0,
+ Complete = 1,
+ Finish = 2,
+ Start = 3,
+ Step = 4
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs
new file mode 100644
index 00000000000..022818799c8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs
@@ -0,0 +1,261 @@
+//
+// System.Web.UI.WebControls.Xml.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.IO;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Xml.XPath;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("DocumentSource")]
+ [PersistChildren(false)]
+ [ControlBuilder (typeof (XmlBuilder))]
+ [Designer ("System.Web.UI.Design.WebControls.XmlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ public class Xml : Control
+ {
+ static XslTransform defaultTransform;
+
+ XmlDocument document;
+ string documentContent;
+ string documentSource;
+ XslTransform transform;
+ XsltArgumentList transformArgumentList;
+ string transformSource;
+ XPathDocument xpathDoc;
+
+ static Xml ()
+ {
+ XmlTextReader reader = new XmlTextReader (new StringReader("<xsl:stylesheet version='1.0' " +
+ "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>" +
+ "<xsl:template match=\"*\">" +
+ "<xsl:copy-of select=\".\"/>" +
+ "</xsl:template>" +
+ "</xsl:stylesheet>"));
+
+ defaultTransform = new XslTransform();
+#if NET_1_0
+ defaultTransform.Load (reader);
+#else
+ defaultTransform.Load (reader, null, null);
+#endif
+ }
+
+ public Xml ()
+ {
+ }
+
+ [MonoTODO("security")]
+ private void LoadXmlDoc ()
+ {
+ if (documentContent != null && documentContent.Length > 0) {
+ document = new XmlDocument ();
+ document.LoadXml (documentContent);
+ return;
+ }
+
+ if (documentSource != null && documentSource.Length != 0) {
+ document = new XmlDocument ();
+ document.Load (documentSource);
+ }
+ }
+
+#if NET_2_0
+ [Obsolete]
+#endif
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("This is the XML document that is used for the XML Webcontrol.")]
+ public XmlDocument Document {
+ get {
+ if (document == null)
+ LoadXmlDoc ();
+ return document;
+ }
+ set {
+ documentSource = null;
+ documentContent = null;
+ xpathDoc = null;
+ document = value;
+ }
+ }
+
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The XML content that is transformed for the XML Webcontrol.")]
+ public string DocumentContent {
+ get {
+ return documentContent;
+ }
+ set {
+ document = null;
+ xpathDoc = null;
+ documentContent = value;
+ }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+ [UrlProperty]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Behavior")]
+ [Editor ("System.Web.UI.Design.XmlUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [WebSysDescription ("The URL or the source of the XML content that is transformed for the XML Webcontrol.")]
+ public string DocumentSource {
+ get {
+ if (documentSource != null)
+ return documentSource;
+ return String.Empty;
+ }
+ set {
+ document = null;
+ documentContent = null;
+ xpathDoc = null;
+ documentSource = value;
+ }
+ }
+
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The XSL transform that is applied to this XML Webcontrol.")]
+ public XslTransform Transform {
+ get {
+ return transform;
+ }
+ set {
+ transformSource = null;
+ transform = value;
+ }
+ }
+
+#if NET_2_0
+ [Localizable (true)]
+#else
+ [Bindable (true)]
+#endif
+ [DefaultValue (""), WebCategory ("Behavior")]
+ [Editor ("System.Web.UI.Design.XmlUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [WebSysDescription ("An URL specifying the source that is used for the XSL transformation.")]
+ public string TransformSource {
+ get {
+ if (transformSource != null)
+ return transformSource;
+ return String.Empty;
+ }
+ set {
+ transform = null;
+ transformSource = value;
+ }
+ }
+
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("Arguments that are used by the XSL Transform.")]
+ public XsltArgumentList TransformArgumentList {
+ get { return transformArgumentList; }
+ set { transformArgumentList = value; }
+ }
+
+ protected override void AddParsedSubObject (object obj)
+ {
+ if (obj is LiteralControl) {
+ DocumentContent = ((LiteralControl) obj).Text;
+ return;
+ }
+
+ throw new HttpException (HttpRuntime.FormatResourceString (
+ "Cannot_Have_Children_of_Type",
+ "Xml",
+ GetType().Name));
+ }
+
+ private void LoadXpathDoc ()
+ {
+ if (documentContent != null && documentContent.Length > 0) {
+ xpathDoc = new XPathDocument (new StringReader (documentContent));
+ return;
+ }
+
+ if (documentSource != null && documentSource.Length != 0) {
+ xpathDoc = new XPathDocument (MapPathSecure (documentSource));
+ return;
+ }
+ }
+
+ private void LoadTransform ()
+ {
+ if (transform != null)
+ return;
+
+ if (transformSource != null && transformSource.Length != 0) {
+ transform = new XslTransform ();
+ transform.Load (MapPathSecure (transformSource));
+ }
+ }
+
+ protected override void Render(HtmlTextWriter output)
+ {
+ if (document == null) {
+ LoadXpathDoc();
+ }
+
+ LoadTransform();
+ if (document == null && xpathDoc == null) {
+ return;
+ }
+
+ if (transform == null) {
+ transform = defaultTransform;
+ }
+
+ if (document != null) {
+#if NET_1_0
+ Transform.Transform(document, transformArgumentList, output);
+#else
+ Transform.Transform(document, transformArgumentList, output, null);
+#endif
+ return;
+ }
+#if NET_1_0
+ Transform.Transform(xpathDoc, transformArgumentList, output);
+#else
+ Transform.Transform(xpathDoc, transformArgumentList, output, null);
+#endif
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/XmlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/XmlBuilder.cs
new file mode 100644
index 00000000000..445e87143d2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/XmlBuilder.cs
@@ -0,0 +1,78 @@
+//
+// System.Web.UI.WebControls.XmlBuilder.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Gonzalo Paniagua Javier (gonzalo@novell.com)
+//
+// Copyright (c) 2004 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
+// "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;
+using System.Collections;
+using System.Web.Compilation;
+using System.Web.UI;
+using System.Xml;
+
+namespace System.Web.UI.WebControls
+{
+ class XmlBuilder : ControlBuilder
+ {
+ public override void AppendLiteralString (string s)
+ {
+ }
+
+ public override Type GetChildControlType (string tagName, IDictionary attribs)
+ {
+ return null;
+ }
+
+ public override bool NeedsTagInnerText ()
+ {
+ return true;
+ }
+
+ public override void SetTagInnerText (string text)
+ {
+ string trimmed = text.Trim ();
+ if (trimmed == "")
+ return;
+
+ XmlDocument doc = new XmlDocument ();
+ try {
+ doc.LoadXml (text);
+ } catch (XmlException xmle) {
+ Location newloc = new Location (location);
+ if (xmle.LineNumber >= 0)
+ newloc.BeginLine += xmle.LineNumber - 1;
+
+ location = newloc;
+ throw;
+ }
+
+ base.AppendLiteralString (trimmed);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSource.cs b/mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSource.cs
new file mode 100644
index 00000000000..e0ebdc545c1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSource.cs
@@ -0,0 +1,320 @@
+//
+// System.Web.UI.WebControls.XmlDataSource
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Xml;
+using System.Xml.Xsl;
+using System.ComponentModel;
+using System.IO;
+
+namespace System.Web.UI.WebControls {
+
+ [DesignerAttribute ("System.Web.UI.Design.WebControls.XmlDataSourceDesigner, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
+ [DefaultProperty ("DataFile")]
+ [DefaultEvent ("Transforming")]
+ [ParseChildren (true)]
+ [PersistChildren (false)]
+ [WebSysDescription ("Connect to an XML file.")]
+// [WebSysDisplayName ("XML file")]
+ public class XmlDataSource : HierarchicalDataSourceControl, IDataSource, IListSource {
+
+
+ event EventHandler IDataSource.DataSourceChanged {
+ add { ((IHierarchicalDataSource)this).DataSourceChanged += value; }
+ remove { ((IHierarchicalDataSource)this).DataSourceChanged -= value; }
+ }
+
+ static object EventTransforming = new object ();
+ public event EventHandler Transforming {
+ add { Events.AddHandler (EventTransforming, value); }
+ remove { Events.RemoveHandler (EventTransforming, value); }
+ }
+
+ protected virtual void OnTransforming (EventArgs e)
+ {
+ EventHandler eh = Events [EventTransforming] as EventHandler;
+ if (eh != null)
+ eh (this, e);
+ }
+
+ XmlDataDocument xmlDataDocument;
+ public XmlDataDocument GetXmlDataDocument ()
+ {
+ if (xmlDataDocument == null) {
+ xmlDataDocument = new XmlDataDocument ();
+ LoadXmlDataDocument (xmlDataDocument);
+ }
+ return xmlDataDocument;
+ }
+
+ [MonoTODO ("XSLT, schema")]
+ void LoadXmlDataDocument (XmlDataDocument document)
+ {
+ if (Transform == "" && TransformFile == "") {
+ if (DataFile != "")
+ document.Load (MapPathSecure (DataFile));
+ else
+ document.LoadXml (Data);
+ } else {
+ throw new NotImplementedException ("XSLT transform not implemented");
+ }
+ }
+
+ public void Save ()
+ {
+ if (!CanBeSaved)
+ throw new InvalidOperationException ();
+
+ xmlDataDocument.Save (MapPathSecure (DataFile));
+ }
+
+ bool CanBeSaved {
+ get {
+ return !ReadOnly && Transform == "" && TransformFile == "" && DataFile != "";
+ }
+ }
+
+ [MonoTODO]
+ protected override void LoadViewState (object savedState)
+ {
+ base.LoadViewState (savedState);
+ }
+
+ [MonoTODO]
+ protected override object SaveViewState ()
+ {
+ return base.SaveViewState ();
+ }
+
+ [MonoTODO]
+ protected override void TrackViewState ()
+ {
+ base.TrackViewState ();
+ }
+
+ protected override HierarchicalDataSourceView GetHierarchicalView (string viewPath)
+ {
+ XmlNode doc = this.GetXmlDataDocument ();
+ XmlNodeList ret = null;
+
+ if (viewPath != "") {
+ XmlNode n = doc.SelectSingleNode (viewPath);
+ if (n != null)
+ ret = n.ChildNodes;
+ } else if (XPath != "") {
+ ret = doc.SelectNodes (XPath);
+ } else {
+ ret = doc.ChildNodes;
+ }
+
+ return new XmlHierarchicalDataSourceView (ret);
+ }
+
+ IList IListSource.GetList ()
+ {
+ return ListSourceHelper.GetList (this);
+ }
+
+ bool IListSource.ContainsListCollection {
+ get { return ListSourceHelper.ContainsListCollection (this); }
+ }
+
+ DataSourceView IDataSource.GetView (string viewName)
+ {
+ if (viewName == "")
+ viewName = "DefaultView";
+
+ return new XmlDataSourceView (this, viewName, GetXmlDataDocument ().DocumentElement.SelectNodes (XPath != "" ? XPath : "./*"));
+ }
+
+ ICollection IDataSource.GetViewNames ()
+ {
+ return new string [] { "DefaultView" };
+ }
+
+ public virtual bool AutoSave {
+ get {
+ object ret = ViewState ["AutoSave"];
+ return ret != null ? (bool)ret : true;
+ }
+ set {
+ ViewState ["AutoSave"] = value;
+ }
+ }
+
+ // TODO: stub these apis
+ //protected virtual FileDataSourceCache Cache { get; }
+ //public virtual int CacheDuration { get; set; }
+ //public virtual DataSourceCacheExpiry CacheExpirationPolicy { get; set; }
+ //public virtual string CacheKeyDependency { get; set; }
+ //public virtual bool EnableCaching { get; set; }
+
+ [DefaultValue ("")]
+ [PersistenceMode (PersistenceMode.InnerProperty)]
+ [WebSysDescription ("Inline XML data.")]
+ [WebCategory ("Data")]
+ [EditorAttribute ("System.ComponentModel.Design.MultilineStringEditor,System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+// [TypeConverter (typeof(MultilineStringConverter))]
+ public virtual string Data {
+ get {
+ string ret = ViewState ["Data"] as string;
+ return ret != null ? ret : "";
+ }
+ set {
+ if (Data != value) {
+ ViewState ["Data"] = value;
+ xmlDataDocument = null;
+ OnDataSourceChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [EditorAttribute ("System.Web.UI.Design.XmlDataFileEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public virtual string DataFile {
+ get {
+ string ret = ViewState ["DataFile"] as string;
+ return ret != null ? ret : "";
+ }
+ set {
+ if (DataFile != value) {
+ ViewState ["DataFile"] = value;
+ xmlDataDocument = null;
+ OnDataSourceChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public virtual bool ReadOnly {
+ get {
+ object ret = ViewState ["ReadOnly"];
+ return ret != null ? (bool)ret : true;
+ }
+ set {
+ ViewState ["ReadOnly"] = value;
+ }
+ }
+
+// [TypeConverterAttribute (typeof(System.ComponentModel.MultilineStringConverter)]
+ [EditorAttribute ("System.ComponentModel.Design.MultilineStringEditor,System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [DefaultValueAttribute ("")]
+ public virtual string Schema {
+ get {
+ string ret = ViewState ["Schema"] as string;
+ return ret != null ? ret : "";
+ }
+ set {
+ if (Schema != value) {
+ ViewState ["Schema"] = value;
+ xmlDataDocument = null;
+ OnDataSourceChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ [EditorAttribute ("System.Web.UI.Design.XsdSchemaFileEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public virtual string SchemaFile {
+ get {
+ string ret = ViewState ["SchemaFile"] as string;
+ return ret != null ? ret : "";
+ }
+ set {
+ if (SchemaFile != value) {
+ ViewState ["SchemaFile"] = value;
+ xmlDataDocument = null;
+ OnDataSourceChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ XsltArgumentList transformArgumentList;
+
+ [BrowsableAttribute (false)]
+ public virtual XsltArgumentList TransformArgumentList {
+ get { return transformArgumentList; }
+ set { transformArgumentList = value; }
+ }
+
+ [PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+ [EditorAttribute ("System.ComponentModel.Design.MultilineStringEditor,System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [DefaultValueAttribute ("")]
+// [TypeConverterAttribute (typeof(System.ComponentModel.MultilineStringConverter))]
+ public virtual string Transform {
+ get {
+ string ret = ViewState ["Transform"] as string;
+ return ret != null ? ret : "";
+ }
+ set {
+ if (Transform != value) {
+ ViewState ["Transform"] = value;
+ xmlDataDocument = null;
+ OnDataSourceChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [EditorAttribute ("System.Web.UI.Design.XslTransformFileEditor, System.Design, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [DefaultValueAttribute ("")]
+ public virtual string TransformFile {
+ get {
+ string ret = ViewState ["TransformFile"] as string;
+ return ret != null ? ret : "";
+ }
+ set {
+ if (TransformFile != value) {
+ ViewState ["TransformFile"] = value;
+ xmlDataDocument = null;
+ OnDataSourceChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [DefaultValueAttribute ("")]
+ public virtual string XPath {
+ get {
+ string ret = ViewState ["XPath"] as string;
+ return ret != null ? ret : "";
+ }
+ set {
+ if (XPath != value) {
+ ViewState ["XPath"] = value;
+ OnDataSourceChanged(EventArgs.Empty);
+ }
+ }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSourceNodeDescriptor.cs b/mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSourceNodeDescriptor.cs
new file mode 100644
index 00000000000..3df2195fddd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSourceNodeDescriptor.cs
@@ -0,0 +1,123 @@
+//
+// System.Web.UI.WebControls.XmlDataSourceNodeDescriptor
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Xml;
+using AC = System.ComponentModel.AttributeCollection;
+
+namespace System.Web.UI.WebControls
+{
+ internal class XmlDataSourceNodeDescriptor: ICustomTypeDescriptor
+ {
+ XmlNode node;
+
+ public XmlDataSourceNodeDescriptor (XmlNode node)
+ {
+ this.node = node;
+ }
+
+ public XmlNode Node {
+ get { return node; }
+ }
+
+ public AC GetAttributes()
+ {
+ return AC.Empty;
+ }
+
+ public string GetClassName()
+ {
+ return "XmlDataSourceNodeDescriptor";
+ }
+
+ public string GetComponentName()
+ {
+ return null;
+ }
+
+ public TypeConverter GetConverter()
+ {
+ return null;
+ }
+
+ public EventDescriptor GetDefaultEvent()
+ {
+ return null;
+ }
+
+ public PropertyDescriptor GetDefaultProperty()
+ {
+ return null;
+ }
+
+ public object GetEditor(Type editorBaseType)
+ {
+ return null;
+ }
+
+ public EventDescriptorCollection GetEvents()
+ {
+ return null;
+ }
+
+ public EventDescriptorCollection GetEvents(Attribute[] arr)
+ {
+ return null;
+ }
+
+ public PropertyDescriptorCollection GetProperties()
+ {
+ if (node.Attributes != null) {
+ PropertyDescriptor[] props = new PropertyDescriptor [node.Attributes.Count];
+ for (int n=0; n<props.Length; n++)
+ props [n] = new XmlDataSourcePropertyDescriptor (node.Attributes [n].Name, node.IsReadOnly);
+ return new PropertyDescriptorCollection (props);
+ } else
+ return PropertyDescriptorCollection.Empty;
+ }
+
+ public PropertyDescriptorCollection GetProperties(Attribute[] arr)
+ {
+ return GetProperties ();
+ }
+
+ public object GetPropertyOwner (PropertyDescriptor pd)
+ {
+ if (pd is XmlDataSourcePropertyDescriptor)
+ return this;
+ return null;
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSourcePropertyDescriptor.cs b/mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSourcePropertyDescriptor.cs
new file mode 100644
index 00000000000..e005259f7f1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSourcePropertyDescriptor.cs
@@ -0,0 +1,95 @@
+//
+// System.Web.UI.WebControls.XmlDataSourcePropertyDescriptor
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+using System;
+using System.Collections;
+using System.Xml;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+
+ internal class XmlDataSourcePropertyDescriptor : PropertyDescriptor
+ {
+ bool readOnly;
+
+ public XmlDataSourcePropertyDescriptor (string name, bool readOnly) : base (name, null)
+ {
+ this.readOnly = readOnly;
+ }
+
+ public override bool CanResetValue (object o)
+ {
+ return false;
+ }
+
+ public override void ResetValue (object o)
+ {
+ }
+
+ public override object GetValue (object o)
+ {
+ XmlDataSourceNodeDescriptor nd = o as XmlDataSourceNodeDescriptor;
+ if (nd != null && nd.Node.Attributes != null) {
+ XmlAttribute a = nd.Node.Attributes [Name];
+ if (a != null) return a.Value;
+ }
+ return String.Empty;
+ }
+
+ public override void SetValue (object o, object value)
+ {
+ XmlDataSourceNodeDescriptor nd = o as XmlDataSourceNodeDescriptor;
+ if (nd != null && nd.Node.Attributes != null) {
+ XmlAttribute a = nd.Node.Attributes [Name];
+ if (a != null) a.Value = value.ToString ();
+ }
+ }
+
+ public override bool ShouldSerializeValue (object o)
+ {
+ return o is XmlNode;
+ }
+
+ public override Type ComponentType {
+ get { return typeof (XmlDataSourceNodeDescriptor); }
+ }
+
+ public override bool IsReadOnly {
+ get { return readOnly; }
+ }
+
+ public override Type PropertyType {
+ get { return typeof (string); }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSourceView.cs b/mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSourceView.cs
new file mode 100644
index 00000000000..5254beba2bd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSourceView.cs
@@ -0,0 +1,83 @@
+//
+// System.Web.UI.WebControls.XmlDataSourceView
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Xml;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class XmlDataSourceView : DataSourceView
+ {
+ string name;
+ ArrayList nodes;
+
+ public XmlDataSourceView (XmlDataSource owner, string name, XmlNodeList nodes)
+ {
+ // Why do they pass owner?
+ this.name = name;
+ this.nodes = new ArrayList (nodes.Count);
+
+ foreach (XmlNode node in nodes) {
+ if (node.NodeType == XmlNodeType.Element)
+ this.nodes.Add (node);
+ }
+ }
+
+ public IEnumerable Select (DataSourceSelectArguments arguments)
+ {
+ return ExecuteSelect (arguments);
+ }
+
+ public override string Name {
+ get { return name; }
+ }
+
+ [MonoTODO]
+ protected internal override IEnumerable ExecuteSelect (DataSourceSelectArguments arguments)
+ {
+ ArrayList list = new ArrayList ();
+ int max = arguments.StartRowIndex + (arguments.MaximumRows > 0 ? arguments.MaximumRows : nodes.Count);
+ if (max > nodes.Count) max = nodes.Count;
+
+ for (int n = arguments.StartRowIndex; n < max; n++)
+ list.Add (new XmlDataSourceNodeDescriptor ((XmlElement) nodes [n]));
+
+ if (arguments.RetrieveTotalRowCount)
+ arguments.TotalRowCount = nodes.Count;
+
+ return list;
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchicalDataSourceView.cs b/mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchicalDataSourceView.cs
new file mode 100644
index 00000000000..b9fc63edca8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchicalDataSourceView.cs
@@ -0,0 +1,55 @@
+//
+// System.Web.UI.WebControls.XmlHierarchicalDataSourceView
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2003 Ben Maurer
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Xml;
+
+namespace System.Web.UI.WebControls {
+ public class XmlHierarchicalDataSourceView : HierarchicalDataSourceView {
+ internal XmlHierarchicalDataSourceView (XmlNodeList nodeList)
+ {
+ this.nodeList = nodeList;
+ }
+
+ public override IHierarchicalEnumerable Select ()
+ {
+ return new XmlHierarchicalEnumerable (nodeList);
+ }
+
+ XmlNodeList nodeList;
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchicalEnumerable.cs b/mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchicalEnumerable.cs
new file mode 100644
index 00000000000..815d0e61b1b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchicalEnumerable.cs
@@ -0,0 +1,66 @@
+//
+// System.Web.UI.WebControls.XmlHierarchicalEnumerable
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Xml;
+
+namespace System.Web.UI.WebControls {
+ internal class XmlHierarchicalEnumerable : IHierarchicalEnumerable {
+ internal XmlHierarchicalEnumerable (XmlNodeList nodeList)
+ {
+ this.nodeList = nodeList;
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ ArrayList ret = new ArrayList (nodeList.Count);
+
+ foreach (XmlNode node in nodeList) {
+ if (node.NodeType == XmlNodeType.Element)
+ ret.Add (new XmlHierarchyData (node));
+ }
+
+ return ret.GetEnumerator ();
+ }
+
+ IHierarchyData IHierarchicalEnumerable.GetHierarchyData (object enumeratedItem)
+ {
+ return (IHierarchyData) enumeratedItem;
+ }
+
+ XmlNodeList nodeList;
+
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchyData.cs b/mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchyData.cs
new file mode 100644
index 00000000000..755c3c17928
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchyData.cs
@@ -0,0 +1,237 @@
+//
+// System.Web.UI.WebControls.XmlHierarchyData
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Xml;
+using System.ComponentModel;
+using AC = System.ComponentModel.AttributeCollection;
+
+namespace System.Web.UI.WebControls {
+ internal class XmlHierarchyData : IHierarchyData, ICustomTypeDescriptor {
+ internal XmlHierarchyData (XmlNode item)
+ {
+ this.item = item;
+ }
+
+ public override string ToString ()
+ {
+ return item.Name;
+ }
+
+ #region ICustomTypeDescriptor
+ AC ICustomTypeDescriptor.GetAttributes ()
+ {
+ return AC.Empty;
+ }
+
+ string ICustomTypeDescriptor.GetClassName ()
+ {
+ return "XmlHierarchyData";
+ }
+
+ string ICustomTypeDescriptor.GetComponentName ()
+ {
+ return null;
+ }
+
+ TypeConverter ICustomTypeDescriptor.GetConverter ()
+ {
+ return null;
+ }
+
+ EventDescriptor ICustomTypeDescriptor.GetDefaultEvent ()
+ {
+ return null;
+ }
+
+ PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty ()
+ {
+ return new XmlHierarchyDataPropertyDescriptor (item, "##Name##");
+ }
+
+ object ICustomTypeDescriptor.GetEditor (Type editorBaseType)
+ {
+ return null;
+ }
+
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents ()
+ {
+ return null;
+ }
+
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents (Attribute [] attrs)
+ {
+ return null;
+ }
+
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties ()
+ {
+ return ((ICustomTypeDescriptor)this).GetProperties (null);
+ }
+
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties (Attribute [] attrFilter)
+ {
+ ArrayList ret = new ArrayList ();
+ ret.Add (new XmlHierarchyDataPropertyDescriptor (item, "##Name##"));
+ ret.Add (new XmlHierarchyDataPropertyDescriptor (item, "##Value##"));
+ ret.Add (new XmlHierarchyDataPropertyDescriptor (item, "##InnerText##"));
+
+ if (item.Attributes != null)
+ foreach (XmlAttribute a in item.Attributes)
+ ret.Add (new XmlHierarchyDataPropertyDescriptor (item, a.Name));
+
+ return new PropertyDescriptorCollection ((PropertyDescriptor[]) ret.ToArray (typeof (PropertyDescriptor)));
+ }
+
+ object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd)
+ {
+ if (pd is XmlHierarchyDataPropertyDescriptor)
+ return this;
+ return null;
+ }
+ #endregion
+
+ #region IHierarchyData
+ IHierarchicalEnumerable IHierarchyData.GetChildren ()
+ {
+ return new XmlHierarchicalEnumerable (item.ChildNodes);
+ }
+
+ IHierarchicalEnumerable IHierarchyData.GetParent ()
+ {
+ if (item.ParentNode == null)
+ return null;
+ return new XmlHierarchicalEnumerable (item.ParentNode.ChildNodes);
+ }
+
+ bool IHierarchyData.HasChildren {
+ get { return item.HasChildNodes; }
+ }
+
+ object IHierarchyData.Item {
+ get { return item; }
+ }
+
+ [MonoTODO]
+ string IHierarchyData.Path {
+ get { throw new NotImplementedException (); }
+ }
+
+ string IHierarchyData.Type {
+ get { return item.Name; }
+ }
+ #endregion
+
+ XmlNode item;
+
+ class XmlHierarchyDataPropertyDescriptor : PropertyDescriptor {
+ public XmlHierarchyDataPropertyDescriptor (XmlNode xmlNode, string name) : base (name, null)
+ {
+ this.xmlNode = xmlNode;
+ this.name = name;
+ }
+
+ public override bool CanResetValue (object o)
+ {
+ return false;
+ }
+
+ public override void ResetValue (object o)
+ {
+ }
+
+ public override object GetValue (object o)
+ {
+ if (o is XmlHierarchyData) {
+ switch (name) {
+ case "##Name##": return xmlNode.Name;
+ case "##Value##": return xmlNode.Value;
+ case "##InnerText##": return xmlNode.InnerText;
+ case null: return String.Empty;
+ default:
+ if (xmlNode.Attributes != null) {
+ XmlAttribute a = xmlNode.Attributes [name];
+ if (a != null)
+ return a.Value;
+ }
+ break;
+ }
+ }
+ return String.Empty;
+ }
+
+ public override void SetValue (object o, object value)
+ {
+ if (o is XmlHierarchyData) {
+ switch (name) {
+ case "##Name##": break;
+ case "##Value##": xmlNode.Value = value.ToString (); break;
+ case "##InnerText##": xmlNode.InnerText = value.ToString (); break;
+ case null: break;
+ default:
+ if (xmlNode.Attributes != null) {
+ XmlAttribute a = xmlNode.Attributes [name];
+ if (a != null)
+ a.Value = value.ToString ();
+ }
+ break;
+ }
+ }
+ }
+
+ public override bool ShouldSerializeValue (object o)
+ {
+ return o is XmlNode;
+ }
+
+ public override Type ComponentType {
+ get { return typeof (XmlHierarchyData); }
+ }
+
+ public override bool IsReadOnly {
+ get { return xmlNode.IsReadOnly; }
+ }
+
+ public override Type PropertyType {
+ get { return typeof (string); }
+ }
+
+ string name;
+ XmlNode xmlNode;
+ }
+
+ }
+
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/.cvsignore b/mcs/class/System.Web/System.Web.UI/.cvsignore
new file mode 100644
index 00000000000..6cf78161dc9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/.cvsignore
@@ -0,0 +1 @@
+semantic.cache
diff --git a/mcs/class/System.Web/System.Web.UI/ApplicationFileParser.cs b/mcs/class/System.Web/System.Web.UI/ApplicationFileParser.cs
new file mode 100644
index 00000000000..a7f3bf9b55d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ApplicationFileParser.cs
@@ -0,0 +1,94 @@
+//
+// System.Web.UI.ApplicationFileParser.cs
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
+// (c) 2004 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
+// "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;
+using System.Collections;
+using System.Web;
+using System.Web.Compilation;
+
+namespace System.Web.UI
+{
+ sealed class ApplicationFileParser : TemplateParser
+ {
+ static ArrayList dependencies;
+
+ public ApplicationFileParser (string fname, HttpContext context)
+ {
+ InputFile = fname;
+ Context = context;
+ }
+
+ protected override Type CompileIntoType ()
+ {
+ return GlobalAsaxCompiler.CompileApplicationType (this);
+ }
+
+ internal static Type GetCompiledApplicationType (string inputFile, HttpContext context)
+ {
+ ApplicationFileParser parser = new ApplicationFileParser (inputFile, context);
+ AspGenerator generator = new AspGenerator (parser);
+ Type type = generator.GetCompiledType ();
+ dependencies = parser.Dependencies;
+ return type;
+ }
+
+ internal override void AddDirective (string directive, Hashtable atts)
+ {
+ if (String.Compare (directive, "application", true) != 0 &&
+ String.Compare (directive, "Import", true) != 0 &&
+ String.Compare (directive, "Assembly", true) != 0)
+ ThrowParseException ("Invalid directive: " + directive);
+
+ base.AddDirective (directive, atts);
+ }
+
+ internal static ArrayList FileDependencies {
+ get { return dependencies; }
+ }
+
+ internal override Type DefaultBaseType {
+ get { return typeof (HttpApplication); }
+ }
+
+ internal override string DefaultBaseTypeName {
+ get { return "System.Web.HttpApplication"; }
+ }
+
+ internal override string DefaultDirectiveName {
+ get { return "application"; }
+ }
+
+ internal override string BaseVirtualDir {
+ get { return Context.Request.ApplicationPath; }
+ }
+ }
+
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/AttributeCollection.cs b/mcs/class/System.Web/System.Web.UI/AttributeCollection.cs
new file mode 100755
index 00000000000..ac3278c6f16
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/AttributeCollection.cs
@@ -0,0 +1,104 @@
+//
+// System.Web.UI.AttributeCollection.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.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;
+using System.Collections;
+
+namespace System.Web.UI {
+
+ public sealed class AttributeCollection
+ {
+ private StateBag bag;
+ private CssStyleCollection styleCollection;
+
+ public AttributeCollection (StateBag bag)
+ {
+ this.bag = bag;
+ }
+
+ public int Count {
+ get { return bag.Count; }
+ }
+
+ public CssStyleCollection CssStyle {
+ get {
+ if (styleCollection == null)
+ styleCollection = new CssStyleCollection (bag);
+ return styleCollection;
+ }
+ }
+
+ public string this [string key] {
+ get { return bag [key] as string; }
+
+ set { bag.Add (key, value); }
+ }
+
+ public ICollection Keys {
+ get { return bag.Keys; }
+ }
+
+ public void Add (string key, string value)
+ {
+ if (styleCollection != null && 0 == String.Compare (key, "style", true))
+ styleCollection.FillStyle (value);
+ else
+ bag.Add (key, value);
+ }
+
+ public void AddAttributes (HtmlTextWriter writer)
+ {
+ foreach (string key in bag.Keys) {
+ string value = bag [key] as string;
+ writer.AddAttribute (key, value);
+ }
+ }
+
+ public void Clear ()
+ {
+ bag.Clear ();
+ }
+
+ public void Remove (string key)
+ {
+ bag.Remove (key);
+ }
+
+ public void Render (HtmlTextWriter writer)
+ {
+ foreach (string key in bag.Keys) {
+ string value = bag [key] as string;
+ if (value != null)
+ writer.WriteAttribute (key, value);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/BaseParser.cs b/mcs/class/System.Web/System.Web.UI/BaseParser.cs
new file mode 100755
index 00000000000..e01bd6faf07
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/BaseParser.cs
@@ -0,0 +1,148 @@
+//
+// System.Web.UI.BaseParser.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.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;
+using System.Collections;
+using System.IO;
+using System.Web;
+using System.Web.Compilation;
+using System.Web.Configuration;
+using System.Web.Util;
+
+namespace System.Web.UI
+{
+ public class BaseParser
+ {
+ HttpContext context;
+ string baseDir;
+ string baseVDir;
+ ILocation location;
+ CompilationConfiguration compilationConfig;
+
+ internal string MapPath (string path)
+ {
+ return MapPath (path, true);
+ }
+
+ internal string MapPath (string path, bool allowCrossAppMapping)
+ {
+ if (context == null)
+ throw new HttpException ("context is null!!");
+
+ return context.Request.MapPath (path, BaseVirtualDir, allowCrossAppMapping);
+ }
+
+ internal string PhysicalPath (string path)
+ {
+ if (Path.DirectorySeparatorChar != '/')
+ path = path.Replace ('/', '\\');
+
+ return Path.Combine (BaseDir, path);
+ }
+
+ internal bool GetBool (Hashtable hash, string key, bool deflt)
+ {
+ string val = hash [key] as string;
+ if (val == null)
+ return deflt;
+
+ hash.Remove (key);
+
+ bool result = false;
+ if (String.Compare (val, "true", true) == 0)
+ result = true;
+ else if (String.Compare (val, "false", true) != 0)
+ ThrowParseException ("Invalid value for " + key);
+
+ return result;
+ }
+
+ internal static string GetString (Hashtable hash, string key, string deflt)
+ {
+ string val = hash [key] as string;
+ if (val == null)
+ return deflt;
+
+ hash.Remove (key);
+ return val;
+ }
+
+ internal void ThrowParseException (string message)
+ {
+ throw new ParseException (location, message);
+ }
+
+ internal void ThrowParseException (string message, Exception inner)
+ {
+ throw new ParseException (location, message, inner);
+ }
+
+ internal ILocation Location {
+ get { return location; }
+ set { location = value; }
+ }
+
+ internal HttpContext Context {
+ get { return context; }
+ set { context = value; }
+ }
+
+ internal string BaseDir {
+ get {
+ if (baseDir == null)
+ baseDir = MapPath (BaseVirtualDir, false);
+
+ return baseDir;
+ }
+ }
+
+ internal virtual string BaseVirtualDir {
+ get {
+ if (baseVDir == null)
+ baseVDir = UrlUtils.GetDirectory (context.Request.FilePath);
+
+ return baseVDir;
+ }
+
+ set { baseVDir = value; }
+ }
+
+ internal CompilationConfiguration CompilationConfig {
+ get {
+ if (compilationConfig == null)
+ compilationConfig = CompilationConfiguration.GetInstance (context);
+
+ return compilationConfig;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/BasePartialCachingControl.cs b/mcs/class/System.Web/System.Web.UI/BasePartialCachingControl.cs
new file mode 100644
index 00000000000..4aa0e760c1f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/BasePartialCachingControl.cs
@@ -0,0 +1,185 @@
+//
+// System.Web.UI.BasePartialCachingControl.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2003 Andreas Nahr
+// (C) 2004 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
+// "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;
+using System.IO;
+using System.Text;
+using System.ComponentModel;
+using System.Web.Caching;
+
+namespace System.Web.UI
+{
+ [ToolboxItem (false)]
+ public abstract class BasePartialCachingControl : Control
+ {
+ private CacheDependency dependency;
+ private string ctrl_id;
+ private string guid;
+ private int duration;
+ private string varyby_params;
+ private string varyby_controls;
+ private string varyby_custom;
+
+ private Control control;
+
+ protected BasePartialCachingControl()
+ {
+ }
+
+ internal string CtrlID {
+ get { return ctrl_id; }
+ set { ctrl_id = value; }
+ }
+
+ internal string Guid {
+ get { return guid; }
+ set { guid = value; }
+ }
+
+ internal int Duration {
+ get { return duration; }
+ set { duration = value; }
+ }
+
+ internal string VaryByParams {
+ get { return varyby_params; }
+ set { varyby_params = value; }
+ }
+
+ internal string VaryByControls {
+ get { return varyby_controls; }
+ set { varyby_controls = value; }
+ }
+
+ internal string VaryByCustom {
+ get { return varyby_custom; }
+ set { varyby_custom = value; }
+ }
+
+ internal abstract Control CreateControl ();
+
+ public override void Dispose ()
+ {
+ if (dependency != null) {
+ dependency.Dispose ();
+ dependency = null;
+ }
+ }
+
+ protected override void OnInit (EventArgs e)
+ {
+ control = CreateControl ();
+ Controls.Add (control);
+ }
+
+ protected override void Render (HtmlTextWriter output)
+ {
+ Cache cache = HttpRuntime.Cache;
+ string key = CreateKey ();
+ string data = cache [key] as string;
+
+ if (data != null) {
+ output.Write (data);
+ return;
+ }
+
+ HttpContext context = HttpContext.Current;
+ StringWriter writer = new StringWriter ();
+ TextWriter prev = context.Response.SetTextWriter (writer);
+ HtmlTextWriter txt_writer = new HtmlTextWriter (writer);
+ string text;
+ try {
+ control.RenderControl (txt_writer);
+ } finally {
+ text = writer.ToString ();
+ context.Response.SetTextWriter (prev);
+ output.Write (text);
+ }
+
+ context.Cache.InsertPrivate (key, text, dependency,
+ DateTime.Now.AddSeconds (duration),
+ Cache.NoSlidingExpiration,
+ CacheItemPriority.Normal, null);
+ }
+
+ public CacheDependency Dependency {
+ get {return dependency;}
+ set {dependency = value;}
+ }
+
+ private string CreateKey ()
+ {
+ StringBuilder builder = new StringBuilder ();
+ HttpContext context = HttpContext.Current;
+
+ builder.Append ("PartialCachingControl\n");
+ builder.Append ("GUID: " + guid + "\n");
+
+ if (varyby_params != null && varyby_params.Length > 0) {
+ string[] prms = varyby_params.Split (';');
+ for (int i=0; i<prms.Length; i++) {
+ string val = context.Request.Params [prms [i]];
+ builder.Append ("VP:");
+ builder.Append (prms [i]);
+ builder.Append ('=');
+ builder.Append (val != null ? val : "__null__");
+ builder.Append ('\n');
+ }
+ }
+
+ if (varyby_controls != null && varyby_params.Length > 0) {
+ string[] prms = varyby_controls.Split (';');
+ for (int i=0; i<prms.Length; i++) {
+ string val = context.Request.Params [prms [i]];
+ builder.Append ("VCN:");
+ builder.Append (prms [i]);
+ builder.Append ('=');
+ builder.Append (val != null ? val : "__null__");
+ builder.Append ('\n');
+ }
+ }
+
+ if (varyby_custom != null) {
+ string val = context.ApplicationInstance.GetVaryByCustomString (context,
+ varyby_custom);
+ builder.Append ("VC:");
+ builder.Append (varyby_custom);
+ builder.Append ('=');
+ builder.Append (val != null ? val : "__null__");
+ builder.Append ('\n');
+ }
+
+ return builder.ToString ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/BoundPropertyEntry.cs b/mcs/class/System.Web/System.Web.UI/BoundPropertyEntry.cs
new file mode 100644
index 00000000000..31fe258fc5f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/BoundPropertyEntry.cs
@@ -0,0 +1,61 @@
+//
+// System.Web.UI.BoundPropertyEntry
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// Copyright (c) 2005 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI
+{
+ public class BoundPropertyEntry : PropertyEntry {
+ string expression;
+ string expressionPrefix;
+ bool generated;
+ bool useSetAttribute;
+
+ public string Expression {
+ get { return expression; }
+ set { expression = value; }
+ }
+
+ public string ExpressionPrefix {
+ get { return expressionPrefix; }
+ set { expressionPrefix = value; }
+ }
+
+ public bool Generated {
+ get { return generated; }
+ set { generated = value; }
+ }
+
+ public bool UseSetAttribute {
+ get { return useSetAttribute; }
+ set { useSetAttribute = value; }
+ }
+ }
+}
+#endif // NET_2_0
+
diff --git a/mcs/class/System.Web/System.Web.UI/BuildMethod.cs b/mcs/class/System.Web/System.Web.UI/BuildMethod.cs
new file mode 100644
index 00000000000..249db8a5a12
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/BuildMethod.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.UI.BuildMethod.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public delegate Control BuildMethod();
+}
diff --git a/mcs/class/System.Web/System.Web.UI/BuildTemplateMethod.cs b/mcs/class/System.Web/System.Web.UI/BuildTemplateMethod.cs
new file mode 100644
index 00000000000..8d599031b06
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/BuildTemplateMethod.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.UI.BuildTemplateMethod.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public delegate void BuildTemplateMethod(Control control);
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ChangeLog b/mcs/class/System.Web/System.Web.UI/ChangeLog
new file mode 100644
index 00000000000..9a1ff62267b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ChangeLog
@@ -0,0 +1,2038 @@
+2005-04-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateParser.cs:
+ * SimpleWebHandlerParser.cs: removed values assigned and neved used.
+
+2005-04-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleWebHandlerParser.cs:
+ * TemplateParser.cs: always get the location (full path) for assemblies,
+ even the ones from the GAC.
+
+ * BaseCompiler.cs: check that DynamicBase directory exists before
+ creating the TempFileCollection.
+
+2005-04-22 Lluis Sanchez Gual <lluis@novell.com>
+
+ * ClientScriptManager.cs: Use a linked list instead of a Hashtable
+ to store the scripts. In this way, scripts will be rendered in the
+ same order as they have been registered. It shouldn't be slower
+ since pages don't have many scripts.
+
+2005-04-21 Lluis Sanchez Gual <lluis@novell.com>
+
+ * IEditableTextControl.cs: Implemented.
+ * DataBinder.cs: Marked constructor as obsolete in 2.0.
+ In GetDataItem, check for the IDataItemContainer interface
+ in the container.
+ * TemplateControl.cs: Improved check for data item.
+
+2005-04-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateParser.cs: we still need LoadWithPartialName if Load fails.
+ * Page.cs: ensure _requiresPostBack is emptied if we didn't have a copy
+ for second postback.
+
+2005-04-20 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * TemplateParser.cs: Adding support for Strict/Explicit attributes
+ for @Page/@Control directives as documented at
+ http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconControlDirective.asp.
+ First step don't choke on them. Fixing #74671
+
+2005-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateParser.cs: use Load instead of LoadWithPartialName. That was
+ there from the time when Load wasn't working properly. First part of the
+ fix to 74500.
+
+2005-04-15 Lluis Sanchez Gual <lluis@novell.com>
+
+ * ControlBuilder.cs: The BindingContainerType property happens
+ to exist in 2.0, so I made it public. Added ParentTemplateBuilder,
+ which is used to get the binding container that is managing
+ the current two-way binding context.
+ * TemplateBuilder.cs: Added some methods and an internal class
+ to support two-way bindings.
+ * CompiledBindableTemplateBuilder.cs: Implemented.
+ * IBindableTemplate.cs: This interface inherits from ITemplate.
+
+2005-04-14 Lluis Sanchez Gual <lluis@novell.com>
+
+ * ControlBuilder.cs: Added BindingContainerType property,
+ which works like NamingContainerType but takes into account
+ template builders with a specific container type (specified
+ using the TemplateContainerAttribute.
+ * StateManagedCollection.cs: Reimplemented Save/Load view
+ state methods. The existing implementation was not correct
+ in all cases.
+
+2005-04-08 Lluis Sanchez Gual <lluis@novell.com>
+
+ * DataSourceView.cs: Added null check.
+
+2005-04-07 Lluis Sanchez Gual <lluis@novell.com>
+
+ * TemplateControl.cs:
+ * Page.cs: Moved Eval and XPath from Page
+ to TemplateControl.
+ * StateManagedCollection.cs: Avoid saving null state.
+
+2005-04-01 Lluis Sanchez Gual <lluis@novell.com>
+
+ * DataSourceView.cs: Rethrow exceptions not handled by operation
+ callbacks.
+ * ITextControl.cs: Removed event.
+ * CollectionBuilder.cs: Don't crash when a collection has more
+ than one indexer.
+
+2005-03-23 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Control.cs: Added a new internal property: HasRenderMethodDelegate.
+ * HtmlTextWriterAttribute.cs: Replaced wrong enum value.
+ * HtmlTextWriter.cs: Register new ASP.NET 2.0 attributes
+
+2005-03-16 Lluis Sanchez Gual <lluis@novell.com>
+
+ * ClientScriptManager.cs: Fix build.
+
+2005-03-11 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Utils.cs, Control.cs: Don't use Page.GetPostBackClientEvent
+ since it is deprecated in 2.0.
+ * Page.cs: Deprecated GetPostBackClientEvent and similar methods
+ in 2.0. Moved callback management methods to ClientScriptManager.
+ * ClientScriptManager.cs: Moved here deprecated methods from Page.
+ In GetPostBackEventReference (PostBackOptions), don't use the
+ WebForm_DoPostback script if the post can be done with a simple
+ __doPostBack call.
+ * PostBackOptions.cs: Fixed default values for some properties.
+
+2005-03-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: in FindControl, throw if there's more than one control
+ with the same ID. Fixes bug #73479.
+
+2005-03-04 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Page.cs: Load control state before loading view state, and the
+ same for saving.
+ * DataSourceSelectArguments.cs: Fix recursive property call.
+
+2005-02-25 Lluis Sanchez Gual <lluis@novell.com>
+
+ * DataSourceView.cs: Fixed incorrect implementation of
+ RaiseUnsupportedCapabilityError.
+ * IDataItemContainer.cs: Added new properties.
+ * Page.cs: Implemented Form property.
+ * Control.cs: Fixed formatting.
+ * StateManagedCollection.cs: Track view state of items loaded
+ in LoadViewState.
+
+2005-02-22 Lluis Sanchez Gual <lluis@novell.com>
+
+ * FilterableAttribute.cs: Fix endless loop.
+
+2005-02-18 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Page.cs: Implemented missing events.
+
+2005-02-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BoundPropertyEntry.cs:
+ * PropertyEntry.cs:
+ * TwoWayBoundPropertyEntry.cs: implemented.
+
+2005-02-10 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Page.cs: Added support for validation groups. Some fixes in
+ SavePageControlState().
+ * IFilterResolutionService.cs: Removed extra field.
+ * INavigateUIData.cs: Added missing field.
+ * ICheckBoxControl.cs, IStaticTextControl.cs, ITextControl.cs:
+ Implemented new interfaces.
+
+2005-02-04 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Page.cs: Implemented support for cross page postback. Implemented
+ support for postback with options. Fixed several method and property
+ signatures for 2.0.
+ * PostBackOptions.cs: Added some TODOs.
+
+2005-02-02 Lluis Sanchez Gual <lluis@novell.com>
+
+ * ParseChildrenAttribute.cs: Set the correct default value for the
+ childType property.
+
+2005-01-28 Lluis Sanchez Gual <lluis@novell.com>
+
+ * ParseChildrenAttribute.cs: Added 2.0 property.
+ * Pair.cs, Triplet.cs: Make classes serializable and sealed in 2.0.
+ * Page.cs: Added support for control state.
+ * TemplateBuilder.cs: ContainerType should be internal.
+ * Control.cs: Added some new 2.0 methods.
+
+2005-01-21 Lluis Sanchez Gual <lluis@novell.com>
+
+ * PageParser.cs: Read the MasterPageFile attribute.
+ * UserControlParser.cs: Not sealed any more since we need to inherit from
+ it. Added new constructor with an additional "type" parameter.
+ * MasterPageParser.cs: Parser for master pages.
+ * Page.cs: Added support for master pages.
+ * MasterPage.cs: Implemented.
+
+2005-01-10 Lluis Sanchez Gual <lluis@novell.com>
+
+ * TemplateBuilder.cs: Added a special constructor that takes an
+ attribute provider as parameter. The container type for the template
+ may be defined in a TemplateContainerAttribute.
+ * ControlBuilder.cs: Create the TemplateBuilder using that special
+ constructor.
+ * TemplateContainerAttribute.cs: Added 2.0 property and ctor.
+
+2004-12-20 Lluis Sanchez Gual <lluis@novell.com>
+
+ * IStyleSheet.cs: Added missing "using".
+ * Page.cs: Implemented Header property.
+ * CssStyleCollection.cs: Made BagToString method internal.
+ * RootBuilder.cs: Register HtmlHead control.
+
+2004-12-17 Lluis Sanchez Gual <lluis@novell.com>
+
+ * CssStyleCollection.cs: Minor (!) fix.
+ * HtmlTextWriter.cs: Register names for new 2.0 styles.
+
+2004-12-17 Lluis Sanchez Gual <lluis@novell.com>
+
+ * CssStyleCollection.cs: Make it work as a standalone collection.
+ * HtmlTextWriter.cs: Added static method for getting style names.
+
+2004-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ControlCollection.cs: fix off-by-one and store a null at the end to
+ remove the reference to the removed control.
+
+2004-12-10 Lluis Sanchez Gual <lluis@novell.com>
+
+ * ClientScriptManager.cs: Added GetScriptLiteral helper method.
+
+2004-12-02 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Page.cs: Added support for callback events. Moved theform variable
+ outside the __doPostBack function, so it can be used by other
+ scripts.
+ * StateBag.cs: Implemented SetDirty().
+
+2004-11-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: when saving "Visible" into the ViewState, save the value
+ for this precise control, as using the Visible property might give us
+ Control's parent visibility. Fixes bug #69200.
+
+2004-11-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: fixed ResolveUrl for relative URLs when using cookie-less
+ sessions.
+
+ * System.Web.Util/UrlUtils.cs: made (Insert|Get|Remove)SessionId use
+ the appRoot + SessionID + vpath format.
+
+ Fixes the 3 issues reported in bug #66623.
+
+2004-11-26 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Page.cs: Moved code for managing client scripts to ClientScriptManager,
+ which is public in 2.0 and internal in 1.1.
+ * ClientScriptManager.cs: Implemented.
+
+2004-11-25 Sanjay Gupta <gsanjay@novell.com>
+
+ * DataSourceView.cs: Removed extra method.
+
+2004-11-24 Sanjay Gupta <gsanjay@novell.com>
+
+ * DataSourveViewSelectCallback.cs: Corrected method signature.
+
+2004-11-23 Lluis Sanchez Gual <lluis@novell.com>
+
+ * ControlBuilder.cs: Always check for the ParseChildrenAttribute,
+ even if the class doesn't implement IParserAccessor.
+ * WebResourceAttribute.cs: Allow multiple attributes of this type.
+
+2004-11-15 Lluis Sanchez Gual <lluis@novell.com>
+
+ * DataSourceView.cs: Moved here implementation of DataSourceViewChanged
+ from SqlDataSourceView.cs.
+
+2004-11-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: unified a few bool fields into an int one.
+
+ * ControlCollection.cs: use an array internally instead of always
+ allocating an arraylist. Also added our own enumerator.
+
+ * EmptyControlCollection.cs: there's no 'special' ctor now in the base
+ class.
+
+2004-11-05 Sanjay Gupta <gsanjay@novell.com>
+
+ * DataSourceView.cs: Changes in access modifiers of methods.
+
+2004-10-20 Sanjay Gupta <gsanjay@novell.com>
+
+ * DataSourceCapabilities.cs: Added Flags attribute.
+ * DataSourceSelectArguments.cs: Updated.
+ * DataSourveView.cs: Updated.
+
+2004-10-19 Sanjay Gupta <gsanjay@novell.com>
+
+ * HierarchicalDataSourceView.cs: Corrected class definition and updated.
+
+2004-10-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HierarchicalDataSourceView.cs: fix typo.
+
+2004-10-18 Sanjay Gupta <gsanjay@novell.com>
+
+ * HierarchicalDataSourceView.cs: Updated.
+
+2004-10-18 Sanjay Gupta <gsanjay@novell.com>
+
+ * DataSourceSelectArguments.cs: Initial implementation.
+
+2004-10-12 Sanjay Gupta <gsanjay@novell.com>
+
+ * UrlPropertyAttribute.cs: Corrected implementation of Equals () method.
+
+2004-10-12 Sanjay Gupta <gsanjay@novell.com>
+
+ * UrlTypes.cs: Updated.
+
+2004-10-12 Sanjay Gupta <gsanjay@novell.com>
+
+ * UrlPropertyAttribute.cs: Added new file.
+
+2004-10-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: even if the control has no children the naming container
+ may contain the control we're looking for. Fixes bug #67304.
+
+2004-09-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: added OtherTags.
+
+2004-09-24 Sanjay Gupta <gsanjay@novell.com>
+
+ * ControlValuePropertyAttribute.cs: Initial implementation.
+
+2004-09-24 Sanjay Gupta <gsanjay@novell.com>
+
+ * IPaginationContainer.cs: Corrected name of class.
+
+2004-09-24 Sanjay Gupta <gsanjay@novell.com>
+
+ * IDReferencePropertyAttribute.cs: Completed implementation.
+
+2004-09-24 Sanjay Gupta <gsanjay@novell.com>
+
+ * ThemeableAttribute.cs:
+ * FilterableAttribute.cs: Code scrubbing and optimization.
+
+2004-09-14 Sanjay Gupta <gsanjay@novell.com>
+
+ * ThemeableAttribute.cs: Completed implementation.
+
+2004-09-14 Sanjay Gupta <gsanjay@novell.com>
+
+ * FilterableAttribute.cs: Completed implementation.
+
+2004-09-14 Sanjay Gupta <gsanjay@novell.com>
+
+ * Control.cs: Added new attributes and a method.
+ * FilterableAttribute.cs: New attribute, initial implementation.
+ * ThemeableAttribute.cs: New attribute, initial implemenataion.
+
+2004-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateParser.cs: ensure bin directory exists before trying to access
+ it. Fixes bug #65446 (not closed yet due to dependencies).
+
+2004-09-09 Sanjay Gupta <gsanjay@novell.com>
+
+ * Control.cs: Implemented methods of interface IExpressionAccessor.
+
+2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleWebHandlerParser.cs: correctly cache Type instead of the
+ assembly for ashx/asmx. Otherwise we need to open the file and check
+ for the class name in there. Thanks to Ben for pointing this out.
+
+2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateParser.cs: removed creation of StringWriter. It's not used.
+ * Control.cs: don't create the EventHandlerList until requested.
+
+2004-09-03 Sanjay Gupta <gsanjay@novell.com>
+
+ * Control.cs: Added new interfaces implemented in .Net 2.0.
+ * ExpressionBinding.cs: Added new class.
+ * ExpressionBindingCollection.cs: Added new class.
+
+2004-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LiteralControl.cs: stylized. This control has EnableViewState disabled
+ by default and doesn't get an automatic ID. When text is null -> "".
+
+2004-08-31 Sanjay Gupta <gsanjay@novell.com>
+
+ * ControlSkinProc.cs:
+ * DataSourceViewOperationCallback.cs:
+ * DataSourceViewSelectCallback.cs:
+ * ExtractTemplateValuesMethod.cs: Explicit modifier "sealed" not
+ required in definition as delegates by default are sealed.
+
+2004-08-31 Sanjay Gupta <gsanjay@novell.com>
+
+ * IDReferencePropertyAttribute.cs: Corrected and changed from interface
+ to class.
+ * IMobileTextWriter.cs: Corrected method signatures.
+
+2004-08-09 Sanjay Gupta <gsanjay@novell.com>
+
+ * ControlSkinProc.cs:
+ * DataSourceViewOperationCallback.cs:
+ * DataSourceViewSelectCallback.cs:
+ * ExtractTemplateValuesMethod.cs: Added new delegates.
+
+2004-08-06 Sanjay Gupta <gsanjay@novell.com>
+
+ * IBindableTemplate.cs:
+ * ICallbackEventHandler.cs:
+ * IControlBuilderAccessor.cs:
+ * IControlDesignerAccessor.cs:
+ * IControlTypeFilter.cs:
+ * IDataItemContainer.cs:
+ * IDataSourceViewSchemaAccessor.cs:
+ * IDReferencePropertyAttribute.cs:
+ * IExpressionsAccessor.cs:
+ * IFilterResolutionService.cs:
+ * IItemPaginationInfo.cs:
+ * IMobileTextWriter.cs:
+ * IPageHeader.cs:
+ * IPaginationContainer.cs:
+ * IPaginationInfo.cs:
+ * IResourceResolutionService.cs:
+ * IResourceUrlGenerator.cs:
+ * IStateFormatter.cs:
+ * IStyleSheet.cs:
+ * IThemeResolutionService.cs:
+ * IUrlResolutionService.cs:
+ * IUserControlTypeResolutionService.cs: Added new files for Interfaces.
+
+2004-08-05 Sanjay Gupta <gsanjay@novell.com>
+
+ * PostBackOptions.cs: Added new file and implemented the class.
+
+2004-08-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlTextWriterTag.cs: readded author name.
+
+2004-08-04 Sanjay Gupta <gsanjay@novell.com>
+
+ * HtmlTextWriterAttribute.cs:
+ * HtmlTextWriterStyle.cs: Added .Net 2.0 enumerations.
+ * CompilationMode.cs:
+ * ConflictOptions.cs:
+ * DataSourceCacheExpiry.cs:
+ * DataSourceCapabilities.cs:
+ * DataSourceOperation.cs:
+ * TemplateContentType.cs:
+ * TemplateInstance.cs:
+ * UrlTypes.cs:
+ * VerificationConditionalOperator.cs:
+ * VerificationReportLevel.cs:
+ * VerificationRule.cs:
+ * XhtmlMobileDocType.cs: Added enumerations.
+
+2004-07-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: style. Reverted previous patch modification of
+ TemplateSourceDirectory (failed when the control is reparented). Use
+ HasControls() and Controls all over instead of _controls, as Controls
+ property and HasControls() might be overriden.
+
+2004-07-27 Alon Gazit <along@mainsoft.com>
+
+ * Control.cs: Changed the implementation of TemplateSourceDirectory
+ and GetDefaultName(). replaced foreach statements with for statements,
+ in order to improve performence.
+
+2004-07-27 Alon Gazit <along@mainsoft.com>
+
+ * Page.cs: changed the implementation of GetViewStateString().
+ if the view state object is null there is no need to perform
+ Serialization.
+
+2004-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControl.cs: don't include private methods of base classes when
+ auto-attaching events. Fixes bug 61569.
+
+2004-07-14 Alon Gazit <along@mainsoft.com>
+
+ * HtmlTextWriter.cs: changed the Hashtables to case insensitive.
+2004-07-08 Pablo Baena <pbaena@gmail.com>
+
+ * Page.cs: added workaround for __doPostBack script on Netscape 4.xx
+
+2004-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: added additional checks for saving/displaying trace data.
+
+ * PageParser.cs: removed checks for trace enabled in configuration
+ files.
+
+2004-06-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ControlCollection.cs: when clearing the control collection, tell the
+ owners about the removal. Fixes bug #60800.
+
+2004-06-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: don't nullify _context after processing the request as there
+ are events not triggered yet. Fixes bug #60726.
+
+2004-06-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlTextWriter.cs: only create a closing tag for unknown tags. Fixes
+ bug #60681.
+
+2004-06-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PageParser.cs:
+ * UserControlParser.cs: set the page/user control base type even when no
+ default directive provided. Fixes bug #60572.
+
+2004-06-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PageParser.cs: use default trace settings from web.config and check
+ if trace is only requested for local connections. Fixes bug #60180.
+
+2004-06-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleWebHandlerParser.cs: implemented GetCompiledTypeFromCache. When
+ we read the default directive, check the cache for the Type and if
+ present, don't keep reading and store the type found.
+
+ * WebHandlerParser.cs:
+ * WebServiceParser.cs: try GetCompiledTypeFromCache before actually
+ compiling.
+
+2004-06-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: properly fixed bug #59794.
+
+2004-06-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs:
+ (ResolveUrl): fixed typo when dealing with relative urls. Closes bug
+ #59794.
+
+2004-06-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleWebHandlerParser.cs:
+ * TemplateParser.cs: pass the language when compiling from a file.
+
+2004-06-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleWebHandlerParser.cs: if we have a global.asax, move its
+ reference to the end to help mcs loading the assemblies. Fixes bug
+ #58768.
+
+ * TemplateParser.cs: same as above. Removed some kludges to workaround
+ loading assemblies from bin path that are now in the runtime. Don't
+ load the assemblies in bin if not needed, but still reference them
+ when compiling.
+
+2004-06-07 Alon Gazit <along@mainsoft.com>
+ * Page.cs: Changed Page.ProcessPostData().
+ After the change ,the state of controls that aren't visible is saved
+ during a postback.
+
+2004-06-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: removed obsolete MonoTODO from RegisterOnSubmitStatement.
+
+2004-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: IsPostBack also returns true when method is GET and we have
+ viewstate information in the query string. Fixes bug #58151.
+
+2004-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: removed obsolete TODO. Only check if Trace is enabled, not
+ HttpRutime.TraceManager.
+
+ * PageParser.cs: for 'trace' we have 2 variables now. Added support
+ for 'buffer' attribute.
+
+2004-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: implemented ClientTarget.
+ * PageParser.cs: support for clientTarget and check for validity.
+
+2004-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs:
+ * Html32TextWriter.cs:
+ * HtmlTextWriter.cs:
+ * SimpleWebHandlerParser.cs:
+ * TemplateControl.cs: Added protected missing members and attributes.
+
+2004-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ObjectStateFormatter.cs: use ObjectFormatter methods instead of
+ calling a protected method of another object.
+
+2004-06-03 Atsushi Enomoto <atsushi@ximian.com>
+
+ * ObjectStateFormatter.cs : csc build fix. Protected Read()/Write()
+ (of other objects) are called in TypeConverterFormatter.
+
+2004-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ObjectStateFormatter.cs: before choosing the binary formatter, check
+ if the object type has a TypeConverter that can convert to/from string.
+ Fixes bug #59495.
+
+ * Page.cs: call GetViewStateString from outside the WriteLine. This
+ allows writing to the Response when getting the string without breaking
+ the HTML generated.
+
+2004-06-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlTextWriter.cs: render end tag for unknown tags.
+ Patch frmo Markus Krutner. Fixes bug #59466.
+
+2004-05-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: call DeterminePostBackMode only once per request. Patch by
+ Evain Jb.
+
+2004-05-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Html32TextWriter.cs: stub contributed by Matthijs ter Woord
+ [meddochat].
+
+ * ObjectTagBuilder.cs: remove the HasBody override as MS does not have
+ that.
+
+2004-05-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleWebHandlerParser.cs:
+ * TemplateParser.cs: for the assembly names given in the 'assembly'
+ attribute, use LoadWithPartialName instead of Load.
+2004-03-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: return HttpContext.Current if _context has not yet been
+ assigned to. Fixes bug #55245.
+
+2004-03-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateParser.cs: don't add import statement or assemblies from
+ global.asax to every file. Fixes bug #55496.
+
+2004-03-09 Juraj Skripsky <juraj@hotfeet.ch>
+
+ * DataBinder.cs: allow unquoted string expressions (e.g. "[test]") and
+ handle single quotes and a few corner cases correctly (see test cases).
+
+2004-03-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControl.cs: fixed typos and added new method names to the set
+ of page events.
+
+2004-02-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ControlBuilder.cs: added SetTagName().
+
+ * ObjectTagBuilder.cs: use SetTagName so that we can properly close
+ <object> builders if the closing tag is provided.
+
+2004-02-16 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: Set cacheability for Location.DownStream.
+
+2004-02-10 Jackson Harper <jackson@ximian.com>
+
+ * TemplateParser.cs: Use full path if the assembly is in the
+ private bin directory. Patch by Gonzalo Paniagua Javier.
+
+2004-02-09 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: Set cacheability for server side caching.
+
+2004-01-30 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Ensure that dynamically loaded controls are
+ initialized.
+
+2004-01-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ApplicationFileParser.cs: check for error in directives. Use
+ GlobalAsaxCompiler.CompileApplicationType for compiling.
+
+ * ObjectTagBuilder.cs: load the Type and check for errors.
+
+ * TemplateParser.cs: add assemblies and imports from global.asax.
+
+ Now we properly create accessors for session and application objects in
+ the application itself, pages and controls. First step for fixing
+ bug #53387.
+
+2004-01-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControl.cs: small speedup for WireUpautomaticEvents. Thanks
+ to Eric Lindvall for pointing this out.
+
+2004-01-15 Jackson Harper <jackson@ximian.com>
+
+ * TemplateParser.cs: Detect if we are parsing a control or page
+ properly.
+ * Page.cs: vary by params and vary by headers can be null now.
+
+2004-01-15 Martin Willemoes Hansen <mwh@sysrq.dk>
+
+ * HtmlTextWriter.cs: Fixed OutputTab routine to generate correct
+ indention.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: If we have a postback that wasn't sent through a
+ postback script (ie user hit submit on a input type=submit) call
+ Validate so page validation occurs. This fixes bug #52770.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: Don't tell the response to cache anymore. This is done
+ when the cacheability is modified by a callback. Set the cache's
+ duration.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * TemplateParser.cs: If varybyparam is set to "none" make it null
+ so we dont get a param named null in the outputcache key.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * BasePartialCachingControl.cs: Use varyby attributes in key
+ generation.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * TemplateParser.cs: Add all the outputcache attribute error
+ messages.
+
+2004-01-13 Jackson Harper <jackson@ximian.com>
+
+ * TemplateParser.cs: Add VaryByControls and Shared output cache
+ properties. These are not assigned yet.
+ * TemplateControlParser.cs: Do not ignore the OutputCache
+ attribute.
+ * BasePartialCachingControl.cs: Initial implementation. Keys are
+ still not created properly.
+ * StaticPartialCachingControl.cs: Assign properties in base class,
+ implement CreateControl.
+
+2004-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ApplicationFileParser.cs: adde DefaultBaseTypeName property.
+
+ * PageParser.cs: support validateRequest.
+
+ * TemplateControlParser.cs: get default values from system.web/pages
+ section.
+
+ * TemplateParser.cs: added separate method for changing base type
+ (Inherits or system.web/pages).
+
+ * UserControlParser.cs: support system.web/pages defined base type.
+
+2004-01-11 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * UserControl.cs: Added missing attribute, implemented method
+ * Page.cs: Added missing attribute, implemented method
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: Handle trace being enabled in the config file.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: Save trace data before rendering it.
+ * System.Web.dll.sources: Add TraceData.cs
+
+2004-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: removed a couple of MonoTODO on methods we're not gonna
+ implement. Applied patch from Jan Jaros (mono-bug@jerryweb.info) to
+ ensure that Unload event is raised. Fixes bug #52555.
+
+2004-01-02 Zoltan Varga <vargaz@freemail.hu>
+
+ * KeyedList.cs: 'private' is not allowed on explicit interface
+ implementations. Fixes 1.2 build.
+
+2003-12-31 Jackson Harper <jackson@ximian.com>
+
+ * TemplateControlParser.cs: When registering tag prefixs make sure
+ the file exists and throw the correct error if it does not.
+
+2003-12-25 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: Throw error if the session is accessed when sessions
+ are disabled.
+
+2003-12-18 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: Write Trace info.
+
+2003-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LosFormatter.cs: new ctor for 1.1. The default ctor is public.
+ * Page.cs: added ViewStateUserKey and made RegisterclientScriptFile
+ internal.
+ * PageParser.cs: the ctor is public.
+ * PartialCachingAttribute.cs: added new ctor and Shared property.
+
+2003-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: assign the ErrorPage to the context if we get an exception
+ when processing the page which only calls Unload.
+
+ * PageParser.cs: handle ErrorPage.
+
+2003-12-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ObjectStateFormatter.cs: added formatters for Unit and FontUnit, which
+ are not [Serializable]. Fixes bug #52244.
+
+2003-12-16 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: Render trace data when tracing is enabled.
+
+2003-12-15 Jackson Harper <jackson@ximian.com>
+
+ * PageParser.cs: Add Trace and Trace mode attributes.
+
+2003-12-15 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: Use the context trace object.
+
+2003-12-14 Alon Gazit <along@mainsoft.com>
+ * AttributeCollection.cs: Changed AttributeCollection.Render().
+ After the change attributes ,that their value is null, aren't
+ rendered.
+
+2003-12-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: remove a few dangling ^M, don't set values for fields
+ that has the default value. If Visible is modified and we're tracking
+ viewstate, save and restore it. Fixes bug #48689.
+
+2003-12-11 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Give null for the ID if it hasn't been explicitly
+ set. This fixes bug #51520.
+
+2003-12-08 Jackson Harper <jackson@ximian.com>
+
+ * PageParser.cs: Ignore the SmartNavigation attribute for now.
+
+2003-12-05 Jackson Harper <jackson@ximian.com>
+
+ * DataBinder.cs (GetIndexedPropertyValue): Check if container is
+ an IList and use a cast instead of reflection to retrieve the item
+ if it is. Fixes bug #51759.
+
+2003-12-04 Alon Gazit <along@mainsoft.com>
+ * Page.cs: Changed Page.ID so it will call Control.ID.
+ Fixed Bug 51682.
+
+2003-12-02 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: Implemented registered array declarations. Patch by
+ Benjamin Jemlich <pcgod@gmx.net>
+
+2003-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateParser.cs: basic check for 'classname' attribute and added
+ patch by pcgod@gmx.net for bug #51568, which fixes automatic class
+ names for pages starting with a number.
+
+2003-11-30 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * LosFormatter.cs: Use ObjectStateFormatter. Pretty big size
+ reduction.
+
+ * ObjectStateFormatter.cs: Comment out tracing.
+
+2003-11-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: fixed UICulture, LCID and Culture. Set the thread
+ [UI]Culture before processing the request.
+
+ * PageParser.cs: read Culture, UICulture and LCID attributes. Added
+ properties for these. Partially contributed by Mohammad Damt.
+
+ Fixes bug #51511.
+
+2003-11-27 Jackson Harper <jackson@ximian.com>
+
+ * TemplateParser.cs: Ignore aspCompat attribute. This fixes bug
+ 51434.
+
+2003-11-22 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * ObjectStateFormatter.cs: Fix bug when reading small ints.
+ Add some tracing so we can see what is going on.
+
+2003-11-21 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: Set vary by params when cache location is Server.
+
+2003-11-21 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * ObjectStateFormatter.cs: v2 file. In v1.x this will be
+ internal as LosFormatter will eventually use it to save
+ the view state.
+
+2003-11-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PersistChildrenAttribute.cs:
+ * PersistenceModeAttribute.cs: implemented.
+
+ * TODO: Removed file.
+ * OutputCacheLocation.cs:
+ * TemplateControlParser.cs:
+ * HtmlInputFile.cs: class status based fixes.
+
+2003-11-19 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: Always set the cache expire time. Tell the response to
+ cache itself for server side cached pages.
+
+2003-11-19 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Remove ResolveBaseUrl. ResolveUrl does the same
+ thing, some corner cases still need work though. Was this the
+ shortest lived method in the history of mono?
+
+2003-11-19 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: New method for resolving urls that use ~/ to denote
+ the applications base directory.
+
+2003-11-19 Jackson Harper <jackson@ximian.com>
+
+ * TemplateParser.cs: Fix typo in error message.
+
+2003-11-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControlParser.cs: support @Reference. Fixes bug #49572. Thanks
+ to Sanjay Gupta.
+
+2003-11-19 Todd Berman <tberman@gentoo.org>
+
+ * KeyedList.cs:
+ * KeyedListEnumerator.cs: New v2 implementations.
+
+2003-11-17 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * StateManagedCollection.cs: Implement.
+
+2003-11-13 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: Initial implementation of InitOutputCache.
+ * TemplateParser.cs: Page OutputCache options
+
+2003-11-09 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * HierarchicalDataSourceControl.cs: Implement.
+
+2003-11-09 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * XPathBinder.cs: Implemented.
+
+2003-11-08 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * DataSourceView.cs:
+ * IDataSource.cs:
+ * ListSourceHelper.cs:
+ * DataSourceControl.cs:
+ * HierarchicalDataSourceView.cs:
+ * IHierarchicalDataSource.cs: Move v2 stuff.
+
+2003-11-07 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs (ResolveUrl): Special case for urls that consist of
+ only a page anchor. ie <a href="#top">. This fixes bug #50165.
+
+2003-11-07 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * IHierarchicalEnumerable.cs:
+ * IHierarchyData.cs:
+ * INavigateUIData.cs: New v2 interfaces.
+
+2003-11-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: patch by Alon Gazit <along@mainsoft.com> to remove extra
+ space in generated javascript.
+
+2003-11-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LosFormatter.cs: encoding updates.
+ * Page.cs: implemented CodePage and ContentType.
+ * PageParser.cs: handle CodePage, ContentEncoding and ResponseEncoding
+ attributes.
+
+2003-11-04 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * Control.cs (GetWebResourceUrl): new v2 function
+ * Page.cs (GetWebResourceUrl): ditto.
+ make the JS we generate work with moz if the form is not a child
+ of document.
+ * WebResourceAttribute.cs: Added, new v2 attribute.
+
+2003-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DesignTimeTemplateParser.cs: added FIXME related to PageParser.
+
+ * PageParser.cs: initialize the parser in the constructor, not just
+ before compiling and reference the application assembly.
+
+ * SimpleWebHandlerParser.cs: reference the assembly that contains the
+ application Type.
+
+ * TemplateControl.cs:
+ * TemplateControlParser.cs: fix BenM #1 bug. Now we pass correct virtual
+ path and physical path when compiling a user control.
+
+ * TemplateParser.cs: new AddApplicationAssembly ().
+ * UserControlParser.cs: now we get valid values in the ctor.
+
+ Referencing the application assembly fixes bug #49652.
+
+
+2003-10-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControl.cs: moved NoParamsInvoker class to its own file.
+
+2003-10-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseParser.cs: added CompilationConfig property.
+
+ * TemplateParser.cs:
+ * SimpleWebHandlerParser.cs: added CompilationConfig property.
+ Don't hardcode assembly names any more, assemblies in bin are added
+ depending on the configuration. The default language is also taken
+ from the configuration.
+
+2003-10-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LosFormatter.cs: fixed bug #49604. Patch by yaronsh@mainsoft.com.
+
+2003-10-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: removed some debug lines.
+ * Page.cs: implemented RegisterOnSubmitStatement
+ * TemplateControl.cs: fixed wire up for methods with no parameters.
+
+2003-10-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PageParser.cs: ignore ValidateRequest by now.
+
+2003-10-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI/TemplateControl.cs: support for wiring up events without
+ parameters.
+
+2003-10-08 Pedro Martnez Juli <yoros@wanadoo.es>
+
+ * PageParser.cs: drop some useless code.
+
+2002-10-29 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * Utils.cs : GetScriptLocation(HttpContext) - Partial Implementation.
+
+2003-10-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI/PageParser.cs:
+ * System.Web.UI/TemplateControlParser.cs: honour the input file given
+ as argument.
+
+2003-09-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs:
+ (ClearChildViewState): doh! Don't clear control viewstate but the
+ viewstate of possible children.
+ (LoadViewStateRecursive): load viewstate even when control is not
+ visible.
+ Fixes bug #49024.
+ The rest are just dangling ^M removed.
+
+ * DataBoundLiteralControl.cs:
+ (LoadViewState): we get an object [], not a string [].
+
+2003-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: implemented ClearChildViewState ().
+
+2003-09-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: store unique IDs for controls requiring postback. Fixes bug
+ #47985.
+
+2003-09-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleWebHandlerParser.cs: add the ashx/asmx file itself to the
+ dependencies so that it's recompiled when changed.
+
+2003-09-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LosFormatter.cs: fixed Deserialize for empty viewstate.
+
+2003-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: check if controls that require postback have
+ been changed by an event and register them to be notified of data
+ changed event.
+
+2003-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: patch by yaronshkop@hotmail.com (Yaron Shkop) that fixes
+ bug #47866.
+
+2003-08-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LosFormatter.cs: handle Unit and FonrUnit as special cases as they
+ are not serializable. Fixes bug #47784.
+
+2003-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: index the viewstates saved by the control position, not
+ the control name. Fixes bug #47697.
+
+2003-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ControlCollection.cs:
+ * EmptyControlCollection.cs: create a minimum ArrayList for this.
+
+ * BaseParser.cs: added setter for BaseVirtualDir.
+
+ * Page.cs: fixed message when restoring view state fails.
+ * UserControlParser.cs: set the BaseVirtualDirectory to handle the case
+ when a relative path to the control is given. Fixes bug #47685.
+
+2003-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: when we load the viewstate for a control that has children
+ viewstates and the child is not found, keep its viewstate around and
+ wait until the child is added to load the viewstate. Fixes bug #47697.
+
+2003-08-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControl.cs: more Delegate.CreateDelegate fixes.
+
+2003-08-01 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * PartialCachingControl.cs: is not abstract
+
+2003-08-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleHandlerFactory.cs: implemented GetHandler.
+ * WebHandlerParser.cs: new file that parses .ashx files.
+
+2003-07-30 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * PersistenceModeAttribute.cs: Fixed wrong AttributeUsage
+
+2003-07-30 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * UserControl.cs: Added attribute
+ * BasePartialCachingControl.cs: New class and paritally implemented
+ * DesignerDataBoundLiteralControl.cs: New class and implemented
+ * DesignTimeTemplateParser.cs:
+ * PartialCachingControl.cs:
+ * StaticPartialCachingControl.cs: New class and paritally implemented
+
+2003-07-27 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * ApplicationFileParser.cs: Fixed signature
+ * DesignTimeParseData.cs: Added missing properties, implemented
+ * Page.cs: Added attributes
+ * PageParser.cs:
+ * TemplateControlParser.cs:
+ * TemplateParser.cs:
+ * UserControlParser.cs: Fixed signature
+
+2003-07-17 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * HtmlControlPersistableAttribute.cs: Added
+ * IgnoreUnknownContentAttribute.cs: Added
+
+2003-07-17 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * IUserControlDesignerAccessor.cs: Added and implemented
+ * Control.cs: Missing member added, added all attributes
+ * Page.cs: Added attributes, fixed signature
+ * TemplateControl.cs: Fixed signature, added all attributes
+ * UserControl.cs: Added all attributes, added and implemented missing interface
+
+2003-07-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ControlCollection.cs: fixed bug #46472.
+
+2003-07-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleWebHandlerParser.cs: implemented GetTypeFromBin.
+
+2003-07-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleWebHandlerParser.cs: updated to new compilation interface.
+
+ * TemplateParser.cs: use the new parameter when compiling.
+
+2003-07-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: also keep the value for the second try on handling postback
+ events.
+
+2003-05-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseParser.cs: fixed MapPath for non-rooted files.
+ * PageParser.cs: don't pass a non-virtual file around.
+ * TemplateControlParser.cs: InputFile uses MapPath now. Take care of
+ the exception teh may be throw by MapPath on an invalid path.
+
+ * TemplateParser.cs: removed unused method.
+ * UserControlParser.cs: modified inputfile. The result is the same, but
+ this one is better.
+
+2003-05-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RootBuilder.cs: throw exception when the tagprefix is not valid or
+ not found.
+
+2003-05-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControlParser.cs: return after processing @Register.
+
+2003-05-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateParser.cs: Added support for server side includes.
+
+2003-05-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControl.cs: fixed the flags used to find the methods that
+ are automatically hooked up on events.
+
+ * TemplateParser.cs: don't compile a source file directly. Use the
+ cache instead.
+
+2003-05-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseParser.cs: Location property is now here. Added a couple of
+ convenience methods to throw a ParseException.
+
+ * TemplateParser.cs:
+ * TemplateControlParser.cs:
+ * PageParser.cs: throw ParseException where appropiate.
+
+2003-05-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ApplicationFileParser.cs: use the generator to actually parse the
+ file.
+
+ * ControlBuilder.cs: small fix in NamingContainerType because
+ TemplateBuilders have a null ControlType. When a control is appended
+ to a parent, assign the child's parent.
+
+ * UserControlParser.cs: fixed the value of InputFile.
+
+2003-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ApplicationFileParser.cs: store the Context and override
+ BaseVirtualDir so that it's the application path.
+
+ * BaseParser.cs: removed CurrentVirtualPath property.
+
+ * TemplateControlParser.cs: use BaseVirtualDir.
+
+ * UserControlParser.cs: removed CurrentVirtualPath.
+
+2003-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateParser.cs: always reference all the assemblies in bin
+ directory.
+
+2003-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ApplicationFileParser.cs: it works now. Prior to these changes, we
+ were using the compiler directly.
+
+ * BaseParser.cs: added some useful properties and methods.
+
+ * CodeBuilder.cs: use ILocation.
+ * CodeRenderBuilder.cs: use ILocation.
+ * CollectionBuilder.cs: use the RootBuilder to map tag names into Types.
+
+ * ControlBuilder.cs: made it useful.
+
+ * DataBindingBuilder.cs: the control type for data bound text is
+ DataBoundLiteralControl now.
+
+ * ObjectTagBuilder.cs: store some object tag attributes.
+
+ * PageParser.cs: handle page-only directives.
+
+ * RootBuilder.cs: bah.
+ * SimpleWebHandlerParser.cs: made it dummy.
+ * TemplateControl.cs: Modified file.
+
+ * TemplateControlParser.cs: handle directives that are common to pages
+ and user controls.
+
+ * TemplateParser.cs: utility methods and handling of directives that
+ are common to app, page and user controls.
+
+ * UserControl.cs: added ControlBuilderAttribute.
+
+ * UserControlControlBuilder.cs: builder for user controls.
+ * UserControlParser.cs: use the new interfaces.
+
+2003-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ControlBuilder.cs: line and fileName are protected now.
+
+ * CodeBuilder.cs: base class for the next 2 files.
+ * CodeRenderBuilder.cs: builder for code render.
+ * DataBindingBuilder.cs: builder for data binding.
+
+2003-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ITagNameToTypeMapper.cs: made it internal.
+
+ * ObjectTagBuilder.cs: builder for <object runat="server"> tag.
+ * ObjectTag.cs:
+ * RootBuilder.cs: initial builder.
+
+2003-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CollectionBuilder.cs:
+ * TemplateBuilder.cs: new classes derived from ControlBuilder that
+ represent a property or a ITemplate.
+
+ * ControlBuilder.cs: implemented all the missing bits.
+ * TemplateParser.cs: added mapping from tag name to Type feature.
+
+2003-02-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: have i definitely fixed naming container stuff this time?
+
+ * LosFormatter.cs: activated binary serialization code.
+
+2003-02-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs:
+ (AddedControl): fixed default id assignation when the sequence of
+ AddedControl until it's included in the page or one of its controls
+ does not pass through a naming container.
+
+2003-02-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: give different default names depending on the place where
+ it is assigned. Implemented ResolveURl (no more ~ rendered in
+ attributes!).
+
+2003-02-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: when adding a control, assign default names to th
+ children that don't have one.
+
+2003-02-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleWebHandlerParser.cs: modified to use the new parser interface.
+
+2003-01-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: some more tweaks to naming containers stuff.
+ * DataBinder.cs: don't throw exception if the container is null.
+
+ * Page.cs: now we can render client scripts, startup scripts and hidden
+ fields. Only render __VIEWSTATE if there is someone that will take care
+ of it.
+ (RaisePostBackEvents): first try the last one that required raise event,
+ then try __EVENTTARGET.
+
+2003-01-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: fixes in UniqueID, FindControl, AddedControl,
+ UnloadRecursive, InitRecursive. Reduced the size of __VIEWSTATE. Made
+ FindControl work with NamingContainers.
+
+ * ControlCollection.cs: notify the parent when clearing the collection.
+
+ * LosFormatter.cs: Added debugging output and generate a valid
+ viewstate even for unknown types.
+
+ * Page.cs: GetPostBackEventReference now uses UniqueID. Reduced
+ viewstate.
+
+2003-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: make it fire the LoadData related events also for controls
+ such as ImageButton, whose variable(s) in the query string are of the
+ form ctrl_name.x and only fire them once per control.
+
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataBinder.cs:
+ (GetPropertyValue): don't try to get the property as indexed
+
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataBinder.cs: use TypeDescriptor to get the properties and their
+ values.
+
+2003-01-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs:
+ (AddedControl): take the children to the same state of the parent.
+ (InitRecursive): set the page of the children.
+
+ * Page.cs: removed one line (it's done a few lines above).
+
+ * UserControl.cs:
+ (OnInit): always call InitializeAsUserControl
+ (InitializeAsUserControl): sets the page for the control.
+
+2003-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: fixed bug #36037.
+
+2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseParser.cs: a couple of path fixes to make it work
+ when the page is not in the root directory.
+
+2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: fixed PreRenderRecursiveInternal. Thanks to kojoadams for
+ reporting the bug.
+
+2002-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseParser.cs: use MapPath and context to locate files.
+ * Control.cs: implemented MapPathSecure.
+ * TemplateControl.cs: use UrlUtils to generate the path.
+ * TemplateControlParser.cs: use the context and MapPath.
+ * UserControl.cs: implemented MapPath.
+ * UserControlParser.cs: added context parameter to constructor.
+
+2002-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: implemented MapPathSecure.
+ * Page.cs: fixed Server property.
+
+2002-12-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataBinder.cs: try the indexer if the property is not found in
+ GetPropertyValue ().
+
+2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: added AutoEventWireup internal property.
+
+ * Page.cs: removed page events wire up from here.
+
+ * TemplateControl.cs: new method WireupAutomaticEvents to hook up page
+ and user controls events.
+
+ * TemplateControlParser.cs: process the options that are applicable
+ once we have the instance of the control.
+
+ * TemplateParser.cs: also stores the options.
+
+ * UserControl.cs: hook up events before initializing the control.
+
+
+2002-12-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: new method to set bindingContainer value.
+ * TemplateControl.cs: added controls are not binding containers.
+
+2002-12-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: implemented TemplateSourceDirectory.
+ * TemplateControl.cs: implemented LoadControl and LoadTemplate.
+
+2002-11-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UserControl.cs: fixed SetAttribute.
+ * UserControlParser.cs: set the correct base type.
+
+2002-11-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateParser.cs: fixed BaseType.
+ * UserControlParser.cs: helper class to compile user controls.
+
+2002-11-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LosFormatter.cs: added DateTime to special types.
+
+2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LosFormatter.cs: added array serialization support. Disabled binary
+ serialization and add some debugging code.
+
+ * StateBag.cs: the length of the list of value can be less than the
+ length if the list of keys when remaining values are null.
+
+2002-11-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: return something useful in GetPostBackClientEvent.
+
+2002-11-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: implemented FileDependecies and made it protected.
+
+2002-10-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: save control names instead of the controls
+ themselves to the ViewState.
+
+ * LosFormatter.cs: added support for serializing unknown
+ types. BinaryFormatter does not work so you better don't store anything
+ of unknown Type in ViewState.
+
+ * Page.cs: GetViewStateString works now using LosFormatter.
+ Complete "Control execution lifecycle" by unloading all the child
+ controls. Check for null in RaisePostBackEvents.
+ LoadPageViewStateFromPersistenceMedium uses LosFormatter too.
+
+2002-10-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataBinder.cs: implemented Eval and GetIndexedPropertyValue methods.
+
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LosFormatter.cs: Use WebEncoding.Encoding.
+
+ * Control.cs:
+ * Page.cs: fixed namespace.
+
+2002-10-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: set the context in ProcessRequest. Added a few trace calls.
+ * Control.cs: added some trace information.
+
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleHandlerFactory.cs: new handler for .ashx files.
+
+2002-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI/PageHandlerFactory.cs: new file.
+ * System.Web.UI/PageParser.cs:
+ * System.Web.UI/TemplateControlParser.cs: we are now able to compile
+ pages and use HttpApplication, HttpRuntime and SimpleWorkerRequest.
+
+2002-09-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: implemented ObBubbleEvent.
+ * Page.cs: temporary workaround to make POST work with xsp server.
+
+2002-09-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: fixed InvokeEventMethod now that Type.GetMethod does not
+ return pvt methods.
+
+2002-09-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleWebHandlerParser.cs: New file.
+ * WebServiceParser.cs: New file.
+
+2002-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LosFormatter.cs: almost fully implemented.
+
+2002-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CompiledTemplateBuilder.cs: InstantiateIn is virtual.
+ * EmptyControlCollection.cs: throw correct exception.
+ * LosFormatter.cs: stubbed out.
+ * OutputCacheLocation.cs: little fix.
+
+2002-08-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI/ApplicationFileParser.cs:
+ * System.Web.UI/BaseParser.cs:
+ * System.Web.UI/PageParser.cs:
+ * System.Web.UI/TemplateControl.cs:
+ * System.Web.UI/TemplateControlParser.cs:
+ * System.Web.UI/TemplateParser.cs: first steps to move xsp into
+ System.Web.
+
+2002-07-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: request to render postback script can be after form started
+ rendering.
+
+2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: added more page events to invoke automagically if some
+ methods are defined.
+
+2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs:
+ (SaveViewState): save state even when control is not visible.
+ (SaveViewStateRecursive):
+ (LoadViewStateRecursive): made internal.
+
+2002-07-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: improved event raising to allow client postback for a wider
+ variety of actions (clicking an hyperlink, ...).
+
+2002-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UserControl.cs: implemented Load/SaveViewState.
+
+2002-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AttributeCollection.cs:
+ (Add): handle 'style' through styleCollection.
+
+ * CssStyleCollection.cs:
+ (fillStyle): renamed to FillStyle and made it internal.
+
+ * Page.cs:
+ (GetViewStateString): fixed, broken after other recent changes.
+ (ProcessPostData): allow a second try for postback data after OnLoad.
+ (ProcessRequest): clear controls collection, removed call to
+ UnloadRecursive.
+
+2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: uncommented Dispose.
+
+ * Page.cs:
+ (DeterminePostBackMode): more checkings.
+ (GetPostBackClientHyperLink): implemented.
+ (GetPostBackEventReference): added some comments with the HTML that MS
+ generates for that.
+ (ProcessRequest): fixed processing order. The page is unloaded after
+ a request and regenerated from view state on subsequents posts.
+
+2002-07-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: fixed related to ViewState. Added RemovedControl.
+
+ * ControlCollection.cs: notify owner of control removal.
+
+ * CssStyleCollection.cs: almost rewritten to make it render the style
+ attribute after changes to it.
+
+ * Page.cs: follow the guidelines in 'Control execution lifecycle'.
+ Removed Xml code.
+
+ * StateBag.cs: don't use IDictionary.GetEnumerator on the
+ HybridDictionary: it makes the program give an InvalidCastException at
+ runtime. Why?
+
+2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: fire Init and Load events for all children.
+
+2002-07-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UserControl.cs: New file.
+
+2002-07-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ControlBuilderAttribute.cs: finished implementation.
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ConstructorNeedsTagAttribute.cs: the default constructor sets the
+ property to false.
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI/AttributeCollection.cs: added CssStyleCollection.
+
+ * System.Web.UI/CssStyleCollection.cs: use a StateBag instead of a
+ Hashtable. Added internal .ctor.
+
+ * System.Web.UI/DataBinding.cs: propertyType is a Type. Implemented
+ Equals and GetHashCode.
+
+ * System.Web.UI/DataBoundLiteralControl.cs:
+ (LoadViewState):
+ (SaveViewState): implemented.
+
+ * System.Web.UI/Page.cs: FileDependencies is not public.
+
+ * System.Web.UI/ParseChildrenAttribute.cs: give a value to Default.
+ (GetHashCode):
+ (Equals):
+ (IsDefaultAttribute): implemented.
+
+2002-07-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: fixed Visible property.
+ * Page.cs: fixed GetViewStateString.
+
+2002-07-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI/Page.cs:
+ (GetViewStateString): new function to give the server access to the
+ generated view state string.
+ (Validate): d'oh!
+
+2002-07-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs:
+ (SaveViewstateRecursive): implemented.
+ (SaveViewState): fixed.
+ (IParserAccessor.AddParsedSubObject): don't use 'this'.
+
+ * Page.cs: added code to save view state to an xml file. It's not
+ being used right now.
+
+2002-06-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI/LiteralControl.cs:
+ Fixes based on class status page:
+
+ - Add attributes (DefaultEvent, ParseChildren).
+ - Fix declarations.
+ - Explicitly implement some interfaces (IPostBackDataHandler
+ and IPostBackEventHandler).
+ - Implemented some missing methods.
+
+2002-06-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: reimplemented FindControls.
+
+ * Page.cs:
+ (.ctor): set the page for this control.
+ (IsPostBack): return valid value.
+ (DeterminePostBackMode): finished.
+ (OnFormRender): render __VIEWSTATE (uses GetTypeHashCode()).
+ (ProcessPostData): implemented. Raises change and postback events.
+ (ProcessRequest): changed to support reuse of the instance.
+ (RegisterRequiresPostBack): implemented.
+
+ * ValidatorCollection.cs: implemented all methods.
+
+2002-06-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs:
+ * Page.cs: first attemp to save view state.
+
+ * HtmlForm.cs: don't render Action.
+
+2002-06-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: implemented more properties using information we already
+ have in Context.
+ (OnFormRender):
+ (OnFormPostRender):
+ (VerifyRenderingInServerForm): implemented.
+
+2002-06-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: changed InvokeEventMethod to use a GetMethod that works with
+ out runtime. Renamed Page_Init and Page_Load.
+
+ After this, we can load a dll and render HTML in linux.
+
+2002-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs:
+ (AddedControl): new function that is called whenever a control is
+ added to a collection of controls in a container. It sets the defaults
+ except for Page.
+
+ * ControlCollection.cs: call AddedControl in Add/AddAt.
+
+ * DataBoundLiteralControl.cs: implemented constructor, Text, Render,
+ SetStaticString and SetDataBoundString.
+
+ * Page.cs: removed SetDefaults.
+
+2002-06-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CompiledTemplateBuilder.cs: new file. Used in the code generated
+ by xsp.
+
+ * Control.cs:
+ (BindingContainer): implemented.
+ (EnsureChildControls): avoid stack overflow.
+
+ * DataBinder.cs: implemented Eval and PropertyValue.
+
+2002-06-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlTextWriter.cs: fixed style attributes rendering (almost the same
+ bug as in regular attributes).
+
+2002-06-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: implemented PreventAutoID.
+
+ * Page.cs:
+ (SetDefaults): don't set ID automatically if Control.PreventAutoID has
+ been called.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs:
+ (Validators): if the collection is null, create one.
+ (GetPostBackEventReference 2): don't throw exception.
+ (GetPostBackClientEvent): return a string with containing the method
+ name, the control name and the argument.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: SetPage is now called SetDefaults and also sets a default
+ ID for controls that don't have one yet.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs:
+ (GetPostBackClient):
+ (RegisterRequiresPostBack): don't throw NotImplementedException to
+ keep going.
+ (ProcessRequest): set the current page as the Page property for *all*
+ the controls, not just the direct children of the page.
+
+2002-06-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs:
+ (MapPathSecure): until security is implemented, return the same path
+ received as argument.
+ (RenderControl): call OnPreRender before rendering the control. So
+ AdRotator can read its configuration file.Is there any other place
+ where this should be done?
+
+ * HtmlTextWriter.cs:
+ (AddAttribute): fixed. Now it really stores attributes.
+ (RenderBeginTag): fixed a couple of bugs (little ones but hard to find).
+
+2002-06-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ControlCollection.cs:
+ (AddAt): if index is -1 behave as a plain Add.
+
+2002-06-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: for each child control to render, assign Control.Page.
+ Probably also needed in HtmlContainerControl derived classes.
+
+2002-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AttributeCollection.cs: don't need a Hastable. StateBag now works
+ fine and takes care of the details.
+
+ * Control.cs: added HasChildren property.
+
+ * StateBag.cs: fixed a couple of nasty bugs.
+
+2002-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: run OnInit, OnLoad y PreRender before rendering the page.
+ Invoke Page_Init and/or Page_Load if the user supplied them (though
+ this should depend on AutoEventWireUp attribute of Page directive).
+
+2002-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: don't throw exception in ControlID. By now, it returns ID.
+
+ * Page.cs:
+ (ProcessRequest): implemented.
+
+2002-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI/Page.cs: finished stubbing out. Implemented some
+ methods.
+
+2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs:
+ (FileDependencies): now is public public.
+ (EnableViewStateMAC): uncommented and made protected.
+ (GetTypeHashCode): added method.
+
+2002-05-24 Duncan Mak <duncan@ximian.com>
+
+ * TemplateControl.cs (SetStringResourcePointer): Fixed typo.
+
+ * StateBag.cs (Item): Changed the visibility level of the this
+ [object] indexer.
+
+ Misc. formatting edits, fixing some bugs introduced by the indentation.
+
+ * DataBinder.cs (Eval)
+ (GetIndexedPropertyValue)
+ (GetPropertyValue): Fixed return types.
+
+2002-05-21 Miguel de Icaza <miguel@ximian.com>
+
+ * HtmlTextWriter.cs: Use this to change the member instances.
+
+2002-05-17 Duncan Mak <duncan@ximian.com>
+
+ * AttributeCollection.cs:
+ * ControlCollection.cs:
+ * CssStyleCollection.cs:
+ * DataBindingCollection.cs:
+ * EmptyControlCollection.cs: Added missing Collection classes.
+
+2002-05-17 Duncan Mak <duncan@ximian.com>
+
+ * BaseParser.cs:
+ * TemplateParser.cs: Implemented. BaseParser is weird because
+ there is no documentation on what it does.
+
+ * ControlBuilder.cs:
+
+ * DataBinder.cs:
+ * DataBinding.cs: Added.
+
+ * DataBoundLiteralControl.cs:
+ * Triplet.cs: Added.
+
+ * RenderMethod.cs: Added this delegate for Control.cs
+
+2002-05-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ValidationPropertyAttribute.cs: a couple of fixes to make it compile.
+
+2002-05-14 Duncan Mak <duncan@ximian.com>
+
+ * ValidationPropertyAttribute.cs: Added to CVS.
+
+2002-05-10 Duncan Mak <duncan@ximian.com>
+
+ * ConstructorNeedsTagAttribute.cs:
+ * ControlBuilderAttribute.cs:
+ * ImageClickEventArgs.cs:
+ * ParseChildrenAttribute.cs:
+ * PartialCachingAttribute.cs:
+ * PersistChildrenAttribute.cs:
+ * PersistenceModeAttribute.cs:
+ * TemplateContainerAttribute.cs: Added to CVS.
+
+ * PersistanceMode.cs: Removed, fixed typo.
+ * PersistenceMode.cs: Replacing above.
+
+ * StateBag.cs (this): Fixed indexer, it takes a string as the
+ index, not an object.
+
+ * ValidatorCollection.cs: Fixed typo, ValidatedCollection to ValidatorCollection.
+
+ * Page.cs (Validators): return type should be ValidatorCollection,
+ not ValidatedCollection.
+
+ * TagPrefixAttribute.cs: Added to CVS.
+
+2002-05-07 Duncan Mak <duncan@ximian.com>
+
+ * Utils.cs (GetClientValidatedEvent): Uncommented the 'Page' argument.
+
+2002-03-26 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * DataBindingHandlerAttribute.cs
+ - Completed
+ * ToolboxDataAttribute.cs - Completed
+
+2002-01-03 Nick Drochak <ndrochak@gol.com>
+
+ * DesignTimeParseData.cs: initialze static member to avoid compile
+ error
+ * PropertyConverter.cs: remove uneeded exception variables from
+ catch blocks.
+
+2002-01-02 Nick Drochak <ndrochak@gol.com>
+
+ * DesignTimeParseData.cs: fix header to show correct class name
+
+2001-12-21 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * StateBag.cs - Completed
+
+2001-12-19 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * Pair.cs - Small undocumented class. Completed.
+
+2001-12-18 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * DesignTimeParseData.cs - Initial implementation
+ * StateBag.cs - Initial implementation
+
+2001-12-17 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * PropertyConverter.cs - Undocumented class. Completed.
+ * Utils.cs - Undocumented, private class.
+ Initial implementation
+
+2001-08-28 Bob Smith <bob@thestuff.net>
+ * Control.cs: Figured out some undocumented API.
+ * Added TODO.
+ * BuildMethod.cs: Initial implementation.
+ * BuildTemplateMethod.cs: Initial implementation.
+ * HtmlTextWriterAttribute.cs: Initial implementation.
+ * HtmlTextWriterStyle.cs: Initial implementation.
+ * HtmlTextWriterTag.cs: Initial implementation.
+ * IAttributeAccessor.cs: Initial implementation.
+ * IDataBindingsAccessor.cs: Initial implementation.
+ * ImageClickEventHandler.cs: Initial implementation.
+ * INamingContainer.cs: Initial implementation.
+ * IParserAccessor.cs: Initial implementation.
+ * IPostBackDataHandler.cs: Initial implementation.
+ * IPostBackEventHandler.cs: Initial implementation.
+ * IStateManager.cs: Initial implementation.
+ * ITagNameToTypeMapper.cs: Initial implementation.
+ * ITemplate.cs: Initial implementation.
+ * IValidator.cs: Initial implementation.
+ * OutputCacheLocation.cs: Initial implementation.
+ * PersistanceMode.cs: Initial implementation.
+ * StateItem.cs: Initial implementation.
+
+2001-08-27 Bob Smith <bob@thestuff.net>
+
+ * Control.cs: Bug fixes and implementations.
+
+2001-08-24 Bob Smith <bob@thestuff.net>
+
+ * Control.cs: Bug fixes.
+
+2001-08-23 Bob Smith <bob@thestuff.net>
+
+ * Control.cs: More implementation. Events reworked for performance.
+
+2001-08-22 Bob Smith <bob@thestuff.net>
+
+ * LiteralControl.cs: Implemented.
+ * Control.cs: Even more implementation (Events). What a beast.
+
+2001-08-20 Bob Smith <bob@thestuff.net>
+
+ * Control.cs: More implementation. Not done yet. Shutter.
+
+2001-08-17 Bob Smith <bob@thestuff.net>
+
+ * Control.cs: Partial implementation.
diff --git a/mcs/class/System.Web/System.Web.UI/ClientScriptManager.cs b/mcs/class/System.Web/System.Web.UI/ClientScriptManager.cs
new file mode 100644
index 00000000000..f1cdb82729c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ClientScriptManager.cs
@@ -0,0 +1,395 @@
+//
+// System.Web.UI.ClientScriptManager.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Lluis Sanchez (lluis@novell.com)
+//
+// (C) 2002,2003 Ximian, Inc. (http://www.ximian.com)
+// (c) 2003 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
+// "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;
+using System.Collections;
+using System.Text;
+
+namespace System.Web.UI
+{
+ #if NET_2_0
+ public
+ #else
+ internal
+ #endif
+ class ClientScriptManager
+ {
+ Hashtable registeredArrayDeclares;
+ ScriptEntry clientScriptBlocks;
+ ScriptEntry startupScriptBlocks;
+ Hashtable hiddenFields;
+ ScriptEntry submitStatements;
+ ScriptEntry scriptIncludes;
+ Page page;
+
+ internal ClientScriptManager (Page page)
+ {
+ this.page = page;
+ }
+
+ public string GetPostBackClientEvent (Control control, string argument)
+ {
+ return GetPostBackEventReference (control, argument);
+ }
+
+ public string GetPostBackClientHyperlink (Control control, string argument)
+ {
+ return "javascript:" + GetPostBackEventReference (control, argument);
+ }
+
+ public string GetPostBackEventReference (Control control)
+ {
+ return GetPostBackEventReference (control, "");
+ }
+
+ public string GetPostBackEventReference (Control control, string argument)
+ {
+ page.RequiresPostBackScript ();
+ return String.Format ("__doPostBack('{0}','{1}')", control.UniqueID, argument);
+ }
+
+#if NET_2_0
+ public string GetPostBackEventReference (PostBackOptions options)
+ {
+ if (options.ActionUrl == null && options.ValidationGroup == null && !options.TrackFocus &&
+ !options.AutoPostBack && !options.PerformValidation)
+ {
+ if (options.RequiresJavaScriptProtocol)
+ return GetPostBackClientHyperlink (options.TargetControl, options.Argument);
+ else
+ return GetPostBackEventReference (options.TargetControl, options.Argument);
+ }
+
+ if (!IsClientScriptIncludeRegistered (typeof(Page), "webform")) {
+ RegisterClientScriptInclude (typeof(Page), "webform", GetWebResourceUrl (typeof(Page), "webform.js"));
+ }
+
+ if (options.ActionUrl != null)
+ RegisterHiddenField (Page.PreviousPageID, page.Request.FilePath);
+
+ if (options.ClientSubmit || options.ActionUrl != null)
+ page.RequiresPostBackScript ();
+
+ return String.Format ("{0}WebForm_DoPostback({1},{2},{3},{4},{5},{6},{7},{8})",
+ options.RequiresJavaScriptProtocol ? "javascript:" : "",
+ ClientScriptManager.GetScriptLiteral (options.TargetControl.UniqueID),
+ ClientScriptManager.GetScriptLiteral (options.Argument),
+ ClientScriptManager.GetScriptLiteral (options.ActionUrl),
+ ClientScriptManager.GetScriptLiteral (options.AutoPostBack),
+ ClientScriptManager.GetScriptLiteral (options.PerformValidation),
+ ClientScriptManager.GetScriptLiteral (options.TrackFocus),
+ ClientScriptManager.GetScriptLiteral (options.ClientSubmit),
+ ClientScriptManager.GetScriptLiteral (options.ValidationGroup)
+ );
+ }
+
+ public string GetCallbackEventReference (Control control, string argument, string clientCallback, string context)
+ {
+ return GetCallbackEventReference (control, argument, clientCallback, context, null);
+ }
+
+ public string GetCallbackEventReference (Control control, string argument, string clientCallback, string context, string clientErrorCallback)
+ {
+ if (!IsClientScriptIncludeRegistered (typeof(Page), "callback"))
+ RegisterClientScriptInclude (typeof(Page), "callback", GetWebResourceUrl (typeof(Page), "callback.js"));
+
+ return string.Format ("WebForm_DoCallback ('{0}', {1}, {2}, {3}, {4})", control.UniqueID, argument, clientCallback, context, clientErrorCallback);
+ }
+
+ public string GetWebResourceUrl(Type type, string resourceName)
+ {
+ if (type == null)
+ throw new ArgumentNullException ("type");
+
+ if (resourceName == null || resourceName.Length == 0)
+ throw new ArgumentNullException ("type");
+
+ return System.Web.Handlers.AssemblyResourceLoader.GetResourceUrl (type, resourceName);
+ }
+
+#endif
+
+ public bool IsClientScriptBlockRegistered (string key)
+ {
+ return IsScriptRegistered (clientScriptBlocks, GetType(), key);
+ }
+
+ public bool IsClientScriptBlockRegistered (Type type, string key)
+ {
+ return IsScriptRegistered (clientScriptBlocks, type, key);
+ }
+
+ public bool IsStartupScriptRegistered (string key)
+ {
+ return IsScriptRegistered (startupScriptBlocks, GetType(), key);
+ }
+
+ public bool IsStartupScriptRegistered (Type type, string key)
+ {
+ return IsScriptRegistered (startupScriptBlocks, type, key);
+ }
+
+ public bool IsOnSubmitStatementRegistered (string key)
+ {
+ return IsScriptRegistered (submitStatements, GetType(), key);
+ }
+
+ public bool IsOnSubmitStatementRegistered (Type type, string key)
+ {
+ return IsScriptRegistered (submitStatements, type, key);
+ }
+
+ public bool IsClientScriptIncludeRegistered (string key)
+ {
+ return IsScriptRegistered (scriptIncludes, GetType(), key);
+ }
+
+ public bool IsClientScriptIncludeRegistered (Type type, string key)
+ {
+ return IsScriptRegistered (scriptIncludes, type, key);
+ }
+
+ bool IsScriptRegistered (ScriptEntry scriptList, Type type, string key)
+ {
+ while (scriptList != null) {
+ if (scriptList.Type == type && scriptList.Key == key)
+ return true;
+ scriptList = scriptList.Next;
+ }
+ return false;
+ }
+
+ public void RegisterArrayDeclaration (string arrayName, string arrayValue)
+ {
+ if (registeredArrayDeclares == null)
+ registeredArrayDeclares = new Hashtable();
+
+ if (!registeredArrayDeclares.ContainsKey (arrayName))
+ registeredArrayDeclares.Add (arrayName, new ArrayList());
+
+ ((ArrayList) registeredArrayDeclares[arrayName]).Add(arrayValue);
+ }
+
+ void RegisterScript (ref ScriptEntry scriptList, Type type, string key, string script, bool addScriptTags)
+ {
+ ScriptEntry last = null;
+ ScriptEntry entry = scriptList;
+
+ while (entry != null) {
+ if (entry.Type == type && entry.Key == key)
+ return;
+ last = entry;
+ entry = entry.Next;
+ }
+
+ if (addScriptTags)
+ script = "<script language=javascript>\n<!--\n" + script + "\n// -->\n</script>";
+
+ entry = new ScriptEntry (type, key, script);
+
+ if (last != null) last.Next = entry;
+ else scriptList = entry;
+ }
+
+ internal void RegisterClientScriptBlock (string key, string script)
+ {
+ RegisterScript (ref clientScriptBlocks, GetType(), key, script, false);
+ }
+
+ public void RegisterClientScriptBlock (Type type, string key, string script)
+ {
+ RegisterScript (ref clientScriptBlocks, type, key, script, false);
+ }
+
+ public void RegisterClientScriptBlock (Type type, string key, string script, bool addScriptTags)
+ {
+ RegisterScript (ref clientScriptBlocks, type, key, script, addScriptTags);
+ }
+
+ public void RegisterHiddenField (string hiddenFieldName, string hiddenFieldInitialValue)
+ {
+ if (hiddenFields == null)
+ hiddenFields = new Hashtable ();
+
+ if (!hiddenFields.ContainsKey (hiddenFieldName))
+ hiddenFields.Add (hiddenFieldName, hiddenFieldInitialValue);
+ }
+
+ internal void RegisterOnSubmitStatement (string key, string script)
+ {
+ RegisterScript (ref submitStatements, GetType (), key, script, false);
+ }
+
+ public void RegisterOnSubmitStatement (Type type, string key, string script)
+ {
+ RegisterScript (ref submitStatements, type, key, script, false);
+ }
+
+ internal void RegisterStartupScript (string key, string script)
+ {
+ RegisterScript (ref startupScriptBlocks, GetType(), key, script, false);
+ }
+
+ public void RegisterStartupScript (Type type, string key, string script)
+ {
+ RegisterScript (ref startupScriptBlocks, type, key, script, false);
+ }
+
+ public void RegisterStartupScript (Type type, string key, string script, bool addScriptTags)
+ {
+ RegisterScript (ref startupScriptBlocks, type, key, script, addScriptTags);
+ }
+
+ public void RegisterClientScriptInclude (string key, string url)
+ {
+ RegisterScript (ref scriptIncludes, GetType(), key, url, false);
+ }
+
+ public void RegisterClientScriptInclude (Type type, string key, string url)
+ {
+ RegisterScript (ref scriptIncludes, type, key, url, false);
+ }
+
+ void WriteScripts (HtmlTextWriter writer, ScriptEntry scriptList)
+ {
+ while (scriptList != null) {
+ writer.WriteLine (scriptList.Script);
+ scriptList = scriptList.Next;
+ }
+ }
+
+ internal void WriteHiddenFields (HtmlTextWriter writer)
+ {
+ if (hiddenFields == null)
+ return;
+
+ foreach (string key in hiddenFields.Keys) {
+ string value = hiddenFields [key] as string;
+ writer.WriteLine ("\n<input type=\"hidden\" name=\"{0}\" value=\"{1}\" />", key, value);
+ }
+
+ hiddenFields = null;
+ }
+
+ internal void WriteClientScriptIncludes (HtmlTextWriter writer)
+ {
+ ScriptEntry entry = scriptIncludes;
+ while (entry != null) {
+ writer.WriteLine ("\n<script src=\"{0}\" type=\"text/javascript\"></script>", entry.Script);
+ entry = entry.Next;
+ }
+ }
+
+ internal void WriteClientScriptBlocks (HtmlTextWriter writer)
+ {
+ WriteScripts (writer, clientScriptBlocks);
+ }
+
+ internal void WriteStartupScriptBlocks (HtmlTextWriter writer)
+ {
+ WriteScripts (writer, startupScriptBlocks);
+ }
+
+ internal void WriteArrayDeclares (HtmlTextWriter writer)
+ {
+ if (registeredArrayDeclares != null) {
+ writer.WriteLine();
+ writer.WriteLine("<script language=\"javascript\">");
+ writer.WriteLine("<!--");
+ IDictionaryEnumerator arrayEnum = registeredArrayDeclares.GetEnumerator();
+ while (arrayEnum.MoveNext()) {
+ writer.Write("\tvar ");
+ writer.Write(arrayEnum.Key);
+ writer.Write(" = new Array(");
+ IEnumerator arrayListEnum = ((ArrayList) arrayEnum.Value).GetEnumerator();
+ bool isFirst = true;
+ while (arrayListEnum.MoveNext()) {
+ if (isFirst)
+ isFirst = false;
+ else
+ writer.Write(", ");
+ writer.Write(arrayListEnum.Current);
+ }
+ writer.WriteLine(");");
+ }
+ writer.WriteLine("// -->");
+ writer.WriteLine("</script>");
+ writer.WriteLine();
+ }
+ }
+
+ internal string WriteSubmitStatements ()
+ {
+ if (submitStatements == null) return null;
+
+ StringBuilder sb = new StringBuilder ();
+ ScriptEntry entry = submitStatements;
+ while (entry != null) {
+ sb.Append (entry.Script);
+ entry = entry.Next;
+ }
+ return sb.ToString ();
+ }
+
+ internal static string GetScriptLiteral (object ob)
+ {
+ if (ob == null)
+ return "null";
+ else if (ob is string) {
+ string s = (string)ob;
+ s = s.Replace ("\"", "\\\"");
+ return "\"" + s + "\"";
+ } else if (ob is bool) {
+ return ob.ToString().ToLower();
+ } else {
+ return ob.ToString ();
+ }
+ }
+
+ class ScriptEntry
+ {
+ public Type Type;
+ public string Key;
+ public string Script;
+ public ScriptEntry Next;
+
+ public ScriptEntry (Type type, string key, string script)
+ {
+ Key = key;
+ Type = type;
+ Script = script;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/CodeBuilder.cs b/mcs/class/System.Web/System.Web.UI/CodeBuilder.cs
new file mode 100644
index 00000000000..484adbc6cd8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/CodeBuilder.cs
@@ -0,0 +1,64 @@
+//
+// System.Web.UI.CodeBuilder
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc. (http://www.ximian.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.Web.Compilation;
+
+namespace System.Web.UI
+{
+ abstract class CodeBuilder : ControlBuilder
+ {
+ string code;
+ bool isAssign;
+
+ public CodeBuilder (string code, bool isAssign, ILocation location)
+ {
+ this.code = code;
+ this.isAssign = isAssign;
+ this.line = location.BeginLine;
+ this.fileName = location.Filename;
+ this.location = location;
+ }
+
+ internal override object CreateInstance ()
+ {
+ return null;
+ }
+
+ internal string Code {
+ get { return code; }
+ set { code = value; }
+ }
+
+ internal bool IsAssign {
+ get { return isAssign; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/CodeRenderBuilder.cs b/mcs/class/System.Web/System.Web.UI/CodeRenderBuilder.cs
new file mode 100644
index 00000000000..5997bc55a14
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/CodeRenderBuilder.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.CodeRenderBuilder
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc. (http://www.ximian.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.Web.Compilation;
+
+namespace System.Web.UI
+{
+ sealed class CodeRenderBuilder : CodeBuilder
+ {
+ public CodeRenderBuilder (string code, bool isAssign, ILocation location)
+ : base (code, isAssign, location)
+ {
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/CollectionBuilder.cs b/mcs/class/System.Web/System.Web.UI/CollectionBuilder.cs
new file mode 100644
index 00000000000..47b6672f9ad
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/CollectionBuilder.cs
@@ -0,0 +1,80 @@
+//
+// System.Web.UI.CollectionBuilder.cs
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2003 Ximian, Inc. (http://www.ximian.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;
+using System.Collections;
+using System.Reflection;
+
+namespace System.Web.UI
+{
+ sealed class CollectionBuilder : ControlBuilder
+ {
+ Type elementType;
+
+ internal CollectionBuilder ()
+ {
+ }
+
+ public override void AppendLiteralString (string s)
+ {
+ if (s != null && s.Trim () != "")
+ throw new HttpException ("Literal content not allowed for " + ControlType);
+ }
+
+ public override Type GetChildControlType (string tagName, IDictionary attribs)
+ {
+ Type t = Root.GetChildControlType (tagName, attribs);
+ if (elementType != null && !elementType.IsAssignableFrom (t))
+ throw new HttpException ("Cannot add a " + t + " to " + elementType);
+
+ return t;
+ }
+
+ public override void Init (TemplateParser parser,
+ ControlBuilder parentBuilder,
+ Type type,
+ string tagName,
+ string id,
+ IDictionary attribs)
+ {
+ base.Init (parser, parentBuilder, type, tagName, id, attribs);
+
+ PropertyInfo prop = parentBuilder.ControlType.GetProperty (tagName, flagsNoCase);
+ SetControlType (prop.PropertyType);
+
+ MemberInfo[] mems = ControlType.GetMember ("Item", MemberTypes.Property, flagsNoCase & ~BindingFlags.IgnoreCase);
+ if (mems.Length > 0) prop = (PropertyInfo) mems [0];
+ else throw new HttpException ("Collection of type '" + ControlType + "' does not have an indexer.");
+
+ elementType = prop.PropertyType;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/CompilationMode.cs b/mcs/class/System.Web/System.Web.UI/CompilationMode.cs
new file mode 100644
index 00000000000..557548df61b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/CompilationMode.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.UI.CompilationMode.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI {
+ public enum CompilationMode {
+ Auto = 0,
+ Never = 1,
+ Always = 2
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/CompiledBindableTemplateBuilder.cs b/mcs/class/System.Web/System.Web.UI/CompiledBindableTemplateBuilder.cs
new file mode 100644
index 00000000000..9c30e84ef53
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/CompiledBindableTemplateBuilder.cs
@@ -0,0 +1,59 @@
+//
+// System.Web.UI.CompiledBindableTemplateBuilder.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections.Specialized;
+
+namespace System.Web.UI
+{
+ public sealed class CompiledBindableTemplateBuilder : IBindableTemplate
+ {
+ private BuildTemplateMethod templateMethod;
+ private ExtractTemplateValuesMethod extractMethod;
+
+ public CompiledBindableTemplateBuilder (BuildTemplateMethod buildTemplateMethod, ExtractTemplateValuesMethod extractTemplateValuesMethod)
+ {
+ this.templateMethod = buildTemplateMethod;
+ this.extractMethod = extractTemplateValuesMethod;
+ }
+
+ public void InstantiateIn (Control container)
+ {
+ templateMethod (container);
+ }
+
+ public IOrderedDictionary ExtractValues (Control container)
+ {
+ if (extractMethod == null) return null;
+ return extractMethod (container);
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/CompiledTemplateBuilder.cs b/mcs/class/System.Web/System.Web.UI/CompiledTemplateBuilder.cs
new file mode 100644
index 00000000000..f2ece3d81dd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/CompiledTemplateBuilder.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.UI.CompiledTemplateBuilder
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+// This is used in the generated C# code from MS and xsp does the same.
+// It just seems to be a container implementing an ITemplate interface.
+
+//
+// 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.
+//
+
+namespace System.Web.UI {
+
+public sealed class CompiledTemplateBuilder : ITemplate
+{
+ private BuildTemplateMethod templateMethod;
+
+ public CompiledTemplateBuilder (BuildTemplateMethod templateMethod)
+ {
+ this.templateMethod = templateMethod;
+ }
+
+ public void InstantiateIn (Control ctrl)
+ {
+ templateMethod (ctrl);
+ }
+}
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/ConflictOptions.cs b/mcs/class/System.Web/System.Web.UI/ConflictOptions.cs
new file mode 100644
index 00000000000..e4e868fb8b5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ConflictOptions.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.UI.ConflictOptions.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI {
+ public enum ConflictOptions {
+ OverwriteChanges = 0,
+ CompareAllValues = 1
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/ConstructorNeedsTagAttribute.cs b/mcs/class/System.Web/System.Web.UI/ConstructorNeedsTagAttribute.cs
new file mode 100755
index 00000000000..ac244667dc6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ConstructorNeedsTagAttribute.cs
@@ -0,0 +1,52 @@
+//
+// System.Web.UI.ConstructorNeedsTagAttribute.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+//
+// 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;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class ConstructorNeedsTagAttribute : Attribute
+ {
+ bool needsTag;
+
+ public ConstructorNeedsTagAttribute ()
+ {
+ needsTag = false;
+ }
+
+ public ConstructorNeedsTagAttribute (bool needsTag)
+ {
+ this.needsTag = needsTag;
+ }
+
+ public bool NeedsTag {
+ get { return needsTag; }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/Control.cs b/mcs/class/System.Web/System.Web.UI/Control.cs
new file mode 100644
index 00000000000..ff805396bee
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/Control.cs
@@ -0,0 +1,1112 @@
+//
+// System.Web.UI.Control.cs
+//
+// Authors:
+// Bob Smith <bob@thestuff.net>
+// Gonzalo Paniagua Javier (gonzalo@ximian.com
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) Bob Smith
+// (c) 2002,2003 Ximian, Inc. (http://www.ximian.com)
+// (C) 2004 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
+// "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;
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.ComponentModel.Design.Serialization;
+using System.Web;
+using System.Web.Util;
+
+namespace System.Web.UI
+{
+ [DefaultProperty ("ID"), DesignerCategory ("Code"), ToolboxItemFilter ("System.Web.UI", ToolboxItemFilterType.Require)]
+ [ToolboxItem ("System.Web.UI.Design.WebControlToolboxItem, " + Consts.AssemblySystem_Design)]
+ [Designer ("System.Web.UI.Design.ControlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ [DesignerSerializer ("Microsoft.VSDesigner.WebForms.ControlCodeDomSerializer, " + Consts.AssemblyMicrosoft_VSDesigner,
+ "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design)]
+ public class Control : IComponent, IDisposable, IParserAccessor, IDataBindingsAccessor
+#if NET_2_0
+ , IUrlResolutionService, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor
+#endif
+ {
+ static readonly object DataBindingEvent = new object();
+ static readonly object DisposedEvent = new object();
+ static readonly object InitEvent = new object();
+ static readonly object LoadEvent = new object();
+ static readonly object PreRenderEvent = new object();
+ static readonly object UnloadEvent = new object();
+ static string[] defaultNameArray;
+
+ string uniqueID;
+ string _userId;
+ ControlCollection _controls;
+ IDictionary _childViewStates;
+ Control _namingContainer;
+ Page _page;
+ Control _parent;
+ ISite _site;
+ HttpContext _context;
+ StateBag _viewState;
+ EventHandlerList _events;
+ RenderMethod _renderMethodDelegate;
+ int defaultNumberID;
+
+ DataBindingCollection dataBindings;
+ Hashtable pendingVS; // may hold unused viewstate data from child controls
+
+
+ /*************/
+ int stateMask;
+ const int ENABLE_VIEWSTATE = 1;
+ const int VISIBLE = 1 << 1;
+ const int AUTOID = 1 << 2;
+ const int CREATING_CONTROLS = 1 << 3;
+ const int BINDING_CONTAINER = 1 << 4;
+ const int AUTO_EVENT_WIREUP = 1 << 5;
+ const int IS_NAMING_CONTAINER = 1 << 6;
+ const int VISIBLE_CHANGED = 1 << 7;
+ const int TRACK_VIEWSTATE = 1 << 8;
+ const int CHILD_CONTROLS_CREATED = 1 << 9;
+ const int ID_SET = 1 << 10;
+ const int INITED = 1 << 11;
+ const int INITING = 1 << 12;
+ const int VIEWSTATE_LOADED = 1 << 13;
+ const int LOADED = 1 << 14;
+ const int PRERENDERED = 1 << 15;
+ /*************/
+
+ static Control ()
+ {
+ defaultNameArray = new string [100];
+ for (int i = 0 ; i < 100 ; i++)
+ defaultNameArray [i] = "_ctrl" + i;
+ }
+
+ public Control()
+ {
+ stateMask = ENABLE_VIEWSTATE | VISIBLE | AUTOID | BINDING_CONTAINER | AUTO_EVENT_WIREUP;
+ if (this is INamingContainer)
+ stateMask |= IS_NAMING_CONTAINER;
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable (EditorBrowsableState.Never), Browsable (false)]
+ public Control BindingContainer {
+ get {
+ Control container = NamingContainer;
+ if ((container.stateMask & BINDING_CONTAINER) == 0)
+ container = container.BindingContainer;
+ return container;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ [WebSysDescription ("An Identification of the control that is rendered.")]
+ public virtual string ClientID {
+ get {
+ string client = UniqueID;
+
+ if (client != null)
+ client = client.Replace (':', '_');
+
+ return client;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ [WebSysDescription ("The child controls of this control.")]
+ public virtual ControlCollection Controls //DIT
+ {
+ get
+ {
+ if (_controls == null) _controls = CreateControlCollection();
+ return _controls;
+ }
+ }
+
+ [DefaultValue (true), WebCategory ("Behavior")]
+ [WebSysDescription ("An Identification of the control that is rendered.")]
+#if NET_2_0
+ [Themeable (true)]
+#endif
+ public virtual bool EnableViewState {
+ get { return ((stateMask & ENABLE_VIEWSTATE) != 0); }
+ set { SetMask (ENABLE_VIEWSTATE, value); }
+ }
+
+ [MergableProperty (false), ParenthesizePropertyName (true)]
+ [WebSysDescription ("The name of the control that is rendered.")]
+#if NET_2_0
+ [Filterable (true), Themeable (true)]
+#endif
+
+ public virtual string ID {
+ get {
+ return (((stateMask & ID_SET) != 0) ? _userId : null);
+ }
+
+ set {
+ if (value == "")
+ value = null;
+
+ stateMask |= ID_SET;
+ _userId = value;
+ NullifyUniqueID ();
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ [WebSysDescription ("The container that this control is part of. The control's name has to be unique within the container.")]
+ public virtual Control NamingContainer {
+ get {
+ if (_namingContainer == null && _parent != null) {
+ if ((_parent.stateMask & IS_NAMING_CONTAINER) == 0)
+ _namingContainer = _parent.NamingContainer;
+ else
+ _namingContainer = _parent;
+ }
+
+ return _namingContainer;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ [WebSysDescription ("The webpage that this control resides on.")]
+#if NET_2_0
+ [Bindable (true)]
+#endif
+ public virtual Page Page //DIT
+ {
+ get
+ {
+ if (_page == null && _parent != null) _page = _parent.Page;
+ return _page;
+ }
+ set
+ {
+ _page = value;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ [WebSysDescription ("The parent control of this control.")]
+ public virtual Control Parent //DIT
+ {
+ get
+ {
+ return _parent;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable (EditorBrowsableState.Advanced), Browsable (false)]
+ [WebSysDescription ("The site this control is part of.")]
+ public ISite Site //DIT
+ {
+ get
+ {
+ return _site;
+ }
+ set
+ {
+ _site = value;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ [WebSysDescription ("A virtual directory containing the parent of the control.")]
+ public virtual string TemplateSourceDirectory {
+ get { return (_parent == null) ? String.Empty : _parent.TemplateSourceDirectory; }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ [WebSysDescription ("The unique ID of the control.")]
+ public virtual string UniqueID {
+ get {
+ if (uniqueID != null)
+ return uniqueID;
+
+ if (_namingContainer == null) {
+ return _userId;
+ }
+
+ if (_userId == null)
+ _userId = _namingContainer.GetDefaultName ();
+
+ string prefix = _namingContainer.UniqueID;
+ if (_namingContainer == _page || prefix == null) {
+ uniqueID = _userId;
+ return uniqueID;
+ }
+
+ uniqueID = prefix + ":" + _userId;
+ return uniqueID;
+ }
+ }
+
+ void SetMask (int m, bool val)
+ {
+ if (val)
+ stateMask |= m;
+ else
+ stateMask &= ~m;
+ }
+
+ [DefaultValue (true), Bindable (true), WebCategory ("Behavior")]
+ [WebSysDescription ("Visiblity state of the control.")]
+#if NET_2_0
+ [Localizable (true)]
+#endif
+ public virtual bool Visible {
+ get {
+ if ((stateMask & VISIBLE) == 0)
+ return false;
+
+ if (_parent != null)
+ return _parent.Visible;
+
+ return true;
+ }
+
+ set {
+ if ((value && (stateMask & VISIBLE) == 0) ||
+ (!value && (stateMask & VISIBLE) != 0)) {
+ if (IsTrackingViewState)
+ stateMask |= VISIBLE_CHANGED;
+ }
+
+ SetMask (VISIBLE, value);
+ }
+ }
+
+ protected bool ChildControlsCreated {
+ get { return ((stateMask & CHILD_CONTROLS_CREATED) != 0); }
+ set {
+ if (value == false && (stateMask & CHILD_CONTROLS_CREATED) != 0)
+ Controls.Clear();
+
+ SetMask (CHILD_CONTROLS_CREATED, value);
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ protected virtual HttpContext Context //DIT
+ {
+ get
+ {
+ HttpContext context;
+ if (_context != null)
+ return _context;
+ if (_parent == null)
+ return HttpContext.Current;
+ context = _parent.Context;
+ if (context != null)
+ return context;
+ return HttpContext.Current;
+ }
+ }
+ protected EventHandlerList Events //DIT
+ {
+ get
+ {
+ if (_events == null)
+ {
+ _events = new EventHandlerList();
+ }
+ return _events;
+ }
+ }
+ protected bool HasChildViewState //DIT
+ {
+ get
+ {
+ if (_childViewStates == null) return false;
+ return true;
+ }
+ }
+
+ protected bool IsTrackingViewState {
+ get { return ((stateMask & TRACK_VIEWSTATE) != 0); }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("ViewState")]
+ protected virtual StateBag ViewState
+ {
+ get
+ {
+ if(_viewState == null)
+ _viewState = new StateBag (ViewStateIgnoresCase);
+
+ if (IsTrackingViewState)
+ _viewState.TrackViewState ();
+
+ return _viewState;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ protected virtual bool ViewStateIgnoresCase
+ {
+ get {
+ return false;
+ }
+ }
+
+ internal bool AutoEventWireup {
+ get { return (stateMask & AUTO_EVENT_WIREUP) != 0; }
+ set { SetMask (AUTO_EVENT_WIREUP, value); }
+ }
+
+ internal void SetBindingContainer (bool isBC)
+ {
+ SetMask (BINDING_CONTAINER, isBC);
+ }
+
+ internal void ResetChildNames ()
+ {
+ defaultNumberID = 0;
+ }
+
+ string GetDefaultName ()
+ {
+ string defaultName;
+ if (defaultNumberID > 99) {
+ defaultName = "_ctrl" + defaultNumberID++;
+ } else {
+ defaultName = defaultNameArray [defaultNumberID++];
+ }
+ return defaultName;
+ }
+
+ void NullifyUniqueID ()
+ {
+ uniqueID = null;
+ if (!HasControls ())
+ return;
+
+ foreach (Control c in Controls)
+ c.NullifyUniqueID ();
+ }
+
+ protected internal virtual void AddedControl (Control control, int index)
+ {
+ /* Ensure the control don't have more than 1 parent */
+ if (control._parent != null)
+ control._parent.Controls.Remove (control);
+
+ control._parent = this;
+ control._page = _page;
+ Control nc = ((stateMask & IS_NAMING_CONTAINER) != 0) ? this : NamingContainer;
+
+ if (nc != null) {
+ control._namingContainer = nc;
+ if (control.AutoID == true && control._userId == null)
+ control._userId = nc.GetDefaultName () + "a";
+ }
+
+ if ((stateMask & (INITING | INITED)) != 0)
+ control.InitRecursive (nc);
+
+ if ((stateMask & (VIEWSTATE_LOADED | LOADED)) != 0) {
+ if (pendingVS != null) {
+ object vs = pendingVS [index];
+ if (vs != null) {
+ pendingVS.Remove (index);
+ if (pendingVS.Count == 0)
+ pendingVS = null;
+
+ control.LoadViewStateRecursive (vs);
+ }
+ }
+ }
+
+ if ((stateMask & LOADED) != 0)
+ control.LoadRecursive ();
+
+ if ((stateMask & PRERENDERED) != 0)
+ control.PreRenderRecursiveInternal ();
+ }
+
+ protected virtual void AddParsedSubObject(object obj) //DIT
+ {
+ WebTrace.PushContext ("Control.AddParsedSubobject ()");
+ Control c = obj as Control;
+ WebTrace.WriteLine ("Start: {0} -> {1}", obj, (c != null) ? c.ID : String.Empty);
+ if (c != null) Controls.Add(c);
+ WebTrace.WriteLine ("End");
+ WebTrace.PopContext ();
+ }
+
+ protected void BuildProfileTree(string parentId, bool calcViewState)
+ {
+ //TODO
+ }
+
+ protected void ClearChildViewState ()
+ {
+ pendingVS = null;
+ }
+
+ protected virtual void CreateChildControls() {} //DIT
+ protected virtual ControlCollection CreateControlCollection() //DIT
+ {
+ return new ControlCollection(this);
+ }
+
+ protected virtual void EnsureChildControls ()
+ {
+ if (ChildControlsCreated == false && (stateMask & CREATING_CONTROLS) == 0) {
+ stateMask |= CREATING_CONTROLS;
+ CreateChildControls();
+ ChildControlsCreated = true;
+ stateMask &= ~CREATING_CONTROLS;
+ }
+ }
+
+ protected bool IsLiteralContent()
+ {
+ if (HasControls () && Controls.Count == 1 && (Controls [0] is LiteralControl))
+ return true;
+
+ return false;
+ }
+
+ public virtual Control FindControl (string id)
+ {
+ return FindControl (id, 0);
+ }
+
+ Control LookForControlByName (string id)
+ {
+ if (!HasControls ())
+ return null;
+
+ Control result = null;
+ foreach (Control c in Controls) {
+ if (String.Compare (id, c._userId, true) == 0) {
+ if (result != null && result != c) {
+ throw new HttpException ("1 Found more than one control with ID '" + id + "'");
+ }
+
+ result = c;
+ continue;
+ }
+
+ if ((c.stateMask & IS_NAMING_CONTAINER) == 0 && c.HasControls ()) {
+ Control child = c.LookForControlByName (id);
+ if (child != null) {
+ if (result != null && result != child)
+ throw new HttpException ("2 Found more than one control with ID '" + id + "'");
+
+ result = child;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ protected virtual Control FindControl (string id, int pathOffset)
+ {
+ EnsureChildControls ();
+ Control namingContainer = null;
+ if ((stateMask & IS_NAMING_CONTAINER) == 0) {
+ namingContainer = NamingContainer;
+ if (namingContainer == null)
+ return null;
+
+ return namingContainer.FindControl (id, pathOffset);
+ }
+
+ if (!HasControls ())
+ return null;
+
+ int colon = id.IndexOf (':', pathOffset);
+ if (colon == -1)
+ return LookForControlByName (id.Substring (pathOffset));
+
+ string idfound = id.Substring (pathOffset, colon - pathOffset);
+ namingContainer = LookForControlByName (idfound);
+ if (namingContainer == null)
+ return null;
+
+ return namingContainer.FindControl (id, colon + 1);
+ }
+
+ protected virtual void LoadViewState(object savedState)
+ {
+ if (savedState != null) {
+ ViewState.LoadViewState (savedState);
+ object o = ViewState ["Visible"];
+ if (o != null) {
+ SetMask (VISIBLE, (bool) o);
+ stateMask |= VISIBLE_CHANGED;
+ }
+ }
+ }
+
+ [MonoTODO("Secure?")]
+ protected string MapPathSecure(string virtualPath)
+ {
+ string combined = UrlUtils.Combine (TemplateSourceDirectory, virtualPath);
+ return Context.Request.MapPath (combined);
+ }
+
+ protected virtual bool OnBubbleEvent(object source, EventArgs args) //DIT
+ {
+ return false;
+ }
+ protected virtual void OnDataBinding(EventArgs e) //DIT
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler)(_events[DataBindingEvent]);
+ if (eh != null) eh(this, e);
+ }
+ }
+ protected virtual void OnInit(EventArgs e) //DIT
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler)(_events[InitEvent]);
+ if (eh != null) eh(this, e);
+ }
+ }
+ protected virtual void OnLoad(EventArgs e) //DIT
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler)(_events[LoadEvent]);
+ if (eh != null) eh(this, e);
+ }
+ }
+ protected virtual void OnPreRender(EventArgs e) //DIT
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler)(_events[PreRenderEvent]);
+ if (eh != null) eh(this, e);
+ }
+ }
+ protected virtual void OnUnload(EventArgs e) //DIT
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler)(_events[UnloadEvent]);
+ if (eh != null) eh(this, e);
+ }
+ }
+
+ protected void RaiseBubbleEvent(object source, EventArgs args)
+ {
+ Control c = Parent;
+ while (c != null) {
+ if (c.OnBubbleEvent (source, args))
+ break;
+ c = c.Parent;
+ }
+ }
+
+ protected virtual void Render(HtmlTextWriter writer) //DIT
+ {
+ RenderChildren(writer);
+ }
+
+ protected virtual void RenderChildren (HtmlTextWriter writer) //DIT
+ {
+ if (_renderMethodDelegate != null) {
+ _renderMethodDelegate (writer, this);
+ } else if (HasControls ()) {
+ int len = Controls.Count;
+ for (int i = 0; i < len; i++) {
+ Control c = Controls [i];
+ c.RenderControl (writer);
+ }
+ }
+ }
+
+ protected virtual object SaveViewState ()
+ {
+ if ((stateMask & VISIBLE_CHANGED) != 0) {
+ ViewState ["Visible"] = (stateMask & VISIBLE) != 0;
+ } else if (_viewState == null) {
+ return null;
+ }
+
+ return _viewState.SaveViewState ();
+ }
+
+ protected virtual void TrackViewState()
+ {
+ if (_viewState != null)
+ _viewState.TrackViewState ();
+
+ stateMask |= TRACK_VIEWSTATE;
+ }
+
+ public virtual void Dispose()
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler) _events [DisposedEvent];
+ if (eh != null)
+ eh(this, EventArgs.Empty);
+ }
+ }
+
+ [WebCategory ("FIXME")]
+ [WebSysDescription ("Raised when the contols databound properties are evaluated.")]
+ public event EventHandler DataBinding //DIT
+ {
+ add
+ {
+ Events.AddHandler(DataBindingEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(DataBindingEvent, value);
+ }
+ }
+
+ [WebSysDescription ("Raised when the contol is disposed.")]
+ public event EventHandler Disposed //DIT
+ {
+ add
+ {
+ Events.AddHandler(DisposedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(DisposedEvent, value);
+ }
+ }
+
+ [WebSysDescription ("Raised when the page containing the control is initialized.")]
+ public event EventHandler Init //DIT
+ {
+ add
+ {
+ Events.AddHandler(InitEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(InitEvent, value);
+ }
+ }
+
+ [WebSysDescription ("Raised after the page containing the control has been loaded.")]
+ public event EventHandler Load //DIT
+ {
+ add
+ {
+ Events.AddHandler(LoadEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(LoadEvent, value);
+ }
+ }
+
+ [WebSysDescription ("Raised before the page containing the control is rendered.")]
+ public event EventHandler PreRender //DIT
+ {
+ add
+ {
+ Events.AddHandler(PreRenderEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(PreRenderEvent, value);
+ }
+ }
+
+ [WebSysDescription ("Raised when the page containing the control is unloaded.")]
+ public event EventHandler Unload //DIT
+ {
+ add
+ {
+ Events.AddHandler(UnloadEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(UnloadEvent, value);
+ }
+ }
+
+ public virtual void DataBind() //DIT
+ {
+ #if NET_2_0
+ bool foundDataItem = false;
+
+ if ((stateMask & IS_NAMING_CONTAINER) != 0 && Page != null) {
+ object o = DataBinder.GetDataItem (this, out foundDataItem);
+ if (foundDataItem)
+ Page.PushDataItemContext (o);
+ }
+
+ try {
+ #endif
+
+ OnDataBinding (EventArgs.Empty);
+ DataBindChildren();
+
+ #if NET_2_0
+ } finally {
+ if (foundDataItem)
+ Page.PopDataItemContext ();
+ }
+ #endif
+ }
+
+ #if NET_2_0
+ protected virtual
+ #endif
+
+ void DataBindChildren ()
+ {
+ if (!HasControls ())
+ return;
+
+ int len = Controls.Count;
+ for (int i = 0; i < len; i++) {
+ Control c = Controls [i];
+ c.DataBind ();
+ }
+ }
+
+
+ public virtual bool HasControls ()
+ {
+ return (_controls != null && _controls.Count > 0);
+ }
+
+ public void RenderControl(HtmlTextWriter writer)
+ {
+ if ((stateMask & VISIBLE) != 0)
+ Render(writer);
+ }
+
+ public string ResolveUrl(string relativeUrl)
+ {
+ if (relativeUrl == null)
+ throw new ArgumentNullException ("relativeUrl");
+
+ if (relativeUrl == "")
+ return "";
+
+ if (relativeUrl [0] == '#')
+ return relativeUrl;
+
+ string ts = TemplateSourceDirectory;
+ if (ts == "" || !UrlUtils.IsRelativeUrl (relativeUrl))
+ return relativeUrl;
+
+ HttpResponse resp = Context.Response;
+ return resp.ApplyAppPathModifier (UrlUtils.Combine (ts, relativeUrl));
+ }
+
+ internal bool HasRenderMethodDelegate () {
+ return _renderMethodDelegate != null;
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public void SetRenderMethodDelegate(RenderMethod renderMethod) //DIT
+ {
+ _renderMethodDelegate = renderMethod;
+ }
+
+ internal void LoadRecursive()
+ {
+ OnLoad (EventArgs.Empty);
+ if (HasControls ()) {
+ int len = Controls.Count;
+ for (int i=0;i<len;i++)
+ {
+ Control c = Controls[i];
+ c.LoadRecursive ();
+ }
+ }
+ stateMask |= LOADED;
+ }
+
+ internal void UnloadRecursive(Boolean dispose)
+ {
+ if (HasControls ()) {
+ int len = Controls.Count;
+ for (int i=0;i<len;i++)
+ {
+ Control c = Controls[i];
+ c.UnloadRecursive (dispose);
+ }
+ }
+
+ OnUnload (EventArgs.Empty);
+ if (dispose)
+ Dispose();
+ }
+
+ internal void PreRenderRecursiveInternal()
+ {
+ if ((stateMask & VISIBLE) != 0) {
+ EnsureChildControls ();
+ OnPreRender (EventArgs.Empty);
+ if (!HasControls ())
+ return;
+
+ int len = Controls.Count;
+ for (int i=0;i<len;i++)
+ {
+ Control c = Controls[i];
+ c.PreRenderRecursiveInternal ();
+ }
+ }
+ stateMask |= PRERENDERED;
+ }
+
+ internal void InitRecursive(Control namingContainer)
+ {
+ if (HasControls ()) {
+ if ((stateMask & IS_NAMING_CONTAINER) != 0)
+ namingContainer = this;
+
+ if (namingContainer != null &&
+ namingContainer._userId == null &&
+ namingContainer.AutoID)
+ namingContainer._userId = namingContainer.GetDefaultName () + "b";
+
+ int len = Controls.Count;
+ for (int i=0;i<len;i++)
+ {
+ Control c = Controls[i];
+ c._page = Page;
+ c._namingContainer = namingContainer;
+ if (namingContainer != null && c._userId == null && c.AutoID)
+ c._userId = namingContainer.GetDefaultName () + "c";
+ c.InitRecursive (namingContainer);
+ }
+ }
+
+ stateMask |= INITING;
+ OnInit (EventArgs.Empty);
+ TrackViewState ();
+ stateMask |= INITED;
+ stateMask &= ~INITING;
+ }
+
+ internal object SaveViewStateRecursive ()
+ {
+ if (!EnableViewState)
+ return null;
+
+ ArrayList controlList = null;
+ ArrayList controlStates = null;
+
+ int idx = -1;
+ if (HasControls ())
+ {
+ int len = Controls.Count;
+ for (int i=0;i<len;i++)
+ {
+ Control ctrl = Controls[i];
+ object ctrlState = ctrl.SaveViewStateRecursive ();
+ idx++;
+ if (ctrlState == null)
+ continue;
+
+ if (controlList == null)
+ {
+ controlList = new ArrayList ();
+ controlStates = new ArrayList ();
+ }
+
+ controlList.Add (idx);
+ controlStates.Add (ctrlState);
+ }
+ }
+
+ object thisState = SaveViewState ();
+ if (thisState == null && controlList == null && controlStates == null)
+ return null;
+
+ return new Triplet (thisState, controlList, controlStates);
+ }
+
+ internal void LoadViewStateRecursive (object savedState)
+ {
+ if (!EnableViewState || savedState == null)
+ return;
+
+ Triplet savedInfo = (Triplet) savedState;
+ LoadViewState (savedInfo.First);
+
+ ArrayList controlList = savedInfo.Second as ArrayList;
+ if (controlList == null)
+ return;
+ ArrayList controlStates = savedInfo.Third as ArrayList;
+ int nControls = controlList.Count;
+ for (int i = 0; i < nControls; i++) {
+ int k = (int) controlList [i];
+ if (k < Controls.Count && controlStates != null) {
+ Control c = Controls [k];
+ c.LoadViewStateRecursive (controlStates [i]);
+ } else {
+ if (pendingVS == null)
+ pendingVS = new Hashtable ();
+
+ pendingVS [k] = controlStates [i];
+ }
+ }
+
+ stateMask |= VIEWSTATE_LOADED;
+ }
+
+ void IParserAccessor.AddParsedSubObject(object obj)
+ {
+ AddParsedSubObject(obj);
+ }
+
+ DataBindingCollection IDataBindingsAccessor.DataBindings
+ {
+ get
+ {
+ if(dataBindings == null)
+ dataBindings = new DataBindingCollection();
+ return dataBindings;
+ }
+ }
+
+ bool IDataBindingsAccessor.HasDataBindings
+ {
+ get
+ {
+ return (dataBindings!=null && dataBindings.Count>0);
+ }
+ }
+
+ internal bool AutoID
+ {
+ get { return (stateMask & AUTOID) != 0; }
+ set {
+ if (value == false && (stateMask & IS_NAMING_CONTAINER) != 0)
+ return;
+
+ SetMask (AUTOID, value);
+ }
+ }
+
+ internal void PreventAutoID()
+ {
+ AutoID = false;
+ }
+
+ protected internal virtual void RemovedControl (Control control)
+ {
+ control.UnloadRecursive (false);
+ control._parent = null;
+ control._page = null;
+ control._namingContainer = null;
+ }
+
+#if NET_2_0
+ protected string GetWebResourceUrl (string resourceName)
+ {
+ return Page.ClientScript.GetWebResourceUrl (GetType(), resourceName);
+ }
+
+ string IUrlResolutionService.ResolveClientUrl (string url)
+ {
+ throw new NotImplementedException ();
+ }
+
+ ControlBuilder IControlBuilderAccessor.ControlBuilder {
+ get {throw new NotImplementedException (); }
+ }
+
+ IDictionary IControlDesignerAccessor.GetDesignModeState ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ void IControlDesignerAccessor.SetDesignModeState (IDictionary designData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ void IControlDesignerAccessor.SetOwnerControl (Control control)
+ {
+ throw new NotImplementedException ();
+ }
+
+ IDictionary IControlDesignerAccessor.UserData {
+ get { throw new NotImplementedException (); }
+ }
+
+ ExpressionBindingCollection expressionBindings;
+
+ ExpressionBindingCollection IExpressionsAccessor.Expressions {
+ get {
+ if (expressionBindings == null)
+ expressionBindings = new ExpressionBindingCollection ();
+ return expressionBindings;
+ }
+ }
+
+ bool IExpressionsAccessor.HasExpressions {
+ get {
+ return (expressionBindings != null && expressionBindings.Count > 0);
+ }
+ }
+
+ [MonoTODO]
+ public virtual void Focus()
+ {
+ throw new NotImplementedException();
+ }
+
+ protected internal virtual void LoadControlState (object state)
+ {
+ }
+
+ protected internal virtual object SaveControlState ()
+ {
+ return null;
+ }
+
+#endif
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs b/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs
new file mode 100755
index 00000000000..2e62189d438
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs
@@ -0,0 +1,495 @@
+//
+// System.Web.UI.ControlBuilder.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002, 2003 Ximian, Inc. (http://www.ximian.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;
+using System.Collections;
+using System.CodeDom;
+using System.Reflection;
+using System.Web;
+using System.Web.Compilation;
+
+namespace System.Web.UI {
+
+ public class ControlBuilder
+ {
+ internal static BindingFlags flagsNoCase = BindingFlags.Public |
+ BindingFlags.Instance |
+ BindingFlags.Static |
+ BindingFlags.IgnoreCase;
+
+ TemplateParser parser;
+ internal ControlBuilder parentBuilder;
+ Type type;
+ string tagName;
+ string id;
+ internal IDictionary attribs;
+ internal int line;
+ internal string fileName;
+ bool childrenAsProperties;
+ bool isIParserAccessor = true;
+ bool hasAspCode;
+ internal ControlBuilder defaultPropertyBuilder;
+ ArrayList children;
+ static int nextID;
+
+ internal bool haveParserVariable;
+ internal CodeMemberMethod method;
+ internal CodeMemberMethod renderMethod;
+ internal int renderIndex;
+ internal bool isProperty;
+ internal ILocation location;
+ ArrayList otherTags;
+
+ public ControlBuilder ()
+ {
+ }
+
+ internal ControlBuilder (TemplateParser parser,
+ ControlBuilder parentBuilder,
+ Type type,
+ string tagName,
+ string id,
+ IDictionary attribs,
+ int line,
+ string sourceFileName)
+
+ {
+ this.parser = parser;
+ this.parentBuilder = parentBuilder;
+ this.type = type;
+ this.tagName = tagName;
+ this.id = id;
+ this.attribs = attribs;
+ this.line = line;
+ this.fileName = sourceFileName;
+ }
+
+ internal void EnsureOtherTags ()
+ {
+ if (otherTags == null)
+ otherTags = new ArrayList ();
+ }
+
+ internal ArrayList OtherTags {
+ get { return otherTags; }
+ }
+
+ public Type ControlType {
+ get { return type; }
+ }
+
+ protected bool FChildrenAsProperties {
+ get { return childrenAsProperties; }
+ }
+
+ protected bool FIsNonParserAccessor {
+ get { return !isIParserAccessor; }
+ }
+
+ public bool HasAspCode {
+ get { return hasAspCode; }
+ }
+
+ public string ID {
+ get { return id; }
+ set { id = value; }
+ }
+
+ internal ArrayList Children {
+ get { return children; }
+ }
+
+ internal void SetControlType (Type t)
+ {
+ type = t;
+ }
+
+ protected bool InDesigner {
+ get { return false; }
+ }
+
+ public Type NamingContainerType {
+ get {
+ if (parentBuilder == null)
+ return typeof (Control);
+
+ Type ptype = parentBuilder.ControlType;
+ if (ptype == null)
+ return parentBuilder.NamingContainerType;
+
+ if (!typeof (INamingContainer).IsAssignableFrom (ptype))
+ return parentBuilder.NamingContainerType;
+
+ return ptype;
+ }
+ }
+
+#if NET_2_0
+ public
+#else
+ internal
+#endif
+ Type BindingContainerType {
+ get {
+ if (parentBuilder == null)
+ return typeof (Control);
+
+ if (parentBuilder is TemplateBuilder && ((TemplateBuilder)parentBuilder).ContainerType != null)
+ return ((TemplateBuilder)parentBuilder).ContainerType;
+
+ Type ptype = parentBuilder.ControlType;
+ if (ptype == null)
+ return parentBuilder.BindingContainerType;
+
+ if (!typeof (INamingContainer).IsAssignableFrom (ptype))
+ return parentBuilder.BindingContainerType;
+
+ return ptype;
+ }
+ }
+
+ internal TemplateBuilder ParentTemplateBuilder {
+ get {
+ if (parentBuilder == null)
+ return null;
+ else if (parentBuilder is TemplateBuilder)
+ return (TemplateBuilder) parentBuilder;
+ else
+ return parentBuilder.ParentTemplateBuilder;
+ }
+ }
+
+ protected TemplateParser Parser {
+ get { return parser; }
+ }
+
+ public string TagName {
+ get { return tagName; }
+ }
+
+ internal RootBuilder Root {
+ get {
+ if (GetType () == typeof (RootBuilder))
+ return (RootBuilder) this;
+
+ return (RootBuilder) parentBuilder.Root;
+ }
+ }
+
+ internal bool ChildrenAsProperties {
+ get { return childrenAsProperties; }
+ }
+
+ public virtual bool AllowWhitespaceLiterals ()
+ {
+ return true;
+ }
+
+ public virtual void AppendLiteralString (string s)
+ {
+ if (s == null || s == "")
+ return;
+
+ if (childrenAsProperties || !isIParserAccessor) {
+ if (defaultPropertyBuilder != null) {
+ defaultPropertyBuilder.AppendLiteralString (s);
+ } else if (s.Trim () != "") {
+ throw new HttpException ("Literal content not allowed for " + tagName + " " +
+ GetType () + " \"" + s + "\"");
+ }
+
+ return;
+ }
+
+ if (!AllowWhitespaceLiterals () && s.Trim () == "")
+ return;
+
+ if (HtmlDecodeLiterals ())
+ s = HttpUtility.HtmlDecode (s);
+
+ if (children == null)
+ children = new ArrayList ();
+
+ children.Add (s);
+ }
+
+ public virtual void AppendSubBuilder (ControlBuilder subBuilder)
+ {
+ subBuilder.OnAppendToParentBuilder (this);
+
+ subBuilder.parentBuilder = this;
+ if (childrenAsProperties) {
+ AppendToProperty (subBuilder);
+ return;
+ }
+
+ if (typeof (CodeRenderBuilder).IsAssignableFrom (subBuilder.GetType ())) {
+ AppendCode (subBuilder);
+ return;
+ }
+
+ if (children == null)
+ children = new ArrayList ();
+
+ children.Add (subBuilder);
+ }
+
+ void AppendToProperty (ControlBuilder subBuilder)
+ {
+ if (typeof (CodeRenderBuilder) == subBuilder.GetType ())
+ throw new HttpException ("Code render not supported here.");
+
+ if (defaultPropertyBuilder != null) {
+ defaultPropertyBuilder.AppendSubBuilder (subBuilder);
+ return;
+ }
+
+ if (children == null)
+ children = new ArrayList ();
+
+ children.Add (subBuilder);
+ }
+
+ void AppendCode (ControlBuilder subBuilder)
+ {
+ if (type != null && !(typeof (Control).IsAssignableFrom (type)))
+ throw new HttpException ("Code render not supported here.");
+
+ if (typeof (CodeRenderBuilder) == subBuilder.GetType ())
+ hasAspCode = true;
+
+ if (children == null)
+ children = new ArrayList ();
+
+ children.Add (subBuilder);
+ }
+
+ public virtual void CloseControl ()
+ {
+ }
+
+ public static ControlBuilder CreateBuilderFromType (TemplateParser parser,
+ ControlBuilder parentBuilder,
+ Type type,
+ string tagName,
+ string id,
+ IDictionary attribs,
+ int line,
+ string sourceFileName)
+ {
+ ControlBuilder builder;
+ object [] atts = type.GetCustomAttributes (typeof (ControlBuilderAttribute), true);
+ if (atts != null && atts.Length > 0) {
+ ControlBuilderAttribute att = (ControlBuilderAttribute) atts [0];
+ builder = (ControlBuilder) Activator.CreateInstance (att.BuilderType);
+ } else {
+ builder = new ControlBuilder ();
+ }
+
+ builder.Init (parser, parentBuilder, type, tagName, id, attribs);
+ builder.line = line;
+ builder.fileName = sourceFileName;
+ return builder;
+ }
+
+ public virtual Type GetChildControlType (string tagName, IDictionary attribs)
+ {
+ return null;
+ }
+
+ public virtual bool HasBody ()
+ {
+ return true;
+ }
+
+ public virtual bool HtmlDecodeLiterals ()
+ {
+ return false;
+ }
+
+ ControlBuilder CreatePropertyBuilder (string propName, TemplateParser parser, IDictionary atts)
+ {
+ PropertyInfo prop = type.GetProperty (propName, flagsNoCase);
+ if (prop == null) {
+ string msg = String.Format ("Property {0} not found in type {1}", propName, type);
+ throw new HttpException (msg);
+ }
+
+ Type propType = prop.PropertyType;
+ ControlBuilder builder = null;
+ if (typeof (ICollection).IsAssignableFrom (propType)) {
+ builder = new CollectionBuilder ();
+ } else if (typeof (ITemplate).IsAssignableFrom (propType)) {
+ builder = new TemplateBuilder (prop);
+ } else {
+ builder = CreateBuilderFromType (parser, parentBuilder, propType, prop.Name,
+ null, atts, line, fileName);
+ builder.isProperty = true;
+ return builder;
+ }
+
+ builder.Init (parser, this, null, prop.Name, null, atts);
+ builder.fileName = fileName;
+ builder.line = line;
+ builder.isProperty = true;
+ return builder;
+ }
+
+ public virtual void Init (TemplateParser parser,
+ ControlBuilder parentBuilder,
+ Type type,
+ string tagName,
+ string id,
+ IDictionary attribs)
+ {
+ this.parser = parser;
+ if (parser != null)
+ this.location = parser.Location;
+
+ this.parentBuilder = parentBuilder;
+ this.type = type;
+ this.tagName = tagName;
+ this.id = id;
+ this.attribs = attribs;
+ if (type == null)
+ return;
+
+ if (this is TemplateBuilder)
+ return;
+
+ object [] atts = type.GetCustomAttributes (typeof (ParseChildrenAttribute), true);
+
+ if (!typeof (IParserAccessor).IsAssignableFrom (type) && atts.Length == 0) {
+ isIParserAccessor = false;
+ childrenAsProperties = true;
+ } else if (atts.Length > 0) {
+ ParseChildrenAttribute att = (ParseChildrenAttribute) atts [0];
+ childrenAsProperties = att.ChildrenAsProperties;
+ if (childrenAsProperties && att.DefaultProperty != "") {
+ defaultPropertyBuilder = CreatePropertyBuilder (att.DefaultProperty,
+ parser, null);
+ }
+ }
+ }
+
+ public virtual bool NeedsTagInnerText ()
+ {
+ return false;
+ }
+
+ public virtual void OnAppendToParentBuilder (ControlBuilder parentBuilder)
+ {
+ if (defaultPropertyBuilder == null)
+ return;
+
+ ControlBuilder old = defaultPropertyBuilder;
+ defaultPropertyBuilder = null;
+ AppendSubBuilder (old);
+ }
+
+ internal void SetTagName (string name)
+ {
+ tagName = name;
+ }
+
+ public virtual void SetTagInnerText (string text)
+ {
+ }
+
+ internal string GetNextID (string proposedID)
+ {
+ if (proposedID != null && proposedID.Trim () != "")
+ return proposedID;
+
+ return "_bctrl_" + nextID++;
+ }
+
+ internal virtual ControlBuilder CreateSubBuilder (string tagid,
+ Hashtable atts,
+ Type childType,
+ TemplateParser parser,
+ ILocation location)
+ {
+ ControlBuilder childBuilder = null;
+ if (childrenAsProperties) {
+ if (defaultPropertyBuilder == null) {
+ childBuilder = CreatePropertyBuilder (tagid, parser, atts);
+ } else {
+ childBuilder = defaultPropertyBuilder.CreateSubBuilder (tagid, atts,
+ null, parser, location);
+ }
+ return childBuilder;
+ }
+
+ childType = GetChildControlType (tagid, atts);
+ if (childType == null)
+ return null;
+
+ childBuilder = CreateBuilderFromType (parser, this, childType, tagid, id, atts,
+ location.BeginLine, location.Filename);
+
+ return childBuilder;
+ }
+
+ internal virtual object CreateInstance ()
+ {
+ // HtmlGenericControl, HtmlTableCell...
+ object [] atts = type.GetCustomAttributes (typeof (ConstructorNeedsTagAttribute), true);
+ object [] args = null;
+ if (atts != null && atts.Length > 0) {
+ ConstructorNeedsTagAttribute att = (ConstructorNeedsTagAttribute) atts [0];
+ if (att.NeedsTag)
+ args = new object [] {tagName};
+ }
+
+ return Activator.CreateInstance (type, args);
+ }
+
+ internal virtual void CreateChildren (object parent)
+ {
+ if (children == null || children.Count == 0)
+ return;
+
+ IParserAccessor parser = parent as IParserAccessor;
+ if (parser == null)
+ return;
+
+ foreach (object o in children) {
+ if (o is string) {
+ parser.AddParsedSubObject (new LiteralControl ((string) o));
+ } else {
+ parser.AddParsedSubObject (((ControlBuilder) o).CreateInstance ());
+ }
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/ControlBuilderAttribute.cs b/mcs/class/System.Web/System.Web.UI/ControlBuilderAttribute.cs
new file mode 100755
index 00000000000..abc5ea7cfa8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ControlBuilderAttribute.cs
@@ -0,0 +1,68 @@
+//
+// System.Web.UI.ControlBuilderAttribute.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.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;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class ControlBuilderAttribute : Attribute
+ {
+ Type builderType;
+ public static readonly ControlBuilderAttribute Default = new ControlBuilderAttribute (null);
+
+ public ControlBuilderAttribute (Type builderType)
+ {
+ this.builderType = builderType;
+ }
+
+ public Type BuilderType {
+ get { return builderType; }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is ControlBuilderAttribute))
+ return false;
+ return ((ControlBuilderAttribute) obj).builderType == builderType;
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return Equals (Default);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/ControlCollection.cs b/mcs/class/System.Web/System.Web.UI/ControlCollection.cs
new file mode 100755
index 00000000000..c6b390b7c33
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ControlCollection.cs
@@ -0,0 +1,243 @@
+//
+// System.Web.UI.ControlCollection.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@novell.com)
+//
+// Copyright (c) 2002-2004 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
+// "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;
+using System.Collections;
+
+namespace System.Web.UI {
+
+ public class ControlCollection : ICollection, IEnumerable
+ {
+ Control owner;
+ Control [] controls;
+ int version;
+ int count;
+ bool readOnly;
+
+ public ControlCollection (Control owner)
+ {
+ if (owner == null)
+ throw new ArgumentException ("owner");
+
+ this.owner = owner;
+ }
+
+ public int Count {
+ get { return count; }
+ }
+
+ public bool IsReadOnly {
+ get { return readOnly; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public virtual Control this [int index] {
+ get {
+ if (index < 0 || index >= count)
+ throw new ArgumentOutOfRangeException ("index");
+
+ return controls [index];
+ }
+ }
+
+ protected Control Owner {
+ get { return owner; }
+ }
+
+ public object SyncRoot {
+ get { return this; }
+ }
+
+ void EnsureControls ()
+ {
+ if (controls == null) {
+ controls = new Control [5];
+ } else if (controls.Length < count + 1) {
+ int n = controls.Length == 5 ? 3 : 2;
+ Control [] newControls = new Control [controls.Length * n];
+ Array.Copy (controls, 0, newControls, 0, controls.Length);
+ controls = newControls;
+ }
+ }
+
+ public virtual void Add (Control child)
+ {
+ if (child == null)
+ throw new ArgumentNullException ();
+
+ if (readOnly)
+ throw new HttpException ();
+
+ EnsureControls ();
+ version++;
+ controls [count++] = child;
+ owner.AddedControl (child, count - 1);
+ }
+
+ public virtual void AddAt (int index, Control child)
+ {
+ if (child == null) // maybe we should check for ! (child is Control)?
+ throw new ArgumentNullException ();
+
+ if (index < -1 || index > count)
+ throw new ArgumentOutOfRangeException ();
+
+ if (readOnly)
+ throw new HttpException ();
+
+ if (index == -1) {
+ Add (child);
+ return;
+ }
+
+ EnsureControls ();
+ version++;
+ Array.Copy (controls, index, controls, index + 1, count - index);
+ count++;
+ controls [index] = child;
+ owner.AddedControl (child, index);
+ }
+
+ public virtual void Clear ()
+ {
+ if (controls == null)
+ return;
+
+ version++;
+ for (int i = 0; i < count; i++)
+ owner.RemovedControl (controls [i]);
+
+ count = 0;
+ if (owner != null)
+ owner.ResetChildNames ();
+ }
+
+ public virtual bool Contains (Control c)
+ {
+ return (controls != null && Array.IndexOf (controls, c) != -1);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ if (controls == null)
+ return;
+
+ controls.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return new SimpleEnumerator (this);
+ }
+
+ public virtual int IndexOf (Control c)
+ {
+ if (controls == null)
+ return -1;
+
+ return Array.IndexOf (controls, c);
+ }
+
+ public virtual void Remove (Control value)
+ {
+ int idx = IndexOf (value);
+ if (idx == -1)
+ return;
+ RemoveAt (idx);
+ }
+
+ public virtual void RemoveAt (int index)
+ {
+ if (readOnly)
+ throw new HttpException ();
+
+ version++;
+ Control ctrl = controls [index];
+ count--;
+ if (count - index > 0)
+ Array.Copy (controls, index + 1, controls, index, count - index);
+
+ controls [count] = null;
+ owner.RemovedControl (ctrl);
+ }
+
+ // Almost the same as in ArrayList
+ sealed class SimpleEnumerator : IEnumerator
+ {
+ ControlCollection coll;
+ int index;
+ int version;
+ object currentElement;
+
+ public SimpleEnumerator (ControlCollection coll)
+ {
+ this.coll = coll;
+ index = -1;
+ version = coll.version;
+ }
+
+ public bool MoveNext ()
+ {
+ if (version != coll.version)
+ throw new InvalidOperationException ("List has changed.");
+
+ if (index >= -1 && ++index < coll.Count) {
+ currentElement = coll [index];
+ return true;
+ } else {
+ index = -2;
+ return false;
+ }
+ }
+
+ public object Current {
+ get {
+ if (index < 0)
+ throw new InvalidOperationException (index == -1 ? "Enumerator not started" : "Enumerator ended");
+
+ return currentElement;
+ }
+ }
+
+ public void Reset ()
+ {
+ if (version != coll.version)
+ throw new InvalidOperationException ("List has changed.");
+
+ index = -1;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/ControlSkinProc.cs b/mcs/class/System.Web/System.Web.UI/ControlSkinProc.cs
new file mode 100644
index 00000000000..8c351adbaaf
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ControlSkinProc.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.ControlSkinProc.cs
+//
+// Author:
+// Sanjay Gupta <gsanjay@novell.com>
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public delegate Control ControlSkinProc (Control control);
+}
+
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/ControlValuePropertyAttribute.cs b/mcs/class/System.Web/System.Web.UI/ControlValuePropertyAttribute.cs
new file mode 100644
index 00000000000..c697b12cec6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ControlValuePropertyAttribute.cs
@@ -0,0 +1,85 @@
+//
+// System.Web.UI.ControlValuePropertyAttribute
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+using System;
+using System.ComponentModel;
+
+namespace System.Web.UI {
+ [AttributeUsage (AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
+ public sealed class ControlValuePropertyAttribute : Attribute
+ {
+ private string propertyName;
+ private object propertyValue;
+ private Type propertyType;
+
+ public ControlValuePropertyAttribute (string propName)
+ {
+ this.propertyName = propName;
+ }
+
+ public ControlValuePropertyAttribute (string propName, object propValue)
+ {
+ this.propertyName = propName;
+ this.propertyValue = propValue;
+ }
+
+ public ControlValuePropertyAttribute (string propName, Type type, string propValue)
+ {
+ this.propertyName = propName;
+ this.propertyValue = propValue;
+ this.propertyType = type;
+ }
+
+ public string Name {
+ get { return propertyName; }
+ }
+
+ public object DefaultValue {
+ get { return propertyValue; }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj != null && obj is ControlValuePropertyAttribute) {
+ ControlValuePropertyAttribute propAttrib = (ControlValuePropertyAttribute)obj;
+ return (this.propertyName == propAttrib.propertyName &&
+ this.propertyValue == propAttrib.propertyValue &&
+ this.propertyType == propAttrib.propertyType);
+ }
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode();
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/CssStyleCollection.cs b/mcs/class/System.Web/System.Web.UI/CssStyleCollection.cs
new file mode 100755
index 00000000000..c74851a923d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/CssStyleCollection.cs
@@ -0,0 +1,145 @@
+//
+// System.Web.UI.CssStyleCollection.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.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;
+using System.Collections;
+using System.Text;
+
+namespace System.Web.UI {
+
+ public sealed class CssStyleCollection
+ {
+ private StateBag bag;
+ private StateBag style;
+
+ internal CssStyleCollection ()
+ {
+ style = new StateBag ();
+ }
+
+ internal CssStyleCollection (StateBag bag)
+ {
+ this.bag = bag;
+ style = new StateBag ();
+ string st_string = bag ["style"] as string;
+ if (st_string != null)
+ FillStyle (st_string);
+ }
+
+ internal void FillStyle (string s)
+ {
+ int mark = s.IndexOf (':');
+ if (mark == -1)
+ return;
+ string key = s.Substring (0, mark). Trim ();
+ if (mark + 1 > s.Length)
+ return;
+
+ string fullValue = s.Substring (mark + 1);
+ if (fullValue == "")
+ return;
+
+ mark = fullValue.IndexOf (';');
+ string value;
+ if (mark == -1)
+ value = fullValue.Trim ();
+ else
+ value = fullValue.Substring (0, mark).Trim ();
+
+ style.Add (key, value);
+ if (mark + 1 > fullValue.Length)
+ return;
+ FillStyle (fullValue.Substring (mark + 1));
+ }
+
+ internal string BagToString ()
+ {
+ StringBuilder sb = new StringBuilder ();
+ foreach (string k in style.Keys)
+ sb.AppendFormat ("{0}: {1}; ", k, style [k]);
+ return sb.ToString ();
+ }
+
+ public int Count
+ {
+ get { return style.Count; }
+ }
+
+ public string this [string key]
+ {
+ get {
+ return style [key] as string;
+ }
+
+ set {
+ Add (key, value);
+ }
+ }
+
+ public ICollection Keys {
+ get { return style.Keys; }
+ }
+
+ public void Add (string key, string value)
+ {
+ style [key] = value;
+ if (bag != null)
+ bag ["style"] = BagToString ();
+ }
+
+#if NET_2_0
+ public
+#else
+ internal
+#endif
+ void Add (HtmlTextWriterStyle key, string value)
+ {
+ Add (HtmlTextWriter.StaticGetStyleName (key), value);
+ }
+
+ public void Clear ()
+ {
+ if (bag != null)
+ bag.Remove ("style");
+ style.Clear ();
+ }
+
+ public void Remove (string key)
+ {
+ if (style [key] != null) {
+ style.Remove (key);
+ if (bag != null)
+ bag ["style"] = BagToString ();
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/DataBinder.cs b/mcs/class/System.Web/System.Web.UI/DataBinder.cs
new file mode 100755
index 00000000000..c73f92edb07
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataBinder.cs
@@ -0,0 +1,221 @@
+//
+// System.Web.UI.DataBinder.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.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;
+using System.Collections;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace System.Web.UI {
+
+ public sealed class DataBinder
+ {
+#if NET_2_0
+ [Obsolete]
+#endif
+ public DataBinder ()
+ {
+ }
+
+ private static string FormatResult (object result, string format)
+ {
+ if (result == null)
+ return String.Empty;
+
+ if (format == null)
+ return result.ToString ();
+
+ return String.Format (format, result);
+ }
+
+ public static object Eval (object container, string expression)
+ {
+ if (expression == null)
+ throw new ArgumentNullException ("expression");
+
+ object current = container;
+
+ while (current != null) {
+ int dot = expression.IndexOf ('.');
+ int size = (dot == -1) ? expression.Length : dot;
+ string prop = expression.Substring (0, size);
+ if (prop.IndexOf ('[') != -1)
+ current = GetIndexedPropertyValue (current, prop);
+ else
+ current = GetPropertyValue (current, prop);
+
+ if (dot == -1)
+ break;
+
+ expression = expression.Substring (prop.Length + 1);
+ }
+
+ return current;
+ }
+
+ public static string Eval (object container, string expression, string format)
+ {
+ object result = Eval (container, expression);
+ return FormatResult (result, format);
+ }
+
+ public static object GetIndexedPropertyValue (object container, string expr)
+ {
+ if (expr == null)
+ throw new ArgumentNullException ("expr");
+
+ int openIdx = expr.IndexOf ('[');
+ int closeIdx = expr.IndexOf (']'); // see the test case. MS ignores all after the first ]
+ if (openIdx < 0 || closeIdx < 0 || closeIdx - openIdx <= 1)
+ throw new ArgumentException (expr + " is not a valid indexed expression.");
+
+ string val = expr.Substring (openIdx + 1, closeIdx - openIdx - 1);
+ val = val.Trim ();
+ if (val.Length == 0)
+ throw new ArgumentException (expr + " is not a valid indexed expression.");
+
+ bool is_string = false;
+ // a quoted val means we have a string
+ if ((val[0] == '\'' && val[val.Length - 1] == '\'') ||
+ (val[0] == '\"' && val[val.Length - 1] == '\"')) {
+ is_string = true;
+ val = val.Substring(1, val.Length - 2);
+ } else {
+ // if all chars are digits, then we have a int
+ for(int i = 0; i < val.Length; i++)
+ if (!Char.IsDigit(val[i])) {
+ is_string = true;
+ break;
+ }
+ }
+
+ int intVal = 0;
+ if (!is_string) {
+ try {
+ intVal = Int32.Parse (val);
+ } catch {
+ throw new ArgumentException (expr + " is not a valid indexed expression.");
+ }
+ }
+
+ string property = null;
+ if (openIdx > 0) {
+ property = expr.Substring (0, openIdx);
+ if (property != null && property != String.Empty)
+ container = GetPropertyValue (container, property);
+ }
+
+ if (container == null)
+ return null;
+
+ if (container is System.Collections.IList) {
+ IList l = (IList) container;
+ return l [intVal];
+ }
+
+ Type t = container.GetType ();
+ // MS does not seem to look for any other than "Item"!!!
+ object [] atts = t.GetCustomAttributes (typeof (DefaultMemberAttribute), false);
+ if (atts.Length != 1)
+ throw new ArgumentException (expr + " indexer not found.");
+
+ property = ((DefaultMemberAttribute) atts [0]).MemberName;
+
+ Type [] argTypes = new Type [] { (is_string) ? typeof (string) : typeof (int) };
+ PropertyInfo prop = t.GetProperty (property, argTypes);
+ if (prop == null)
+ throw new ArgumentException (expr + " indexer not found.");
+
+ object [] args = new object [1];
+ if (is_string)
+ args [0] = val;
+ else
+ args [0] = intVal;
+
+ return prop.GetValue (container, args);
+ }
+
+ public static string GetIndexedPropertyValue (object container, string expr, string format)
+ {
+ object result = GetIndexedPropertyValue (container, expr);
+ return FormatResult (result, format);
+ }
+
+ public static object GetPropertyValue (object container, string propName)
+ {
+ if (propName == null)
+ throw new ArgumentNullException ("propName");
+
+ PropertyDescriptor prop = TypeDescriptor.GetProperties (container).Find (propName, true);
+ if (prop == null) {
+ throw new HttpException ("Property " + propName + " not found in " +
+ container.GetType ());
+ }
+
+ return prop.GetValue (container);
+ }
+
+ public static string GetPropertyValue (object container, string propName, string format)
+ {
+ object result = GetPropertyValue (container, propName);
+ return FormatResult (result, format);
+ }
+
+ #if NET_2_0
+ public static object GetDataItem (object container, out bool foundDataItem)
+ {
+ foundDataItem = false;
+ if (container == null)
+ return null;
+
+ if (container is IDataItemContainer) {
+ foundDataItem = true;
+ return ((IDataItemContainer)container).DataItem;
+ }
+
+ PropertyInfo pi = container.GetType ().GetProperty ("DataItem", BindingFlags.Public | BindingFlags.Instance);
+ if (pi == null)
+ return null;
+
+ foundDataItem = true;
+ return pi.GetValue (container, null);
+ }
+
+
+ public static object GetDataItem (object container)
+ {
+ bool flag;
+ return GetDataItem (container, out flag);
+ }
+ #endif
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/DataBinding.cs b/mcs/class/System.Web/System.Web.UI/DataBinding.cs
new file mode 100755
index 00000000000..88e56feb183
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataBinding.cs
@@ -0,0 +1,81 @@
+//
+// System.Web.UI.DataBinding.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.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;
+
+namespace System.Web.UI {
+
+ public sealed class DataBinding
+ {
+ string propertyName;
+ Type propertyType;
+ string expression;
+
+ public DataBinding (string propertyName, Type propertyType,
+ string expression)
+ {
+ this.propertyName = propertyName;
+ this.propertyType = propertyType;
+ this.expression = expression;
+ }
+
+ public string Expression {
+ get { return expression; }
+ set { expression = value; }
+ }
+
+ public string PropertyName {
+ get { return propertyName; }
+ }
+
+ public Type PropertyType {
+ get { return propertyType; }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is DataBinding))
+ return false;
+
+ DataBinding o = (DataBinding) obj;
+ return (o.Expression == expression &&
+ o.PropertyName == propertyName &&
+ o.PropertyType == propertyType);
+ }
+
+ public override int GetHashCode ()
+ {
+ return propertyName.GetHashCode () +
+ (propertyType.GetHashCode () << 1) +
+ (expression.GetHashCode () << 2) ;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/DataBindingBuilder.cs b/mcs/class/System.Web/System.Web.UI/DataBindingBuilder.cs
new file mode 100644
index 00000000000..cdbea0eea24
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataBindingBuilder.cs
@@ -0,0 +1,45 @@
+//
+// System.Web.UI.DataBindingBuilder
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc. (http://www.ximian.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;
+using System.Web.Compilation;
+
+namespace System.Web.UI
+{
+ sealed class DataBindingBuilder : CodeBuilder
+ {
+ public DataBindingBuilder (string code, ILocation location)
+ : base (code, false, location)
+ {
+ SetControlType (typeof (DataBoundLiteralControl));
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/DataBindingCollection.cs b/mcs/class/System.Web/System.Web.UI/DataBindingCollection.cs
new file mode 100755
index 00000000000..89508c87a59
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataBindingCollection.cs
@@ -0,0 +1,113 @@
+//
+// System.Web.UI.DataBindingCollection.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+//
+// 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;
+using System.Collections;
+
+namespace System.Web.UI {
+
+ public sealed class DataBindingCollection : ICollection, IEnumerable
+ {
+ Hashtable list;
+ ArrayList removed;
+
+ public DataBindingCollection ()
+ {
+ list = new Hashtable ();
+ removed = new ArrayList ();
+ }
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public bool IsReadOnly {
+ get { return list.IsReadOnly; }
+ }
+
+ public bool IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ public DataBinding this [string propertyName] {
+ get { return list [propertyName] as DataBinding; }
+ }
+
+ public string [] RemovedBindings {
+ get { return (string []) removed.ToArray (typeof (string)); }
+ }
+
+ public object SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ public void Add (DataBinding binding)
+ {
+ list.Add (binding.PropertyName, binding);
+ }
+
+ public void Clear ()
+ {
+ list.Clear ();
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ public void Remove (DataBinding binding)
+ {
+ string key = binding.PropertyName;
+ Remove (key);
+ }
+
+ public void Remove (string propertyName)
+ {
+ removed.Add (propertyName);
+ list.Remove (propertyName);
+ }
+
+ public void Remove (string propertyName,
+ bool addToRemovedList)
+ {
+ if (addToRemovedList)
+ removed.Add (String.Empty); // LAMESPEC
+ else
+ removed.Add (propertyName);
+
+ list.Remove (propertyName);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/DataBindingHandlerAttribute.cs b/mcs/class/System.Web/System.Web.UI/DataBindingHandlerAttribute.cs
new file mode 100644
index 00000000000..6a73d95ec4e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataBindingHandlerAttribute.cs
@@ -0,0 +1,70 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI
+ * Class: DataBindingHandlerAttribute
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Reflection;
+
+namespace System.Web.UI
+{
+ [AttributeUsage(AttributeTargets.Class)]
+ public sealed class DataBindingHandlerAttribute : Attribute
+ {
+ public static readonly DataBindingHandlerAttribute Default;
+
+ private string handlerTypeName;
+
+ public DataBindingHandlerAttribute()
+ {
+ handlerTypeName = String.Empty;
+ }
+
+ public DataBindingHandlerAttribute(string typeName)
+ {
+ handlerTypeName = typeName;
+ }
+
+ public DataBindingHandlerAttribute(Type type)
+ {
+ handlerTypeName = type.AssemblyQualifiedName;
+ }
+
+ public string HandlerTypeName
+ {
+ get
+ {
+ return handlerTypeName;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/DataBoundLiteralControl.cs b/mcs/class/System.Web/System.Web.UI/DataBoundLiteralControl.cs
new file mode 100755
index 00000000000..fbe26ca4c7c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataBoundLiteralControl.cs
@@ -0,0 +1,106 @@
+//
+// System.Web.UI.DataBoundLiteralCOntrol.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.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;
+using System.ComponentModel;
+using System.Text;
+
+namespace System.Web.UI {
+
+ [ToolboxItem(false)]
+ public sealed class DataBoundLiteralControl : Control
+ {
+ private string [] staticLiterals;
+ private string [] dataBoundLiterals;
+
+ public DataBoundLiteralControl (int staticLiteralsCount,
+ int dataBoundLiteralCount)
+ {
+ staticLiterals = new string [staticLiteralsCount];
+ dataBoundLiterals = new string [dataBoundLiteralCount];
+ PreventAutoID ();
+ }
+
+ public string Text {
+ get {
+ StringBuilder text = new StringBuilder ();
+ int stLength = staticLiterals.Length;
+ int dbLength = dataBoundLiterals.Length;
+ int max = (stLength > dbLength) ? stLength : dbLength;
+ for (int i = 0; i < max; i++){
+ if (i < stLength)
+ text.Append (staticLiterals [i]);
+ if (i < dbLength)
+ text.Append (dataBoundLiterals [i]);
+ }
+
+ return text.ToString ();
+ }
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new EmptyControlCollection (this);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState != null) {
+ Array source = (Array) savedState;
+ if (source.Length == dataBoundLiterals.Length)
+ source.CopyTo (dataBoundLiterals, 0);
+ }
+ }
+
+ protected override void Render (HtmlTextWriter output)
+ {
+ output.Write (Text);
+ }
+
+ protected override object SaveViewState ()
+ {
+ if (dataBoundLiterals.Length == 0)
+ return null;
+ return dataBoundLiterals;
+ }
+
+ public void SetDataBoundString (int index, string s)
+ {
+ dataBoundLiterals [index] = s;
+ }
+
+ public void SetStaticString (int index, string s)
+ {
+ staticLiterals [index] = s;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/DataSourceCacheExpiry.cs b/mcs/class/System.Web/System.Web.UI/DataSourceCacheExpiry.cs
new file mode 100644
index 00000000000..b676bcf1488
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataSourceCacheExpiry.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.UI.DataSourceCacheExpiry.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI {
+ public enum DataSourceCacheExpiry {
+ Absolute = 0,
+ Sliding = 1
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/DataSourceCapabilities.cs b/mcs/class/System.Web/System.Web.UI/DataSourceCapabilities.cs
new file mode 100644
index 00000000000..60c3d020036
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataSourceCapabilities.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.UI.DataSourceCapabilities.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI {
+ [Flags]
+ public enum DataSourceCapabilities {
+ None = 0,
+ Sort = 1,
+ Page = 2,
+ RetrieveTotalRowCount = 4
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/DataSourceControl.cs b/mcs/class/System.Web/System.Web.UI/DataSourceControl.cs
new file mode 100644
index 00000000000..ba0914d2636
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataSourceControl.cs
@@ -0,0 +1,101 @@
+//
+// System.Web.UI.DataSourceControl
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.UI {
+ public abstract class DataSourceControl : Control, IDataSource, System.ComponentModel.IListSource {
+
+
+ protected DataSourceControl()
+ {
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new EmptyControlCollection (this);
+ }
+
+ protected virtual DataSourceView GetView (string viewName)
+ {
+ return null;
+ }
+
+ DataSourceView IDataSource.GetView (string viewName)
+ {
+ return GetView (viewName);
+ }
+
+ protected virtual ICollection GetViewNames ()
+ {
+ return null;
+ }
+
+ ICollection IDataSource.GetViewNames ()
+ {
+ return GetViewNames ();
+ }
+
+ IList System.ComponentModel.IListSource.GetList ()
+ {
+ return ListSourceHelper.GetList (this);
+ }
+
+ bool System.ComponentModel.IListSource.ContainsListCollection {
+ get { return ListSourceHelper.ContainsListCollection (this); }
+ }
+
+ //public override bool EnablePersonalization { get; set; }
+ //public override bool EnableTheming { get; set; }
+ //public override string SkinID { get; set; }
+ public override bool Visible {
+ get { return false; }
+ set { throw new NotSupportedException (); }
+ }
+
+ static object dataSourceChanged = new object ();
+ event EventHandler System.Web.UI.IDataSource.DataSourceChanged {
+ add { Events.AddHandler (dataSourceChanged, value); }
+ remove { Events.RemoveHandler (dataSourceChanged, value); }
+ }
+
+ protected virtual void OnDataSourceChanged (EventArgs e)
+ {
+ EventHandler eh = Events [dataSourceChanged] as EventHandler;
+ if (eh != null)
+ eh (this, e);
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/DataSourceOperation.cs b/mcs/class/System.Web/System.Web.UI/DataSourceOperation.cs
new file mode 100644
index 00000000000..80ecb4c8c08
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataSourceOperation.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.UI.DataSourceOperation.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI {
+ public enum DataSourceOperation {
+ Delete = 0,
+ Insert = 1,
+ Select = 2,
+ Update = 3,
+ SelectCount = 4
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/DataSourceSelectArguments.cs b/mcs/class/System.Web/System.Web.UI/DataSourceSelectArguments.cs
new file mode 100644
index 00000000000..ee26e6d7b30
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataSourceSelectArguments.cs
@@ -0,0 +1,140 @@
+//
+// System.Web.UI.DataSourceSelectArguments.cs
+//
+// Author:
+// Sanjay Gupta <gsanjay@novell.com>
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public sealed class DataSourceSelectArguments
+ {
+ string sortExpression = string.Empty;
+ int startingRowIndex = 0;
+ int maxRows = 0;
+ bool isEmpty;
+ bool getTotalRowCount = false;
+ int totalRowCount = -1;
+ DataSourceCapabilities dsc = DataSourceCapabilities.None;
+
+ public static readonly DataSourceSelectArguments Empty = new DataSourceSelectArguments ();
+
+ public DataSourceSelectArguments ()
+ {
+ this.isEmpty = true;
+ }
+
+ public DataSourceSelectArguments (string sortExpression)
+ {
+ this.sortExpression = sortExpression;
+ this.isEmpty = false;
+ }
+
+ public DataSourceSelectArguments (int startingRowIndex, int maxRows)
+ {
+ this.startingRowIndex = startingRowIndex;
+ this.maxRows = maxRows;
+ this.isEmpty = false;
+ }
+
+ public DataSourceSelectArguments (string sortExpression, int startingRowIndex, int maxRows)
+ {
+ this.sortExpression = sortExpression;
+ this.startingRowIndex = startingRowIndex;
+ this.maxRows = maxRows;
+ this.isEmpty = false;
+ }
+
+ public void AddSupportedCapabilities (DataSourceCapabilities srcCapabilities)
+ {
+ this.dsc = this.dsc | srcCapabilities;
+ }
+
+ [MonoTODO]
+ public override bool Equals (object obj)
+ {
+ if (!(obj is DataSourceSelectArguments))
+ return false;
+ return false;
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ return sortExpression.GetHashCode ();
+ }
+
+ public void RaiseUnsupportedCapabilitiesError (DataSourceView view)
+ {
+ view.RaiseUnsupportedCapabilityError (this.dsc);
+ }
+
+ public bool IsEmpty {
+ get { return this.isEmpty; }
+ }
+
+ public int MaximumRows {
+ get { return this.maxRows; }
+ set {
+ this.maxRows = value;
+ this.isEmpty = false;
+ }
+ }
+
+ public bool RetrieveTotalRowCount {
+ get { return this.getTotalRowCount; }
+ set { this.getTotalRowCount = value; }
+ }
+
+ public string SortExpression {
+ get { return this.sortExpression; }
+ set {
+ this.sortExpression = value;
+ this.isEmpty = false;
+ }
+ }
+
+ public int StartRowIndex {
+ get { return this.startingRowIndex; }
+ set {
+ this.startingRowIndex = value;
+ this.isEmpty = false;
+ }
+ }
+
+ public int TotalRowCount {
+ get { return this.totalRowCount; }
+ set {
+ this.totalRowCount = value;
+ this.isEmpty = false;
+ }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/DataSourceView.cs b/mcs/class/System.Web/System.Web.UI/DataSourceView.cs
new file mode 100644
index 00000000000..d7e8cf6c2c9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataSourceView.cs
@@ -0,0 +1,208 @@
+//
+// System.Web.UI.DataSourceView
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2003 Ben Maurer
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.ComponentModel;
+
+namespace System.Web.UI {
+ public abstract class DataSourceView
+ {
+ IDataSource dataSourceOwner;
+ string viewName = String.Empty;
+
+ [MonoTODO ("Extra method to keep things compiling")]
+ protected DataSourceView()
+ {
+ }
+
+ protected DataSourceView(IDataSource owner, string viewName)
+ {
+ this.dataSourceOwner = owner;
+ this.viewName = viewName;
+ }
+
+ public virtual void Delete (IDictionary keys, IDictionary values,
+ DataSourceViewOperationCallback callBack)
+ {
+ if (callBack == null)
+ throw new ArgumentNullException ("callBack");
+
+ int rowAffected = 0;
+ Exception passOn = null;
+ try {
+ rowAffected = ExecuteDelete (keys, values);
+ } catch (Exception e) {
+ passOn = e;
+ }
+
+ if (!callBack (rowAffected, passOn) && passOn != null)
+ throw passOn;
+ }
+
+ protected virtual int ExecuteDelete(IDictionary keys, IDictionary values)
+ {
+ throw new NotSupportedException ();
+ }
+
+ protected virtual int ExecuteInsert (IDictionary keys)
+ {
+ throw new NotSupportedException();
+ }
+
+ protected internal abstract IEnumerable ExecuteSelect (
+ DataSourceSelectArguments arguments);
+
+ protected virtual int ExecuteUpdate (IDictionary keys, IDictionary values,
+ IDictionary oldValues )
+ {
+ throw new NotSupportedException ();
+ }
+
+ public virtual void Insert (IDictionary values,
+ DataSourceViewOperationCallback callBack)
+ {
+ if (callBack == null)
+ throw new ArgumentNullException("callBack");
+
+ int rowAffected = 0;
+ Exception passOn = null;
+ try {
+ rowAffected = ExecuteInsert (values);
+ } catch (Exception e) {
+ passOn = e;
+ }
+
+ if (!callBack (rowAffected, passOn) && passOn != null)
+ throw passOn;
+ }
+
+ protected virtual void OnDataSourceViewChanged (EventArgs eventArgs)
+ {
+ if (eventsList != null) {
+ EventHandler evtHandler = eventsList [EventDataSourceViewChanged] as EventHandler;
+ if (evtHandler != null)
+ evtHandler(this, eventArgs);
+ }
+ }
+
+ protected internal virtual void RaiseUnsupportedCapabilityError (
+ DataSourceCapabilities capability)
+ {
+ if ((capability & DataSourceCapabilities.Sort) != 0)
+ if (!CanSort)
+ throw new NotSupportedException ("Sort Capabilites");
+
+ if ((capability & DataSourceCapabilities.Page) != 0)
+ if (!CanPage)
+ throw new NotSupportedException("Page Capabilites");
+
+ if ((capability & DataSourceCapabilities.RetrieveTotalRowCount) != 0)
+ if (!CanRetrieveTotalRowCount)
+ throw new NotSupportedException("RetrieveTotalRowCount Capabilites");
+
+ return;
+ }
+
+ public virtual void Select (DataSourceSelectArguments selectArgs,
+ DataSourceViewSelectCallback callBack)
+ {
+ if (callBack == null)
+ throw new ArgumentNullException("callBack");
+
+ selectArgs.RaiseUnsupportedCapabilitiesError (this);
+
+ IEnumerable selectList = ExecuteSelect (selectArgs);
+ callBack (selectList);
+ }
+
+ public virtual int Update(IDictionary keys, IDictionary values,
+ IDictionary oldValues, DataSourceViewOperationCallback callBack)
+ {
+ if (callBack == null)
+ throw new ArgumentNullException ("callBack");
+
+ int rowAffected = 0;
+ Exception passOn = null;
+ try {
+ rowAffected = ExecuteUpdate (keys, values, oldValues);
+ } catch (Exception e) {
+ passOn = e;
+ }
+
+ if (!callBack (rowAffected, passOn) && passOn != null)
+ throw passOn;
+
+ return rowAffected;
+ }
+
+ public virtual bool CanDelete { get { return false; } }
+ public virtual bool CanInsert { get { return false; } }
+ public virtual bool CanPage { get { return false; } }
+ public virtual bool CanRetrieveTotalRowCount { get { return false; } }
+ public virtual bool CanSort { get { return false; } }
+ public virtual bool CanUpdate { get { return false; } }
+
+ EventHandlerList eventsList;
+ protected EventHandlerList Events {
+ get {
+ if (eventsList == null)
+ eventsList = new EventHandlerList();
+
+ return eventsList;
+ }
+ }
+
+ internal bool HasEvents ()
+ {
+ return eventsList != null;
+ }
+
+ public virtual string Name {
+ get { return viewName; }
+ }
+
+ static readonly object EventDataSourceViewChanged = new object ();
+
+ public event EventHandler DataSourceViewChanged
+ {
+ add { Events.AddHandler (EventDataSourceViewChanged, value); }
+ remove { Events.RemoveHandler (EventDataSourceViewChanged, value); }
+ }
+
+ }
+
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/DataSourceViewOperationCallback.cs b/mcs/class/System.Web/System.Web.UI/DataSourceViewOperationCallback.cs
new file mode 100644
index 00000000000..0fb3f9694c7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataSourceViewOperationCallback.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.UI.DataSourceViewOperationCallback.cs
+//
+// Author:
+// Sanjay Gupta <gsanjay@novell.com>
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public delegate bool DataSourceViewOperationCallback (int recordsAffected, Exception exception);
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/DataSourceViewSelectCallback.cs b/mcs/class/System.Web/System.Web.UI/DataSourceViewSelectCallback.cs
new file mode 100644
index 00000000000..53db740e855
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataSourceViewSelectCallback.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.UI.DataSourceViewSelectCallback.cs
+//
+// Author:
+// Sanjay Gupta <gsanjay@novell.com>
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System;
+using System.Collections;
+
+namespace System.Web.UI
+{
+ public delegate void DataSourceViewSelectCallback (IEnumerable data);
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/DesignTimeParseData.cs b/mcs/class/System.Web/System.Web.UI/DesignTimeParseData.cs
new file mode 100644
index 00000000000..379501b1b55
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DesignTimeParseData.cs
@@ -0,0 +1,87 @@
+//
+// System.Web.UI.DesignTimeParseData.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2001 Gaurav Vaish
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.Web;
+using System.ComponentModel.Design;
+
+namespace System.Web.UI
+{
+ public sealed class DesignTimeParseData
+ {
+ private static bool inDesigner = false;
+ private EventHandler dataBindingHandler;
+ private IDesignerHost designerHost;
+ private string documentUrl;
+ private string parseText;
+
+ public DesignTimeParseData(IDesignerHost designerHost, string parseText)
+ {
+ if (parseText == null)
+ throw new ArgumentNullException("parseText");
+ if (parseText.Length == 0)
+ throw new ArgumentException("parseText cannot be an empty string.", "parseText");
+
+ DesignTimeParseData.inDesigner = true;
+ this.designerHost = designerHost;
+ this.parseText = parseText;
+ this.documentUrl = string.Empty;
+ }
+
+ public EventHandler DataBindingHandler {
+ get {return dataBindingHandler;}
+ set {dataBindingHandler = value;}
+ }
+
+ public IDesignerHost DesignerHost {
+ get {return designerHost;}
+ }
+
+ public string DocumentUrl {
+ get {return documentUrl;}
+ set {
+ if (value == null)
+ documentUrl = string.Empty;
+ else
+ documentUrl = value;
+ }
+ }
+
+ public string ParseText {
+ get {return parseText;}
+ }
+
+ internal static bool InDesigner {
+ get {return inDesigner;}
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/DesignTimeTemplateParser.cs b/mcs/class/System.Web/System.Web.UI/DesignTimeTemplateParser.cs
new file mode 100644
index 00000000000..78a32b4c40e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DesignTimeTemplateParser.cs
@@ -0,0 +1,73 @@
+//
+// System.Web.UI.DesignTimeTemplateParser.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+
+namespace System.Web.UI
+{
+
+ public sealed class DesignTimeTemplateParser
+ {
+ private DesignTimeTemplateParser ()
+ {
+ }
+
+ public static Control ParseControl (DesignTimeParseData data)
+ {
+ TemplateParser NewParser = InitParser (data);
+ NewParser.RootBuilder.Text = data.ParseText;
+ if (NewParser.RootBuilder.Children == null)
+ return null;
+ foreach (ControlBuilder builder in NewParser.RootBuilder.Children)
+ return (Control) builder.CreateInstance ();
+ return null;
+ }
+
+ public static ITemplate ParseTemplate (DesignTimeParseData data)
+ {
+ TemplateParser NewParser = InitParser (data);
+ NewParser.RootBuilder.Text = data.ParseText;
+ return NewParser.RootBuilder;
+ }
+
+ [MonoTODO]
+ private static TemplateParser InitParser (DesignTimeParseData data)
+ {
+ // TODO create the parser and set data
+ TemplateParser NewParser = new PageParser(); // see FIXME in PageParser
+ // = data.DesignerHost;
+ // = data.DataBindingHandler;
+ // = data.ParseText;
+ // Parse data
+ return NewParser;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/DesignerDataBoundLiteralControl.cs b/mcs/class/System.Web/System.Web.UI/DesignerDataBoundLiteralControl.cs
new file mode 100644
index 00000000000..33333b9e4e1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DesignerDataBoundLiteralControl.cs
@@ -0,0 +1,78 @@
+//
+// System.Web.UI.DesignerDataBoundLiteralControl.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+
+namespace System.Web.UI
+{
+ [ToolboxItem(false)]
+ [DataBindingHandler ("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
+ public sealed class DesignerDataBoundLiteralControl : Control
+ {
+ private string text = "";
+
+ public DesignerDataBoundLiteralControl ()
+ {
+ base.PreventAutoID ();
+ }
+
+ public string Text {
+ get { return text;}
+ set {
+ if (value == null)
+ text = string.Empty;
+ else
+ text = value;
+ }
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new EmptyControlCollection (this);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState != null)
+ text = (string) savedState;
+ }
+
+ protected override void Render (HtmlTextWriter output)
+ {
+ output.Write (text);
+ }
+
+ protected override object SaveViewState ()
+ {
+ return text;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/EmptyControlCollection.cs b/mcs/class/System.Web/System.Web.UI/EmptyControlCollection.cs
new file mode 100755
index 00000000000..2ead5502da0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/EmptyControlCollection.cs
@@ -0,0 +1,51 @@
+//
+// System.Web.UI.EmptyControlCollection.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+//
+// 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;
+
+namespace System.Web.UI {
+
+ public class EmptyControlCollection : ControlCollection
+ {
+ public EmptyControlCollection (Control owner)
+ : base (owner)
+ {
+ }
+
+ public override void Add (Control child)
+ {
+ throw new NotSupportedException ("Control " + Owner.ID + " does not allow children");
+ }
+
+ public override void AddAt (int index, Control child)
+ {
+ throw new NotSupportedException ("Control " + Owner.ID + " does not allow children");
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ExpressionBinding.cs b/mcs/class/System.Web/System.Web.UI/ExpressionBinding.cs
new file mode 100644
index 00000000000..5219fbea13d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ExpressionBinding.cs
@@ -0,0 +1,96 @@
+//
+// System.Web.UI.ExpressionBinding.cs
+//
+// Authors:
+// Sanjay Gupta gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI {
+ public sealed class ExpressionBinding
+ {
+ string propertyName;
+ Type propertyType;
+ string expression;
+ string prefix;
+ bool generated;
+
+ public ExpressionBinding (string propertyName, Type propertyType,
+ string expressionPrefix, string expression)
+ {
+ this.propertyName = propertyName;
+ this.propertyType = propertyType;
+ this.prefix = expressionPrefix;
+ this.expression = expression;
+ this.generated = false;
+ }
+
+ public string Expression {
+ get { return expression; }
+ set { expression = value; }
+ }
+
+ public string ExpressionPrefix {
+ get { return prefix; }
+ set { prefix = value; }
+ }
+
+ public bool Generated {
+ get { return generated; }
+ }
+
+ public string PropertyName {
+ get { return propertyName; }
+ }
+
+ public Type PropertyType {
+ get { return propertyType; }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is ExpressionBinding))
+ return false;
+
+ ExpressionBinding o = (ExpressionBinding)obj;
+ return (o.Expression == expression &&
+ o.ExpressionPrefix == prefix &&
+ o.PropertyName == propertyName &&
+ o.PropertyType == propertyType);
+ }
+
+ public override int GetHashCode ()
+ {
+ return propertyName.GetHashCode () +
+ (propertyType.GetHashCode () << 1) +
+ (prefix.GetHashCode () << 2) +
+ (expression.GetHashCode () << 3);
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/ExpressionBindingCollection.cs b/mcs/class/System.Web/System.Web.UI/ExpressionBindingCollection.cs
new file mode 100644
index 00000000000..79cb1ef0ffa
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ExpressionBindingCollection.cs
@@ -0,0 +1,144 @@
+//
+// System.Web.UI.ExpressionBindingCollection.cs
+//
+// Authors:
+// Sanjay Gupta gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System;
+using System.Collections;
+
+namespace System.Web.UI {
+
+ public sealed class ExpressionBindingCollection : ICollection, IEnumerable
+ {
+ Hashtable list;
+ ArrayList removed;
+
+ public ExpressionBindingCollection ()
+ {
+ list = new Hashtable ();
+ removed = new ArrayList ();
+ }
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public bool IsReadOnly {
+ get { return list.IsReadOnly; }
+ }
+
+ public bool IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ public ExpressionBinding this [string propertyName] {
+ get { return list [propertyName] as ExpressionBinding; }
+ }
+
+ public string [] RemovedBindings {
+ get { return (string []) removed.ToArray (typeof (string)); }
+ }
+
+ public object SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ public void Add (ExpressionBinding binding)
+ {
+ list.Add (binding.PropertyName, binding);
+ OnChanged (new EventArgs ());
+ }
+
+ public void Clear ()
+ {
+ list.Clear ();
+ removed.Clear ();
+ OnChanged (new EventArgs ());
+ }
+
+ public bool Contains (string propertyName)
+ {
+ return list.Contains (propertyName);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ public void CopyTo (ExpressionBinding [] bindings, int index)
+ {
+ if (index < 0)
+ throw new ArgumentNullException ("Index cannot be negative");
+ if (index >= bindings.Length)
+ throw new ArgumentException ("Index cannot be greater than or equal to length of array passed");
+ if (list.Count > (bindings.Length - index + 1))
+ throw new ArgumentException ("Number of elements in source is greater than available space from index to end of destination");
+
+ foreach (string key in list.Keys)
+ bindings [index++] = (ExpressionBinding) list [key];
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ public void Remove (ExpressionBinding binding)
+ {
+ Remove(binding.PropertyName, true);
+ }
+
+ public void Remove (string propertyName)
+ {
+ Remove (propertyName, true);
+ }
+
+ public void Remove (string propertyName, bool addToRemovedList)
+ {
+ if (addToRemovedList)
+ removed.Add (String.Empty);
+ else
+ removed.Add (propertyName);
+
+ list.Remove (propertyName);
+ OnChanged (new EventArgs ());
+ }
+
+ public event EventHandler Changed;
+
+ protected void OnChanged (EventArgs e)
+ {
+ if (Changed != null)
+ Changed (this, e);
+ }
+
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/ExtractTemplateValuesMethod.cs b/mcs/class/System.Web/System.Web.UI/ExtractTemplateValuesMethod.cs
new file mode 100644
index 00000000000..f9ce6822441
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ExtractTemplateValuesMethod.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.UI.ExtractTemplateValuesMethod.cs
+//
+// Author:
+// Sanjay Gupta <gsanjay@novell.com>
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System;
+using System.Collections.Specialized;
+
+namespace System.Web.UI
+{
+ public delegate IOrderedDictionary ExtractTemplateValuesMethod (Control control);
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/FilterableAttribute.cs b/mcs/class/System.Web/System.Web.UI/FilterableAttribute.cs
new file mode 100644
index 00000000000..511ff4622b3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/FilterableAttribute.cs
@@ -0,0 +1,117 @@
+//
+// System.Web.UI.FilterableAttribute
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+using System;
+using System.ComponentModel;
+
+namespace System.Web.UI {
+ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
+ public sealed class FilterableAttribute : Attribute, IDisposable
+ {
+ private bool filterable;
+ private bool dispose;
+
+ public FilterableAttribute (bool filterable)
+ {
+ this.filterable = filterable;
+ }
+
+ public static readonly FilterableAttribute Default = new FilterableAttribute (true);
+
+ public static readonly FilterableAttribute No = new FilterableAttribute (false);
+
+ public static readonly FilterableAttribute Yes = new FilterableAttribute (true);
+
+ public bool Filterable {
+ get { return filterable; }
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ private void Dispose (bool disposing)
+ {
+ if (!this.dispose) {
+ //Do nothing
+ this.dispose = true;
+ }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj != null && obj is FilterableAttribute) {
+ FilterableAttribute fa = (FilterableAttribute) obj;
+ return (this.filterable == fa.filterable);
+ }
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return this.filterable.GetHashCode ();
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return Equals (Default);
+ }
+
+ public static bool IsObjectFilterable (object obj)
+ {
+ return IsTypeFilterable (obj.GetType ());
+ }
+
+ public static bool IsPropertyFilterable (PropertyDescriptor propDesc)
+ {
+ System.ComponentModel.AttributeCollection attributes = propDesc.Attributes;
+ if (attributes.Count != 0) {
+ foreach (Attribute attrib in attributes)
+ if (attrib is FilterableAttribute)
+ return true;
+ }
+ return false;
+ }
+
+ public static bool IsTypeFilterable (Type type)
+ {
+ Object [] attributes = type.GetCustomAttributes (typeof (FilterableAttribute), false);
+ if (attributes.Length != 0) {
+ foreach (Attribute attrib in attributes)
+ if (attrib is FilterableAttribute)
+ return true;
+ }
+ return false;
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/HierarchicalDataSourceControl.cs b/mcs/class/System.Web/System.Web.UI/HierarchicalDataSourceControl.cs
new file mode 100644
index 00000000000..0485907dc29
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/HierarchicalDataSourceControl.cs
@@ -0,0 +1,77 @@
+//
+// System.Web.UI.HierarchicalDataSourceControl
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.UI {
+ public abstract class HierarchicalDataSourceControl : Control, IHierarchicalDataSource {
+ protected HierarchicalDataSourceControl()
+ {
+ }
+
+ protected virtual HierarchicalDataSourceView GetHierarchicalView (string viewPath)
+ {
+ return null;
+ }
+
+ HierarchicalDataSourceView IHierarchicalDataSource.GetHierarchicalView (string viewPath)
+ {
+ return this.GetHierarchicalView (viewPath);
+ }
+
+ //public override bool EnablePersonalization { get; set; }
+ //public override bool EnableTheming { get; set; }
+ //public override string SkinID { get; set; }
+ public override bool Visible {
+ get { return false; }
+ set { throw new NotSupportedException (); }
+ }
+
+ static object dataSourceChanged = new object ();
+ event EventHandler System.Web.UI.IHierarchicalDataSource.DataSourceChanged {
+ add { Events.AddHandler (dataSourceChanged, value); }
+ remove { Events.RemoveHandler (dataSourceChanged, value); }
+ }
+
+ protected virtual void OnDataSourceChanged (EventArgs e)
+ {
+ EventHandler eh = Events [dataSourceChanged] as EventHandler;
+ if (eh != null)
+ eh (this, e);
+ }
+ }
+
+
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/HierarchicalDataSourceView.cs b/mcs/class/System.Web/System.Web.UI/HierarchicalDataSourceView.cs
new file mode 100644
index 00000000000..d9f6972edbd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/HierarchicalDataSourceView.cs
@@ -0,0 +1,48 @@
+//
+// System.Web.UI.HierarchicalDataSourceView
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2003 Ben Maurer
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.UI {
+ public abstract class HierarchicalDataSourceView {
+ protected HierarchicalDataSourceView ()
+ {
+ }
+
+ public abstract IHierarchicalEnumerable Select();
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/Html32TextWriter.cs b/mcs/class/System.Web/System.Web.UI/Html32TextWriter.cs
new file mode 100644
index 00000000000..e8bb5f9a7e4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/Html32TextWriter.cs
@@ -0,0 +1,308 @@
+//
+// System.Web.UI.Html32TextWriter.cs: Provides a HtmlTextWriter which writes HTML 3.2
+//
+// Authors:
+// Matthijs ter Woord [meddochat] (meddochat@zonnet.nl)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// Copyright (C) Matthijs ter Woord, 2004
+// (C) 2004 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
+// "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.Collections;
+using System.Globalization;
+using System.IO;
+
+namespace System.Web.UI
+{
+ [MonoTODO ("Needs work and verification.")]
+ public class Html32TextWriter : HtmlTextWriter
+ {
+ public Html32TextWriter (TextWriter writer) : base (writer)
+ {
+ }
+
+ public Html32TextWriter (TextWriter writer, string tabString) : base (writer, tabString)
+ {
+ }
+
+
+ public override void RenderBeginTag (HtmlTextWriterTag tagKey)
+ {
+ base.RenderBeginTag (tagKey);
+ }
+
+ public override void RenderEndTag ()
+ {
+ base.RenderEndTag ();
+ }
+
+ protected override string GetTagName (HtmlTextWriterTag tagKey)
+ {
+ if (tagKey == HtmlTextWriterTag.Unknown ||
+ !Enum.IsDefined (typeof (HtmlTextWriterTag), tagKey))
+ return "";
+
+ return tagKey.ToString ().ToLower (CultureInfo.InvariantCulture);
+ /* The code below is here just in case we need to split things up
+ switch (tagkey) {
+ case HtmlTextWriterTag.Unknown:
+ return "";
+ case HtmlTextWriterTag.A:
+ return "a";
+ case HtmlTextWriterTag.Acronym:
+ return "acronym";
+ case HtmlTextWriterTag.Address:
+ return "address";
+ case HtmlTextWriterTag.Area:
+ return "area";
+ case HtmlTextWriterTag.B:
+ return "b";
+ case HtmlTextWriterTag.Base:
+ return "base";
+ case HtmlTextWriterTag.Basefont:
+ return "basefont";
+ case HtmlTextWriterTag.Bdo:
+ return "bdo";
+ case HtmlTextWriterTag.Bgsound:
+ return "bgsound";
+ case HtmlTextWriterTag.Big:
+ return "big";
+ case HtmlTextWriterTag.Blockquote:
+ return "blockquote";
+ case HtmlTextWriterTag.Body:
+ return "body";
+ case HtmlTextWriterTag.Br:
+ return "br";
+ case HtmlTextWriterTag.Button:
+ return "button";
+ case HtmlTextWriterTag.Caption:
+ return "caption";
+ case HtmlTextWriterTag.Center:
+ return "center";
+ case HtmlTextWriterTag.Cite:
+ return "cite";
+ case HtmlTextWriterTag.Code:
+ return "code";
+ case HtmlTextWriterTag.Col:
+ return "col";
+ case HtmlTextWriterTag.Colgroup:
+ return "colgroup";
+ case HtmlTextWriterTag.Dd:
+ return "dd";
+ case HtmlTextWriterTag.Del:
+ return "del";
+ case HtmlTextWriterTag.Dfn:
+ return "dfn";
+ case HtmlTextWriterTag.Dir:
+ return "dir";
+ case HtmlTextWriterTag.Div:
+ return "table";
+ case HtmlTextWriterTag.Dl:
+ return "dl";
+ case HtmlTextWriterTag.Dt:
+ return "dt";
+ case HtmlTextWriterTag.Em:
+ return "em";
+ case HtmlTextWriterTag.Embed:
+ return "embed";
+ case HtmlTextWriterTag.Fieldset:
+ return "fieldset";
+ case HtmlTextWriterTag.Font:
+ return "font";
+ case HtmlTextWriterTag.Form:
+ return "form";
+ case HtmlTextWriterTag.Frame:
+ return "frame";
+ case HtmlTextWriterTag.Frameset:
+ return "frameset";
+ case HtmlTextWriterTag.H1:
+ return "h1";
+ case HtmlTextWriterTag.H2:
+ return "h2";
+ case HtmlTextWriterTag.H3:
+ return "h3";
+ case HtmlTextWriterTag.H4:
+ return "h4";
+ case HtmlTextWriterTag.H5:
+ return "h5";
+ case HtmlTextWriterTag.H6:
+ return "h6";
+ case HtmlTextWriterTag.Head:
+ return "head";
+ case HtmlTextWriterTag.Hr:
+ return "hr";
+ case HtmlTextWriterTag.Html:
+ return "html";
+ case HtmlTextWriterTag.I:
+ return "i";
+ case HtmlTextWriterTag.Iframe:
+ return "iframe";
+ case HtmlTextWriterTag.Img:
+ return "img";
+ case HtmlTextWriterTag.Input:
+ return "input";
+ case HtmlTextWriterTag.Ins:
+ return "ins";
+ case HtmlTextWriterTag.Isindex:
+ return "isindex";
+ case HtmlTextWriterTag.Kbd:
+ return "kbd";
+ case HtmlTextWriterTag.Label:
+ return "label";
+ case HtmlTextWriterTag.Legend:
+ return "legend";
+ case HtmlTextWriterTag.Li:
+ return "li";
+ case HtmlTextWriterTag.Link:
+ return "link";
+ case HtmlTextWriterTag.Map:
+ return "map";
+ case HtmlTextWriterTag.Marquee:
+ return "marquee";
+ case HtmlTextWriterTag.Menu:
+ return "menu";
+ case HtmlTextWriterTag.Meta:
+ return "meta";
+ case HtmlTextWriterTag.Nobr:
+ return "nobr";
+ case HtmlTextWriterTag.Noframes:
+ return "noframes";
+ case HtmlTextWriterTag.Noscript:
+ return "noscript";
+ case HtmlTextWriterTag.Object:
+ return "object";
+ case HtmlTextWriterTag.Ol:
+ return "ol";
+ case HtmlTextWriterTag.Option:
+ return "option";
+ case HtmlTextWriterTag.P:
+ return "p";
+ case HtmlTextWriterTag.Param:
+ return "param";
+ case HtmlTextWriterTag.Pre:
+ return "pre";
+ case HtmlTextWriterTag.Q:
+ return "q";
+ case HtmlTextWriterTag.Rt:
+ return "rt";
+ case HtmlTextWriterTag.Ruby:
+ return "ruby";
+ case HtmlTextWriterTag.S:
+ return "s";
+ case HtmlTextWriterTag.Samp:
+ return "samp";
+ case HtmlTextWriterTag.Script:
+ return "script";
+ case HtmlTextWriterTag.Select:
+ return "select";
+ case HtmlTextWriterTag.Small:
+ return "small";
+ case HtmlTextWriterTag.Span:
+ return "span";
+ case HtmlTextWriterTag.Strike:
+ return "strike";
+ case HtmlTextWriterTag.Strong:
+ return "strong";
+ case HtmlTextWriterTag.Style:
+ return "style";
+ case HtmlTextWriterTag.Sub:
+ return "sub";
+ case HtmlTextWriterTag.Sup:
+ return "sup";
+ case HtmlTextWriterTag.Table:
+ return "table";
+ case HtmlTextWriterTag.Tbody:
+ return "tbody";
+ case HtmlTextWriterTag.Td:
+ return "td";
+ case HtmlTextWriterTag.Textarea:
+ return "textarea";
+ case HtmlTextWriterTag.Tfoot:
+ return "tfoot";
+ case HtmlTextWriterTag.Th:
+ return "th";
+ case HtmlTextWriterTag.Thead:
+ return "thead";
+ case HtmlTextWriterTag.Title:
+ return "title";
+ case HtmlTextWriterTag.Tr:
+ return "tr";
+ case HtmlTextWriterTag.Tt:
+ return "tt";
+ case HtmlTextWriterTag.U:
+ return "u";
+ case HtmlTextWriterTag.Ul:
+ return "ul";
+ case HtmlTextWriterTag.Var:
+ return "var";
+ case HtmlTextWriterTag.Wbr:
+ return "wbr";
+ case HtmlTextWriterTag.Xml:
+ return "xml";
+ default:
+ return "";
+ }
+ */
+ }
+
+ protected override bool OnStyleAttributeRender (string name, string value, HtmlTextWriterStyle key)
+ {
+ return base.OnStyleAttributeRender (name, value, key);
+ }
+
+ protected override bool OnTagRender (string name, HtmlTextWriterTag key)
+ {
+ return base.OnTagRender (name, key);
+ }
+
+ protected override string RenderAfterContent ()
+ {
+ return base.RenderAfterContent ();
+ }
+
+ protected override string RenderAfterTag ()
+ {
+ return base.RenderAfterTag ();
+ }
+
+ protected override string RenderBeforeContent ()
+ {
+ return base.RenderBeforeContent ();
+ }
+
+ protected override string RenderBeforeTag ()
+ {
+ return base.RenderBeforeTag ();
+ }
+
+ [MonoTODO]
+ protected Stack FontStack {
+ get {
+ return null;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlControlPersistableAttribute.cs b/mcs/class/System.Web/System.Web.UI/HtmlControlPersistableAttribute.cs
new file mode 100644
index 00000000000..a499d54f7c1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/HtmlControlPersistableAttribute.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.UI.HtmlControlPersistableAttribute.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Property)]
+ internal sealed class HtmlControlPersistableAttribute : Attribute
+ {
+ bool persist;
+
+ public HtmlControlPersistableAttribute (bool persist)
+ {
+ this.persist = persist;
+ }
+
+ public bool Persist {
+ get { return persist; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs
new file mode 100644
index 00000000000..690adcd5ff8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs
@@ -0,0 +1,1110 @@
+
+//
+// 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.
+//
+/* System.Web.UI
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI{
+
+public class HtmlTextWriter : System.IO.TextWriter {
+
+static HtmlTextWriter(){
+ HtmlTextWriter._tagKeyLookupTable = new Hashtable(97,CaseInsensitiveHashCodeProvider.DefaultInvariant,
+ CaseInsensitiveComparer.DefaultInvariant);
+ HtmlTextWriter._tagNameLookupArray = new TagInformation[97];
+ HtmlTextWriter.RegisterTag("", HtmlTextWriterTag.Unknown, TagType.Other);
+ HtmlTextWriter.RegisterTag("a", HtmlTextWriterTag.A, TagType.Inline);
+ HtmlTextWriter.RegisterTag("acronym", HtmlTextWriterTag.Acronym, TagType.Inline);
+ HtmlTextWriter.RegisterTag("address", HtmlTextWriterTag.Address, TagType.Other);
+ HtmlTextWriter.RegisterTag("area", HtmlTextWriterTag.Area, TagType.Other);
+ HtmlTextWriter.RegisterTag("b", HtmlTextWriterTag.B, TagType.Inline);
+ HtmlTextWriter.RegisterTag("base", HtmlTextWriterTag.Base, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("basefont", HtmlTextWriterTag.Basefont, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("bdo", HtmlTextWriterTag.Bdo, TagType.Inline);
+ HtmlTextWriter.RegisterTag("bgsound", HtmlTextWriterTag.Bgsound, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("big", HtmlTextWriterTag.Big, TagType.Inline);
+ HtmlTextWriter.RegisterTag("blockquote", HtmlTextWriterTag.Blockquote, TagType.Other);
+ HtmlTextWriter.RegisterTag("body", HtmlTextWriterTag.Body, TagType.Other);
+ HtmlTextWriter.RegisterTag("br", HtmlTextWriterTag.Br, TagType.Other);
+ HtmlTextWriter.RegisterTag("button", HtmlTextWriterTag.Button, TagType.Inline);
+ HtmlTextWriter.RegisterTag("caption", HtmlTextWriterTag.Caption, TagType.Other);
+ HtmlTextWriter.RegisterTag("center", HtmlTextWriterTag.Center, TagType.Other);
+ HtmlTextWriter.RegisterTag("cite", HtmlTextWriterTag.Cite, TagType.Inline);
+ HtmlTextWriter.RegisterTag("code", HtmlTextWriterTag.Code, TagType.Inline);
+ HtmlTextWriter.RegisterTag("col", HtmlTextWriterTag.Col, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("colgroup", HtmlTextWriterTag.Colgroup, TagType.Other);
+ HtmlTextWriter.RegisterTag("del", HtmlTextWriterTag.Del, TagType.Inline);
+ HtmlTextWriter.RegisterTag("dd", HtmlTextWriterTag.Dd, TagType.Inline);
+ HtmlTextWriter.RegisterTag("dfn", HtmlTextWriterTag.Dfn, TagType.Inline);
+ HtmlTextWriter.RegisterTag("dir", HtmlTextWriterTag.Dir, TagType.Other);
+ HtmlTextWriter.RegisterTag("div", HtmlTextWriterTag.Div, TagType.Other);
+ HtmlTextWriter.RegisterTag("dl", HtmlTextWriterTag.Dl, TagType.Other);
+ HtmlTextWriter.RegisterTag("dt", HtmlTextWriterTag.Dt, TagType.Inline);
+ HtmlTextWriter.RegisterTag("em", HtmlTextWriterTag.Em, TagType.Inline);
+ HtmlTextWriter.RegisterTag("embed", HtmlTextWriterTag.Embed, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("fieldset", HtmlTextWriterTag.Fieldset, TagType.Other);
+ HtmlTextWriter.RegisterTag("font", HtmlTextWriterTag.Font, TagType.Inline);
+ HtmlTextWriter.RegisterTag("form", HtmlTextWriterTag.Form, TagType.Other);
+ HtmlTextWriter.RegisterTag("frame", HtmlTextWriterTag.Frame, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("frameset", HtmlTextWriterTag.Frameset, TagType.Other);
+ HtmlTextWriter.RegisterTag("h1", HtmlTextWriterTag.H1, TagType.Other);
+ HtmlTextWriter.RegisterTag("h2", HtmlTextWriterTag.H2, TagType.Other);
+ HtmlTextWriter.RegisterTag("h3", HtmlTextWriterTag.H3, TagType.Other);
+ HtmlTextWriter.RegisterTag("h4", HtmlTextWriterTag.H4, TagType.Other);
+ HtmlTextWriter.RegisterTag("h5", HtmlTextWriterTag.H5, TagType.Other);
+ HtmlTextWriter.RegisterTag("h6", HtmlTextWriterTag.H6, TagType.Other);
+ HtmlTextWriter.RegisterTag("head", HtmlTextWriterTag.Head, TagType.Other);
+ HtmlTextWriter.RegisterTag("hr", HtmlTextWriterTag.Hr, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("html", HtmlTextWriterTag.Html, TagType.Other);
+ HtmlTextWriter.RegisterTag("i", HtmlTextWriterTag.I, TagType.Inline);
+ HtmlTextWriter.RegisterTag("iframe", HtmlTextWriterTag.Iframe, TagType.Other);
+ HtmlTextWriter.RegisterTag("img", HtmlTextWriterTag.Img, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("input", HtmlTextWriterTag.Input, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("ins", HtmlTextWriterTag.Ins, TagType.Inline);
+ HtmlTextWriter.RegisterTag("isindex", HtmlTextWriterTag.Isindex, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("kbd", HtmlTextWriterTag.Kbd, TagType.Inline);
+ HtmlTextWriter.RegisterTag("label", HtmlTextWriterTag.Label, TagType.Inline);
+ HtmlTextWriter.RegisterTag("legend", HtmlTextWriterTag.Legend, TagType.Other);
+ HtmlTextWriter.RegisterTag("li", HtmlTextWriterTag.Li, TagType.Inline);
+ HtmlTextWriter.RegisterTag("link", HtmlTextWriterTag.Link, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("map", HtmlTextWriterTag.Map, TagType.Other);
+ HtmlTextWriter.RegisterTag("marquee", HtmlTextWriterTag.Marquee, TagType.Other);
+ HtmlTextWriter.RegisterTag("menu", HtmlTextWriterTag.Menu, TagType.Other);
+ HtmlTextWriter.RegisterTag("meta", HtmlTextWriterTag.Meta, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("nobr", HtmlTextWriterTag.Nobr, TagType.Inline);
+ HtmlTextWriter.RegisterTag("noframes", HtmlTextWriterTag.Noframes, TagType.Other);
+ HtmlTextWriter.RegisterTag("noscript", HtmlTextWriterTag.Noscript, TagType.Other);
+ HtmlTextWriter.RegisterTag("object", HtmlTextWriterTag.Object, TagType.Other);
+ HtmlTextWriter.RegisterTag("ol", HtmlTextWriterTag.Ol, TagType.Other);
+ HtmlTextWriter.RegisterTag("option", HtmlTextWriterTag.Option, TagType.Other);
+ HtmlTextWriter.RegisterTag("p", HtmlTextWriterTag.P, TagType.Inline);
+ HtmlTextWriter.RegisterTag("param", HtmlTextWriterTag.Param, TagType.Other);
+ HtmlTextWriter.RegisterTag("pre", HtmlTextWriterTag.Pre, TagType.Other);
+ HtmlTextWriter.RegisterTag("q", HtmlTextWriterTag.Q, TagType.Inline);
+ HtmlTextWriter.RegisterTag("rt", HtmlTextWriterTag.Rt, TagType.Other);
+ HtmlTextWriter.RegisterTag("ruby", HtmlTextWriterTag.Ruby, TagType.Other);
+ HtmlTextWriter.RegisterTag("s", HtmlTextWriterTag.S, TagType.Inline);
+ HtmlTextWriter.RegisterTag("samp", HtmlTextWriterTag.Samp, TagType.Inline);
+ HtmlTextWriter.RegisterTag("script", HtmlTextWriterTag.Script, TagType.Other);
+ HtmlTextWriter.RegisterTag("select", HtmlTextWriterTag.Select, TagType.Other);
+ HtmlTextWriter.RegisterTag("small", HtmlTextWriterTag.Small, TagType.Other);
+ HtmlTextWriter.RegisterTag("span", HtmlTextWriterTag.Span, TagType.Inline);
+ HtmlTextWriter.RegisterTag("strike", HtmlTextWriterTag.Strike, TagType.Inline);
+ HtmlTextWriter.RegisterTag("strong", HtmlTextWriterTag.Strong, TagType.Inline);
+ HtmlTextWriter.RegisterTag("style", HtmlTextWriterTag.Style, TagType.Other);
+ HtmlTextWriter.RegisterTag("sub", HtmlTextWriterTag.Sub, TagType.Inline);
+ HtmlTextWriter.RegisterTag("sup", HtmlTextWriterTag.Sup, TagType.Inline);
+ HtmlTextWriter.RegisterTag("table", HtmlTextWriterTag.Table, TagType.Other);
+ HtmlTextWriter.RegisterTag("tbody", HtmlTextWriterTag.Tbody, TagType.Other);
+ HtmlTextWriter.RegisterTag("td", HtmlTextWriterTag.Td, TagType.Inline);
+ HtmlTextWriter.RegisterTag("textarea", HtmlTextWriterTag.Textarea, TagType.Inline);
+ HtmlTextWriter.RegisterTag("tfoot", HtmlTextWriterTag.Tfoot, TagType.Other);
+ HtmlTextWriter.RegisterTag("th", HtmlTextWriterTag.Th, TagType.Inline);
+ HtmlTextWriter.RegisterTag("thead", HtmlTextWriterTag.Thead, TagType.Other);
+ HtmlTextWriter.RegisterTag("title", HtmlTextWriterTag.Title, TagType.Other);
+ HtmlTextWriter.RegisterTag("tr", HtmlTextWriterTag.Tr, TagType.Other);
+ HtmlTextWriter.RegisterTag("tt", HtmlTextWriterTag.Tt, TagType.Inline);
+ HtmlTextWriter.RegisterTag("u", HtmlTextWriterTag.U, TagType.Inline);
+ HtmlTextWriter.RegisterTag("ul", HtmlTextWriterTag.Ul, TagType.Other);
+ HtmlTextWriter.RegisterTag("var", HtmlTextWriterTag.Var, TagType.Inline);
+ HtmlTextWriter.RegisterTag("wbr", HtmlTextWriterTag.Wbr, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("xml", HtmlTextWriterTag.Xml, TagType.Other);
+
+#if NET_2_0
+ HtmlTextWriter._attrNameLookupArray = new AttributeInformation[54];
+#else
+ HtmlTextWriter._attrNameLookupArray = new AttributeInformation[40];
+#endif
+ HtmlTextWriter._attrKeyLookupTable = new Hashtable (HtmlTextWriter._attrNameLookupArray.Length,
+ CaseInsensitiveHashCodeProvider.DefaultInvariant, CaseInsensitiveComparer.DefaultInvariant);
+ HtmlTextWriter.RegisterAttribute("accesskey", HtmlTextWriterAttribute.Accesskey, true);
+ HtmlTextWriter.RegisterAttribute("align", HtmlTextWriterAttribute.Align, false);
+ HtmlTextWriter.RegisterAttribute("alt", HtmlTextWriterAttribute.Alt, true);
+ HtmlTextWriter.RegisterAttribute("background", HtmlTextWriterAttribute.Background, true);
+ HtmlTextWriter.RegisterAttribute("bgcolor", HtmlTextWriterAttribute.Bgcolor, false);
+ HtmlTextWriter.RegisterAttribute("border", HtmlTextWriterAttribute.Border, false);
+ HtmlTextWriter.RegisterAttribute("bordercolor", HtmlTextWriterAttribute.Bordercolor, false);
+ HtmlTextWriter.RegisterAttribute("cellpadding", HtmlTextWriterAttribute.Cellpadding, false);
+ HtmlTextWriter.RegisterAttribute("cellspacing", HtmlTextWriterAttribute.Cellspacing, false);
+ HtmlTextWriter.RegisterAttribute("checked", HtmlTextWriterAttribute.Checked, false);
+ HtmlTextWriter.RegisterAttribute("class", HtmlTextWriterAttribute.Class, true);
+ HtmlTextWriter.RegisterAttribute("cols", HtmlTextWriterAttribute.Cols, false);
+ HtmlTextWriter.RegisterAttribute("colspan", HtmlTextWriterAttribute.Colspan, false);
+ HtmlTextWriter.RegisterAttribute("disabled", HtmlTextWriterAttribute.Disabled, false);
+ HtmlTextWriter.RegisterAttribute("for", HtmlTextWriterAttribute.For, false);
+ HtmlTextWriter.RegisterAttribute("height", HtmlTextWriterAttribute.Height, false);
+ HtmlTextWriter.RegisterAttribute("href", HtmlTextWriterAttribute.Href, true);
+ HtmlTextWriter.RegisterAttribute("id", HtmlTextWriterAttribute.Id, false);
+ HtmlTextWriter.RegisterAttribute("maxlength", HtmlTextWriterAttribute.Maxlength, false);
+ HtmlTextWriter.RegisterAttribute("multiple", HtmlTextWriterAttribute.Multiple, false);
+ HtmlTextWriter.RegisterAttribute("name", HtmlTextWriterAttribute.Name, false);
+ HtmlTextWriter.RegisterAttribute("nowrap", HtmlTextWriterAttribute.Nowrap, false);
+ HtmlTextWriter.RegisterAttribute("onchange", HtmlTextWriterAttribute.Onchange, true);
+ HtmlTextWriter.RegisterAttribute("onclick", HtmlTextWriterAttribute.Onclick, true);
+ HtmlTextWriter.RegisterAttribute("readonly", HtmlTextWriterAttribute.ReadOnly, false);
+ HtmlTextWriter.RegisterAttribute("rows", HtmlTextWriterAttribute.Rows, false);
+ HtmlTextWriter.RegisterAttribute("rowspan", HtmlTextWriterAttribute.Rowspan, false);
+ HtmlTextWriter.RegisterAttribute("rules", HtmlTextWriterAttribute.Rules, false);
+ HtmlTextWriter.RegisterAttribute("selected", HtmlTextWriterAttribute.Selected, false);
+ HtmlTextWriter.RegisterAttribute("size", HtmlTextWriterAttribute.Size, false);
+ HtmlTextWriter.RegisterAttribute("src", HtmlTextWriterAttribute.Src, true);
+ HtmlTextWriter.RegisterAttribute("style", HtmlTextWriterAttribute.Style, false);
+ HtmlTextWriter.RegisterAttribute("tabindex", HtmlTextWriterAttribute.Tabindex, false);
+ HtmlTextWriter.RegisterAttribute("target", HtmlTextWriterAttribute.Target, false);
+ HtmlTextWriter.RegisterAttribute("title", HtmlTextWriterAttribute.Title, true);
+ HtmlTextWriter.RegisterAttribute("type", HtmlTextWriterAttribute.Type, false);
+ HtmlTextWriter.RegisterAttribute("valign", HtmlTextWriterAttribute.Valign, false);
+ HtmlTextWriter.RegisterAttribute("value", HtmlTextWriterAttribute.Value, true);
+ HtmlTextWriter.RegisterAttribute("width", HtmlTextWriterAttribute.Width, false);
+ HtmlTextWriter.RegisterAttribute("wrap", HtmlTextWriterAttribute.Wrap, false);
+#if NET_2_0
+ HtmlTextWriter.RegisterAttribute("abbr", HtmlTextWriterAttribute.Abbr, false);
+ HtmlTextWriter.RegisterAttribute("autocomplete", HtmlTextWriterAttribute.AutoComplete, false);
+ HtmlTextWriter.RegisterAttribute("axis", HtmlTextWriterAttribute.Axis, false);
+ HtmlTextWriter.RegisterAttribute("content", HtmlTextWriterAttribute.Content, false);
+ HtmlTextWriter.RegisterAttribute("coords", HtmlTextWriterAttribute.Coords, false);
+ HtmlTextWriter.RegisterAttribute("_designerRegion", HtmlTextWriterAttribute.DesignerRegion, false);
+ HtmlTextWriter.RegisterAttribute("dir", HtmlTextWriterAttribute.Dir, false);
+ HtmlTextWriter.RegisterAttribute("headers", HtmlTextWriterAttribute.Headers, false);
+ HtmlTextWriter.RegisterAttribute("longdesc", HtmlTextWriterAttribute.Longdesc, false);
+ HtmlTextWriter.RegisterAttribute("rel", HtmlTextWriterAttribute.Rel, false);
+ HtmlTextWriter.RegisterAttribute("scope", HtmlTextWriterAttribute.Scope, false);
+ HtmlTextWriter.RegisterAttribute("shape", HtmlTextWriterAttribute.Shape, false);
+ HtmlTextWriter.RegisterAttribute("usemap", HtmlTextWriterAttribute.Usemap, false);
+ HtmlTextWriter.RegisterAttribute("vcard_name", HtmlTextWriterAttribute.VCardName, false);
+#endif
+
+#if NET_2_0
+ HtmlTextWriter._styleNameLookupArray = new String[42];
+#else
+ HtmlTextWriter._styleNameLookupArray = new String[14];
+#endif
+ HtmlTextWriter._styleKeyLookupTable = new Hashtable (HtmlTextWriter._styleNameLookupArray.Length,
+ CaseInsensitiveHashCodeProvider.DefaultInvariant, CaseInsensitiveComparer.DefaultInvariant);
+ HtmlTextWriter.RegisterStyle("background-color", HtmlTextWriterStyle.BackgroundColor);
+ HtmlTextWriter.RegisterStyle("background-image", HtmlTextWriterStyle.BackgroundImage);
+ HtmlTextWriter.RegisterStyle("border-collapse", HtmlTextWriterStyle.BorderCollapse);
+ HtmlTextWriter.RegisterStyle("border-color", HtmlTextWriterStyle.BorderColor);
+ HtmlTextWriter.RegisterStyle("border-style", HtmlTextWriterStyle.BorderStyle);
+ HtmlTextWriter.RegisterStyle("border-width", HtmlTextWriterStyle.BorderWidth);
+ HtmlTextWriter.RegisterStyle("color", HtmlTextWriterStyle.Color);
+ HtmlTextWriter.RegisterStyle("font-family", HtmlTextWriterStyle.FontFamily);
+ HtmlTextWriter.RegisterStyle("font-size", HtmlTextWriterStyle.FontSize);
+ HtmlTextWriter.RegisterStyle("font-style", HtmlTextWriterStyle.FontStyle);
+ HtmlTextWriter.RegisterStyle("font-weight", HtmlTextWriterStyle.FontWeight);
+ HtmlTextWriter.RegisterStyle("height", HtmlTextWriterStyle.Height);
+ HtmlTextWriter.RegisterStyle("text-decoration", HtmlTextWriterStyle.TextDecoration);
+ HtmlTextWriter.RegisterStyle("width", HtmlTextWriterStyle.Width);
+#if NET_2_0
+ HtmlTextWriter.RegisterStyle("list-style-image", HtmlTextWriterStyle.ListStyleImage);
+ HtmlTextWriter.RegisterStyle("list-style-type", HtmlTextWriterStyle.ListStyleType);
+ HtmlTextWriter.RegisterStyle("cursor", HtmlTextWriterStyle.Cursor);
+ HtmlTextWriter.RegisterStyle("direction", HtmlTextWriterStyle.Direction);
+ HtmlTextWriter.RegisterStyle("display", HtmlTextWriterStyle.Display);
+ HtmlTextWriter.RegisterStyle("filter", HtmlTextWriterStyle.Filter);
+ HtmlTextWriter.RegisterStyle("font-variant", HtmlTextWriterStyle.FontVariant);
+ HtmlTextWriter.RegisterStyle("left", HtmlTextWriterStyle.Left);
+ HtmlTextWriter.RegisterStyle("margin", HtmlTextWriterStyle.Margin);
+ HtmlTextWriter.RegisterStyle("margin-bottom", HtmlTextWriterStyle.MarginBottom);
+ HtmlTextWriter.RegisterStyle("margin-left", HtmlTextWriterStyle.MarginLeft);
+ HtmlTextWriter.RegisterStyle("margin-right", HtmlTextWriterStyle.MarginRight);
+ HtmlTextWriter.RegisterStyle("margin-top", HtmlTextWriterStyle.MarginTop);
+ HtmlTextWriter.RegisterStyle("overflow", HtmlTextWriterStyle.Overflow);
+ HtmlTextWriter.RegisterStyle("overflow-x", HtmlTextWriterStyle.OverflowX);
+ HtmlTextWriter.RegisterStyle("overflow-y", HtmlTextWriterStyle.OverflowY);
+ HtmlTextWriter.RegisterStyle("padding", HtmlTextWriterStyle.Padding);
+ HtmlTextWriter.RegisterStyle("padding-bottom", HtmlTextWriterStyle.PaddingBottom);
+ HtmlTextWriter.RegisterStyle("padding-left", HtmlTextWriterStyle.PaddingLeft);
+ HtmlTextWriter.RegisterStyle("padding-right", HtmlTextWriterStyle.PaddingRight);
+ HtmlTextWriter.RegisterStyle("padding-top", HtmlTextWriterStyle.PaddingTop);
+ HtmlTextWriter.RegisterStyle("position", HtmlTextWriterStyle.Position);
+ HtmlTextWriter.RegisterStyle("text-align", HtmlTextWriterStyle.TextAlign);
+ HtmlTextWriter.RegisterStyle("text-overflow", HtmlTextWriterStyle.TextOverflow);
+ HtmlTextWriter.RegisterStyle("top", HtmlTextWriterStyle.Top);
+ HtmlTextWriter.RegisterStyle("visibility", HtmlTextWriterStyle.Visibility);
+ HtmlTextWriter.RegisterStyle("white-space", HtmlTextWriterStyle.WhiteSpace);
+ HtmlTextWriter.RegisterStyle("z-index", HtmlTextWriterStyle.ZIndex);
+#endif
+}
+
+public HtmlTextWriter(TextWriter writer):this(writer, " "){}
+
+public HtmlTextWriter(TextWriter writer, string tabString) : base() {
+ this.writer = writer;
+ this.tabString = tabString;
+ indentLevel = 0;
+ tabsPending = false;
+ _httpWriter = writer as HttpWriter;
+ _isDescendant = GetType() == typeof(HtmlTextWriter) == false;
+ _attrList = new RenderAttribute[20];
+ _attrCount = 0;
+ _styleList = new RenderStyle[20];
+ _styleCount = 0;
+ _endTags = new TagStackEntry[16];
+ _endTagCount = 0;
+ _inlineCount = 0;
+}
+
+public virtual void AddAttribute(HtmlTextWriterAttribute key, string value){
+ if ((int) key >= 0 && (int) key < HtmlTextWriter._attrNameLookupArray.Length) {
+ AttributeInformation attrInfo = HtmlTextWriter._attrNameLookupArray[(int) key];
+ AddAttribute(attrInfo.name, value, key, attrInfo.encode);
+ }
+}
+
+public virtual void AddAttribute(HtmlTextWriterAttribute key, string value, bool fEncode){
+ if ((int) key >= 0 && (int) key < HtmlTextWriter._attrNameLookupArray.Length) {
+ AddAttribute(HtmlTextWriter._attrNameLookupArray[(int) key].name, value, key, fEncode);
+ }
+}
+
+public virtual void AddAttribute(string name, string value){
+ HtmlTextWriterAttribute attr = GetAttributeKey(name);
+ value = EncodeAttributeValue(GetAttributeKey(name), value);
+ AddAttribute(name, value, attr);
+}
+
+public virtual void AddAttribute(string name, string value, bool fEndode){
+ value = EncodeAttributeValue(value, fEndode);
+ AddAttribute(name, value, GetAttributeKey(name));
+}
+
+protected virtual void AddAttribute(string name, string value, HtmlTextWriterAttribute key){
+ AddAttribute(name, value, key, false);
+}
+
+private void AddAttribute(string name, string value, HtmlTextWriterAttribute key, bool encode){
+ if (_attrCount >= (int) _attrList.Length) {
+ RenderAttribute[] rAttrArr = new RenderAttribute[_attrList.Length * 2];
+ System.Array.Copy(_attrList, rAttrArr, (int) _attrList.Length);
+ _attrList = rAttrArr;
+ }
+ RenderAttribute rAttr;
+ rAttr.name = name;
+ rAttr.value = value;
+ rAttr.key = key;
+ rAttr.encode = encode;
+ _attrList [_attrCount++] = rAttr;
+}
+
+public virtual void AddStyleAttribute(HtmlTextWriterStyle key, string value){
+ AddStyleAttribute(GetStyleName(key), value, key);
+}
+
+public virtual void AddStyleAttribute(string name, string value){
+ AddStyleAttribute(name, value, GetStyleKey(name));
+}
+
+protected virtual void AddStyleAttribute(string name, string value, HtmlTextWriterStyle key){
+ if (_styleCount >= (int) _styleList.Length) {
+ RenderStyle[] rAttrArr = new RenderStyle[_styleList.Length * 2];
+ System.Array.Copy(_styleList, rAttrArr, (int) _styleList.Length);
+ _styleList = rAttrArr;
+ }
+ RenderStyle rAttr;
+ rAttr.name = name;
+ rAttr.value = value;
+ rAttr.key = key;
+ _styleList [_styleCount++] = rAttr;
+}
+
+public override void Close(){
+ writer.Close();
+}
+
+protected virtual string EncodeAttributeValue(HtmlTextWriterAttribute attrKey, string value){
+ bool valid = true;
+ if (0 <= (int) attrKey && (int) attrKey < HtmlTextWriter._attrNameLookupArray.Length)
+ valid = HtmlTextWriter._attrNameLookupArray[(int) attrKey].encode;
+ return EncodeAttributeValue(value, valid);
+}
+
+protected string EncodeAttributeValue(string value, bool fEncode){
+ if (value == null)
+ return null;
+ if (!(fEncode))
+ return value;
+ return System.Web.HttpUtility.HtmlAttributeEncode(value);
+}
+
+protected string EncodeUrl(string url){
+ if (url.IndexOf(SpaceChar) < 0)
+ return url;
+ System.Text.StringBuilder sb = new System.Text.StringBuilder();
+ for(int i=0; i <= url.Length; i++){
+ char temp = url[i];
+ if (temp != 32)
+ sb.Append(temp);
+ else
+ sb.Append("%20");
+ }
+ return sb.ToString();
+}
+
+protected virtual void FilterAttributes(){
+ int count = 0;
+ for(int i=0; i < _styleCount; i++){
+ RenderStyle rStyle = _styleList[i];
+ if (OnStyleAttributeRender(rStyle.name, rStyle.value, rStyle.key)) {
+ count++;
+ }
+ }
+ _styleCount = count;
+ count = 0;
+ for(int i=0; i <= _attrCount; i++){
+ RenderAttribute rAttr = _attrList[i];
+ if (OnAttributeRender(rAttr.name, rAttr.value, rAttr.key)) {
+ count++;
+ }
+ }
+ _attrCount = count;
+}
+
+public override void Flush(){
+ writer.Flush();
+}
+
+protected HtmlTextWriterAttribute GetAttributeKey(string attrName){
+ if (attrName != null && attrName.Length > 0) {
+ object attr = HtmlTextWriter._attrKeyLookupTable[attrName];
+ if (attr != null)
+ return (HtmlTextWriterAttribute) attr;
+ }
+ return (HtmlTextWriterAttribute) (-1);
+}
+
+protected string GetAttributeName(HtmlTextWriterAttribute attrKey){
+ if ((int) attrKey >= 0 && (int) attrKey < HtmlTextWriter._attrNameLookupArray.Length)
+ return HtmlTextWriter._attrNameLookupArray[(int) attrKey].name;
+ return System.String.Empty;
+}
+
+protected HtmlTextWriterStyle GetStyleKey(string styleName){
+ if (styleName != null && styleName.Length > 0) {
+ object style = HtmlTextWriter._styleKeyLookupTable[styleName];
+ if (style != null)
+ return (HtmlTextWriterStyle) style;
+ }
+ return (HtmlTextWriterStyle) (-1);
+}
+
+protected string GetStyleName(HtmlTextWriterStyle styleKey){
+ return StaticGetStyleName (styleKey);
+}
+
+internal static string StaticGetStyleName (HtmlTextWriterStyle styleKey){
+ if ((int) styleKey >= 0 && (int) styleKey < HtmlTextWriter._styleNameLookupArray.Length)
+ return HtmlTextWriter._styleNameLookupArray[(int) styleKey];
+ return System.String.Empty;
+}
+
+protected virtual HtmlTextWriterTag GetTagKey(string tagName){
+ if (tagName != null && tagName.Length > 0) {
+ object tag = HtmlTextWriter._tagKeyLookupTable[tagName];
+ if (tag != null)
+ return (HtmlTextWriterTag) tag;
+ }
+ return 0;
+}
+
+protected virtual string GetTagName(HtmlTextWriterTag tagKey){
+ if ((int) tagKey >= 0 && (int) tagKey < HtmlTextWriter._tagNameLookupArray.Length)
+ return HtmlTextWriter._tagNameLookupArray[(int) tagKey].name;
+ return System.String.Empty;
+}
+
+protected bool IsAttributeDefined(HtmlTextWriterAttribute key){
+ for (int i=0; i < _attrCount; i++) {
+ if (_attrList[i].key == key)
+ return true;
+ }
+ return false;
+}
+
+protected bool IsAttributeDefined(HtmlTextWriterAttribute key, out string value){
+ value = null;
+ for (int i=0; i < _attrCount; i++) {
+ if (_attrList[i].key == key) {
+ value = _attrList[i].value;
+ return true;
+ }
+ }
+ return false;
+}
+
+protected bool IsStyleAttributeDefined(HtmlTextWriterStyle key){
+ for (int i= 0; i < _styleCount; i++) {
+ if (_styleList[i].key == key)
+ return true;
+ }
+ return false;
+}
+
+protected bool IsStyleAttributeDefined(HtmlTextWriterStyle key, out string value){
+ value = null;
+ for( int i=0; i < _styleCount; i++) {
+ if (_styleList[i].key == key) {
+ value = _styleList[i].value;
+ return true;
+ }
+ }
+ return false;
+}
+
+protected virtual bool OnAttributeRender(string name, string value, HtmlTextWriterAttribute key){
+ return true;
+}
+
+protected virtual bool OnStyleAttributeRender(string name, string value, HtmlTextWriterStyle key){
+ return true;
+}
+
+protected virtual bool OnTagRender(string name, HtmlTextWriterTag key){
+ return true;
+}
+
+protected virtual void OutputTabs(){
+ if (tabsPending) {
+ for(int i=0; i < indentLevel; i++) {
+ writer.Write(tabString);
+ }
+ tabsPending = false;
+ }
+}
+
+protected string PopEndTag(){
+ if (_endTagCount <= 0)
+ throw new InvalidOperationException("A PopEndTag was called without a corresponding PushEndTag");
+ _endTagCount--;
+ TagKey = _endTags[_endTagCount].tagKey;
+ return _endTags[_endTagCount].endTagText;
+}
+
+protected void PushEndTag(string endTag){
+ if (_endTagCount >= (int) _endTags.Length) {
+ TagStackEntry[] temp = new TagStackEntry[(int) _endTags.Length * 2];
+ System.Array.Copy(_endTags, temp, (int) _endTags.Length);
+ _endTags = temp;
+ }
+ _endTags[_endTagCount].tagKey = _tagKey;
+ _endTags[_endTagCount].endTagText = endTag;
+ _endTagCount++;
+}
+
+protected static void RegisterAttribute(string name, HtmlTextWriterAttribute key){
+ HtmlTextWriter.RegisterAttribute(name, key, false);
+}
+
+private static void RegisterAttribute(string name, HtmlTextWriterAttribute key, bool fEncode){
+ name = name.ToLower();
+ HtmlTextWriter._attrKeyLookupTable.Add(name, key);
+ if ((int) key < (int) HtmlTextWriter._attrNameLookupArray.Length)
+ HtmlTextWriter._attrNameLookupArray[(int) key] = new AttributeInformation(name, fEncode);
+}
+
+protected static void RegisterStyle(string name, HtmlTextWriterStyle key){
+ name = name.ToLower();
+ HtmlTextWriter._styleKeyLookupTable.Add(name, key);
+ if ((int) key < (int) HtmlTextWriter._styleNameLookupArray.Length)
+ HtmlTextWriter._styleNameLookupArray[(int) key] = name;
+}
+
+protected static void RegisterTag(string name, HtmlTextWriterTag key){
+ HtmlTextWriter.RegisterTag(name, key, TagType.Other);
+}
+
+private static void RegisterTag(string name, HtmlTextWriterTag key, TagType type){
+ name = name.ToLower();
+ HtmlTextWriter._tagKeyLookupTable.Add(name, key);
+ string fullTag = null;
+ if ((int) type != 1 && (int) key != 0) {
+ fullTag = EndTagLeftChars + name + TagRightChar;
+ }
+ if ((int) key < HtmlTextWriter._tagNameLookupArray.Length)
+ HtmlTextWriter._tagNameLookupArray[(int) key] = new TagInformation(name, type, fullTag);
+}
+
+protected virtual string RenderAfterContent(){
+ return null;
+}
+
+protected virtual string RenderAfterTag(){
+ return null;
+}
+
+protected virtual string RenderBeforeContent(){
+ return null;
+}
+
+protected virtual string RenderBeforeTag(){
+ return null;
+}
+
+public virtual void RenderBeginTag(HtmlTextWriterTag tagKey){
+ TagKey = tagKey;
+ bool tagRendered = true;
+ bool tagRender = true;
+ if (_isDescendant) {
+ tagRender = OnTagRender(_tagName, _tagKey);
+ FilterAttributes();
+ string beforeTag = RenderBeforeTag();
+ if (beforeTag != null) {
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(beforeTag);
+ }
+ }
+ TagInformation currentTag = HtmlTextWriter._tagNameLookupArray[_tagIndex];
+ if (currentTag.closingTag == null && currentTag.tagType == TagType.Other) {
+ currentTag.closingTag = EndTagLeftChars + _tagName + TagRightChar;
+ }
+
+ if (tagRender) {
+ tagRendered = false;
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(TagLeftChar);
+ writer.Write(_tagName);
+ RenderAttribute rAttr;
+ string rAttrValue = null;
+ for (int i=0; i < _attrCount; i++) {
+ rAttr = _attrList[i];
+ if (rAttr.key == HtmlTextWriterAttribute.Style)
+ rAttrValue = rAttr.value;
+ else {
+ writer.Write(SpaceChar);
+ writer.Write(rAttr.name);
+ if (rAttr.value != null) {
+ writer.Write(EqualsChar);
+ writer.Write(DoubleQuoteChar);
+ if (rAttr.encode) {
+ if (_httpWriter == null) {
+ System.Web.HttpUtility.HtmlAttributeEncode(rAttr.value, writer);
+ }
+ else {
+ System.Web.HttpUtility.HtmlAttributeEncode(rAttr.value, (TextWriter) _httpWriter);
+ }
+ }
+ else {
+ writer.Write(rAttr.value);
+ }
+ writer.Write(DoubleQuoteChar);
+ }
+ }
+ }
+ if (_styleCount > 0 || rAttrValue != null) {
+ writer.Write(SpaceChar);
+ writer.Write("style");
+ writer.Write(EqualsChar);
+ writer.Write(DoubleQuoteChar);
+ RenderStyle rStyle;
+ for (int i=0; i < _styleCount; i++) {
+ rStyle = _styleList[i];
+ writer.Write(rStyle.name);
+ writer.Write(StyleEqualsChar);
+ writer.Write(rStyle.value);
+ writer.Write(SemicolonChar);
+ }
+ if (rAttrValue != null)
+ writer.Write(rAttrValue);
+ writer.Write(DoubleQuoteChar);
+ }
+ if (currentTag.tagType == TagType.NonClosing) {
+ writer.Write(SpaceChar);
+ writer.Write(SlashChar);
+ writer.Write(TagRightChar);
+ }
+ else
+ writer.Write(TagRightChar);
+ }
+ string beforeContent = RenderBeforeContent();
+ if (beforeContent != null) {
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(beforeContent);
+ }
+ if (tagRendered) {
+ if (currentTag.tagType == TagType.Inline)
+ _inlineCount++;
+ else {
+ WriteLine();
+ Indent++;
+ }
+ if (currentTag.closingTag == null) {
+ currentTag.closingTag = EndTagLeftChars + _tagName + TagRightChar;
+ }
+ }
+ if (_isDescendant) {
+ string afterContent = RenderAfterContent();
+ if (afterContent != null) {
+ if (currentTag.closingTag != null)
+ currentTag.closingTag = afterContent;
+ }
+ string afterTag = RenderAfterTag();
+ if (afterTag != null) {
+ if (currentTag.closingTag != null)
+ currentTag.closingTag = afterTag;
+ }
+ }
+ PushEndTag(currentTag.closingTag);
+ _attrCount = 0;
+ _styleCount = 0;
+}
+
+public virtual void RenderBeginTag(string tagName){
+ TagName = tagName;
+ RenderBeginTag(_tagKey);
+}
+
+public virtual void RenderEndTag(){
+ string endTagText = PopEndTag();
+ if (endTagText != null) {
+ if (HtmlTextWriter._tagNameLookupArray[_tagIndex].tagType == 0) {
+ _inlineCount--;
+ Write(endTagText);
+ }
+ else{
+ WriteLine();
+ Indent--;
+ Write(endTagText);
+ }
+ }
+}
+
+public override void Write(bool value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(char value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(char[] buffer){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(buffer);
+}
+
+public override void Write(char[] buffer, int index, int count){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(buffer, index, count);
+}
+
+public override void Write(double value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(int value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(long value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(object value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(float value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(string s){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(s);
+}
+
+public override void Write(string format, object arg0){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(format, arg0);
+}
+
+public override void Write(string format, object arg0, object arg1){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(format, arg0, arg1);
+}
+
+public override void Write(string format, params object[] arg){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(format, arg);
+}
+
+public virtual void WriteAttribute(string name, string value){
+ WriteAttribute(name, value, false);
+}
+
+public virtual void WriteAttribute(string name, string value, bool fEncode){
+ writer.Write(SpaceChar);
+ writer.Write(name);
+ if (value != null) {
+ writer.Write(EqualsChar);
+ writer.Write(DoubleQuoteChar);
+ if (fEncode) {
+ if (_httpWriter == null) {
+ System.Web.HttpUtility.HtmlAttributeEncode(value, writer);
+ }
+ else{
+ System.Web.HttpUtility.HtmlAttributeEncode(value, (TextWriter) _httpWriter);
+ }
+ }
+ else{
+ writer.Write(value);
+ }
+ writer.Write(DoubleQuoteChar);
+ }
+}
+
+public virtual void WriteBeginTag(string tagName){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(TagLeftChar);
+ writer.Write(tagName);
+}
+
+public virtual void WriteEndTag(string tagName){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(TagLeftChar);
+ writer.Write(SlashChar);
+ writer.Write(tagName);
+ writer.Write(TagRightChar);
+}
+
+public virtual void WriteFullBeginTag(string tagName){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(TagLeftChar);
+ writer.Write(tagName);
+ writer.Write(TagRightChar);
+}
+
+public override void WriteLine(){
+ writer.WriteLine();
+ tabsPending = true;
+}
+
+public override void WriteLine(bool value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(char value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(char[] buffer){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(buffer);
+ tabsPending = true;
+}
+
+public override void WriteLine(char[] buffer, int index, int count){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(buffer, index, count);
+ tabsPending = true;
+}
+
+public override void WriteLine(double value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(int value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(long value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(object value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(float value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(string s){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(s);
+ tabsPending = true;
+}
+
+public override void WriteLine(string format, object arg0){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(format, arg0);
+ tabsPending = true;
+}
+
+public override void WriteLine(string format, object arg0, object arg1){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(format, arg0, arg1);
+ tabsPending = true;
+}
+
+public override void WriteLine(string format, params object[] arg){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(format, arg);
+ tabsPending = true;
+}
+
+[CLSCompliant(false)]
+public override void WriteLine(uint value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public void WriteLineNoTabs(string s){
+ writer.WriteLine(s);
+}
+
+public virtual void WriteStyleAttribute(string name, string value){
+ WriteStyleAttribute(name, value, false);
+}
+
+public virtual void WriteStyleAttribute(string name, string value, bool fEncode){
+ writer.Write(name);
+ writer.Write(StyleEqualsChar);
+ if (fEncode) {
+ if (_httpWriter == null) {
+ System.Web.HttpUtility.HtmlAttributeEncode(value, writer);
+ }
+ else{
+ System.Web.HttpUtility.HtmlAttributeEncode(value, (TextWriter) _httpWriter);
+ }
+ }
+ else {
+ writer.Write(value);
+ }
+ writer.Write(SemicolonChar);
+}
+
+public override System.Text.Encoding Encoding {
+ get{
+ return writer.Encoding;
+ }
+}
+
+public int Indent {
+ get{
+ return indentLevel;
+ }
+ set{
+ if (value < 0)
+ value = 0;
+ indentLevel = value;
+ }
+}
+
+public TextWriter InnerWriter {
+ get{
+ return writer;
+ }
+ set{
+ writer = value;
+ _httpWriter = value as HttpWriter;
+ }
+}
+
+public override string NewLine {
+ get{
+ return writer.NewLine;
+ }
+ set{
+ writer.NewLine = value;
+ }
+}
+
+protected HtmlTextWriterTag TagKey {
+ get{
+ return _tagKey;
+ }
+ set{
+ _tagIndex = (int) value;
+ if (_tagIndex < 0 || _tagIndex >= (int) HtmlTextWriter._tagNameLookupArray.Length)
+ throw new ArgumentOutOfRangeException("value");
+ _tagKey = value;
+ if (value != 0)
+ _tagName = HtmlTextWriter._tagNameLookupArray[_tagIndex].name;
+ }
+}
+
+protected string TagName {
+ get{
+ return _tagName;
+ }
+ set{
+ _tagName = value;
+ _tagKey = GetTagKey(_tagName);
+ _tagIndex = (int) _tagKey;
+ }
+}
+
+public const string DefaultTabString = "\t";
+public const char DoubleQuoteChar = '"';
+public const string EndTagLeftChars = "</";
+public const char EqualsChar = '=';
+public const string EqualsDoubleQuoteString = "=\"";
+public const string SelfClosingChars = " /";
+public const string SelfClosingTagEnd = " />";
+public const char SemicolonChar = ';';
+public const char SingleQuoteChar = '\'';
+public const char SlashChar = '/';
+public const char SpaceChar = ' ';
+public const char StyleEqualsChar = ':';
+public const char TagLeftChar = '<';
+public const char TagRightChar = '>';
+
+private int _attrCount;
+private int _endTagCount;
+private int _styleCount;
+private int indentLevel;
+private int _inlineCount;
+private int _tagIndex;
+
+private bool _isDescendant;
+private bool tabsPending;
+
+private HtmlTextWriterTag _tagKey;
+private TextWriter writer;
+private HttpWriter _httpWriter;
+
+private static Hashtable _attrKeyLookupTable;
+private static Hashtable _styleKeyLookupTable;
+private static Hashtable _tagKeyLookupTable;
+
+private string _tagName;
+private string tabString;
+private static string[] _styleNameLookupArray;
+
+private RenderAttribute[] _attrList;
+private static AttributeInformation[] _attrNameLookupArray;
+private static TagInformation[] _tagNameLookupArray;
+private TagStackEntry[] _endTags;
+private RenderStyle[] _styleList;
+
+} //HtmlTextWriter
+
+struct AttributeInformation {
+ public bool encode;
+ public string name;
+
+ public AttributeInformation(string name, bool encode){
+ this.encode = encode;
+ this.name = name;
+ }
+}
+
+struct RenderAttribute {
+ public bool encode;
+ public HtmlTextWriterAttribute key;
+ public string name;
+ public string value;
+}
+
+struct RenderStyle {
+ public HtmlTextWriterStyle key;
+ public string name;
+ public string value;
+}
+
+struct TagInformation {
+ public string closingTag;
+ public string name;
+ public TagType tagType;
+
+ public TagInformation(string name, TagType tagType, string closingTag){
+ this.name = name;
+ this.tagType = tagType;
+ this.closingTag = closingTag;
+ }
+}
+
+struct TagStackEntry {
+ public string endTagText;
+ public HtmlTextWriterTag tagKey;
+}
+
+enum TagType {
+ Inline,
+ NonClosing,
+ Other
+}
+
+
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs
new file mode 100644
index 00000000000..aebbc0ae513
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs
@@ -0,0 +1,91 @@
+//
+// System.Web.UI.HtmlTextWriterAttribute.cs
+//
+// Authors:
+// Leen Toelen (toelen@hotmail.com)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+namespace System.Web.UI{
+ public enum HtmlTextWriterAttribute {
+ Accesskey,
+ Align,
+ Alt,
+ Background,
+ Bgcolor,
+ Border,
+ Bordercolor,
+ Cellpadding,
+ Cellspacing,
+ Checked,
+ Class,
+ Cols,
+ Colspan,
+ Disabled,
+ For,
+ Height,
+ Href,
+ Id,
+ Maxlength,
+ Multiple,
+ Name,
+ Nowrap,
+ Onchange,
+ Onclick,
+ ReadOnly,
+ Rows,
+ Rowspan,
+ Rules,
+ Selected,
+ Size,
+ Src,
+ Style,
+ Tabindex,
+ Target,
+ Title,
+ Type,
+ Valign,
+ Value,
+ Width,
+ Wrap,
+#if NET_2_0
+ Abbr = 40,
+ AutoComplete = 41,
+ Axis = 42,
+ Content = 43,
+ Coords = 44,
+ DesignerRegion = 45,
+ Dir = 46,
+ Headers = 47,
+ Longdesc = 48,
+ Rel = 49,
+ Scope = 50,
+ Shape = 51,
+ Usemap = 52,
+ VCardName = 53
+#endif
+ }
+} // namespace System.Web.UI
+
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs
new file mode 100644
index 00000000000..b22c9702487
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs
@@ -0,0 +1,79 @@
+//
+// System.Web.UI.HtmlTextWriterStyle.cs
+//
+// Authors:
+// Leen Toelen (toelen@hotmail.com)
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+namespace System.Web.UI{
+ public enum HtmlTextWriterStyle {
+ BackgroundColor,
+ BackgroundImage,
+ BorderCollapse,
+ BorderColor,
+ BorderStyle,
+ BorderWidth,
+ Color,
+ FontFamily,
+ FontSize,
+ FontStyle,
+ FontWeight,
+ Height,
+ TextDecoration,
+ Width,
+#if NET_2_0
+ ListStyleImage = 14,
+ ListStyleType = 15,
+ Cursor = 16,
+ Direction = 17,
+ Display = 18,
+ Filter = 19,
+ FontVariant = 20,
+ Left = 21,
+ Margin = 22,
+ MarginBottom = 23,
+ MarginLeft = 24,
+ MarginRight = 25,
+ MarginTop = 26,
+ Overflow = 27,
+ OverflowX = 28,
+ OverflowY = 29,
+ Padding = 30,
+ PaddingBottom = 31,
+ PaddingLeft = 32,
+ PaddingRight = 33,
+ PaddingTop = 34,
+ Position = 35,
+ TextAlign = 36,
+ TextOverflow = 37,
+ Top = 38,
+ Visibility = 39,
+ WhiteSpace = 40,
+ ZIndex = 41
+#endif
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs
new file mode 100644
index 00000000000..7d8696358da
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs
@@ -0,0 +1,127 @@
+/* System.Web.UI
+* Authors
+* Leen Toelen (toelen@hotmail.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.
+//
+
+namespace System.Web.UI{
+ public enum HtmlTextWriterTag {
+ Unknown,
+ A,
+ Acronym,
+ Address,
+ Area,
+ B,
+ Base,
+ Basefont,
+ Bdo,
+ Bgsound,
+ Big,
+ Blockquote,
+ Body,
+ Br,
+ Button,
+ Caption,
+ Center,
+ Cite,
+ Code,
+ Col,
+ Colgroup,
+ Dd,
+ Del,
+ Dfn,
+ Dir,
+ Div,
+ Dl,
+ Dt,
+ Em,
+ Embed,
+ Fieldset,
+ Font,
+ Form,
+ Frame,
+ Frameset,
+ H1,
+ H2,
+ H3,
+ H4,
+ H5,
+ H6,
+ Head,
+ Hr,
+ Html,
+ I,
+ Iframe,
+ Img,
+ Input,
+ Ins,
+ Isindex,
+ Kbd,
+ Label,
+ Legend,
+ Li,
+ Link,
+ Map,
+ Marquee,
+ Menu,
+ Meta,
+ Nobr,
+ Noframes,
+ Noscript,
+ Object,
+ Ol,
+ Option,
+ P,
+ Param,
+ Pre,
+ Q,
+ Rt,
+ Ruby,
+ S,
+ Samp,
+ Script,
+ Select,
+ Small,
+ Span,
+ Strike,
+ Strong,
+ Style,
+ Sub,
+ Sup,
+ Table,
+ Tbody,
+ Td,
+ Textarea,
+ Tfoot,
+ Th,
+ Thead,
+ Title,
+ Tr,
+ Tt,
+ U,
+ Ul,
+ Var,
+ Wbr,
+ Xml
+ }
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI/IAttributeAccessor.cs b/mcs/class/System.Web/System.Web.UI/IAttributeAccessor.cs
new file mode 100644
index 00000000000..1b67f20f9b4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IAttributeAccessor.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.UI.IAttributeAccessor.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IAttributeAccessor
+ {
+ string GetAttribute(string key);
+ void SetAttribute(string key, string value);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IBindableTemplate.cs b/mcs/class/System.Web/System.Web.UI/IBindableTemplate.cs
new file mode 100644
index 00000000000..c363223d202
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IBindableTemplate.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.IBindableTemplate.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+using System.Collections.Specialized;
+
+namespace System.Web.UI
+{
+ public interface IBindableTemplate: ITemplate
+ {
+ IOrderedDictionary ExtractValues (Control control);
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/ICallbackEventHandler.cs b/mcs/class/System.Web/System.Web.UI/ICallbackEventHandler.cs
new file mode 100644
index 00000000000..f2ffc89ed18
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ICallbackEventHandler.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.ICallbackEventHandler.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface ICallbackEventHandler
+ {
+ string RaiseCallbackEvent (string eventArgs);
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/ICheckBoxControl.cs b/mcs/class/System.Web/System.Web.UI/ICheckBoxControl.cs
new file mode 100644
index 00000000000..6ebc2a330d7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ICheckBoxControl.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.ICheckBoxControl.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface ICheckBoxControl
+ {
+ bool Checked { get; set; }
+ event EventHandler CheckedChanged;
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IControlBuilderAccessor.cs b/mcs/class/System.Web/System.Web.UI/IControlBuilderAccessor.cs
new file mode 100644
index 00000000000..1652c097e21
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IControlBuilderAccessor.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.IControlBuilderAccessor.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface IControlBuilderAccessor
+ {
+ ControlBuilder ControlBuilder { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IControlDesignerAccessor.cs b/mcs/class/System.Web/System.Web.UI/IControlDesignerAccessor.cs
new file mode 100644
index 00000000000..604f222d538
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IControlDesignerAccessor.cs
@@ -0,0 +1,48 @@
+//
+// System.Web.UI.IControlDesignerAccessor.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+using System.Collections;
+
+namespace System.Web.UI
+{
+ public interface IControlDesignerAccessor
+ {
+
+ IDictionary GetDesignModeState ();
+ void SetDesignModeState (IDictionary designData);
+ void SetOwnerControl (Control control);
+
+ IDictionary UserData { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IControlTypeFilter.cs b/mcs/class/System.Web/System.Web.UI/IControlTypeFilter.cs
new file mode 100644
index 00000000000..f9a82f2b2aa
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IControlTypeFilter.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.UI.IControlTypeFilter.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface IControlTypeFilter
+ {
+ string GetFilterHash (string virtualPathContainer);
+ bool IsAllowedMethod (string virtualPathContainer, string controlPath);
+ bool IsAllowedMethod (string virtualPathContainer, Type control);
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IDReferencePropertyAttribute.cs b/mcs/class/System.Web/System.Web.UI/IDReferencePropertyAttribute.cs
new file mode 100644
index 00000000000..b8687c372d5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IDReferencePropertyAttribute.cs
@@ -0,0 +1,67 @@
+//
+// System.Web.UI.IDReferencePropertyAttribute.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public sealed class IDReferencePropertyAttribute : Attribute
+ {
+ Type controlType;
+
+ public IDReferencePropertyAttribute ()
+ {
+ }
+
+ public IDReferencePropertyAttribute (Type controlReferenceType)
+ {
+ controlType = controlReferenceType;
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj != null && obj is IDReferencePropertyAttribute)
+ return (this.controlType == ((IDReferencePropertyAttribute) obj).controlType);
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return controlType.GetHashCode ();
+ }
+
+ public Type ReferencedControlType {
+ get { return controlType; }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IDataBindingsAccessor.cs b/mcs/class/System.Web/System.Web.UI/IDataBindingsAccessor.cs
new file mode 100644
index 00000000000..83cb04739ad
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IDataBindingsAccessor.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.UI.IDataBindingsAccessor.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IDataBindingsAccessor
+ {
+ DataBindingCollection DataBindings {get;}
+ bool HasDataBindings {get;}
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IDataItemContainer.cs b/mcs/class/System.Web/System.Web.UI/IDataItemContainer.cs
new file mode 100644
index 00000000000..67fb97074a1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IDataItemContainer.cs
@@ -0,0 +1,45 @@
+//
+// System.Web.UI.IDataItemContainer.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface IDataItemContainer
+ {
+ object DataItem { get; }
+/* int DataItemIndex { get; }
+ int DisplayIndex { get; }
+*/
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IDataSource.cs b/mcs/class/System.Web/System.Web.UI/IDataSource.cs
new file mode 100644
index 00000000000..b82694dfa4d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IDataSource.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.UI.IDataSource
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.UI {
+ public interface IDataSource {
+ event EventHandler DataSourceChanged;
+ DataSourceView GetView (string viewName);
+ ICollection GetViewNames ();
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IDataSourceViewSchemaAccessor.cs b/mcs/class/System.Web/System.Web.UI/IDataSourceViewSchemaAccessor.cs
new file mode 100644
index 00000000000..4b90be834a3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IDataSourceViewSchemaAccessor.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.IDataSourceViewSchemaAccessor.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface IDataSourceViewSchemaAccessor
+ {
+ object DataSourceViewSchema { get; set; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IEditableTextControl.cs b/mcs/class/System.Web/System.Web.UI/IEditableTextControl.cs
new file mode 100644
index 00000000000..dc9277fce20
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IEditableTextControl.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.IEditableTextControl.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface IEditableTextControl: ITextControl
+ {
+ event EventHandler TextChanged;
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IExpressionsAccessor.cs b/mcs/class/System.Web/System.Web.UI/IExpressionsAccessor.cs
new file mode 100644
index 00000000000..27cc9271740
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IExpressionsAccessor.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.IExpressionsAccessor.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface IExpressionsAccessor
+ {
+ ExpressionBindingCollection Expressions { get; }
+ bool HasExpressions { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IFilterResolutionService.cs b/mcs/class/System.Web/System.Web.UI/IFilterResolutionService.cs
new file mode 100644
index 00000000000..847055a7a4f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IFilterResolutionService.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.IFilterResolutionService.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface IFilterResolutionService
+ {
+ int CompareFilters (string filter1, string filter2);
+ bool EvaluateFilter (string filterName);
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IHierarchicalDataSource.cs b/mcs/class/System.Web/System.Web.UI/IHierarchicalDataSource.cs
new file mode 100644
index 00000000000..04f876ce490
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IHierarchicalDataSource.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.IHierarchicalDataSource
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.UI {
+ public interface IHierarchicalDataSource {
+ event EventHandler DataSourceChanged;
+ HierarchicalDataSourceView GetHierarchicalView (string viewPath);
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IHierarchicalEnumerable.cs b/mcs/class/System.Web/System.Web.UI/IHierarchicalEnumerable.cs
new file mode 100644
index 00000000000..1e8859e1fb2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IHierarchicalEnumerable.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.UI.IHierarchicalEnumerable
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+
+namespace System.Web.UI {
+ public interface IHierarchicalEnumerable : IEnumerable {
+ IHierarchyData GetHierarchyData (object enumeratedItem);
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IHierarchyData.cs b/mcs/class/System.Web/System.Web.UI/IHierarchyData.cs
new file mode 100644
index 00000000000..3869a652b6e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IHierarchyData.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.IHierarchyData
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+namespace System.Web.UI {
+ public interface IHierarchyData {
+ IHierarchicalEnumerable GetChildren ();
+ IHierarchicalEnumerable GetParent ();
+ bool HasChildren { get; }
+ object Item { get; }
+ string Path { get; }
+ string Type { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IItemPaginationInfo.cs b/mcs/class/System.Web/System.Web.UI/IItemPaginationInfo.cs
new file mode 100644
index 00000000000..9c9ee2aad38
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IItemPaginationInfo.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.UI.IItemPaginationInfo.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface IItemPaginationInfo
+ {
+ void SetVisibleItems (int itemIndex, int count);
+
+ int FirstVisibleItemIndex { get; }
+ int ItemCount { get; }
+ int ItemWeight { get; }
+ int VisibleItemCount { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IMobileTextWriter.cs b/mcs/class/System.Web/System.Web.UI/IMobileTextWriter.cs
new file mode 100644
index 00000000000..35f024e7fa6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IMobileTextWriter.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.IMobileTextWriter.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface IMobileTextWriter
+ {
+ void AddRecognizedAttribute (string element, string attribute);
+ void RemoveRecognizedAttribute (string element, string attribute);
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/INamingContainer.cs b/mcs/class/System.Web/System.Web.UI/INamingContainer.cs
new file mode 100644
index 00000000000..62cf0654e63
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/INamingContainer.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.UI.INamingContainer.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface INamingContainer
+ {
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/INavigateUIData.cs b/mcs/class/System.Web/System.Web.UI/INavigateUIData.cs
new file mode 100644
index 00000000000..eb648b6902e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/INavigateUIData.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.UI.INavigateUIData
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+namespace System.Web.UI {
+ public interface INavigateUIData {
+ string Name { get; }
+ string NavigateUrl { get; }
+ string Value { get; }
+ string Description { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IPageHeader.cs b/mcs/class/System.Web/System.Web.UI/IPageHeader.cs
new file mode 100644
index 00000000000..881c7c66751
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IPageHeader.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.UI.IPageHeader.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+using System.Collections;
+
+namespace System.Web.UI
+{
+ public interface IPageHeader
+ {
+ IList LinkedStyleSheets { get; }
+ IDictionary Metadata { get; }
+ IStyleSheet StyleSheet { get; }
+ string Title { get; set; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IPaginationContainer.cs b/mcs/class/System.Web/System.Web.UI/IPaginationContainer.cs
new file mode 100644
index 00000000000..f5d36a71abb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IPaginationContainer.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.IPaginationContainer.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface IPaginationContainer
+ {
+ int MaximumWeight { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IPaginationInfo.cs b/mcs/class/System.Web/System.Web.UI/IPaginationInfo.cs
new file mode 100644
index 00000000000..7e4339efcfb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IPaginationInfo.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.IPaginationInfo.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface IPaginationInfo
+ {
+ bool PaginateChildren { get; }
+ int Weight { get; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IParserAccessor.cs b/mcs/class/System.Web/System.Web.UI/IParserAccessor.cs
new file mode 100644
index 00000000000..f49d8338393
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IParserAccessor.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.UI.IParserAccessor.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IParserAccessor
+ {
+ void AddParsedSubObject(object obj);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IPostBackDataHandler.cs b/mcs/class/System.Web/System.Web.UI/IPostBackDataHandler.cs
new file mode 100644
index 00000000000..4b3ff911600
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IPostBackDataHandler.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.IPostBackDataHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Web;
+using System.Collections.Specialized;
+
+namespace System.Web.UI
+{
+ public interface IPostBackDataHandler
+ {
+ bool LoadPostData(string postDataKey, NameValueCollection postCollection);
+ void RaisePostDataChangedEvent();
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IPostBackEventHandler.cs b/mcs/class/System.Web/System.Web.UI/IPostBackEventHandler.cs
new file mode 100644
index 00000000000..94daa507243
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IPostBackEventHandler.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.UI.IPostBackEventHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IPostBackEventHandler
+ {
+ void RaisePostBackEvent(string eventArgument);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IResourceResolutionService.cs b/mcs/class/System.Web/System.Web.UI/IResourceResolutionService.cs
new file mode 100644
index 00000000000..0db76bce114
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IResourceResolutionService.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.IResourceResolutionService.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+using System.Collections;
+
+namespace System.Web.UI
+{
+ public interface IResourceResolutionService
+ {
+ IDictionary GetPagedResources ();
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IResourceUrlGenerator.cs b/mcs/class/System.Web/System.Web.UI/IResourceUrlGenerator.cs
new file mode 100644
index 00000000000..1416478a81c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IResourceUrlGenerator.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.IResourceUrlGenerator.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface IResourceUrlGenerator
+ {
+ string GetResourceUrl (Type type, string resource);
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IStateFormatter.cs b/mcs/class/System.Web/System.Web.UI/IStateFormatter.cs
new file mode 100644
index 00000000000..877c326bd22
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IStateFormatter.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.IStateFormatter.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface IStateFormatter
+ {
+ object Deserialize (string serializationState);
+ string Serialize (object state);
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IStateManager.cs b/mcs/class/System.Web/System.Web.UI/IStateManager.cs
new file mode 100644
index 00000000000..988946e8f5d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IStateManager.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.IStateManager.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IStateManager
+ {
+ void LoadViewState(object state);
+ object SaveViewState();
+ void TrackViewState();
+ bool IsTrackingViewState { get; }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IStaticTextControl.cs b/mcs/class/System.Web/System.Web.UI/IStaticTextControl.cs
new file mode 100644
index 00000000000..8e77249442a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IStaticTextControl.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.IStaticTextControl.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface IStaticTextControl
+ {
+ string Text { get; set; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IStyleSheet.cs b/mcs/class/System.Web/System.Web.UI/IStyleSheet.cs
new file mode 100644
index 00000000000..e6fd19a4ae7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IStyleSheet.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.UI.IStyleSheet.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI
+{
+ public interface IStyleSheet
+ {
+ void CreateStyleRule (Style style, string selection, IUrlResolutionService urlResolver);
+ void RegisterStyle (Style style, IUrlResolutionService urlResolver);
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/ITagNameToTypeMapper.cs b/mcs/class/System.Web/System.Web.UI/ITagNameToTypeMapper.cs
new file mode 100644
index 00000000000..662315f85a3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ITagNameToTypeMapper.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.UI.ITagNameToTypeMapper.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Web;
+using System.Collections;
+
+namespace System.Web.UI
+{
+ interface ITagNameToTypeMapper
+ {
+ Type GetControlType(string tagName, IDictionary attribs);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ITemplate.cs b/mcs/class/System.Web/System.Web.UI/ITemplate.cs
new file mode 100644
index 00000000000..9ebb6a470ee
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ITemplate.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.UI.ITemplate.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface ITemplate
+ {
+ void InstantiateIn(Control container);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ITextControl.cs b/mcs/class/System.Web/System.Web.UI/ITextControl.cs
new file mode 100644
index 00000000000..dfa1bd1f48d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ITextControl.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.ITextControl.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public interface ITextControl
+ {
+ string Text { get; set; }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IThemeResolutionService.cs b/mcs/class/System.Web/System.Web.UI/IThemeResolutionService.cs
new file mode 100644
index 00000000000..428595b40a2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IThemeResolutionService.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.UI.IThemeResolutionService.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+using System.Collections;
+
+namespace System.Web.UI
+{
+ public interface IThemeResolutionService
+ {
+ ThemeProvider [] GetAllThemeProviders ();
+ ThemeProvider GetThemeProvider ();
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IUrlResolutionService.cs b/mcs/class/System.Web/System.Web.UI/IUrlResolutionService.cs
new file mode 100644
index 00000000000..4ca78a0c541
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IUrlResolutionService.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.IUrlResolutionService.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+using System.Collections;
+
+namespace System.Web.UI
+{
+ public interface IUrlResolutionService
+ {
+ string ResolveClientUrl (string url);
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IUserControlDesignerAccessor.cs b/mcs/class/System.Web/System.Web.UI/IUserControlDesignerAccessor.cs
new file mode 100644
index 00000000000..064d994dd0f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IUserControlDesignerAccessor.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.UI.IUserControlDesignerAccessor.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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.
+//
+
+namespace System.Web.UI
+{
+ public interface IUserControlDesignerAccessor
+ {
+ string InnerText { get; set; }
+ string TagName { get; set; }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IUserControlTypeResolutionService.cs b/mcs/class/System.Web/System.Web.UI/IUserControlTypeResolutionService.cs
new file mode 100644
index 00000000000..ce245b2e3b2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IUserControlTypeResolutionService.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.IUserControlTypeResolutionService.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+
+#if NET_2_0
+using System;
+using System.Collections;
+
+namespace System.Web.UI
+{
+ public interface IUserControlTypeResolutionService
+ {
+ Type GetType (string prefixTag, string tagName);
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/IValidator.cs b/mcs/class/System.Web/System.Web.UI/IValidator.cs
new file mode 100644
index 00000000000..60aed884c7c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IValidator.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.IValidator.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IValidator
+ {
+ void Validate();
+ string ErrorMessage {get; set;}
+ bool IsValid {get; set;}
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IgnoreUnknownContentAttribute.cs b/mcs/class/System.Web/System.Web.UI/IgnoreUnknownContentAttribute.cs
new file mode 100644
index 00000000000..6a14369d018
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IgnoreUnknownContentAttribute.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.UI.IgnoreUnknownContentAttribute.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Property)]
+ internal sealed class IgnoreUnknownContentAttribute : Attribute
+ {
+
+ public IgnoreUnknownContentAttribute ()
+ {
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/ImageClickEventArgs.cs b/mcs/class/System.Web/System.Web.UI/ImageClickEventArgs.cs
new file mode 100755
index 00000000000..133ce48e78d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ImageClickEventArgs.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.UI.ImageClickEventArgs.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+//
+// 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;
+
+namespace System.Web.UI {
+ public sealed class ImageClickEventArgs : EventArgs
+ {
+ public ImageClickEventArgs (int x, int y)
+ {
+ X = x;
+ Y = y;
+ }
+
+ public int X;
+ public int Y;
+ }
+}
+
+
diff --git a/mcs/class/System.Web/System.Web.UI/ImageClickEventHandler.cs b/mcs/class/System.Web/System.Web.UI/ImageClickEventHandler.cs
new file mode 100644
index 00000000000..b3609051dd6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ImageClickEventHandler.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.UI.ImageClickEventHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public delegate void ImageClickEventHandler(object sender, ImageClickEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI/KeyedList.cs b/mcs/class/System.Web/System.Web.UI/KeyedList.cs
new file mode 100644
index 00000000000..a91c82ea696
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/KeyedList.cs
@@ -0,0 +1,216 @@
+//
+// System.Web.UI/KeyedList.cs
+//
+// Author: Todd Berman <tberman@gentoo.org>
+//
+// (C) 2003 Todd Berman
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI
+{
+
+ public class KeyedList : IOrderedDictionary, IStateManager
+ {
+
+ private Hashtable objectTable = new Hashtable ();
+ private ArrayList objectList = new ArrayList ();
+
+ public void Add (object key, object value)
+ {
+ objectTable.Add (key, value);
+ objectList.Add (new DictionaryEntry (key, value));
+ }
+
+ public void Clear ()
+ {
+ objectTable.Clear ();
+ objectList.Clear ();
+ }
+
+ public bool Contains (object key)
+ {
+ return objectTable.Contains (key);
+ }
+
+ public void CopyTo (Array array, int idx)
+ {
+ objectTable.CopyTo (array, idx);
+ }
+
+ public void Insert (int idx, object key, object value)
+ {
+ if (idx > Count)
+ throw new ArgumentOutOfRangeException ("index");
+
+ objectTable.Add (key, value);
+ objectList.Insert (idx, new DictionaryEntry (key, value));
+ }
+
+ public void Remove (object key)
+ {
+ objectTable.Remove (key);
+ objectList.RemoveAt (IndexOf (key));
+ }
+
+ public void RemoveAt (int idx)
+ {
+ if (idx >= Count)
+ throw new ArgumentOutOfRangeException ("index");
+
+ objectTable.Remove ( ((DictionaryEntry)objectList[idx]).Key );
+ objectList.RemoveAt (idx);
+ }
+
+ IDictionaryEnumerator IDictionary.GetEnumerator ()
+ {
+ return new KeyedListEnumerator (objectList);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return new KeyedListEnumerator (objectList);
+ }
+
+ void IStateManager.LoadViewState (object state)
+ {
+ if (state != null)
+ {
+ object[] states = (object[]) state;
+ if (states[0] != null) {
+ objectList = (ArrayList) states[0];
+ for (int i = 0; i < objectList.Count; i++)
+ {
+ DictionaryEntry pair = (DictionaryEntry) objectList[i];
+ objectTable.Add (pair.Key, pair.Value);
+ }
+ }
+ }
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ object[] ret = new object[] { objectList };
+ if (ret[0] == null)
+ return null;
+
+ return ret;
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ trackViewState = true;
+ }
+
+ public int Count {
+ get { return objectList.Count; }
+ }
+
+ public bool IsFixedSize {
+ get { return false; }
+ }
+
+ public bool IsReadOnly {
+ get { return false; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public object this[int idx] {
+ get { return ((DictionaryEntry) objectList[idx]).Value; }
+ set {
+ if (idx < 0 || idx >= Count)
+ throw new ArgumentOutOfRangeException ("index");
+
+ object key = ((DictionaryEntry) objectList[idx]).Key;
+ objectList[idx] = new DictionaryEntry (key, value);
+ objectTable[key] = value;
+ }
+ }
+
+ public object this[object key] {
+ get { return objectTable[key]; }
+ set {
+ if (objectTable.Contains (key))
+ {
+ objectTable[key] = value;
+ objectTable[IndexOf (key)] = new DictionaryEntry (key, value);
+ return;
+ }
+ Add (key, value);
+ }
+ }
+
+ public ICollection Keys {
+ get {
+ ArrayList retList = new ArrayList ();
+ for (int i = 0; i < objectList.Count; i++)
+ {
+ retList.Add ( ((DictionaryEntry)objectList[i]).Key );
+ }
+ return retList;
+ }
+ }
+
+ public ICollection Values {
+ get {
+ ArrayList retList = new ArrayList ();
+ for (int i = 0; i < objectList.Count; i++)
+ {
+ retList.Add ( ((DictionaryEntry)objectList[i]).Value );
+ }
+ return retList;
+ }
+ }
+
+ public object SyncRoot {
+ get { return this; }
+ }
+
+ private bool trackViewState;
+
+ bool IStateManager.IsTrackingViewState {
+ get { return trackViewState; }
+ }
+
+ private int IndexOf (object key)
+ {
+ for (int i = 0; i < objectList.Count; i++)
+ {
+ if (((DictionaryEntry) objectList[i]).Key.Equals (key))
+ {
+ return i;
+ }
+ }
+ return -1;
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/KeyedListEnumerator.cs b/mcs/class/System.Web/System.Web.UI/KeyedListEnumerator.cs
new file mode 100644
index 00000000000..8abe067aadc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/KeyedListEnumerator.cs
@@ -0,0 +1,88 @@
+//
+// System.Web.UI/KeyedListEnumerator.cs
+//
+// Author: Todd Berman <tberman@gentoo.org>
+//
+// (C) 2003 Todd Berman
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System.Collections;
+
+namespace System.Web.UI
+{
+ public class KeyedListEnumerator : IDictionaryEnumerator
+ {
+ private int index = -1;
+ private ArrayList objs;
+
+ internal KeyedListEnumerator (ArrayList list)
+ {
+ objs = list;
+ }
+
+ public bool MoveNext ()
+ {
+ index++;
+ if (index >= objs.Count)
+ return false;
+
+ return true;
+ }
+
+ public void Reset ()
+ {
+ index = -1;
+ }
+
+ public object Current {
+ get {
+ if (index < 0 || index >= objs.Count)
+ throw new InvalidOperationException ();
+
+ return objs[index];
+ }
+ }
+
+ public DictionaryEntry Entry {
+ get {
+ return (DictionaryEntry) Current;
+ }
+ }
+
+ public object Key {
+ get {
+ return Entry.Key;
+ }
+ }
+
+ public object Value {
+ get {
+ return Entry.Value;
+ }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/ListSourceHelper.cs b/mcs/class/System.Web/System.Web.UI/ListSourceHelper.cs
new file mode 100644
index 00000000000..d423f9e47de
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ListSourceHelper.cs
@@ -0,0 +1,56 @@
+//
+// System.Web.UI.ListSourceHelper
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.UI {
+ public sealed class ListSourceHelper {
+ private ListSourceHelper () {}
+
+ [MonoTODO]
+ public static bool ContainsListCollection (IDataSource dataSource)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static IList GetList (IDataSource dataSource)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/LiteralControl.cs b/mcs/class/System.Web/System.Web.UI/LiteralControl.cs
new file mode 100644
index 00000000000..93002f71467
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/LiteralControl.cs
@@ -0,0 +1,71 @@
+//
+// System.Web.UI.LiteralControl.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) Bob Smith
+// Copyright (c) 2002-2004 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
+// "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;
+using System.ComponentModel;
+using System.Web;
+
+namespace System.Web.UI
+{
+ [ToolboxItem(false)]
+ public class LiteralControl : Control
+ {
+ string _text;
+
+ public LiteralControl () : this (null) {}
+
+ public LiteralControl (string text)
+ {
+ EnableViewState = false;
+ PreventAutoID ();
+ _text = (text == null) ? "" : text; // Text property is not called for this.
+ }
+
+ public virtual string Text {
+ get { return _text; }
+ set {
+ _text = (value == null) ? "" : value;
+ }
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ writer.Write (_text);
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new EmptyControlCollection (this);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/LosFormatter.cs b/mcs/class/System.Web/System.Web.UI/LosFormatter.cs
new file mode 100644
index 00000000000..b445257657f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/LosFormatter.cs
@@ -0,0 +1,80 @@
+//
+// System.Web.UI.LosFormatter
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.IO;
+
+
+namespace System.Web.UI {
+ public sealed class LosFormatter {
+
+ ObjectStateFormatter osf = new ObjectStateFormatter ();
+
+ public LosFormatter ()
+ {
+ }
+
+#if NET_1_1
+ [MonoTODO]
+ public LosFormatter (bool enableMac, string macKeyModifier)
+ {
+ }
+#endif
+ public object Deserialize (Stream stream)
+ {
+ return osf.Deserialize (stream);
+ }
+
+ public object Deserialize (TextReader input)
+ {
+ if (input == null)
+ throw new ArgumentNullException ("input");
+
+ return Deserialize (input.ReadToEnd ());
+ }
+
+ public object Deserialize (string input)
+ {
+ return osf.Deserialize (input);
+ }
+
+ public void Serialize (Stream stream, object value)
+ {
+ osf.Serialize (stream, value);
+ }
+
+ public void Serialize (TextWriter output, object value)
+ {
+ if (output == null)
+ throw new ArgumentNullException ("output");
+
+ output.Write (osf.Serialize (value));
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/MasterPage.cs b/mcs/class/System.Web/System.Web.UI/MasterPage.cs
new file mode 100644
index 00000000000..08075e9ed5d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/MasterPage.cs
@@ -0,0 +1,69 @@
+//
+// System.Web.UI.MasterPage.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 Novell, Inc.
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI
+{
+ public class MasterPage: UserControl
+ {
+ Hashtable templates = new Hashtable ();
+ ArrayList placeholders = new ArrayList ();
+
+ protected internal void AddContentTemplate (string templateName, ITemplate template)
+ {
+ templates [templateName] = template;
+ }
+
+ protected internal IList ContentPlaceHolders {
+ get { return placeholders; }
+ }
+
+ protected internal ICollection ContentTemplates {
+ get { return templates; }
+ }
+
+ internal void FillPlaceHolders ()
+ {
+ foreach (ContentPlaceHolder place in placeholders) {
+ ITemplate template = templates [place.ID] as ITemplate;
+ if (template != null)
+ template.InstantiateIn (place);
+ }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/MasterPageParser.cs b/mcs/class/System.Web/System.Web.UI/MasterPageParser.cs
new file mode 100644
index 00000000000..ac8a9407e5e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/MasterPageParser.cs
@@ -0,0 +1,69 @@
+//
+// System.Web.UI.MasterPageParser
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2005 Novell, Inc.
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Web;
+using System.Web.Compilation;
+using System.Web.Util;
+
+namespace System.Web.UI
+{
+ internal sealed class MasterPageParser: UserControlParser
+ {
+ internal MasterPageParser (string virtualPath, string inputFile, HttpContext context)
+ : base (virtualPath, inputFile, context, "System.Web.UI.MasterPage")
+ {
+ }
+
+ public static MasterPage GetCompiledMasterInstance (string virtualPath, string inputFile, HttpContext context)
+ {
+ MasterPageParser mpp = new MasterPageParser (virtualPath, inputFile, context);
+ return (MasterPage) mpp.GetCompiledInstance ();
+ }
+
+ internal override Type DefaultBaseType {
+ get { return typeof (MasterPage); }
+ }
+
+ internal override string DefaultBaseTypeName {
+ get { return "System.Web.UI.MasterPage"; }
+ }
+
+ internal override string DefaultDirectiveName {
+ get { return "master"; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/ObjectConverter.cs b/mcs/class/System.Web/System.Web.UI/ObjectConverter.cs
new file mode 100644
index 00000000000..2822f494c43
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ObjectConverter.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.UI.ObjectConverter
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 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
+// "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.
+//
+
+namespace System.Web.UI
+{
+ [Obsolete ("Use the System.Convert class and String.Format instead", false)]
+ public sealed class ObjectConverter
+ {
+ public static object ConvertValue (object value, Type toType, string formatString)
+ {
+ throw new NotImplementedException ("Not implemented and [Obsolete]");
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/ObjectStateFormatter.cs b/mcs/class/System.Web/System.Web.UI/ObjectStateFormatter.cs
new file mode 100644
index 00000000000..678e939f518
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ObjectStateFormatter.cs
@@ -0,0 +1,877 @@
+//
+// System.Web.UI.ObjectStateFormatter
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) 2003 Ben Maurer
+// (c) Copyright 2004 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
+// "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.
+//
+
+//#define TRACE
+
+using System.Collections;
+using System.ComponentModel;
+using System.Globalization;
+using System.Drawing;
+using System.IO;
+using System.Reflection;
+using System.Runtime.Serialization.Formatters.Binary;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Web.UI.WebControls;
+using System.Web.Util;
+using System.Diagnostics;
+
+namespace System.Web.UI {
+ #if NET_2_0
+ public
+ #else
+ internal
+ #endif
+ sealed class ObjectStateFormatter : IFormatter {
+ public object Deserialize (Stream inputStream)
+ {
+ if (inputStream == null)
+ throw new ArgumentNullException ("inputStream");
+
+ return DeserializeObject (new BinaryReader (inputStream));
+ }
+
+ public object Deserialize (string inputString)
+ {
+ if (inputString == null)
+ throw new ArgumentNullException ("inputString");
+
+ if (inputString == "")
+ return null;
+
+ return Deserialize (new MemoryStream (Convert.FromBase64String (inputString)));
+ }
+
+ public string Serialize (object stateGraph)
+ {
+ if (stateGraph == null)
+ return "";
+
+ MemoryStream ms = new MemoryStream ();
+ Serialize (ms, stateGraph);
+
+ #if TRACE
+ ms.WriteTo (File.OpenWrite (Path.GetTempFileName ()));
+ #endif
+
+ return Convert.ToBase64String (ms.GetBuffer (), 0, (int) ms.Length);
+ }
+
+ public void Serialize (Stream outputStream, object stateGraph)
+ {
+ if (outputStream == null)
+ throw new ArgumentNullException ("outputStream");
+
+ if (stateGraph == null)
+ throw new ArgumentNullException ("stateGraph");
+
+ SerializeValue (new BinaryWriter (outputStream), stateGraph);
+ }
+
+ void SerializeValue (BinaryWriter w, object o)
+ {
+ ObjectFormatter.WriteObject (w, o, new WriterContext ());
+ }
+
+ object DeserializeObject (BinaryReader r)
+ {
+ return ObjectFormatter.ReadObject (r, new ReaderContext ());
+ }
+
+ #region IFormatter
+
+ object IFormatter.Deserialize (Stream serializationStream)
+ {
+ return Deserialize (serializationStream);
+ }
+
+ void IFormatter.Serialize (Stream serializationStream, object stateGraph)
+ {
+ Serialize (serializationStream, stateGraph);
+ }
+
+ SerializationBinder IFormatter.Binder {
+ get { return null; }
+ set { }
+ }
+
+ StreamingContext IFormatter.Context {
+ get { return new StreamingContext (StreamingContextStates.All); }
+ set { }
+ }
+
+ ISurrogateSelector IFormatter.SurrogateSelector {
+ get { return null; }
+ set { }
+ }
+
+ #endregion
+
+ #region Object Readers/Writers
+
+ class WriterContext {
+ Hashtable cache;
+ short nextKey = 0;
+
+ public bool RegisterCache (object o, out short key)
+ {
+ if (cache == null) {
+ cache = new Hashtable ();
+ cache.Add (o, key = nextKey++);
+ return false;
+ }
+
+ object posKey = cache [o];
+ if (posKey == null) {
+ cache.Add (o, key = nextKey++);
+ return false;
+ }
+
+ key = (short) posKey;
+ return true;
+ }
+ }
+
+ class ReaderContext {
+ ArrayList cache;
+
+ public void CacheItem (object o)
+ {
+ if (cache == null)
+ cache = new ArrayList ();
+
+ cache.Add (o);
+ }
+
+ public object GetCache (short key)
+ {
+ return cache [key];
+ }
+ }
+
+ abstract class ObjectFormatter {
+ static readonly Hashtable writeMap = new Hashtable ();
+ static ObjectFormatter [] readMap = new ObjectFormatter [256];
+ static BinaryObjectFormatter binaryObjectFormatter;
+ static TypeFormatter typeFormatter;
+ static EnumFormatter enumFormatter;
+ static SingleRankArrayFormatter singleRankArrayFormatter;
+ static TypeConverterFormatter typeConverterFormatter;
+
+ static ObjectFormatter ()
+ {
+ new StringFormatter ().Register ();
+ new Int64Formatter ().Register ();
+ new Int32Formatter ().Register ();
+ new Int16Formatter ().Register ();
+ new ByteFormatter ().Register ();
+ new BooleanFormatter ().Register ();
+ new CharFormatter ().Register ();
+ new DateTimeFormatter ().Register ();
+ new PairFormatter ().Register ();
+ new TripletFormatter ().Register ();
+ new ArrayListFormatter ().Register ();
+ new HashtableFormatter ().Register ();
+ new ObjectArrayFormatter ().Register ();
+ new UnitFormatter ().Register ();
+ new FontUnitFormatter ().Register ();
+
+ new ColorFormatter ().Register ();
+
+ enumFormatter = new EnumFormatter ();
+ enumFormatter.Register ();
+
+ typeFormatter = new TypeFormatter ();
+ typeFormatter.Register ();
+
+ singleRankArrayFormatter = new SingleRankArrayFormatter ();
+ singleRankArrayFormatter.Register ();
+
+ typeConverterFormatter = new TypeConverterFormatter ();
+ typeConverterFormatter.Register ();
+
+ binaryObjectFormatter = new BinaryObjectFormatter ();
+ binaryObjectFormatter.Register ();
+ }
+
+ // 0 == null
+ static byte nextId = 1;
+
+ public ObjectFormatter ()
+ {
+ PrimaryId = nextId ++;
+ if (NumberOfIds == 1)
+ return;
+
+ SecondaryId = nextId ++;
+ if (NumberOfIds == 2)
+ return;
+
+ TertiaryId = nextId ++;
+ if (NumberOfIds == 3)
+ return;
+
+ throw new Exception ();
+ }
+
+ protected readonly byte PrimaryId, SecondaryId = 255, TertiaryId = 255;
+
+ protected abstract void Write (BinaryWriter w, object o, WriterContext ctx);
+ protected abstract object Read (byte token, BinaryReader r, ReaderContext ctx);
+ protected abstract Type Type { get; }
+ protected virtual int NumberOfIds { get { return 1; } }
+
+ public virtual void Register ()
+ {
+ writeMap [Type] = this;
+ readMap [PrimaryId] = this;
+ if (SecondaryId != 255) {
+ readMap [SecondaryId] = this;
+ if (TertiaryId != 255)
+ readMap [TertiaryId] = this;
+ }
+ }
+
+ public static void WriteObject (BinaryWriter w, object o, WriterContext ctx)
+ {
+ #if TRACE
+ if (o != null) {
+ Trace.WriteLine (String.Format ("Writing {0} (type: {1})", o, o.GetType ()));
+ Trace.Indent ();
+ } else {
+ Trace.WriteLine ("Writing null");
+ }
+ long pos = w.BaseStream.Position;
+ #endif
+
+ if (o == null) {
+ w.Write ((byte) 0);
+ return;
+ }
+
+ Type t = o.GetType ();
+
+ ObjectFormatter fmt = writeMap [t] as ObjectFormatter;
+ if (fmt == null) {
+ // Handle abstract types here
+
+ if (o is Type)
+ fmt = typeFormatter;
+ else if (t.IsEnum)
+ fmt = enumFormatter;
+ else if (t.IsArray && ((Array) o).Rank == 1)
+ fmt = singleRankArrayFormatter;
+ else {
+ TypeConverter converter;
+ converter = TypeDescriptor.GetConverter (o);
+ if (converter == null ||
+ !converter.CanConvertTo (typeof (string)) ||
+ !converter.CanConvertFrom (typeof (string))) {
+ fmt = binaryObjectFormatter;
+ } else {
+ typeConverterFormatter.Converter = converter;
+ fmt = typeConverterFormatter;
+ }
+ }
+ }
+
+ fmt.Write (w, o, ctx);
+ #if TRACE
+ Trace.Unindent ();
+ Trace.WriteLine (String.Format ("Wrote {0} (type: {1}) {2} bytes", o, o.GetType (), w.BaseStream.Position - pos));
+ #endif
+ }
+
+ public static object ReadObject (BinaryReader r, ReaderContext ctx)
+ {
+ byte sig = r.ReadByte ();
+
+ if (sig == 0)
+ return null;
+
+ return readMap [sig].Read (sig, r, ctx);
+ }
+
+ protected void Write7BitEncodedInt (BinaryWriter w, int value)
+ {
+ do {
+ int high = (value >> 7) & 0x01ffffff;
+ byte b = (byte)(value & 0x7f);
+
+ if (high != 0) {
+ b = (byte)(b | 0x80);
+ }
+
+ w.Write(b);
+ value = high;
+ } while(value != 0);
+ }
+
+ protected int Read7BitEncodedInt (BinaryReader r)
+ {
+ int ret = 0;
+ int shift = 0;
+ byte b;
+
+ do {
+ b = r.ReadByte();
+
+ ret = ret | ((b & 0x7f) << shift);
+ shift += 7;
+ } while ((b & 0x80) == 0x80);
+
+ return ret;
+ }
+ }
+
+ #region Primitive Formatters
+ class StringFormatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ short key;
+ if (ctx.RegisterCache (o, out key)) {
+ w.Write (SecondaryId);
+ w.Write (key);
+ } else {
+ w.Write (PrimaryId);
+ w.Write ((string)o);
+ }
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ if (token == PrimaryId) {
+ string s = r.ReadString ();
+ ctx.CacheItem (s);
+ return s;
+ } else {
+ return ctx.GetCache (r.ReadInt16 ());
+ }
+ }
+ protected override Type Type {
+ get { return typeof (string); }
+ }
+
+ protected override int NumberOfIds {
+ get { return 2; }
+ }
+ }
+
+ class Int64Formatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ w.Write (PrimaryId);
+ w.Write ((long)o);
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ return r.ReadInt64 ();
+ }
+ protected override Type Type {
+ get { return typeof (long); }
+ }
+ }
+
+ class Int32Formatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ int i = (int) o;
+ if ((int)(byte) i == i) {
+ w.Write (SecondaryId);
+ w.Write ((byte) i);
+ } else {
+ w.Write (PrimaryId);
+ w.Write (i);
+ }
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ if (token == PrimaryId)
+ return r.ReadInt32 ();
+ else
+ return (int) r.ReadByte ();
+ }
+ protected override Type Type {
+ get { return typeof (int); }
+ }
+
+ protected override int NumberOfIds {
+ get { return 2; }
+ }
+ }
+
+ class Int16Formatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ w.Write (PrimaryId);
+ w.Write ((short)o);
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ return r.ReadInt16 ();
+ }
+ protected override Type Type {
+ get { return typeof (short); }
+ }
+ }
+
+ class ByteFormatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ w.Write (PrimaryId);
+ w.Write ((byte)o);
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ return r.ReadByte ();
+ }
+ protected override Type Type {
+ get { return typeof (byte); }
+ }
+ }
+
+ class BooleanFormatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ if ((bool)o == true)
+ w.Write (PrimaryId);
+ else
+ w.Write (SecondaryId);
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ return token == PrimaryId;
+ }
+
+ protected override Type Type {
+ get { return typeof (bool); }
+ }
+
+ protected override int NumberOfIds {
+ get { return 2; }
+ }
+ }
+
+ class CharFormatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ w.Write (PrimaryId);
+ w.Write ((char) o);
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ return r.ReadChar ();
+ }
+
+ protected override Type Type {
+ get { return typeof (char); }
+ }
+ }
+
+ class DateTimeFormatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ w.Write (PrimaryId);
+ w.Write (((DateTime) o).Ticks);
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ return new DateTime (r.ReadInt64 ());
+ }
+
+ protected override Type Type {
+ get { return typeof (DateTime); }
+ }
+ }
+
+ class PairFormatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ Pair p = (Pair) o;
+ w.Write (PrimaryId);
+ WriteObject (w, p.First, ctx);
+ WriteObject (w, p.Second, ctx);
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ Pair p = new Pair ();
+ p.First = ReadObject (r, ctx);
+ p.Second = ReadObject (r, ctx);
+ return p;
+ }
+
+ protected override Type Type {
+ get { return typeof (Pair); }
+ }
+ }
+
+ class TripletFormatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ Triplet t = (Triplet) o;
+ w.Write (PrimaryId);
+ WriteObject (w, t.First, ctx);
+ WriteObject (w, t.Second, ctx);
+ WriteObject (w, t.Third, ctx);
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ Triplet t = new Triplet ();
+ t.First = ReadObject (r, ctx);
+ t.Second = ReadObject (r, ctx);
+ t.Third = ReadObject (r, ctx);
+ return t;
+ }
+
+ protected override Type Type {
+ get { return typeof (Triplet); }
+ }
+ }
+
+ class ArrayListFormatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ ArrayList l = (ArrayList) o;
+
+ w.Write (PrimaryId);
+ Write7BitEncodedInt (w, l.Count);
+ foreach (object i in l)
+ WriteObject (w, i, ctx);
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ int len = Read7BitEncodedInt (r);
+ ArrayList l = new ArrayList (len);
+
+ for (int i = 0; i < len; i++)
+ l.Add (ReadObject (r, ctx));
+
+ return l;
+ }
+
+ protected override Type Type {
+ get { return typeof (ArrayList); }
+ }
+ }
+
+ class HashtableFormatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ Hashtable ht = (Hashtable) o;
+
+ w.Write (PrimaryId);
+ Write7BitEncodedInt (w, ht.Count);
+ foreach (DictionaryEntry de in ht) {
+ WriteObject (w, de.Key, ctx);
+ WriteObject (w, de.Value, ctx);
+ }
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ int len = Read7BitEncodedInt (r);
+ Hashtable ht = new Hashtable (len);
+
+ for (int i = 0; i < len; i++) {
+ object key = ReadObject (r, ctx);
+ object val = ReadObject (r, ctx);
+
+ ht.Add (key, val);
+ }
+
+ return ht;
+ }
+
+ protected override Type Type {
+ get { return typeof (Hashtable); }
+ }
+ }
+
+ class ObjectArrayFormatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ object [] val = (object []) o;
+
+ w.Write (PrimaryId);
+ Write7BitEncodedInt (w, val.Length);
+ foreach (object i in val)
+ WriteObject (w, i, ctx);
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ int len = Read7BitEncodedInt (r);
+ object [] ret = new object [len];
+
+ for (int i = 0; i < len; i++)
+ ret [i] = ReadObject (r, ctx);
+
+ return ret;
+ }
+
+ protected override Type Type {
+ get { return typeof (object []); }
+ }
+ }
+
+ #endregion
+
+ #region System.Web Optimizations
+ class ColorFormatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ Color c = (Color) o;
+
+ if (!c.IsKnownColor) {
+ w.Write (PrimaryId);
+ w.Write (c.ToArgb ());
+ } else {
+ w.Write (SecondaryId);
+ w.Write ((int) c.ToKnownColor ());
+ }
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ if (token == PrimaryId)
+ return Color.FromArgb (r.ReadInt32 ());
+ else
+ return Color.FromKnownColor ((KnownColor) r.ReadInt32 ());
+ }
+
+ protected override Type Type {
+ get { return typeof (Color); }
+ }
+
+ protected override int NumberOfIds {
+ get { return 2; }
+ }
+ }
+
+ #endregion
+
+ #region Special Formatters
+ class EnumFormatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ object value = Convert.ChangeType (o, ((Enum) o).GetTypeCode ());
+ w.Write (PrimaryId);
+ WriteObject (w, o.GetType (), ctx);
+ WriteObject (w, value, ctx);
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ Type t = (Type) ReadObject (r, ctx);
+ object value = ReadObject (r, ctx);
+
+ return Enum.ToObject (t, value);
+ }
+ protected override Type Type {
+ get { return typeof (Enum); }
+ }
+ }
+
+ class TypeFormatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ short key;
+ if (ctx.RegisterCache (o, out key)) {
+ w.Write (SecondaryId);
+ w.Write (key);
+ } else {
+ w.Write (PrimaryId);
+ w.Write (((Type) o).FullName);
+
+ // We should cache the name of the assembly
+ w.Write (((Type) o).Assembly.FullName);
+ }
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ if (token == PrimaryId) {
+ string type = r.ReadString ();
+ string assembly = r.ReadString ();
+
+ Type t = Assembly.Load (assembly).GetType (type);
+ ctx.CacheItem (t);
+ return t;
+ } else {
+ return ctx.GetCache (r.ReadInt16 ());
+ }
+ }
+
+ protected override Type Type {
+ get { return typeof (Type); }
+ }
+
+ protected override int NumberOfIds {
+ get { return 2; }
+ }
+ }
+
+ class SingleRankArrayFormatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ Array val = (Array) o;
+
+ w.Write (PrimaryId);
+ WriteObject (w, val.GetType ().GetElementType (), ctx);
+
+ Write7BitEncodedInt (w, val.Length);
+ foreach (object i in val)
+ WriteObject (w, i, ctx);
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ Type t = (Type) ReadObject (r, ctx);
+ int len = Read7BitEncodedInt (r);
+ Array val = Array.CreateInstance (t, len);
+
+ for (int i = 0; i < len; i++)
+ val.SetValue (ReadObject (r, ctx), i);
+
+ return val;
+ }
+
+ protected override Type Type {
+ get { return typeof (Array); }
+ }
+ }
+
+ class FontUnitFormatter : StringFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ base.Write (w, o.ToString (), ctx);
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ return FontUnit.Parse ((string) base.Read (token, r, ctx));
+ }
+
+ protected override Type Type {
+ get { return typeof (FontUnit); }
+ }
+ }
+
+ class UnitFormatter : StringFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ base.Write (w, o.ToString (), ctx);
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ return Unit.Parse ((string) base.Read (token, r, ctx));
+ }
+
+ protected override Type Type {
+ get { return typeof (Unit); }
+ }
+ }
+
+ class TypeConverterFormatter : StringFormatter {
+ TypeConverter converter;
+
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ w.Write (PrimaryId);
+ ObjectFormatter.WriteObject (w, o.GetType (), ctx);
+ string v = (string) converter.ConvertTo (null, CultureInfo.InvariantCulture,
+ o, typeof (string));
+ base.Write (w, v, ctx);
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ Type t = (Type) ObjectFormatter.ReadObject (r, ctx);
+ converter = TypeDescriptor.GetConverter (t);
+ token = r.ReadByte ();
+ string v = (string) base.Read (token, r, ctx);
+ return converter.ConvertFrom (null, CultureInfo.InvariantCulture, v);
+ }
+
+ protected override Type Type {
+ get { return typeof (TypeConverter); }
+ }
+
+ public TypeConverter Converter {
+ set { converter = value; }
+ }
+ }
+
+ class BinaryObjectFormatter : ObjectFormatter {
+ protected override void Write (BinaryWriter w, object o, WriterContext ctx)
+ {
+ w.Write (PrimaryId);
+
+ MemoryStream ms = new MemoryStream (128);
+ new BinaryFormatter ().Serialize (ms, o);
+
+ byte [] buf = ms.GetBuffer ();
+ Write7BitEncodedInt (w, buf.Length);
+ w.Write (buf, 0, buf.Length);
+ }
+
+ protected override object Read (byte token, BinaryReader r, ReaderContext ctx)
+ {
+ int len = Read7BitEncodedInt (r);
+ byte [] buf = r.ReadBytes (len);
+ if (buf.Length != len)
+ throw new Exception ();
+
+ return new BinaryFormatter ().Deserialize (new MemoryStream (buf));
+ }
+
+ protected override Type Type {
+ get { return typeof (object); }
+ }
+ }
+
+ #endregion
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ObjectTag.cs b/mcs/class/System.Web/System.Web.UI/ObjectTag.cs
new file mode 100644
index 00000000000..d28228491a8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ObjectTag.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.UI.ObjectTag
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc. (http://www.ximian.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.
+//
+
+namespace System.Web.UI
+{
+ [ControlBuilder (typeof (ObjectTagBuilder))]
+ class ObjectTag
+ {
+ private ObjectTag()
+ {
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/ObjectTagBuilder.cs b/mcs/class/System.Web/System.Web.UI/ObjectTagBuilder.cs
new file mode 100644
index 00000000000..3a815d6a291
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ObjectTagBuilder.cs
@@ -0,0 +1,105 @@
+//
+// System.Web.UI.ObjectTagBuilder
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc. (http://www.ximian.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;
+using System.Collections;
+using System.Web.Compilation;
+
+namespace System.Web.UI
+{
+ public sealed class ObjectTagBuilder : ControlBuilder
+ {
+ string id;
+ string scope;
+ Type type;
+
+ public ObjectTagBuilder ()
+ {
+ SetTagName ("object");
+ }
+
+ public override void AppendLiteralString (string s)
+ {
+ // Do nothing
+ }
+
+ public override void AppendSubBuilder (ControlBuilder subBuilder)
+ {
+ // Do nothing
+ }
+
+ public override void Init (TemplateParser parser,
+ ControlBuilder parentBuilder,
+ Type type,
+ string tagName,
+ string id,
+ IDictionary attribs)
+ {
+ if (attribs == null)
+ throw new ParseException (parser.Location, "Error in ObjectTag.");
+
+ attribs.Remove ("runat");
+ this.id = attribs ["id"] as string;
+ attribs.Remove ("id");
+ if (this.id == null || this.id.Trim () == "")
+ throw new ParseException (parser.Location, "Object tag must have a valid ID.");
+
+ scope = attribs ["scope"] as string;
+ string className = attribs ["class"] as string;
+ attribs.Remove ("scope");
+ attribs.Remove ("class");
+ if (className == null || className.Trim () == "")
+ throw new ParseException (parser.Location, "Object tag must have 'class' attribute.");
+
+ this.type = parser.LoadType (className);
+ if (this.type == null)
+ throw new ParseException (parser.Location, "Type " + className + " not found.");
+
+ if (attribs ["progid"] != null || attribs ["classid"] != null)
+ throw new ParseException (parser.Location, "ClassID and ProgID are not supported.");
+
+ if (attribs.Count > 0)
+ throw new ParseException (parser.Location, "Unknown attribute");
+ }
+
+ internal Type Type {
+ get { return type; }
+ }
+
+ internal string ObjectID {
+ get { return id; }
+ }
+
+ internal string Scope {
+ get { return scope; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/OutputCacheLocation.cs b/mcs/class/System.Web/System.Web.UI/OutputCacheLocation.cs
new file mode 100644
index 00000000000..39264e44147
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/OutputCacheLocation.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.UI.OutputCacheLocation.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public enum OutputCacheLocation
+ {
+ Any,
+ Client,
+ Downstream,
+ Server,
+ None,
+#if NET_1_1
+ ServerAndClient
+#endif
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/Page.cs b/mcs/class/System.Web/System.Web.UI/Page.cs
new file mode 100755
index 00000000000..2f1abb5e6c9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/Page.cs
@@ -0,0 +1,1430 @@
+//
+// System.Web.UI.Page.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2002,2003 Ximian, Inc. (http://www.ximian.com)
+// (c) 2003 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
+// "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;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.ComponentModel.Design.Serialization;
+using System.Globalization;
+using System.IO;
+using System.Security.Principal;
+using System.Text;
+using System.Threading;
+using System.Web;
+using System.Web.Caching;
+using System.Web.SessionState;
+using System.Web.Util;
+#if NET_2_0
+using System.Web.UI.HtmlControls;
+#endif
+
+namespace System.Web.UI
+{
+
+#if !NET_2_0
+[RootDesignerSerializer ("Microsoft.VSDesigner.WebForms.RootCodeDomSerializer, " + Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design, true)]
+#endif
+[DefaultEvent ("Load"), DesignerCategory ("ASPXCodeBehind")]
+[ToolboxItem (false)]
+[Designer ("System.Web.UI.Design.ControlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+public class Page : TemplateControl, IHttpHandler
+{
+ private bool _viewState = true;
+ private bool _viewStateMac;
+ private string _errorPage;
+ private bool _isValid;
+ private bool _smartNavigation;
+ private int _transactionMode;
+ private HttpContext _context;
+ private ValidatorCollection _validators;
+ private bool renderingForm;
+ private object _savedViewState;
+ private ArrayList _requiresPostBack;
+ private ArrayList _requiresPostBackCopy;
+ private ArrayList requiresPostDataChanged;
+ private IPostBackEventHandler requiresRaiseEvent;
+ private NameValueCollection secondPostData;
+ private bool requiresPostBackScript;
+ private bool postBackScriptRendered;
+ bool handleViewState;
+ string viewStateUserKey;
+ NameValueCollection _requestValueCollection;
+ string clientTarget;
+ ClientScriptManager scriptManager;
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ protected const string postEventArgumentID = "__EVENTARGUMENT";
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ protected const string postEventSourceID = "__EVENTTARGET";
+
+#if NET_2_0
+ internal const string CallbackArgumentID = "__CALLBACKARGUMENT";
+ internal const string CallbackSourceID = "__CALLBACKTARGET";
+ internal const string PreviousPageID = "__PREVIOUSPAGE";
+
+ IPageHeader htmlHeader;
+
+ MasterPage masterPage;
+ string masterPageFile;
+
+ Page previousPage;
+ bool isCrossPagePostBack;
+ ArrayList requireStateControls;
+ Hashtable _validatorsByGroup;
+ HtmlForm _form;
+#endif
+
+ #region Constructor
+ public Page ()
+ {
+ scriptManager = new ClientScriptManager (this);
+ Page = this;
+ }
+
+ #endregion
+
+ #region Properties
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public HttpApplicationState Application
+ {
+ get { return _context.Application; }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+#if NET_2_0
+ public bool AspCompatMode
+ {
+ get { return false; }
+ set { throw new NotImplementedException (); }
+ }
+#else
+ protected bool AspCompatMode
+ {
+ set { throw new NotImplementedException (); }
+ }
+#endif
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+#if NET_2_0
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public bool Buffer
+ {
+ get { return Response.BufferOutput; }
+ set { Response.BufferOutput = value; }
+ }
+#else
+ protected bool Buffer
+ {
+ set { Response.BufferOutput = value; }
+ }
+#endif
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public Cache Cache
+ {
+ get { return _context.Cache; }
+ }
+
+#if NET_2_0
+ [EditorBrowsableAttribute (EditorBrowsableState.Advanced)]
+#endif
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false), DefaultValue ("")]
+ [WebSysDescription ("Value do override the automatic browser detection and force the page to use the specified browser.")]
+ public string ClientTarget
+ {
+ get { return (clientTarget == null) ? "" : clientTarget; }
+ set {
+ clientTarget = value;
+ if (value == "")
+ clientTarget = null;
+ }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+#if NET_2_0
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public int CodePage
+ {
+ get { return Response.ContentEncoding.CodePage; }
+ set { Response.ContentEncoding = Encoding.GetEncoding (value); }
+ }
+#else
+ protected int CodePage
+ {
+ set { Response.ContentEncoding = Encoding.GetEncoding (value); }
+ }
+#endif
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+#if NET_2_0
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public string ContentType
+ {
+ get { return Response.ContentType; }
+ set { Response.ContentType = value; }
+ }
+#else
+ protected string ContentType
+ {
+ set { Response.ContentType = value; }
+ }
+#endif
+
+ protected override HttpContext Context
+ {
+ get {
+ if (_context == null)
+ return HttpContext.Current;
+
+ return _context;
+ }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+#if NET_2_0
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public string Culture
+ {
+ get { return Thread.CurrentThread.CurrentCulture.Name; }
+ set { Thread.CurrentThread.CurrentCulture = new CultureInfo (value); }
+ }
+#else
+ protected string Culture
+ {
+ set { Thread.CurrentThread.CurrentCulture = new CultureInfo (value); }
+ }
+#endif
+
+ [Browsable (false)]
+ public override bool EnableViewState
+ {
+ get { return _viewState; }
+ set { _viewState = value; }
+ }
+
+#if NET_2_0
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+#endif
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ protected bool EnableViewStateMac
+ {
+ get { return _viewStateMac; }
+ set { _viewStateMac = value; }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false), DefaultValue ("")]
+ [WebSysDescription ("The URL of a page used for error redirection.")]
+ public string ErrorPage
+ {
+ get { return _errorPage; }
+ set {
+ _errorPage = value;
+ if (_context != null)
+ _context.ErrorPage = value;
+ }
+ }
+
+#if NET_2_0
+ [Obsolete]
+#endif
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ protected ArrayList FileDependencies
+ {
+ set {
+ if (Response != null)
+ Response.AddFileDependencies (value);
+ }
+ }
+
+ [Browsable (false)]
+ public override string ID
+ {
+ get { return base.ID; }
+ set { base.ID = value; }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public bool IsPostBack
+ {
+ get {
+ return _requestValueCollection != null;
+ }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never), Browsable (false)]
+ public bool IsReusable {
+ get { return false; }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public bool IsValid
+ {
+ get { return _isValid; }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+#if NET_2_0
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public int LCID {
+ get { return Thread.CurrentThread.CurrentCulture.LCID; }
+ set { Thread.CurrentThread.CurrentCulture = new CultureInfo (value); }
+ }
+#else
+ protected int LCID {
+ set { Thread.CurrentThread.CurrentCulture = new CultureInfo (value); }
+ }
+#endif
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public HttpRequest Request
+ {
+ get { return _context.Request; }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public HttpResponse Response
+ {
+ get { return _context.Response; }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+#if NET_2_0
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public string ResponseEncoding
+ {
+ get { return Response.ContentEncoding.WebName; }
+ set { Response.ContentEncoding = Encoding.GetEncoding (value); }
+ }
+#else
+ protected string ResponseEncoding
+ {
+ set { Response.ContentEncoding = Encoding.GetEncoding (value); }
+ }
+#endif
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public HttpServerUtility Server
+ {
+ get {
+ return Context.Server;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public virtual HttpSessionState Session
+ {
+ get {
+ if (_context.Session == null)
+ throw new HttpException ("Session state can only be used " +
+ "when enableSessionState is set to true, either " +
+ "in a configuration file or in the Page directive.");
+
+ return _context.Session;
+ }
+ }
+
+#if NET_2_0
+ [FilterableAttribute (false)]
+#endif
+ [Browsable (false)]
+ public bool SmartNavigation
+ {
+ get { return _smartNavigation; }
+ set { _smartNavigation = value; }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public TraceContext Trace
+ {
+ get { return Context.Trace; }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+#if NET_2_0
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public bool TraceEnabled
+ {
+ get { return Trace.IsEnabled; }
+ set { Trace.IsEnabled = value; }
+ }
+#else
+ protected bool TraceEnabled
+ {
+ set { Trace.IsEnabled = value; }
+ }
+#endif
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+#if NET_2_0
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public TraceMode TraceModeValue
+ {
+ get { return Trace.TraceMode; }
+ set { Trace.TraceMode = value; }
+ }
+#else
+ protected TraceMode TraceModeValue
+ {
+ set { Trace.TraceMode = value; }
+ }
+#endif
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+#if NET_2_0
+ public int TransactionMode
+ {
+ get { return _transactionMode; }
+ set { _transactionMode = value; }
+ }
+#else
+ protected int TransactionMode
+ {
+ set { _transactionMode = value; }
+ }
+#endif
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+#if NET_2_0
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public string UICulture
+ {
+ get { return Thread.CurrentThread.CurrentUICulture.Name; }
+ set { Thread.CurrentThread.CurrentUICulture = new CultureInfo (value); }
+ }
+#else
+ protected string UICulture
+ {
+ set { Thread.CurrentThread.CurrentUICulture = new CultureInfo (value); }
+ }
+#endif
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public IPrincipal User
+ {
+ get { return _context.User; }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public ValidatorCollection Validators
+ {
+ get {
+ if (_validators == null)
+ _validators = new ValidatorCollection ();
+ return _validators;
+ }
+ }
+
+ [MonoTODO ("Use this when encrypting/decrypting ViewState")]
+ [Browsable (false)]
+ public string ViewStateUserKey {
+ get { return viewStateUserKey; }
+ set { viewStateUserKey = value; }
+ }
+
+ [Browsable (false)]
+ public override bool Visible
+ {
+ get { return base.Visible; }
+ set { base.Visible = value; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ protected IAsyncResult AspCompatBeginProcessRequest (HttpContext context,
+ AsyncCallback cb,
+ object extraData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ protected void AspCompatEndProcessRequest (IAsyncResult result)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected virtual HtmlTextWriter CreateHtmlTextWriter (TextWriter tw)
+ {
+ return new HtmlTextWriter (tw);
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public void DesignerInitialize ()
+ {
+ InitRecursive (null);
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected virtual NameValueCollection DeterminePostBackMode ()
+ {
+ if (_context == null)
+ return null;
+
+ HttpRequest req = _context.Request;
+ if (req == null)
+ return null;
+
+ NameValueCollection coll = null;
+ if (0 == String.Compare (Request.HttpMethod, "POST", true))
+ coll = req.Form;
+ else
+ coll = req.QueryString;
+
+
+ if (coll == null || coll ["__VIEWSTATE"] == null)
+ return null;
+
+ return coll;
+ }
+
+#if NET_2_0
+ [Obsolete]
+#endif
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public string GetPostBackClientEvent (Control control, string argument)
+ {
+ return scriptManager.GetPostBackClientEvent (control, argument);
+ }
+
+#if NET_2_0
+ [Obsolete]
+#endif
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public string GetPostBackClientHyperlink (Control control, string argument)
+ {
+ return scriptManager.GetPostBackClientHyperlink (control, argument);
+ }
+
+#if NET_2_0
+ [Obsolete]
+#endif
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public string GetPostBackEventReference (Control control)
+ {
+ return scriptManager.GetPostBackEventReference (control);
+ }
+
+#if NET_2_0
+ [Obsolete]
+#endif
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public string GetPostBackEventReference (Control control, string argument)
+ {
+ return scriptManager.GetPostBackEventReference (control, argument);
+ }
+
+ internal void RequiresPostBackScript ()
+ {
+ requiresPostBackScript = true;
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public virtual int GetTypeHashCode ()
+ {
+ return 0;
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ protected virtual void InitOutputCache (int duration,
+ string varyByHeader,
+ string varyByCustom,
+ OutputCacheLocation location,
+ string varyByParam)
+ {
+ HttpCachePolicy cache = _context.Response.Cache;
+ bool set_vary = false;
+
+ switch (location) {
+ case OutputCacheLocation.Any:
+ cache.SetCacheability (HttpCacheability.Public);
+ cache.SetMaxAge (new TimeSpan (0, 0, duration));
+ cache.SetLastModified (_context.Timestamp);
+ set_vary = true;
+ break;
+ case OutputCacheLocation.Client:
+ cache.SetCacheability (HttpCacheability.Private);
+ cache.SetMaxAge (new TimeSpan (0, 0, duration));
+ cache.SetLastModified (_context.Timestamp);
+ break;
+ case OutputCacheLocation.Downstream:
+ cache.SetCacheability (HttpCacheability.Public);
+ cache.SetMaxAge (new TimeSpan (0, 0, duration));
+ cache.SetLastModified (_context.Timestamp);
+ break;
+ case OutputCacheLocation.Server:
+ cache.SetCacheability (HttpCacheability.Server);
+ set_vary = true;
+ break;
+ case OutputCacheLocation.None:
+ break;
+ }
+
+ if (set_vary) {
+ if (varyByCustom != null)
+ cache.SetVaryByCustom (varyByCustom);
+
+ if (varyByParam != null && varyByParam.Length > 0) {
+ string[] prms = varyByParam.Split (';');
+ foreach (string p in prms)
+ cache.VaryByParams [p.Trim ()] = true;
+ cache.VaryByParams.IgnoreParams = false;
+ } else {
+ cache.VaryByParams.IgnoreParams = true;
+ }
+
+ if (varyByHeader != null && varyByHeader.Length > 0) {
+ string[] hdrs = varyByHeader.Split (';');
+ foreach (string h in hdrs)
+ cache.VaryByHeaders [h.Trim ()] = true;
+ }
+ }
+
+ cache.Duration = duration;
+ cache.SetExpires (_context.Timestamp.AddSeconds (duration));
+ }
+
+#if NET_2_0
+ [Obsolete]
+#else
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+#endif
+ public bool IsClientScriptBlockRegistered (string key)
+ {
+ return scriptManager.IsClientScriptBlockRegistered (key);
+ }
+
+#if NET_2_0
+ [Obsolete]
+#else
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+#endif
+ public bool IsStartupScriptRegistered (string key)
+ {
+ return scriptManager.IsStartupScriptRegistered (key);
+ }
+
+ public string MapPath (string virtualPath)
+ {
+ return Request.MapPath (virtualPath);
+ }
+
+ private void RenderPostBackScript (HtmlTextWriter writer, string formUniqueID)
+ {
+ writer.WriteLine ("<input type=\"hidden\" name=\"{0}\" value=\"\" />", postEventSourceID);
+ writer.WriteLine ("<input type=\"hidden\" name=\"{0}\" value=\"\" />", postEventArgumentID);
+ writer.WriteLine ();
+ writer.WriteLine ("<script language=\"javascript\">");
+ writer.WriteLine ("<!--");
+
+ if (Request.Browser.Browser == ("Netscape") && Request.Browser.MajorVersion == 4)
+ writer.WriteLine ("\tvar theForm = document.{0};", formUniqueID);
+ else
+ writer.WriteLine ("\tvar theForm = document.getElementById ('{0}');", formUniqueID);
+
+ writer.WriteLine ("\tfunction __doPostBack(eventTarget, eventArgument) {");
+ writer.WriteLine ("\t\ttheForm.{0}.value = eventTarget;", postEventSourceID);
+ writer.WriteLine ("\t\ttheForm.{0}.value = eventArgument;", postEventArgumentID);
+ writer.WriteLine ("\t\ttheForm.submit();");
+ writer.WriteLine ("\t}");
+ writer.WriteLine ("// -->");
+ writer.WriteLine ("</script>");
+ }
+
+ internal void OnFormRender (HtmlTextWriter writer, string formUniqueID)
+ {
+ if (renderingForm)
+ throw new HttpException ("Only 1 HtmlForm is allowed per page.");
+
+ renderingForm = true;
+ writer.WriteLine ();
+ scriptManager.WriteHiddenFields (writer);
+ if (requiresPostBackScript) {
+ RenderPostBackScript (writer, formUniqueID);
+ postBackScriptRendered = true;
+ }
+
+ if (handleViewState) {
+ string vs = GetViewStateString ();
+ writer.Write ("<input type=\"hidden\" name=\"__VIEWSTATE\" ");
+ writer.WriteLine ("value=\"{0}\" />", vs);
+ }
+
+ scriptManager.WriteClientScriptBlocks (writer);
+ }
+
+ internal string GetViewStateString ()
+ {
+ if (_savedViewState == null)
+ return null;
+ StringWriter sr = new StringWriter ();
+ LosFormatter fmt = new LosFormatter ();
+ fmt.Serialize (sr, _savedViewState);
+ return sr.GetStringBuilder ().ToString ();
+ }
+
+ internal void OnFormPostRender (HtmlTextWriter writer, string formUniqueID)
+ {
+ scriptManager.WriteArrayDeclares (writer);
+
+ if (!postBackScriptRendered && requiresPostBackScript)
+ RenderPostBackScript (writer, formUniqueID);
+
+ scriptManager.WriteHiddenFields (writer);
+ scriptManager.WriteClientScriptIncludes (writer);
+ scriptManager.WriteStartupScriptBlocks (writer);
+ renderingForm = false;
+ postBackScriptRendered = false;
+ }
+
+ private void ProcessPostData (NameValueCollection data, bool second)
+ {
+ if (data == null)
+ return;
+
+ if (_requiresPostBackCopy == null && _requiresPostBack != null)
+ _requiresPostBackCopy = (ArrayList) _requiresPostBack.Clone ();
+
+ Hashtable used = new Hashtable ();
+ foreach (string id in data.AllKeys){
+ if (id == "__VIEWSTATE" || id == postEventSourceID || id == postEventArgumentID)
+ continue;
+
+ string real_id = id;
+ int dot = real_id.IndexOf ('.');
+ if (dot >= 1)
+ real_id = real_id.Substring (0, dot);
+
+ if (real_id == null || used.ContainsKey (real_id))
+ continue;
+
+ used.Add (real_id, real_id);
+
+ Control ctrl = FindControl (real_id);
+ if (ctrl != null){
+ IPostBackDataHandler pbdh = ctrl as IPostBackDataHandler;
+ IPostBackEventHandler pbeh = ctrl as IPostBackEventHandler;
+
+ if (pbdh == null) {
+ if (pbeh != null)
+ RegisterRequiresRaiseEvent (pbeh);
+ continue;
+ }
+
+ if (pbdh.LoadPostData (real_id, data) == true) {
+ if (requiresPostDataChanged == null)
+ requiresPostDataChanged = new ArrayList ();
+ requiresPostDataChanged.Add (pbdh);
+ if (_requiresPostBackCopy != null)
+ _requiresPostBackCopy.Remove (ctrl.UniqueID);
+ }
+ } else if (!second) {
+ if (secondPostData == null)
+ secondPostData = new NameValueCollection ();
+ secondPostData.Add (real_id, data [id]);
+ }
+ }
+
+ ArrayList list1 = null;
+ if (_requiresPostBackCopy != null && _requiresPostBackCopy.Count > 0) {
+ string [] handlers = (string []) _requiresPostBackCopy.ToArray (typeof (string));
+ foreach (string id in handlers) {
+ IPostBackDataHandler pbdh = FindControl (id) as IPostBackDataHandler;
+ if (pbdh != null) {
+ _requiresPostBackCopy.Remove (id);
+ if (pbdh.LoadPostData (id, data)) {
+ if (requiresPostDataChanged == null)
+ requiresPostDataChanged = new ArrayList ();
+
+ requiresPostDataChanged.Add (pbdh);
+ }
+ } else if (second) {
+ if (list1 == null)
+ list1 = new ArrayList ();
+ list1.Add (id);
+ }
+ }
+ }
+ _requiresPostBack = list1;
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public void ProcessRequest (HttpContext context)
+ {
+ _context = context;
+ if (clientTarget != null)
+ Request.ClientTarget = clientTarget;
+
+ WireupAutomaticEvents ();
+ //-- Control execution lifecycle in the docs
+
+ // Save culture information because it can be modified in FrameworkInitialize()
+ CultureInfo culture = Thread.CurrentThread.CurrentCulture;
+ CultureInfo uiculture = Thread.CurrentThread.CurrentUICulture;
+ FrameworkInitialize ();
+ context.ErrorPage = _errorPage;
+
+ try {
+ InternalProcessRequest ();
+ } finally {
+ try {
+ UnloadRecursive (true);
+ } catch {}
+ Thread.CurrentThread.CurrentCulture = culture;
+ Thread.CurrentThread.CurrentUICulture = uiculture;
+ }
+ }
+
+#if NET_2_0
+ internal void ProcessCrossPagePostBack (HttpContext context)
+ {
+ isCrossPagePostBack = true;
+ ProcessRequest (context);
+ }
+#endif
+
+ void InternalProcessRequest ()
+ {
+ _requestValueCollection = this.DeterminePostBackMode();
+
+#if NET_2_0
+ if (!IsCrossPagePostBack)
+ LoadPreviousPageReference ();
+
+ OnPreInit (EventArgs.Empty);
+#endif
+ Trace.Write ("aspx.page", "Begin Init");
+ InitRecursive (null);
+ Trace.Write ("aspx.page", "End Init");
+
+#if NET_2_0
+ OnInitComplete (EventArgs.Empty);
+
+ if (masterPageFile != null) {
+ Controls.Add (Master);
+ Master.FillPlaceHolders ();
+ }
+#endif
+
+ renderingForm = false;
+ if (IsPostBack) {
+ Trace.Write ("aspx.page", "Begin LoadViewState");
+ LoadPageViewState ();
+ Trace.Write ("aspx.page", "End LoadViewState");
+ Trace.Write ("aspx.page", "Begin ProcessPostData");
+ ProcessPostData (_requestValueCollection, false);
+ Trace.Write ("aspx.page", "End ProcessPostData");
+ }
+
+#if NET_2_0
+ if (IsCrossPagePostBack)
+ return;
+
+ OnPreLoad (EventArgs.Empty);
+#endif
+
+ LoadRecursive ();
+ if (IsPostBack) {
+ Trace.Write ("aspx.page", "Begin ProcessPostData Second Try");
+ ProcessPostData (secondPostData, true);
+ Trace.Write ("aspx.page", "End ProcessPostData Second Try");
+ Trace.Write ("aspx.page", "Begin Raise ChangedEvents");
+ RaiseChangedEvents ();
+ Trace.Write ("aspx.page", "End Raise ChangedEvents");
+ Trace.Write ("aspx.page", "Begin Raise PostBackEvent");
+ RaisePostBackEvents ();
+ Trace.Write ("aspx.page", "End Raise PostBackEvent");
+ }
+
+#if NET_2_0
+ OnLoadComplete (EventArgs.Empty);
+
+ if (IsCallback) {
+ string result = ProcessCallbackData ();
+ HtmlTextWriter callbackOutput = new HtmlTextWriter (_context.Response.Output);
+ callbackOutput.Write (result);
+ callbackOutput.Flush ();
+ return;
+ }
+#endif
+
+ Trace.Write ("aspx.page", "Begin PreRender");
+ PreRenderRecursiveInternal ();
+ Trace.Write ("aspx.page", "End PreRender");
+
+#if NET_2_0
+ OnPreRenderComplete (EventArgs.Empty);
+#endif
+
+ Trace.Write ("aspx.page", "Begin SaveViewState");
+ SavePageViewState ();
+ Trace.Write ("aspx.page", "End SaveViewState");
+
+#if NET_2_0
+ OnSaveStateComplete (EventArgs.Empty);
+#endif
+
+ //--
+ Trace.Write ("aspx.page", "Begin Render");
+ HtmlTextWriter output = new HtmlTextWriter (_context.Response.Output);
+ RenderControl (output);
+ Trace.Write ("aspx.page", "End Render");
+
+ RenderTrace (output);
+ }
+
+ private void RenderTrace (HtmlTextWriter output)
+ {
+ TraceManager traceManager = HttpRuntime.TraceManager;
+
+ if (Trace.HaveTrace && !Trace.IsEnabled || !Trace.HaveTrace && !traceManager.Enabled)
+ return;
+
+ Trace.SaveData ();
+
+ if (!Trace.HaveTrace && traceManager.Enabled && !traceManager.PageOutput)
+ return;
+
+ if (!traceManager.LocalOnly || Context.Request.IsLocal)
+ Trace.Render (output);
+ }
+
+ internal void RaisePostBackEvents ()
+ {
+ if (requiresRaiseEvent != null) {
+ RaisePostBackEvent (requiresRaiseEvent, null);
+ return;
+ }
+
+ NameValueCollection postdata = _requestValueCollection;
+ if (postdata == null)
+ return;
+
+ string eventTarget = postdata [postEventSourceID];
+ if (eventTarget == null || eventTarget.Length == 0) {
+ Validate ();
+ return;
+ }
+
+ IPostBackEventHandler target = FindControl (eventTarget) as IPostBackEventHandler;
+ if (target == null)
+ return;
+
+ string eventArgument = postdata [postEventArgumentID];
+ RaisePostBackEvent (target, eventArgument);
+ }
+
+ internal void RaiseChangedEvents ()
+ {
+ if (requiresPostDataChanged == null)
+ return;
+
+ foreach (IPostBackDataHandler ipdh in requiresPostDataChanged)
+ ipdh.RaisePostDataChangedEvent ();
+
+ requiresPostDataChanged = null;
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected virtual void RaisePostBackEvent (IPostBackEventHandler sourceControl, string eventArgument)
+ {
+ sourceControl.RaisePostBackEvent (eventArgument);
+ }
+
+#if NET_2_0
+ [Obsolete]
+#endif
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public void RegisterArrayDeclaration (string arrayName, string arrayValue)
+ {
+ scriptManager.RegisterArrayDeclaration (arrayName, arrayValue);
+ }
+
+#if NET_2_0
+ [Obsolete]
+#endif
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public virtual void RegisterClientScriptBlock (string key, string script)
+ {
+ scriptManager.RegisterClientScriptBlock (key, script);
+ }
+
+#if NET_2_0
+ [Obsolete]
+#endif
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public virtual void RegisterHiddenField (string hiddenFieldName, string hiddenFieldInitialValue)
+ {
+ scriptManager.RegisterHiddenField (hiddenFieldName, hiddenFieldInitialValue);
+ }
+
+ [MonoTODO("Used in HtmlForm")]
+ internal void RegisterClientScriptFile (string a, string b, string c)
+ {
+ throw new NotImplementedException ();
+ }
+
+#if NET_2_0
+ [Obsolete]
+#endif
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public void RegisterOnSubmitStatement (string key, string script)
+ {
+ scriptManager.RegisterOnSubmitStatement (key, script);
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public void RegisterRequiresPostBack (Control control)
+ {
+ if (_requiresPostBack == null)
+ _requiresPostBack = new ArrayList ();
+
+ _requiresPostBack.Add (control.UniqueID);
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public virtual void RegisterRequiresRaiseEvent (IPostBackEventHandler control)
+ {
+ requiresRaiseEvent = control;
+ }
+
+#if NET_2_0
+ [Obsolete]
+#endif
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public virtual void RegisterStartupScript (string key, string script)
+ {
+ scriptManager.RegisterStartupScript (key, script);
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public void RegisterViewStateHandler ()
+ {
+ handleViewState = true;
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected virtual void SavePageStateToPersistenceMedium (object viewState)
+ {
+ _savedViewState = viewState;
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected virtual object LoadPageStateFromPersistenceMedium ()
+ {
+ NameValueCollection postdata = _requestValueCollection;
+ string view_state;
+ if (postdata == null || (view_state = postdata ["__VIEWSTATE"]) == null)
+ return null;
+
+ _savedViewState = null;
+ LosFormatter fmt = new LosFormatter ();
+
+ try {
+ _savedViewState = fmt.Deserialize (view_state);
+ } catch (Exception e) {
+ throw new HttpException ("Error restoring page viewstate.\n", e);
+ }
+
+ return _savedViewState;
+ }
+
+ internal void LoadPageViewState()
+ {
+ object sState = LoadPageStateFromPersistenceMedium ();
+ if (sState != null) {
+#if NET_2_0
+ Triplet data = (Triplet) sState;
+ LoadPageControlState (data.Third);
+ LoadViewStateRecursive (data.First);
+ _requiresPostBack = data.Second as ArrayList;
+#else
+ Pair pair = (Pair) sState;
+ LoadViewStateRecursive (pair.First);
+ _requiresPostBack = pair.Second as ArrayList;
+#endif
+ }
+ }
+
+ internal void SavePageViewState ()
+ {
+ if (!handleViewState)
+ return;
+
+#if NET_2_0
+ object controlState = SavePageControlState ();
+#endif
+
+ object viewState = SaveViewStateRecursive ();
+ object reqPostback = (_requiresPostBack != null && _requiresPostBack.Count > 0) ? _requiresPostBack : null;
+
+#if NET_2_0
+ Triplet triplet = new Triplet ();
+ triplet.First = viewState;
+ triplet.Second = reqPostback;
+ triplet.Third = controlState;
+
+ if (triplet.First == null && triplet.Second == null && triplet.Third == null)
+ triplet = null;
+
+ SavePageStateToPersistenceMedium (triplet);
+#else
+ Pair pair = new Pair ();
+ pair.First = viewState;
+ pair.Second = reqPostback;
+
+ if (pair.First == null && pair.Second == null)
+ pair = null;
+
+ SavePageStateToPersistenceMedium (pair);
+#endif
+ }
+
+ public virtual void Validate ()
+ {
+ ValidateCollection (_validators);
+ }
+
+ void ValidateCollection (ValidatorCollection validators)
+ {
+ if (validators == null || validators.Count == 0){
+ _isValid = true;
+ return;
+ }
+
+ bool all_valid = true;
+ foreach (IValidator v in validators){
+ v.Validate ();
+ if (v.IsValid == false)
+ all_valid = false;
+ }
+
+ if (all_valid)
+ _isValid = true;
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public virtual void VerifyRenderingInServerForm (Control control)
+ {
+ if (!renderingForm)
+ throw new HttpException ("Control '" + control.ClientID + " " + control.GetType () +
+ "' must be rendered within a HtmlForm");
+ }
+
+ #endregion
+
+ #if NET_2_0
+ public
+ #else
+ internal
+ #endif
+ ClientScriptManager ClientScript {
+ get { return scriptManager; }
+ }
+
+ #if NET_2_0
+
+ static readonly object InitCompleteEvent = new object ();
+ static readonly object LoadCompleteEvent = new object ();
+ static readonly object PreInitEvent = new object ();
+ static readonly object PreLoadEvent = new object ();
+ static readonly object PreRenderCompleteEvent = new object ();
+ static readonly object SaveStateCompleteEvent = new object ();
+
+ public event EventHandler InitComplete {
+ add { Events.AddHandler (InitCompleteEvent, value); }
+ remove { Events.RemoveHandler (InitCompleteEvent, value); }
+ }
+
+ public event EventHandler LoadComplete {
+ add { Events.AddHandler (LoadCompleteEvent, value); }
+ remove { Events.RemoveHandler (LoadCompleteEvent, value); }
+ }
+
+ public event EventHandler PreInit {
+ add { Events.AddHandler (PreInitEvent, value); }
+ remove { Events.RemoveHandler (PreInitEvent, value); }
+ }
+
+ public event EventHandler PreLoad {
+ add { Events.AddHandler (PreLoadEvent, value); }
+ remove { Events.RemoveHandler (PreLoadEvent, value); }
+ }
+
+ public event EventHandler PreRenderComplete {
+ add { Events.AddHandler (PreRenderCompleteEvent, value); }
+ remove { Events.RemoveHandler (PreRenderCompleteEvent, value); }
+ }
+
+ public event EventHandler SaveStateComplete {
+ add { Events.AddHandler (SaveStateCompleteEvent, value); }
+ remove { Events.RemoveHandler (SaveStateCompleteEvent, value); }
+ }
+
+ protected virtual void OnInitComplete (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) (Events [InitCompleteEvent]);
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnLoadComplete (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) (Events [LoadCompleteEvent]);
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnPreInit (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) (Events [PreInitEvent]);
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnPreLoad (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) (Events [PreLoadEvent]);
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnPreRenderComplete (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) (Events [PreRenderCompleteEvent]);
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ protected virtual void OnSaveStateComplete (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh = (EventHandler) (Events [SaveStateCompleteEvent]);
+ if (eh != null) eh (this, e);
+ }
+ }
+
+ public HtmlForm Form {
+ get { return _form; }
+ }
+
+ internal void RegisterForm (HtmlForm form)
+ {
+ _form = form;
+ }
+
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public Page PreviousPage {
+ get { return previousPage; }
+ }
+
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public bool IsCallback {
+ get { return _requestValueCollection != null && _requestValueCollection [CallbackArgumentID] != null; }
+ }
+
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public bool IsCrossPagePostBack {
+ get { return _requestValueCollection != null && isCrossPagePostBack; }
+ }
+
+ string ProcessCallbackData ()
+ {
+ string callbackTarget = _requestValueCollection [CallbackSourceID];
+ if (callbackTarget == null || callbackTarget.Length == 0)
+ throw new HttpException ("Callback target not provided.");
+
+ ICallbackEventHandler target = FindControl (callbackTarget) as ICallbackEventHandler;
+ if (target == null)
+ throw new HttpException (string.Format ("Invalid callback target '{0}'.", callbackTarget));
+
+ string callbackArgument = _requestValueCollection [CallbackArgumentID];
+ return target.RaiseCallbackEvent (callbackArgument);
+ }
+
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public IPageHeader Header {
+ get { return htmlHeader; }
+ }
+
+ internal void SetHeader (IPageHeader header)
+ {
+ htmlHeader = header;
+ }
+
+ [DefaultValueAttribute ("")]
+ public string MasterPageFile {
+ get { return masterPageFile; }
+ set { masterPageFile = value; masterPage = null; }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public MasterPage Master {
+ get {
+ if (masterPage == null)
+ masterPage = MasterPageParser.GetCompiledMasterInstance (masterPageFile, Server.MapPath (masterPageFile), Context);
+ return masterPage;
+ }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public void RegisterRequiresControlState (Control control)
+ {
+ if (requireStateControls == null) requireStateControls = new ArrayList ();
+ requireStateControls.Add (control);
+ }
+
+ public bool RequiresControlState (Control control)
+ {
+ if (requireStateControls == null) return false;
+ return requireStateControls.Contains (control);
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public void UnregisterRequiresControlState (Control control)
+ {
+ if (requireStateControls != null)
+ requireStateControls.Remove (control);
+ }
+
+ public ValidatorCollection GetValidators (string validationGroup)
+ {
+ if (validationGroup == null || validationGroup == "")
+ return Validators;
+
+ if (_validatorsByGroup == null) _validatorsByGroup = new Hashtable ();
+ ValidatorCollection col = _validatorsByGroup [validationGroup] as ValidatorCollection;
+ if (col == null) {
+ col = new ValidatorCollection ();
+ _validatorsByGroup [validationGroup] = col;
+ }
+ return col;
+ }
+
+ public virtual void Validate (string validationGroup)
+ {
+ if (validationGroup == null || validationGroup == "")
+ ValidateCollection (_validators);
+ else {
+ if (_validatorsByGroup != null) {
+ ValidateCollection (_validatorsByGroup [validationGroup] as ValidatorCollection);
+ } else {
+ _isValid = true;
+ }
+ }
+ }
+
+ object SavePageControlState ()
+ {
+ if (requireStateControls == null) return null;
+ object[] state = new object [requireStateControls.Count];
+
+ bool allNull = true;
+ for (int n=0; n<state.Length; n++) {
+ state [n] = ((Control) requireStateControls [n]).SaveControlState ();
+ if (state [n] != null) allNull = false;
+ }
+ if (allNull) return null;
+ else return state;
+ }
+
+ void LoadPageControlState (object data)
+ {
+ if (requireStateControls == null) return;
+
+ object[] state = (object[]) data;
+ int max = Math.Min (requireStateControls.Count, state != null ? state.Length : requireStateControls.Count);
+ for (int n=0; n < max; n++) {
+ Control ctl = (Control) requireStateControls [n];
+ ctl.LoadControlState (state != null ? state [n] : null);
+ }
+ }
+
+ void LoadPreviousPageReference ()
+ {
+ if (_requestValueCollection != null) {
+ string prevPage = _requestValueCollection [PreviousPageID];
+ if (prevPage != null) {
+ previousPage = (Page) PageParser.GetCompiledPageInstance (prevPage, Server.MapPath (prevPage), Context);
+ previousPage.ProcessCrossPagePostBack (_context);
+ } else {
+ previousPage = _context.LastPage;
+ }
+ }
+ _context.LastPage = this;
+ }
+
+
+ #endif
+}
+}
diff --git a/mcs/class/System.Web/System.Web.UI/PageHandlerFactory.cs b/mcs/class/System.Web/System.Web.UI/PageHandlerFactory.cs
new file mode 100644
index 00000000000..4a462ee5654
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PageHandlerFactory.cs
@@ -0,0 +1,48 @@
+//
+// System.Web.UI.PageHandlerFactory
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.Web;
+using System.Web.Compilation;
+
+namespace System.Web.UI
+{
+ class PageHandlerFactory : IHttpHandlerFactory
+ {
+ public virtual IHttpHandler GetHandler (HttpContext context, string requestType, string url, string path)
+ {
+ return PageParser.GetCompiledPageInstance (url, path, context);
+ }
+
+ public virtual void ReleaseHandler (IHttpHandler handler)
+ {
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/PageParser.cs b/mcs/class/System.Web/System.Web.UI/PageParser.cs
new file mode 100644
index 00000000000..cbc72569bfc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PageParser.cs
@@ -0,0 +1,349 @@
+//
+// System.Web.UI.PageParser
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.Text;
+using System.Web;
+using System.Web.Compilation;
+using System.Web.Configuration;
+using System.Web.Util;
+
+namespace System.Web.UI
+{
+ public sealed class PageParser : TemplateControlParser
+ {
+ bool enableSessionState = true;
+ bool haveTrace;
+ bool trace;
+ bool notBuffer;
+ TraceMode tracemode;
+ bool readonlySessionState;
+ string responseEncoding;
+ string contentType;
+ int codepage = -1;
+ int lcid = -1;
+ string culture;
+ string uiculture;
+ string errorPage;
+ bool validateRequest;
+ string clientTarget;
+ Type baseType = typeof (Page);
+
+#if NET_2_0
+ string masterPage;
+#endif
+
+ public PageParser ()
+ {
+ }
+
+ internal PageParser (string virtualPath, string inputFile, HttpContext context)
+ {
+ Context = context;
+ BaseVirtualDir = UrlUtils.GetDirectory (virtualPath);
+ InputFile = inputFile;
+ SetBaseType (PagesConfig.PageBaseType);
+ AddApplicationAssembly ();
+ }
+
+ public static IHttpHandler GetCompiledPageInstance (string virtualPath,
+ string inputFile,
+ HttpContext context)
+ {
+ PageParser pp = new PageParser (virtualPath, inputFile, context);
+ IHttpHandler h = (IHttpHandler) pp.GetCompiledInstance ();
+ return h;
+ }
+
+ internal override void ProcessMainAttributes (Hashtable atts)
+ {
+ string enabless = GetString (atts, "EnableSessionState", PagesConfig.EnableSessionState);
+ if (enabless != null) {
+ readonlySessionState = (String.Compare (enabless, "readonly", true) == 0);
+ if (readonlySessionState == true || String.Compare (enabless, "true", true) == 0) {
+ enableSessionState = true;
+ } else if (String.Compare (enabless, "false", true) == 0) {
+ enableSessionState = false;
+ } else {
+ ThrowParseException ("Invalid value for EnableSessionState: " + enabless);
+ }
+ }
+
+ string cp = GetString (atts, "CodePage", null);
+ if (cp != null) {
+ if (responseEncoding != null)
+ ThrowParseException ("CodePage and ResponseEncoding are " +
+ "mutually exclusive.");
+
+ int codepage = 0;
+ try {
+ codepage = (int) UInt32.Parse (cp);
+ } catch {
+ ThrowParseException ("Invalid value for CodePage: " + cp);
+ }
+
+ try {
+ Encoding.GetEncoding (codepage);
+ } catch {
+ ThrowParseException ("Unsupported codepage: " + cp);
+ }
+ }
+
+ responseEncoding = GetString (atts, "ResponseEncoding", null);
+ if (responseEncoding != null) {
+ if (codepage != -1)
+ ThrowParseException ("CodePage and ResponseEncoding are " +
+ "mutually exclusive.");
+
+ try {
+ Encoding.GetEncoding (responseEncoding);
+ } catch {
+ ThrowParseException ("Unsupported encoding: " + responseEncoding);
+ }
+ }
+
+ contentType = GetString (atts, "ContentType", null);
+
+ string lcidStr = GetString (atts, "LCID", null);
+ if (lcidStr != null) {
+ try {
+ lcid = (int) UInt32.Parse (lcidStr);
+ } catch {
+ ThrowParseException ("Invalid value for LCID: " + lcid);
+ }
+
+ CultureInfo ci = null;
+ try {
+ ci = new CultureInfo (lcid);
+ } catch {
+ ThrowParseException ("Unsupported LCID: " + lcid);
+ }
+
+ if (ci.IsNeutralCulture) {
+ string suggestedCulture = SuggestCulture (ci.Name);
+ string fmt = "LCID attribute must be set to a non-neutral Culture.";
+ if (suggestedCulture != null) {
+ ThrowParseException (fmt + " Please try one of these: " +
+ suggestedCulture);
+ } else {
+ ThrowParseException (fmt);
+ }
+ }
+ }
+
+ culture = GetString (atts, "Culture", null);
+ if (culture != null) {
+ if (lcidStr != null)
+ ThrowParseException ("Culture and LCID are mutually exclusive.");
+
+ CultureInfo ci = null;
+ try {
+ ci = new CultureInfo (culture);
+ } catch {
+ ThrowParseException ("Unsupported Culture: " + culture);
+ }
+
+ if (ci.IsNeutralCulture) {
+ string suggestedCulture = SuggestCulture (culture);
+ string fmt = "Culture attribute must be set to a non-neutral Culture.";
+ if (suggestedCulture != null)
+ ThrowParseException (fmt +
+ " Please try one of these: " + suggestedCulture);
+ else
+ ThrowParseException (fmt);
+ }
+ }
+
+ uiculture = GetString (atts, "UICulture", null);
+ if (uiculture != null) {
+ CultureInfo ci = null;
+ try {
+ ci = new CultureInfo (uiculture);
+ } catch {
+ ThrowParseException ("Unsupported Culture: " + uiculture);
+ }
+
+ if (ci.IsNeutralCulture) {
+ string suggestedCulture = SuggestCulture (uiculture);
+ string fmt = "UICulture attribute must be set to a non-neutral Culture.";
+ if (suggestedCulture != null)
+ ThrowParseException (fmt +
+ " Please try one of these: " + suggestedCulture);
+ else
+ ThrowParseException (fmt);
+ }
+ }
+
+ string tracestr = GetString (atts, "Trace", null);
+ if (tracestr != null) {
+ haveTrace = true;
+ atts ["Trace"] = tracestr;
+ trace = GetBool (atts, "Trace", false);
+ }
+
+ string tracemodes = GetString (atts, "TraceMode", null);
+ if (tracemodes != null) {
+ bool valid = true;
+ try {
+ tracemode = (TraceMode) Enum.Parse (typeof (TraceMode), tracemodes, false);
+ } catch {
+ valid = false;
+ }
+
+ if (!valid || tracemode == TraceMode.Default)
+ ThrowParseException ("The 'tracemode' attribute is case sensitive and must be " +
+ "one of the following values: SortByTime, SortByCategory.");
+ }
+
+ errorPage = GetString (atts, "ErrorPage", null);
+ validateRequest = GetBool (atts, "ValidateRequest", PagesConfig.ValidateRequest);
+ clientTarget = GetString (atts, "ClientTarget", null);
+ if (clientTarget != null) {
+ NameValueCollection coll;
+ coll = (NameValueCollection) Context.GetConfig ("system.web/clientTarget");
+ if (coll == null || coll [clientTarget] == null) {
+ ThrowParseException (String.Format (
+ "ClientTarget '{0}' is an invalid alias. See the " +
+ "documentation for <clientTarget> config. section.",
+ clientTarget));
+ }
+ clientTarget = (string) coll [clientTarget];
+ }
+
+ notBuffer = !GetBool (atts, "Buffer", true);
+
+#if NET_2_0
+ masterPage = GetString (atts, "MasterPageFile", null);
+#endif
+ // Ignored by now
+ GetString (atts, "EnableViewStateMac", null);
+ GetString (atts, "SmartNavigation", null);
+
+ base.ProcessMainAttributes (atts);
+ }
+
+ static string SuggestCulture (string culture)
+ {
+ string retval = null;
+ foreach (CultureInfo ci in CultureInfo.GetCultures (CultureTypes.SpecificCultures)) {
+ if (ci.Name.StartsWith (culture))
+ retval += ci.Name + " ";
+ }
+ return retval;
+ }
+
+ protected override Type CompileIntoType ()
+ {
+ AspGenerator generator = new AspGenerator (this);
+ return generator.GetCompiledType ();
+ }
+
+ internal bool EnableSessionState {
+ get { return enableSessionState; }
+ }
+
+ internal bool ReadOnlySessionState {
+ get { return readonlySessionState; }
+ }
+
+ internal bool HaveTrace {
+ get { return haveTrace; }
+ }
+
+ internal bool Trace {
+ get { return trace; }
+ }
+
+ internal TraceMode TraceMode {
+ get { return tracemode; }
+ }
+
+ internal override Type DefaultBaseType {
+ get { return baseType; }
+ }
+
+ internal override string DefaultBaseTypeName {
+ get { return "System.Web.UI.Page"; }
+ }
+
+ internal override string DefaultDirectiveName {
+ get { return "page"; }
+ }
+
+ internal string ResponseEncoding {
+ get { return responseEncoding; }
+ }
+
+ internal string ContentType {
+ get { return contentType; }
+ }
+
+ internal int CodePage {
+ get { return codepage; }
+ }
+
+ internal string Culture {
+ get { return culture; }
+ }
+
+ internal string UICulture {
+ get { return uiculture; }
+ }
+
+ internal int LCID {
+ get { return lcid; }
+ }
+
+ internal string ErrorPage {
+ get { return errorPage; }
+ }
+
+ internal bool ValidateRequest {
+ get { return validateRequest; }
+ }
+
+ internal string ClientTarget {
+ get { return clientTarget; }
+ }
+
+ internal bool NotBuffer {
+ get { return notBuffer; }
+ }
+
+#if NET_2_0
+ internal string MasterPageFile {
+ get { return masterPage; }
+ }
+#endif
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/Pair.cs b/mcs/class/System.Web/System.Web.UI/Pair.cs
new file mode 100644
index 00000000000..0a619289149
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/Pair.cs
@@ -0,0 +1,61 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI
+ * Class: Pair
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI
+{
+#if NET_2_0
+ [Serializable]
+ sealed
+#endif
+ public class Pair
+ {
+ public object First;
+ public object Second;
+
+ public Pair(object first, object second)
+ {
+ First = first;
+ Second = second;
+ }
+
+ public Pair()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ParseChildrenAttribute.cs b/mcs/class/System.Web/System.Web.UI/ParseChildrenAttribute.cs
new file mode 100755
index 00000000000..a9f50099a4e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ParseChildrenAttribute.cs
@@ -0,0 +1,112 @@
+//
+// System.Web.UI.ParseChildrenAttribute.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.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;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class ParseChildrenAttribute : Attribute
+ {
+ bool childrenAsProperties;
+ string defaultProperty;
+ public static readonly ParseChildrenAttribute Default = new ParseChildrenAttribute ();
+
+#if NET_2_0
+ Type childType = typeof(System.Web.UI.Control);
+#endif
+
+ // LAMESPEC
+ public ParseChildrenAttribute ()
+ {
+ childrenAsProperties = false;
+ defaultProperty = "";
+ }
+
+ public ParseChildrenAttribute (bool childrenAsProperties)
+ {
+ this.childrenAsProperties = childrenAsProperties;
+ this.defaultProperty = "";
+ }
+
+ public ParseChildrenAttribute (bool childrenAsProperties,
+ string defaultProperty)
+ {
+ this.childrenAsProperties = childrenAsProperties;
+ if (childrenAsProperties)
+ this.defaultProperty = defaultProperty;
+ }
+
+ public bool ChildrenAsProperties {
+
+ get { return childrenAsProperties; }
+
+ set { childrenAsProperties = value; }
+ }
+
+ public string DefaultProperty {
+ get { return defaultProperty; }
+
+ set { defaultProperty = value; }
+ }
+
+#if NET_2_0
+ public Type ChildControlType {
+ get { return childType; }
+ set { childType = value; }
+ }
+#endif
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is ParseChildrenAttribute))
+ return false;
+
+ ParseChildrenAttribute o = (ParseChildrenAttribute) obj;
+ if (childrenAsProperties == o.childrenAsProperties){
+ if (childrenAsProperties == false)
+ return true;
+ return (defaultProperty == o.DefaultProperty);
+ }
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return Equals (Default);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/PartialCachingAttribute.cs b/mcs/class/System.Web/System.Web.UI/PartialCachingAttribute.cs
new file mode 100755
index 00000000000..7f566444ec9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PartialCachingAttribute.cs
@@ -0,0 +1,93 @@
+//
+// System.Web.UI.PartialCachingAttribute.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+//
+// 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;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class PartialCachingAttribute : Attribute
+ {
+ int duration;
+ string varyByControls;
+ string varyByCustom;
+ string varyByParams;
+#if NET_1_1
+ bool shared;
+#endif
+
+ public PartialCachingAttribute (int duration)
+ {
+ this.duration = duration;
+ }
+
+ public PartialCachingAttribute (int duration, string varyByParams,
+ string varyByControls, string varyByCustom)
+ {
+ this.duration = duration;
+ this.varyByParams = varyByParams;
+ this.varyByControls = varyByControls;
+ this.varyByCustom = varyByCustom;
+ }
+
+#if NET_1_1
+ public PartialCachingAttribute (int duration, string varyByParams, string varyByControls,
+ string varyByCustom, bool shared)
+ {
+ this.duration = duration;
+ this.varyByParams = varyByParams;
+ this.varyByControls = varyByControls;
+ this.varyByCustom = varyByCustom;
+ this.shared = shared;
+ }
+#endif
+
+ public int Duration {
+ get { return duration; }
+ }
+
+ public string VaryByParams {
+ get { return varyByParams; }
+ }
+
+ public string VaryByControls {
+ get { return varyByControls; }
+ }
+
+ public string VaryByCustom {
+ get { return varyByCustom; }
+ }
+
+#if NET_1_1
+ public bool Shared {
+ get { return shared; }
+ }
+#endif
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/PartialCachingControl.cs b/mcs/class/System.Web/System.Web.UI/PartialCachingControl.cs
new file mode 100644
index 00000000000..42452582da9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PartialCachingControl.cs
@@ -0,0 +1,58 @@
+//
+// System.Web.UI.PartialCachingControl.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+
+namespace System.Web.UI
+{
+ public class PartialCachingControl : BasePartialCachingControl
+ {
+
+ //private Type controlType;
+ private Control createdControl;
+
+ internal PartialCachingControl (Type createCachedControlType)
+ {
+ // controlType = createCachedControlType;
+ }
+
+ [MonoTODO ("Implement")]
+ internal override Control CreateControl()
+ {
+ createdControl = null;
+ throw new NotImplementedException ();
+ }
+
+ public Control CachedControl {
+ get {return createdControl;}
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/PersistChildrenAttribute.cs b/mcs/class/System.Web/System.Web.UI/PersistChildrenAttribute.cs
new file mode 100755
index 00000000000..473407e797e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PersistChildrenAttribute.cs
@@ -0,0 +1,71 @@
+//
+// System.Web.UI.PersistChildrenAttribute.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+//
+// 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;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class PersistChildrenAttribute : Attribute
+ {
+ bool persist;
+
+ public PersistChildrenAttribute (bool persist)
+ {
+ this.persist = persist;
+ }
+
+ public static readonly PersistChildrenAttribute Default = new PersistChildrenAttribute (true);
+ public static readonly PersistChildrenAttribute Yes = new PersistChildrenAttribute (true);
+ public static readonly PersistChildrenAttribute No = new PersistChildrenAttribute (false);
+
+ public bool Persist {
+ get { return persist; }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is PersistChildrenAttribute))
+ return false;
+
+ return (((PersistChildrenAttribute) obj).persist == persist);
+ }
+
+ public override int GetHashCode ()
+ {
+ return persist ? 1 : 0;
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return (persist == true);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/PersistenceMode.cs b/mcs/class/System.Web/System.Web.UI/PersistenceMode.cs
new file mode 100755
index 00000000000..125ed53ffd7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PersistenceMode.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.UI.PersistenceMode.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public enum PersistenceMode
+ {
+ Attribute = 0,
+ InnerProperty = 1,
+ InnerDefaultProperty = 2,
+ EncodedInnerDefaultProperty = 3,
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/PersistenceModeAttribute.cs b/mcs/class/System.Web/System.Web.UI/PersistenceModeAttribute.cs
new file mode 100755
index 00000000000..f1081e89788
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PersistenceModeAttribute.cs
@@ -0,0 +1,82 @@
+//
+// System.Web.UI.PersistenceModeAttribute.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+//
+// 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;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.All)]
+ public sealed class PersistenceModeAttribute : Attribute
+ {
+ PersistenceMode mode;
+
+ public PersistenceModeAttribute (PersistenceMode mode)
+ {
+ this.mode = mode;
+ }
+
+ public static readonly PersistenceModeAttribute Attribute =
+ new PersistenceModeAttribute (PersistenceMode.Attribute);
+
+ public static readonly PersistenceModeAttribute Default =
+ new PersistenceModeAttribute (PersistenceMode.Attribute);
+
+ public static readonly PersistenceModeAttribute EncodedInnerDefaultProperty =
+ new PersistenceModeAttribute (PersistenceMode.EncodedInnerDefaultProperty);
+
+ public static readonly PersistenceModeAttribute InnerDefaultProperty =
+ new PersistenceModeAttribute (PersistenceMode.InnerDefaultProperty);
+
+ public static readonly PersistenceModeAttribute InnerProperty =
+ new PersistenceModeAttribute (PersistenceMode.InnerProperty);
+
+ public PersistenceMode Mode {
+ get { return mode; }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is PersistenceModeAttribute))
+ return false;
+
+ return ((PersistenceModeAttribute) obj).mode == mode;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) mode;
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return (mode == PersistenceMode.Attribute);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/PostBackOptions.cs b/mcs/class/System.Web/System.Web.UI/PostBackOptions.cs
new file mode 100644
index 00000000000..c75c6eb54eb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PostBackOptions.cs
@@ -0,0 +1,134 @@
+//
+// System.Web.UI.PostBackOptions.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+using System;
+
+namespace System.Web.UI
+{
+ public sealed class PostBackOptions
+ {
+ private Control control;
+ private string argument;
+ private string actionUrl;
+ private bool autoPostBack;
+ private bool requiresJavaScriptProtocol;
+ private bool trackFocus;
+ private bool clientSubmit;
+ private bool performValidation;
+ private string validationGroup;
+
+ public PostBackOptions (Control control) : this (control, null, null, false, false, false,
+ false, false, null)
+ {
+ }
+
+ public PostBackOptions (Control control, string argument) : this (control, argument, null, false,
+ false, false, false, false, null)
+ {
+ }
+
+ public PostBackOptions (Control control, string argument, string actionUrl, bool isAutoPostBack,
+ bool isJavaScriptProtocolRequired, bool isTrackFocus, bool isClientSubmit,
+ bool isValidationPerformed, string validatingGroup)
+ {
+ this.control = control;
+ this.argument = argument;
+ this.actionUrl = actionUrl;
+ this.autoPostBack = isAutoPostBack;
+ this.requiresJavaScriptProtocol = isJavaScriptProtocolRequired;
+ this.trackFocus = isTrackFocus;
+ this.clientSubmit = isClientSubmit;
+ this.performValidation = isValidationPerformed;
+ this.validationGroup = validatingGroup;
+ }
+
+ public string ActionUrl {
+ get { return actionUrl; }
+ set { actionUrl = value; }
+ }
+
+ public string Argument {
+ get { return argument; }
+ set { argument = value; }
+ }
+
+ [MonoTODO ("Implement support for this in Page")]
+ public bool AutoPostBack {
+ get { return autoPostBack; }
+ set { autoPostBack = value; }
+ }
+
+ public bool ClientSubmit {
+ get { return clientSubmit; }
+ set { clientSubmit = value; }
+ }
+
+ public bool PerformValidation {
+ get { return performValidation; }
+ set { performValidation = value; }
+ }
+
+ public bool RequiresJavaScriptProtocol {
+ get { return requiresJavaScriptProtocol; }
+ set { requiresJavaScriptProtocol = value; }
+ }
+
+ public Control TargetControl {
+ get { return control; }
+ set { control = value; }
+ }
+
+ [MonoTODO ("Implement support for this in Page")]
+ public bool TrackFocus {
+ get { return trackFocus; }
+ set { trackFocus = value; }
+ }
+
+ [MonoTODO ("Implement support for this in Page")]
+ public string ValidationGroup {
+ get { return validationGroup; }
+ set { validationGroup = value; }
+ }
+
+ // Returns true if some of these options must be handled by
+ // client script.
+ internal bool RequiresSpecialPostBack {
+ get {
+ return actionUrl != null ||
+ validationGroup != null ||
+ trackFocus ||
+ autoPostBack ||
+ argument != null;
+ }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/PropertyConverter.cs b/mcs/class/System.Web/System.Web.UI/PropertyConverter.cs
new file mode 100644
index 00000000000..e9ba5cde1f8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PropertyConverter.cs
@@ -0,0 +1,145 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI
+ * Class: PropertyConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using System.Reflection;
+
+namespace System.Web.UI
+{
+ public sealed class PropertyConverter
+ {
+ private static Type[] parseMethodTypes;
+ private static Type[] parseMethodTypesWithSOP;
+
+ static PropertyConverter()
+ {
+ parseMethodTypes = new Type[1];
+ parseMethodTypes[0] = typeof(string);
+ parseMethodTypesWithSOP = new Type[2];
+ parseMethodTypesWithSOP[0] = typeof(string);
+ parseMethodTypesWithSOP[1] = typeof(IServiceProvider);
+ }
+
+ private PropertyConverter()
+ {
+ // Prevent any instance
+ }
+
+ public static object EnumFromString(Type enumType, string enumValue)
+ {
+ object retVal = null;
+ try
+ {
+ retVal = Enum.Parse(enumType, enumValue, true);
+ } catch
+ {
+ retVal = null;
+ }
+ return retVal;
+ }
+
+ public static string EnumToString(Type enumType, object enumValue)
+ {
+ string retVal = Enum.Format(enumType, enumValue, "G");
+ return retVal.Replace('_','-');
+ }
+
+ public static object ObjectFromString(Type objType, MemberInfo propertyInfo, string objValue)
+ {
+ if(objValue == null)
+ return null;
+ if(! (!objType.Equals(typeof(Boolean)) || objValue.Length > 0) )
+ {
+ return null;
+ }
+ if(objType.IsEnum)
+ {
+ return EnumFromString(objType, objValue);
+ }
+ if(objType.Equals(typeof(string)))
+ {
+ return objValue;
+ }
+ PropertyDescriptor pc = null;
+ if(propertyInfo != null)
+ {
+ pc = (TypeDescriptor.GetProperties(propertyInfo.ReflectedType))[propertyInfo.Name];
+ }
+ if(pc != null)
+ {
+ TypeConverter converter = pc.Converter;
+ if(converter!=null && converter.CanConvertFrom(typeof(string)))
+ {
+ return converter.ConvertFromInvariantString(objValue);
+ }
+ }
+ MethodInfo mi = objType.GetMethod("Parse", parseMethodTypesWithSOP);
+ object o = null;
+ if(mi != null)
+ {
+ object[] parameters = new object[2];
+ parameters[0] = objValue;
+ parameters[1] = CultureInfo.InvariantCulture;
+ try
+ {
+ o = Utils.InvokeMethod(mi, null, parameters);
+ } catch
+ {
+ }
+ }
+ if(o == null)
+ {
+ mi = objType.GetMethod("Parse", parseMethodTypes);
+ if(mi!=null)
+ {
+ object[] parameters = new object[1];
+ parameters[0] = objValue;
+ try
+ {
+ o = Utils.InvokeMethod(mi, null, parameters);
+ } catch
+ {
+ }
+ }
+ }
+ if(o == null)
+ {
+ throw new HttpException(/*HttpRuntime.FormatResourceString(*/"Type_not_creatable_from_string"/*, objType.FullName, objValue, propertyInfo.Name)*/);
+ }
+ return o;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/PropertyEntry.cs b/mcs/class/System.Web/System.Web.UI/PropertyEntry.cs
new file mode 100644
index 00000000000..942d262910d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PropertyEntry.cs
@@ -0,0 +1,69 @@
+//
+// System.Web.UI.PropertyEntry
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// Copyright (c) 2005 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
+// "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.
+//
+#if NET_2_0
+using System;
+using System.Reflection;
+
+namespace System.Web.UI
+{
+ public abstract class PropertyEntry {
+ Type type;
+ string name;
+ string filter;
+ PropertyInfo pinfo;
+
+ public Type DeclaringType {
+ get { return pinfo.DeclaringType; }
+ }
+
+ public string Filter {
+ get { return filter; }
+ set { filter = value; }
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public PropertyInfo PropertyInfo {
+ get { return pinfo; }
+ set { pinfo = value; }
+ }
+
+ public Type Type {
+ get { return type; }
+ set { type = value; }
+ }
+ }
+
+}
+#endif // NET_2_0
+
diff --git a/mcs/class/System.Web/System.Web.UI/RenderMethod.cs b/mcs/class/System.Web/System.Web.UI/RenderMethod.cs
new file mode 100755
index 00000000000..d1e688f7d78
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/RenderMethod.cs
@@ -0,0 +1,34 @@
+//
+//
+// System.Web.UI.RenderMethod.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+//
+// 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.
+//
+
+namespace System.Web.UI {
+
+ public delegate void RenderMethod (HtmlTextWriter output, Control container);
+}
diff --git a/mcs/class/System.Web/System.Web.UI/RootBuilder.cs b/mcs/class/System.Web/System.Web.UI/RootBuilder.cs
new file mode 100644
index 00000000000..8bf44dc77a1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/RootBuilder.cs
@@ -0,0 +1,143 @@
+//
+// System.Web.UI.RootBuilder
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc. (http://www.ximian.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;
+using System.Collections;
+using System.Web.Compilation;
+using System.Web.UI.HtmlControls;
+
+namespace System.Web.UI
+{
+ public sealed class RootBuilder : TemplateBuilder
+ {
+ static Hashtable htmlControls;
+ static Hashtable htmlInputControls;
+ AspComponentFoundry foundry;
+
+ static RootBuilder ()
+ {
+ htmlControls = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant,
+ CaseInsensitiveComparer.DefaultInvariant);
+
+ htmlControls.Add ("A", typeof (HtmlAnchor));
+ htmlControls.Add ("BUTTON", typeof (HtmlButton));
+ htmlControls.Add ("FORM", typeof (HtmlForm));
+ htmlControls.Add ("IMG", typeof (HtmlImage));
+ htmlControls.Add ("INPUT", "INPUT");
+ htmlControls.Add ("SELECT", typeof (HtmlSelect));
+ htmlControls.Add ("TABLE", typeof (HtmlTable));
+ htmlControls.Add ("TD", typeof (HtmlTableCell));
+ htmlControls.Add ("TH", typeof (HtmlTableCell));
+ htmlControls.Add ("TR", typeof (HtmlTableRow));
+ htmlControls.Add ("TEXTAREA", typeof (HtmlTextArea));
+#if NET_2_0
+ htmlControls.Add ("HEAD", typeof (HtmlHead));
+#endif
+
+ htmlInputControls = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant,
+ CaseInsensitiveComparer.DefaultInvariant);
+
+ htmlInputControls.Add ("BUTTON", typeof (HtmlInputButton));
+ htmlInputControls.Add ("SUBMIT", typeof (HtmlInputButton));
+ htmlInputControls.Add ("RESET", typeof (HtmlInputButton));
+ htmlInputControls.Add ("CHECKBOX", typeof (HtmlInputCheckBox));
+ htmlInputControls.Add ("FILE", typeof (HtmlInputFile));
+ htmlInputControls.Add ("HIDDEN", typeof (HtmlInputHidden));
+ htmlInputControls.Add ("IMAGE", typeof (HtmlInputImage));
+ htmlInputControls.Add ("RADIO", typeof (HtmlInputRadioButton));
+ htmlInputControls.Add ("TEXT", typeof (HtmlInputText));
+ htmlInputControls.Add ("PASSWORD", typeof (HtmlInputText));
+ }
+
+ public RootBuilder (TemplateParser parser)
+ {
+ foundry = new AspComponentFoundry ();
+ line = 1;
+ fileName = parser.InputFile;
+ Init (parser, null, null, null, null, null);
+ }
+
+ public override Type GetChildControlType (string tagName, IDictionary attribs)
+ {
+ string prefix;
+ string cname;
+ int colon = tagName.IndexOf (':');
+ if (colon != -1) {
+ if (colon == 0)
+ throw new Exception ("Empty TagPrefix is not valid");
+
+ if (colon + 1 == tagName.Length)
+ return null;
+
+ prefix = tagName.Substring (0, colon);
+ cname = tagName.Substring (colon + 1);
+ } else {
+ prefix = "";
+ cname = tagName;
+ }
+
+ Type t = foundry.GetComponentType (prefix, cname);
+ if (t != null)
+ return t;
+ else if (prefix != "")
+ throw new Exception ("TagPrefix " + prefix + " not registered");
+
+ return LookupHtmlControls (tagName, attribs);
+ }
+
+ static Type LookupHtmlControls (string tagName, IDictionary attribs)
+ {
+ object o = htmlControls [tagName];
+ if (o is string) {
+ if (attribs == null)
+ throw new HttpException ("Unable to map input type control to a Type.");
+
+ string ctype = attribs ["TYPE"] as string;
+ if (ctype == null)
+ ctype = "TEXT"; // The default used by MS
+
+ Type t = htmlInputControls [ctype] as Type;
+ if (t == null)
+ throw new HttpException ("Unable to map input type control to a Type.");
+
+ return t;
+ }
+
+ if (o == null)
+ o = typeof (HtmlGenericControl);
+
+ return (Type) o;
+ }
+
+ internal AspComponentFoundry Foundry {
+ get { return foundry; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/SimpleHandlerFactory.cs b/mcs/class/System.Web/System.Web.UI/SimpleHandlerFactory.cs
new file mode 100644
index 00000000000..a9c491f57a3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/SimpleHandlerFactory.cs
@@ -0,0 +1,54 @@
+//
+// System.Web.UI.SimpleHandlerFactory
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.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.Web;
+
+namespace System.Web.UI
+{
+ class SimpleHandlerFactory : IHttpHandlerFactory
+ {
+ public virtual IHttpHandler GetHandler (HttpContext context,
+ string requestType,
+ string virtualPath,
+ string path)
+ {
+ Type type = WebHandlerParser.GetCompiledType (context, virtualPath, path);
+ if (!(typeof (IHttpHandler).IsAssignableFrom (type)))
+ throw new HttpException ("Type does not implement IHttpHandler: " + type.FullName);
+
+ return Activator.CreateInstance (type) as IHttpHandler;
+ }
+
+ public virtual void ReleaseHandler (IHttpHandler handler)
+ {
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/SimplePropertyEntry.cs b/mcs/class/System.Web/System.Web.UI/SimplePropertyEntry.cs
new file mode 100644
index 00000000000..057c9debf9a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/SimplePropertyEntry.cs
@@ -0,0 +1,49 @@
+//
+// System.Web.UI.SimplePropertyEntry
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// Copyright (c) 2005 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI
+{
+ public class SimplePropertyEntry : PropertyEntry {
+ bool useSetAttribute;
+ object val;
+
+ public bool UseSetAttribute {
+ get { return useSetAttribute; }
+ set { useSetAttribute = value; }
+ }
+
+ public object Value {
+ get { return val; }
+ set { val = value; }
+ }
+ }
+}
+#endif // NET_2_0
+
diff --git a/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs b/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs
new file mode 100644
index 00000000000..ec28beb30d2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs
@@ -0,0 +1,465 @@
+//
+// System.Web.UI.SimpleWebHandlerParser
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.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;
+using System.CodeDom.Compiler;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using System.Web;
+using System.Web.Compilation;
+using System.Web.Configuration;
+using System.Web.Util;
+
+namespace System.Web.UI
+{
+ public abstract class SimpleWebHandlerParser
+ {
+ HttpContext context;
+ string vPath;
+ string physPath;
+ string className;
+ string codeBehind;
+ bool debug;
+ string language;
+ string program;
+ bool gotDefault;
+ ArrayList assemblies;
+ ArrayList dependencies;
+ Hashtable anames;
+ string privateBinPath;
+ string baseDir;
+ string baseVDir;
+ CompilationConfiguration compilationConfig;
+ int appAssemblyIndex = -1;
+ Type cachedType;
+
+ protected SimpleWebHandlerParser (HttpContext context, string virtualPath, string physicalPath)
+ {
+ cachedType = CachingCompiler.GetTypeFromCache (physicalPath);
+ if (cachedType != null)
+ return; // We don't need anything else.
+
+ this.context = context;
+ this.vPath = virtualPath;
+ this.physPath = physicalPath;
+ AddDependency (physicalPath);
+
+ assemblies = new ArrayList ();
+ string location = Context.ApplicationInstance.AssemblyLocation;
+ if (location != typeof (TemplateParser).Assembly.Location)
+ appAssemblyIndex = assemblies.Add (location);
+
+ assemblies.AddRange (CompilationConfig.Assemblies);
+ if (CompilationConfig.AssembliesInBin)
+ AddAssembliesInBin ();
+
+ language = CompilationConfig.DefaultLanguage;
+
+ GetDirectivesAndContent ();
+ }
+
+ protected Type GetCompiledTypeFromCache ()
+ {
+ return cachedType;
+ }
+
+ void GetDirectivesAndContent ()
+ {
+ StreamReader reader = new StreamReader (File.OpenRead (physPath));
+ string line;
+ bool directiveFound = false;
+ StringBuilder content = new StringBuilder ();
+
+ while ((line = reader.ReadLine ()) != null && cachedType == null) {
+ string trimmed = line.Trim ();
+ if (!directiveFound && trimmed == String.Empty)
+ continue;
+
+ if (trimmed.StartsWith ("<")) {
+ ParseDirective (trimmed);
+ directiveFound = true;
+ if (gotDefault) {
+ cachedType = CachingCompiler.GetTypeFromCache (physPath);
+ if (cachedType != null)
+ break;
+ }
+
+ continue;
+ }
+
+ content.Append (line + "\n");
+ content.Append (reader.ReadToEnd ());
+ }
+ reader.Close ();
+
+ if (!gotDefault)
+ throw new ParseException (null, "No @" + DefaultDirectiveName +
+ " directive found");
+
+ if (cachedType == null)
+ this.program = content.ToString ();
+ }
+
+ void TagParsed (ILocation location, System.Web.Compilation.TagType tagtype, string tagid, TagAttributes attributes)
+ {
+ if (tagtype != System.Web.Compilation.TagType.Directive)
+ throw new ParseException (location, "Unexpected tag");
+
+ if (String.Compare (tagid, DefaultDirectiveName, true) == 0) {
+ AddDefaultDirective (location, attributes);
+ } else if (String.Compare (tagid, "Assembly", true) == 0) {
+ AddAssemblyDirective (location, attributes);
+ } else {
+ throw new ParseException (location, "Unexpected directive: " + tagid);
+ }
+ }
+
+ void TextParsed (ILocation location, string text)
+ {
+ if (text.Trim () != "")
+ throw new ParseException (location, "Text not allowed here");
+ }
+
+ void ParseError (ILocation location, string message)
+ {
+ throw new ParseException (location, message);
+ }
+
+ static string GetAndRemove (Hashtable table, string key)
+ {
+ string o = table [key] as string;
+ table.Remove (key);
+ return o;
+ }
+
+ void ParseDirective (string line)
+ {
+ AspParser parser = new AspParser (physPath, new StringReader (line));
+ parser.Error += new ParseErrorHandler (ParseError);
+ parser.TagParsed += new TagParsedHandler (TagParsed);
+ parser.TextParsed += new TextParsedHandler (TextParsed);
+
+ parser.Parse ();
+ }
+
+ internal virtual void AddDefaultDirective (ILocation location, TagAttributes attrs)
+ {
+ if (gotDefault)
+ throw new ParseException (location, "duplicate " + DefaultDirectiveName + " directive");
+
+ gotDefault = true;
+ Hashtable attributes = attrs.GetDictionary (null);
+ className = GetAndRemove (attributes, "class");
+ if (className == null)
+ throw new ParseException (null, "No Class attribute found.");
+
+ string d = GetAndRemove (attributes, "debug");
+ if (d != null) {
+ debug = (String.Compare (d, "true", true) == 0);
+ if (debug == false && String.Compare (d, "false", true) != 0)
+ throw new ParseException (null, "Invalid value for Debug attribute");
+ }
+
+ language = GetAndRemove (attributes, "language");
+ if (language == null)
+ language = CompilationConfig.DefaultLanguage;
+
+ codeBehind = GetAndRemove (attributes, "codebehind");
+ if (attributes.Count > 0)
+ throw new ParseException (location, "Unrecognized attribute in " +
+ DefaultDirectiveName + " directive");
+ }
+
+ internal virtual void AddAssemblyDirective (ILocation location, TagAttributes attrs)
+ {
+ Hashtable tbl = attrs.GetDictionary (null);
+ string name = GetAndRemove (tbl, "Name");
+ string src = GetAndRemove (tbl, "Src");
+ if (name == null && src == null)
+ throw new ParseException (location, "You gotta specify Src or Name");
+
+ if (name != null && src != null)
+ throw new ParseException (location, "Src and Name cannot be used together");
+
+ if (name != null) {
+ AddAssemblyByName (name, location);
+ } else {
+ GetAssemblyFromSource (src, location);
+ }
+
+ if (tbl.Count > 0)
+ throw new ParseException (location, "Unrecognized attribute in Assembly directive");
+ }
+
+ internal virtual void AddAssembly (Assembly assembly, bool fullPath)
+ {
+ if (anames == null)
+ anames = new Hashtable ();
+
+ string name = assembly.GetName ().Name;
+ string loc = assembly.Location;
+ if (fullPath) {
+ if (!assemblies.Contains (loc)) {
+ assemblies.Add (loc);
+ }
+
+ anames [name] = loc;
+ anames [loc] = assembly;
+ } else {
+ if (!assemblies.Contains (name)) {
+ assemblies.Add (name);
+ }
+
+ anames [name] = assembly;
+ }
+ }
+
+ internal virtual Assembly AddAssemblyByName (string name, ILocation location)
+ {
+ if (anames == null)
+ anames = new Hashtable ();
+
+ if (anames.Contains (name)) {
+ object o = anames [name];
+ if (o is string)
+ o = anames [o];
+
+ return (Assembly) o;
+ }
+
+ Assembly assembly = LoadAssemblyFromBin (name);
+ if (assembly != null) {
+ AddAssembly (assembly, true);
+ return assembly;
+ }
+
+ try {
+ assembly = Assembly.LoadWithPartialName (name);
+ } catch (Exception e) {
+ throw new ParseException (location, "Assembly " + name + " not found", e);
+ }
+
+ AddAssembly (assembly, true);
+ return assembly;
+ }
+
+ void AddAssembliesInBin ()
+ {
+ if (!Directory.Exists (PrivateBinPath))
+ return;
+
+ string [] binDlls = Directory.GetFiles (PrivateBinPath, "*.dll");
+ foreach (string dll in binDlls) {
+ try {
+ Assembly assembly = Assembly.LoadFrom (dll);
+ AddAssembly (assembly, true);
+ } catch (Exception e) {
+ throw new Exception ("Error while loading " + dll, e);
+ }
+ }
+ }
+
+ Assembly LoadAssemblyFromBin (string name)
+ {
+ Assembly assembly;
+ if (!Directory.Exists (PrivateBinPath))
+ return null;
+
+ string [] binDlls = Directory.GetFiles (PrivateBinPath, "*.dll");
+ foreach (string dll in binDlls) {
+ string fn = Path.GetFileName (dll);
+ fn = Path.ChangeExtension (fn, null);
+ if (fn != name)
+ continue;
+
+ assembly = Assembly.LoadFrom (dll);
+ return assembly;
+ }
+
+ return null;
+ }
+
+ Assembly GetAssemblyFromSource (string vpath, ILocation location)
+ {
+ vpath = UrlUtils.Combine (BaseVirtualDir, vpath);
+ string realPath = context.Request.MapPath (vpath);
+ if (!File.Exists (realPath))
+ throw new ParseException (location, "File " + vpath + " not found");
+
+ AddDependency (realPath);
+
+ CompilerResults result = CachingCompiler.Compile (language, realPath, realPath, assemblies);
+ if (result.NativeCompilerReturnValue != 0) {
+ StreamReader reader = new StreamReader (realPath);
+ throw new CompilationException (realPath, result.Errors, reader.ReadToEnd ());
+ }
+
+ AddAssembly (result.CompiledAssembly, true);
+ return result.CompiledAssembly;
+ }
+
+ internal Type GetTypeFromBin (string typeName)
+ {
+ if (!Directory.Exists (PrivateBinPath))
+ throw new HttpException (String.Format ("Type {0} not found.", typeName));
+
+ string [] binDlls = Directory.GetFiles (PrivateBinPath, "*.dll");
+ Type result = null;
+ foreach (string dll in binDlls) {
+ Assembly assembly = Assembly.LoadFrom (dll);
+ Type type = assembly.GetType (typeName, false);
+ if (type != null) {
+ if (result != null)
+ throw new HttpException (String.Format ("Type {0} is not unique.", typeName));
+
+ result = type;
+ }
+ }
+
+ if (result == null)
+ throw new HttpException (String.Format ("Type {0} not found.", typeName));
+
+ return result;
+ }
+
+ internal virtual void AddDependency (string filename)
+ {
+ if (dependencies == null)
+ dependencies = new ArrayList ();
+
+ if (!dependencies.Contains (filename))
+ dependencies.Add (filename);
+ }
+
+ // Properties
+ protected abstract string DefaultDirectiveName { get; }
+
+ internal HttpContext Context {
+ get { return context; }
+ }
+
+ internal string VirtualPath {
+ get { return vPath; }
+ }
+
+ internal string PhysicalPath {
+ get { return physPath; }
+ }
+
+ internal string ClassName {
+ get { return className; }
+ }
+
+ internal string CodeBehind {
+ get { return codeBehind; }
+ }
+
+ internal bool Debug {
+ get { return debug; }
+ }
+
+ internal string Language {
+ get { return language; }
+ }
+
+ internal string Program {
+ get { return program; }
+ }
+
+ internal ArrayList Assemblies {
+ get {
+ if (appAssemblyIndex != -1) {
+ object o = assemblies [appAssemblyIndex];
+ assemblies.RemoveAt (appAssemblyIndex);
+ assemblies.Add (o);
+ appAssemblyIndex = -1;
+ }
+
+ return assemblies;
+ }
+ }
+
+ internal ArrayList Dependencies {
+ get { return dependencies; }
+ }
+
+ internal string PrivateBinPath {
+ get {
+ if (privateBinPath != null)
+ return privateBinPath;
+
+ AppDomainSetup setup = AppDomain.CurrentDomain.SetupInformation;
+ privateBinPath = setup.PrivateBinPath;
+
+ if (!Path.IsPathRooted (privateBinPath)) {
+ string appbase = setup.ApplicationBase;
+ if (appbase.StartsWith ("file://")) {
+ appbase = appbase.Substring (7);
+ if (Path.DirectorySeparatorChar != '/')
+ appbase = appbase.Replace ('/', Path.DirectorySeparatorChar);
+ }
+ privateBinPath = Path.Combine (appbase, privateBinPath);
+ }
+
+ return privateBinPath;
+ }
+ }
+
+ internal string BaseDir {
+ get {
+ if (baseDir == null)
+ baseDir = context.Request.MapPath (BaseVirtualDir);
+
+ return baseDir;
+ }
+ }
+
+ internal virtual string BaseVirtualDir {
+ get {
+ if (baseVDir == null)
+ baseVDir = UrlUtils.GetDirectory (context.Request.FilePath);
+
+ return baseVDir;
+ }
+ }
+
+ internal CompilationConfiguration CompilationConfig {
+ get {
+ if (compilationConfig == null)
+ compilationConfig = CompilationConfiguration.GetInstance (context);
+
+ return compilationConfig;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/StateBag.cs b/mcs/class/System.Web/System.Web.UI/StateBag.cs
new file mode 100644
index 00000000000..6fbcae047eb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/StateBag.cs
@@ -0,0 +1,277 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI
+ * Class: StateBag
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI
+{
+ public sealed class StateBag : IStateManager, IDictionary, ICollection, IEnumerable
+ {
+ private bool marked;
+ private HybridDictionary bag;
+
+ public StateBag (bool ignoreCase)
+ {
+ Initialize (ignoreCase);
+ }
+
+ public StateBag ()
+ {
+ Initialize (false);
+ }
+
+ private void Initialize (bool ignoreCase)
+ {
+ marked = false;
+ bag = new HybridDictionary (ignoreCase);
+ }
+
+ public int Count {
+ get { return bag.Count; }
+ }
+
+
+ public object this [string key] {
+ get {
+ if (key == null || key.Length == 0)
+ throw new ArgumentException (HttpRuntime.FormatResourceString ("Key_Cannot_Be_Null"));
+
+ object val = bag [key];
+
+ if (val is StateItem)
+ return ((StateItem) val).Value;
+
+ return null; //
+ }
+
+ set { Add (key, value); }
+ }
+
+ object IDictionary.this [object key] {
+ get { return this [(string) key] as object; }
+
+ set { Add ((string) key, value); }
+ }
+
+ public ICollection Keys {
+ get { return bag.Keys; }
+ }
+
+ public ICollection Values {
+ get { return bag.Values; }
+ }
+
+ public StateItem Add (string key, object value)
+ {
+ if (key == null || key.Length == 0)
+ throw new ArgumentException (HttpRuntime.FormatResourceString ("Key_Cannot_Be_Null"));
+
+ StateItem val = bag [key] as StateItem; //don't throw exception when null
+ if(val == null) {
+ if(value != null || marked) {
+ val = new StateItem (value);
+ bag.Add (key, val);
+ }
+ }
+ else if (value == null && !marked)
+ bag.Remove (key);
+ else
+ val.Value = value;
+
+ if (val != null && marked) {
+ val.IsDirty = true;
+ }
+
+ return val;
+ }
+
+ public void Clear ()
+ {
+ bag.Clear ();
+ }
+
+ public IDictionaryEnumerator GetEnumerator ()
+ {
+ return bag.GetEnumerator ();
+ }
+
+ public bool IsItemDirty (string key)
+ {
+ object o = bag [key];
+
+ if (o is StateItem)
+ return ((StateItem) o).IsDirty;
+
+ return false;
+ }
+
+ public void Remove (string key)
+ {
+ bag.Remove (key);
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ public void SetItemDirty (string key, bool dirty)
+ {
+ if (bag [key] is StateItem)
+ ((StateItem) bag [key]).IsDirty = dirty;
+ }
+
+ internal bool IsTrackingViewState {
+ get { return marked; }
+ }
+
+ internal void LoadViewState (object state)
+ {
+ if(state!=null) {
+ Pair pair = (Pair) state;
+ ArrayList keyList = (ArrayList) (pair.First);
+ ArrayList valList = (ArrayList) (pair.Second);
+
+ int valCount = valList.Count;
+ for(int i = 0; i < keyList.Count; i++) {
+ if (i < valCount)
+ Add ((string) keyList [i], valList [i]);
+ else
+ Add ((string) keyList [i], null);
+ }
+ }
+ }
+
+ internal object SaveViewState ()
+ {
+ if(bag.Count > 0) {
+ ArrayList keyList = null, valList = null;
+
+ foreach (string key in bag.Keys) {
+ StateItem item = (StateItem) bag [key];
+
+ if (item.IsDirty) {
+ if (keyList == null) {
+ keyList = new ArrayList ();
+ valList = new ArrayList ();
+ }
+
+ keyList.Add (key);
+ valList.Add (item.Value);
+ }
+ }
+
+ if (keyList!=null)
+ return new Pair (keyList, valList);
+ }
+ return null;
+ }
+
+ internal void TrackViewState()
+ {
+ marked = true;
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return GetEnumerator ();
+ }
+
+ void IStateManager.LoadViewState (object savedState)
+ {
+ LoadViewState (savedState);
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ return SaveViewState ();
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ TrackViewState ();
+ }
+
+ bool IStateManager.IsTrackingViewState {
+ get { return IsTrackingViewState; }
+ }
+
+ void ICollection.CopyTo (Array array, int index)
+ {
+ Values.CopyTo (array, index);
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return false; }
+ }
+
+ object ICollection.SyncRoot
+ {
+ get { return this; }
+ }
+
+ void IDictionary.Add (object key, object value)
+ {
+ Add ((string) key, value);
+ }
+
+ void IDictionary.Remove (object key)
+ {
+ Remove ((string) key);
+ }
+
+ bool IDictionary.Contains (object key)
+ {
+ return bag.Contains ((string) key);
+ }
+
+ bool IDictionary.IsFixedSize {
+ get { return false; }
+ }
+
+ bool IDictionary.IsReadOnly {
+ get { return false; }
+ }
+
+#if NET_2_0
+ public void SetDirty ()
+ {
+ foreach (string key in bag.Keys)
+ SetItemDirty (key, true);
+ }
+#endif
+
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/StateItem.cs b/mcs/class/System.Web/System.Web.UI/StateItem.cs
new file mode 100644
index 00000000000..2cffd164ccf
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/StateItem.cs
@@ -0,0 +1,68 @@
+//
+// System.Web.UI.StateItem.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public sealed class StateItem
+ {
+ private bool _isDirty = false;
+ private object _value = null;
+ public bool IsDirty
+ {
+ get
+ {
+ return _isDirty;
+ }
+ set
+ {
+ _isDirty = value;
+ }
+ }
+ public object Value
+ {
+ get
+ {
+ return _value;
+ }
+ set
+ {
+ _value = value;
+ }
+ }
+ private StateItem() {}
+ internal StateItem(Object value)
+ {
+ _value = value;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/StateManagedCollection.cs b/mcs/class/System.Web/System.Web.UI/StateManagedCollection.cs
new file mode 100644
index 00000000000..309f6f01bb7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/StateManagedCollection.cs
@@ -0,0 +1,352 @@
+//
+// System.Web.UI.StateManagedCollection
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.UI {
+ public abstract class StateManagedCollection : IList, IStateManager
+ {
+ ArrayList items = new ArrayList ();
+ bool saveEverything = false;
+ IStateManager[] originalItems;
+
+ protected abstract object CreateKnownType (int index);
+ protected abstract void SetDirtyObject (object o);
+ protected virtual Type [] GetKnownTypes ()
+ {
+ return null;
+ }
+
+ #region OnXXX
+ protected virtual void OnClear ()
+ {
+ }
+
+ protected virtual void OnClearComplete ()
+ {
+ }
+
+ protected virtual void OnInsert (int index, object value)
+ {
+ }
+
+ protected virtual void OnInsertComplete (int index, object value)
+ {
+ }
+
+ protected virtual void OnRemove (int index, object value)
+ {
+ }
+
+ protected virtual void OnRemoveComplete (int index, object value)
+ {
+ }
+
+ protected virtual void OnValidate (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ }
+ #endregion
+
+ #region IStateManager
+ void IStateManager.LoadViewState (object savedState)
+ {
+ if (savedState == null) {
+ foreach (IStateManager item in items)
+ item.LoadViewState (null);
+ return;
+ }
+
+ object[] its = (object[]) savedState;
+
+ saveEverything = (bool)its [0];
+
+ if (saveEverything)
+ items.Clear ();
+
+ for (int n=1; n<its.Length; n++) {
+ int oi;
+ object state;
+ object type;
+
+ Triplet triplet = its [n] as Triplet;
+ if (triplet != null) {
+ oi = (int) triplet.First;
+ state = triplet.Second;
+ type = triplet.Third;
+ } else {
+ Pair pair = (Pair) its [n];
+ oi = (int) pair.First;
+ state = pair.Second;
+ type = null;
+ }
+
+ IStateManager item;
+ if (oi != -1)
+ item = originalItems [oi];
+ else {
+ if (type is Type)
+ item = (IStateManager) Activator.CreateInstance ((Type) type);
+ else
+ item = (IStateManager) CreateKnownType ((int) type);
+ }
+
+ if (saveEverything) ((IList)this).Add (item);
+
+ item.LoadViewState (state);
+ }
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ object[] state = null;
+ bool hasData = false;
+ Type[] knownTypes = GetKnownTypes ();
+
+ if (saveEverything) {
+ state = new object [items.Count + 1];
+ state [0] = true;
+ for (int n=0; n<items.Count; n++)
+ {
+ IStateManager item = (IStateManager) items [n];
+ int oi = Array.IndexOf (originalItems, item);
+ object ns = item.SaveViewState ();
+ if (ns != null) hasData = true;
+
+ if (oi == -1) {
+ Type t = item.GetType ();
+ int idx = knownTypes == null ? -1 : Array.IndexOf (knownTypes, t);
+ if (idx != -1)
+ state [n + 1] = new Triplet (oi, ns, idx);
+ else
+ state [n + 1] = new Triplet (oi, ns, t);
+ }
+ else
+ state [n + 1] = new Pair (oi, ns);
+ }
+ } else {
+ ArrayList list = new ArrayList ();
+ for (int n=0; n<items.Count; n++) {
+ IStateManager item = (IStateManager) items [n];
+ object ns = item.SaveViewState ();
+ if (ns != null) {
+ hasData = true;
+ list.Add (new Pair (n, ns));
+ }
+ }
+ if (hasData) {
+ list.Insert (0, false);
+ state = list.ToArray ();
+ }
+ }
+
+ if (hasData)
+ return state;
+ else
+ return null;
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ isTrackingViewState = true;
+ originalItems = new IStateManager [items.Count];
+ for (int n=0; n<items.Count; n++) {
+ originalItems [n] = (IStateManager) items [n];
+ originalItems [n].TrackViewState ();
+ }
+
+ }
+
+ bool isTrackingViewState;
+ bool IStateManager.IsTrackingViewState {
+ get { return isTrackingViewState; }
+ }
+ #endregion
+
+ #region ICollection, IList, IEnumerable
+
+ public void Clear ()
+ {
+ this.OnClear ();
+ items.Clear ();
+ this.OnClearComplete ();
+
+ if (isTrackingViewState)
+ saveEverything = true;
+ }
+
+ public int IndexOf (object o)
+ {
+ if (o == null)
+ return -1;
+ return items.IndexOf (o);
+ }
+
+ public bool Contains (object o)
+ {
+ return o != null && items.Contains (o);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return items.GetEnumerator ();
+ }
+
+ void System.Collections.ICollection.CopyTo (Array array, int index)
+ {
+ items.CopyTo (array, index);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return GetEnumerator ();
+ }
+
+ int IList.Add (object value)
+ {
+ OnValidate(value);
+ if (isTrackingViewState) {
+ ((IStateManager) value).TrackViewState ();
+ SetDirtyObject (value);
+ saveEverything = true;
+ }
+
+ OnInsert (-1, value);
+ items.Add (value);
+ OnInsertComplete (-1, value);
+
+ return Count - 1;
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ OnValidate(value);
+ if (isTrackingViewState) {
+ ((IStateManager) value).TrackViewState ();
+ SetDirtyObject (value);
+ saveEverything = true;
+ }
+
+ OnInsert (index, value);
+ items.Insert (index, value);
+ OnInsertComplete(index, value);
+ }
+
+ void IList.Remove (object value)
+ {
+ if (value == null)
+ return;
+ OnValidate (value);
+ ((IList)this).RemoveAt (IndexOf (value));
+ }
+ void IList.RemoveAt (int index)
+ {
+ object o = items [index];
+
+ OnRemove (index, o);
+ items.RemoveAt (index);
+ OnRemoveComplete(index, o);
+
+ if (isTrackingViewState)
+ saveEverything = true;
+ }
+
+ void IList.Clear ()
+ {
+ this.Clear ();
+ }
+
+ bool IList.Contains (object value)
+ {
+ if (value == null)
+ return false;
+
+ OnValidate (value);
+ return Contains (value);
+ }
+
+ int IList.IndexOf (object value)
+ {
+ if (value == null)
+ return -1;
+
+ OnValidate (value);
+ return IndexOf (value);
+ }
+
+ public int Count {
+ get { return items.Count; }
+ }
+
+ int ICollection.Count {
+ get { return items.Count; }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return false; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return false; }
+ }
+
+ bool IList.IsReadOnly {
+ get { return false; }
+ }
+
+ object IList.this [int index] {
+ get { return items [index]; }
+ set {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("index");
+
+ OnValidate (value);
+ if (isTrackingViewState) {
+ ((IStateManager) value).TrackViewState ();
+ SetDirtyObject (value);
+ saveEverything = true;
+ }
+
+ items [index] = value;
+ }
+ }
+ #endregion
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/StaticPartialCachingControl.cs b/mcs/class/System.Web/System.Web.UI/StaticPartialCachingControl.cs
new file mode 100644
index 00000000000..4ab2af9870b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/StaticPartialCachingControl.cs
@@ -0,0 +1,72 @@
+//
+// System.Web.UI.StaticPartialCachingControl.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+
+namespace System.Web.UI
+{
+ public class StaticPartialCachingControl : BasePartialCachingControl
+ {
+
+ private BuildMethod buildMethod;
+
+ public StaticPartialCachingControl (string ctrlID, string guid, int duration,
+ string varyByParams, string varyByControls, string varyByCustom,
+ BuildMethod buildMethod)
+ {
+ CtrlID = ctrlID;
+ Guid = guid;
+ Duration = duration;
+ VaryByParams = varyByParams;
+ VaryByControls = varyByControls;
+ VaryByCustom = varyByCustom;
+
+ this.buildMethod = buildMethod;
+ }
+
+ public static void BuildCachedControl (Control parent, string ctrlID, string guid,
+ int duration, string varyByParams, string varyByControls,
+ string varyByCustom, BuildMethod buildMethod)
+ {
+ StaticPartialCachingControl NewControl =
+ new StaticPartialCachingControl (ctrlID, guid, duration,
+ varyByParams, varyByControls, varyByCustom,
+ buildMethod);
+
+ parent.Controls.Add (NewControl);
+ }
+
+ internal override Control CreateControl()
+ {
+ return buildMethod ();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/TagPrefixAttribute.cs b/mcs/class/System.Web/System.Web.UI/TagPrefixAttribute.cs
new file mode 100755
index 00000000000..233b0669308
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/TagPrefixAttribute.cs
@@ -0,0 +1,58 @@
+//
+// System.Web.UI.TagPrefixAttribute.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+//
+// 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;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class TagPrefixAttribute : Attribute
+ {
+ string namespaceName;
+ string tagPrefix;
+
+ public TagPrefixAttribute (string namespaceName,
+ string tagPrefix)
+ {
+ if (namespaceName == null || tagPrefix == null)
+ throw new ArgumentNullException ();
+
+ this.namespaceName = namespaceName;
+ this.tagPrefix = tagPrefix;
+ }
+
+ public string NamespaceName {
+ get { return namespaceName; }
+ }
+
+ public string TagPrefix {
+ get { return tagPrefix; }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/TemplateBuilder.cs b/mcs/class/System.Web/System.Web.UI/TemplateBuilder.cs
new file mode 100644
index 00000000000..9a30ef94609
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/TemplateBuilder.cs
@@ -0,0 +1,130 @@
+//
+// System.Web.UI.TemplateBuilder
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc. (http://www.ximian.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;
+using System.Collections;
+using System.Reflection;
+#if NET_2_0
+using System.ComponentModel;
+#endif
+
+namespace System.Web.UI
+{
+ public class TemplateBuilder : ControlBuilder, ITemplate
+ {
+ string text;
+ TemplateContainerAttribute containerAttribute;
+#if NET_2_0
+ ArrayList bindings;
+#endif
+
+ public TemplateBuilder ()
+ {
+ }
+
+ internal TemplateBuilder (ICustomAttributeProvider prov)
+ {
+ object[] ats = prov.GetCustomAttributes (typeof(TemplateContainerAttribute), true);
+ if (ats.Length > 0) {
+ containerAttribute = (TemplateContainerAttribute) ats [0];
+ }
+ }
+
+ public virtual string Text {
+ get { return text; }
+ set { text = value; }
+ }
+
+ internal Type ContainerType {
+ get { return containerAttribute != null ? containerAttribute.ContainerType : null; }
+ }
+
+#if NET_2_0
+ internal BindingDirection BindingDirection {
+ get { return containerAttribute != null ? containerAttribute.BindingDirection : BindingDirection.OneWay; }
+ }
+
+ internal void RegisterBoundProperty (Type controlType, string controlProperty, string controlId, string fieldName)
+ {
+ if (bindings == null) bindings = new ArrayList ();
+ bindings.Add (new TemplateBinding (controlType, controlProperty, controlId, fieldName));
+ }
+
+ internal ICollection Bindings {
+ get { return bindings; }
+ }
+#endif
+
+ public override void Init (TemplateParser parser,
+ ControlBuilder parentBuilder,
+ Type type,
+ string tagName,
+ string ID,
+ IDictionary attribs)
+ {
+ // enough?
+ base.Init (parser, parentBuilder, type, tagName, ID, attribs);
+ }
+
+ public virtual void InstantiateIn (Control container)
+ {
+ CreateChildren (container);
+ }
+
+ public override bool NeedsTagInnerText ()
+ {
+ return false;
+ }
+
+ public override void SetTagInnerText (string text)
+ {
+ this.text = text;
+ }
+ }
+
+#if NET_2_0
+ internal class TemplateBinding
+ {
+ public Type ControlType;
+ public string ControlProperty;
+ public string ControlId;
+ public string FieldName;
+
+ public TemplateBinding (Type controlType, string controlProperty, string controlId, string fieldName)
+ {
+ ControlType = controlType;
+ ControlProperty = controlProperty;
+ ControlId = controlId;
+ FieldName = fieldName;
+ }
+ }
+#endif
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/TemplateContainerAttribute.cs b/mcs/class/System.Web/System.Web.UI/TemplateContainerAttribute.cs
new file mode 100755
index 00000000000..aac8d003efc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/TemplateContainerAttribute.cs
@@ -0,0 +1,63 @@
+//
+// System.Web.UI.TemplateContainerAttribute.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+//
+// 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;
+using System.ComponentModel;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Property)]
+ public sealed class TemplateContainerAttribute : Attribute
+ {
+ Type containerType;
+
+#if NET_2_0
+ BindingDirection direction;
+
+ public TemplateContainerAttribute (Type containerType, BindingDirection direction)
+ {
+ this.containerType = containerType;
+ this.direction = direction;
+ }
+
+ public BindingDirection BindingDirection {
+ get { return direction; }
+ }
+#endif
+
+ public TemplateContainerAttribute (Type containerType)
+ {
+ this.containerType = containerType;
+ }
+
+ public Type ContainerType {
+ get { return containerType; }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/TemplateContentType.cs b/mcs/class/System.Web/System.Web.UI/TemplateContentType.cs
new file mode 100644
index 00000000000..8e3579f388e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/TemplateContentType.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.UI.TemplateContentType.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI {
+ public enum TemplateContentType {
+ Complete = 0,
+ Fragment = 1
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/TemplateControl.cs b/mcs/class/System.Web/System.Web.UI/TemplateControl.cs
new file mode 100755
index 00000000000..e2249798227
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/TemplateControl.cs
@@ -0,0 +1,319 @@
+//
+// System.Web.UI.TemplateControl.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.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;
+using System.Collections;
+using System.ComponentModel;
+using System.Reflection;
+using System.Web;
+using System.Web.Compilation;
+using System.Web.Util;
+
+namespace System.Web.UI {
+
+ public abstract class TemplateControl : Control, INamingContainer
+ {
+ static object abortTransaction = new object ();
+ static object commitTransaction = new object ();
+ static object error = new object ();
+ static string [] methodNames = { "Page_Init",
+ "Page_Load",
+ "Page_DataBind",
+ "Page_PreRender",
+ "Page_Disposed",
+ "Page_Error",
+ "Page_Unload",
+ "Page_AbortTransaction",
+ "Page_CommitTransaction" };
+
+ const BindingFlags bflags = BindingFlags.Public |
+ BindingFlags.NonPublic |
+ BindingFlags.Instance;
+
+ #region Constructor
+ protected TemplateControl ()
+ {
+ Construct ();
+ }
+
+ #endregion
+
+ #region Properties
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ protected virtual int AutoHandlers {
+ get { return 0; }
+ set { }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ protected virtual bool SupportAutoEvents {
+ get { return true; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ protected virtual void Construct ()
+ {
+ }
+
+ [MonoTODO]
+ protected LiteralControl CreateResourceBasedLiteralControl (int offset,
+ int size,
+ bool fAsciiOnly)
+ {
+ return null;
+ }
+
+ internal void WireupAutomaticEvents ()
+ {
+ if (!SupportAutoEvents || !AutoEventWireup)
+ return;
+
+ Type type = GetType ();
+ foreach (string methodName in methodNames) {
+ MethodInfo method = type.GetMethod (methodName, bflags);
+ if (method == null)
+ continue;
+
+ if (method.DeclaringType != type) {
+ if (!method.IsPublic && !method.IsFamilyOrAssembly &&
+ !method.IsFamilyAndAssembly && !method.IsFamily)
+ continue;
+ }
+
+ if (method.ReturnType != typeof (void))
+ continue;
+
+ ParameterInfo [] parms = method.GetParameters ();
+ int length = parms.Length;
+ bool noParams = (length == 0);
+ if (!noParams && (length != 2 ||
+ parms [0].ParameterType != typeof (object) ||
+ parms [1].ParameterType != typeof (EventArgs)))
+ continue;
+
+ int pos = methodName.IndexOf ("_");
+ string eventName = methodName.Substring (pos + 1);
+ EventInfo evt = type.GetEvent (eventName);
+ if (evt == null) {
+ /* This should never happen */
+ continue;
+ }
+
+ if (noParams) {
+ NoParamsInvoker npi = new NoParamsInvoker (this, methodName);
+ evt.AddEventHandler (this, npi.FakeDelegate);
+ } else {
+ evt.AddEventHandler (this, Delegate.CreateDelegate (
+ typeof (EventHandler), this, methodName));
+ }
+ }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ protected virtual void FrameworkInitialize ()
+ {
+ }
+
+ Type GetTypeFromControlPath (string virtualPath)
+ {
+ if (virtualPath == null)
+ throw new ArgumentNullException ("virtualPath");
+
+ string vpath = UrlUtils.Combine (TemplateSourceDirectory, virtualPath);
+ string realpath = Context.Request.MapPath (vpath);
+ return UserControlParser.GetCompiledType (vpath, realpath, Context);
+ }
+
+ public Control LoadControl (string virtualPath)
+ {
+ object control = Activator.CreateInstance (GetTypeFromControlPath (virtualPath));
+ if (control is UserControl)
+ ((UserControl) control).InitializeAsUserControl (Page);
+
+ return (Control) control;
+ }
+
+ public ITemplate LoadTemplate (string virtualPath)
+ {
+ Type t = GetTypeFromControlPath (virtualPath);
+ return new SimpleTemplate (t);
+ }
+
+ protected virtual void OnAbortTransaction (EventArgs e)
+ {
+ EventHandler eh = Events [abortTransaction] as EventHandler;
+ if (eh != null)
+ eh (this, e);
+ }
+
+ protected virtual void OnCommitTransaction (EventArgs e)
+ {
+ EventHandler eh = Events [commitTransaction] as EventHandler;
+ if (eh != null)
+ eh (this, e);
+ }
+
+ protected virtual void OnError (EventArgs e)
+ {
+ EventHandler eh = Events [error] as EventHandler;
+ if (eh != null)
+ eh (this, e);
+ }
+
+ [MonoTODO]
+ public Control ParseControl (string content)
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public static object ReadStringResource (Type t)
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ protected void SetStringResourcePointer (object stringResourcePointer,
+ int maxResourceOffset)
+ {
+ }
+
+ [MonoTODO]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ protected void WriteUTF8ResourceString (HtmlTextWriter output, int offset,
+ int size, bool fAsciiOnly)
+ {
+ }
+
+ #endregion
+
+ #region Events
+
+ [WebSysDescription ("Raised when the user aborts a transaction.")]
+ public event EventHandler AbortTransaction {
+ add { Events.AddHandler (abortTransaction, value); }
+ remove { Events.RemoveHandler (abortTransaction, value); }
+ }
+
+ [WebSysDescription ("Raised when the user initiates a transaction.")]
+ public event EventHandler CommitTransaction {
+ add { Events.AddHandler (commitTransaction, value); }
+ remove { Events.RemoveHandler (commitTransaction, value); }
+ }
+
+ [WebSysDescription ("Raised when an exception occurs that cannot be handled.")]
+ public event EventHandler Error {
+ add { Events.AddHandler (error, value); }
+ remove { Events.RemoveHandler (error, value); }
+ }
+
+ #endregion
+
+ class SimpleTemplate : ITemplate
+ {
+ Type type;
+
+ public SimpleTemplate (Type type)
+ {
+ this.type = type;
+ }
+
+ public void InstantiateIn (Control control)
+ {
+ Control template = Activator.CreateInstance (type) as Control;
+ template.SetBindingContainer (false);
+ control.Controls.Add (template);
+ }
+ }
+
+#if NET_2_0
+
+ Stack dataItemCtx;
+
+ internal void PushDataItemContext (object o)
+ {
+ if (dataItemCtx == null)
+ dataItemCtx = new Stack ();
+
+ dataItemCtx.Push (o);
+ }
+
+ internal void PopDataItemContext ()
+ {
+ if (dataItemCtx == null)
+ throw new InvalidOperationException ();
+
+ dataItemCtx.Pop ();
+ }
+
+ internal object CurrentDataItem {
+ get {
+ if (dataItemCtx == null || dataItemCtx.Count == 0)
+ throw new InvalidOperationException ("No data item");
+
+ return dataItemCtx.Peek ();
+ }
+ }
+
+ protected object Eval (string expression)
+ {
+ return DataBinder.Eval (CurrentDataItem, expression);
+ }
+
+ protected object Eval (string expression, string format)
+ {
+ return DataBinder.Eval (CurrentDataItem, expression, format);
+ }
+
+ protected object XPath (string xpathexpression)
+ {
+ return XPathBinder.Eval (CurrentDataItem, xpathexpression);
+ }
+
+ protected object XPath (string xpathexpression, string format)
+ {
+ return XPathBinder.Eval (CurrentDataItem, xpathexpression, format);
+ }
+
+ protected IEnumerable XPathSelect (string xpathexpression)
+ {
+ return XPathBinder.Select (CurrentDataItem, xpathexpression);
+ }
+#endif
+
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs b/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs
new file mode 100644
index 00000000000..f2ab4e458d3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs
@@ -0,0 +1,179 @@
+//
+// System.Web.UI.TemplateControlParser
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Web.Compilation;
+using System.Web.Util;
+
+namespace System.Web.UI
+{
+ public abstract class TemplateControlParser : TemplateParser
+ {
+ bool autoEventWireup = true;
+ bool enableViewState = true;
+
+ protected TemplateControlParser ()
+ {
+ }
+
+ internal override void ProcessMainAttributes (Hashtable atts)
+ {
+ autoEventWireup = GetBool (atts, "AutoEventWireup", PagesConfig.AutoEventWireup);
+ enableViewState = GetBool (atts, "EnableViewState", PagesConfig.EnableViewState);
+
+ atts.Remove ("TargetSchema"); // Ignored
+
+ base.ProcessMainAttributes (atts);
+ }
+
+ internal object GetCompiledInstance ()
+ {
+ Type type = CompileIntoType ();
+ if (type == null)
+ return null;
+
+ object ctrl = Activator.CreateInstance (type);
+ if (ctrl == null)
+ return null;
+
+ HandleOptions (ctrl);
+ return ctrl;
+ }
+
+ internal override void AddDirective (string directive, Hashtable atts)
+ {
+ int cmp = String.Compare ("Register", directive, true);
+ if (cmp == 0) {
+ string tagprefix = GetString (atts, "TagPrefix", null);
+ if (tagprefix == null || tagprefix.Trim () == "")
+ ThrowParseException ("No TagPrefix attribute found.");
+
+ string ns = GetString (atts, "Namespace", null);
+ string assembly = GetString (atts, "Assembly", null);
+
+ if (ns != null && assembly == null)
+ ThrowParseException ("Need an Assembly attribute with Namespace.");
+
+ if (ns == null && assembly != null)
+ ThrowParseException ("Need a Namespace attribute with Assembly.");
+
+ if (ns != null) {
+ if (atts.Count != 0)
+ ThrowParseException ("Unknown attribute: " + GetOneKey (atts));
+
+ AddImport (ns);
+ Assembly ass = AddAssemblyByName (assembly);
+ AddDependency (ass.Location);
+ RootBuilder.Foundry.RegisterFoundry (tagprefix, ass, ns);
+ return;
+ }
+
+ string tagname = GetString (atts, "TagName", null);
+ string src = GetString (atts, "Src", null);
+
+ if (tagname == null && src != null)
+ ThrowParseException ("Need a TagName attribute with Src.");
+
+ if (tagname != null && src == null)
+ ThrowParseException ("Need a Src attribute with TagName.");
+
+ if (!src.EndsWith (".ascx"))
+ ThrowParseException ("Source file extension for controls must be .ascx");
+
+ string realpath = MapPath (src);
+ if (!File.Exists (realpath))
+ throw new ParseException (Location, "Could not find file \""
+ + realpath + "\".");
+
+ try {
+ AddDependency (realpath);
+ } catch (Exception e) {
+ throw new ParseException (Location, e.Message);
+ }
+
+ string vpath = UrlUtils.Combine (BaseVirtualDir, src);
+ Type type = UserControlParser.GetCompiledType (vpath, realpath, Context);
+ AddAssembly (type.Assembly, true);
+ RootBuilder.Foundry.RegisterFoundry (tagprefix, tagname, type);
+ return;
+ }
+
+ cmp = String.Compare ("Reference", directive, true);
+ if (cmp == 0) {
+ string page = GetString (atts, "Page", null);
+ string control = GetString (atts, "Control", null);
+
+ bool is_page = (page != null);
+ if (!is_page && control == null)
+ ThrowParseException ("Must provide 'page' or 'control' attribute");
+
+ if (is_page && control != null)
+ ThrowParseException ("'page' and 'control' are mutually exclusive");
+
+ string filepath = (!is_page) ? control : page;
+ filepath = MapPath (filepath);
+ AddDependency (filepath);
+ Type ctype;
+ if (is_page) {
+ PageParser pp = new PageParser (page, filepath, Context);
+ ctype = pp.CompileIntoType ();
+ } else {
+ ctype = UserControlParser.GetCompiledType (control, filepath, Context);
+ }
+
+ AddAssembly (ctype.Assembly, true);
+ if (atts.Count != 0)
+ ThrowParseException ("Unknown attribute: " + GetOneKey (atts));
+
+ return;
+ }
+
+ base.AddDirective (directive, atts);
+ }
+
+ internal override void HandleOptions (object obj)
+ {
+ Control ctrl = obj as Control;
+ ctrl.AutoEventWireup = autoEventWireup;
+ ctrl.EnableViewState = enableViewState;
+ }
+
+ internal bool AutoEventWireup {
+ get { return autoEventWireup; }
+ }
+
+ internal bool EnableViewState {
+ get { return enableViewState; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/TemplateInstance.cs b/mcs/class/System.Web/System.Web.UI/TemplateInstance.cs
new file mode 100644
index 00000000000..be3207ac149
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/TemplateInstance.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.UI.TemplateInstance.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI {
+ public enum TemplateInstance {
+ Multiple = 0,
+ Single = 1
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/TemplateParser.cs b/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
new file mode 100755
index 00000000000..cda37bcb59c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
@@ -0,0 +1,606 @@
+//
+// System.Web.UI.TemplateParser
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc. (http://www.ximian.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;
+using System.CodeDom.Compiler;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Web;
+using System.Web.Compilation;
+using System.Web.Configuration;
+using System.Web.Util;
+
+namespace System.Web.UI
+{
+ public abstract class TemplateParser : BaseParser
+ {
+ string inputFile;
+ string text;
+ string privateBinPath;
+ Hashtable mainAttributes;
+ ArrayList dependencies;
+ ArrayList assemblies;
+ Hashtable anames;
+ ArrayList imports;
+ ArrayList interfaces;
+ ArrayList scripts;
+ Type baseType;
+ string className;
+ RootBuilder rootBuilder;
+ bool debug;
+ string compilerOptions;
+ string language;
+ bool strictOn = false;
+ bool explicitOn = false;
+ bool output_cache;
+ int oc_duration;
+ string oc_header, oc_custom, oc_param, oc_controls;
+ bool oc_shared;
+ OutputCacheLocation oc_location;
+ Assembly srcAssembly;
+ int appAssemblyIndex = -1;
+
+ internal TemplateParser ()
+ {
+ imports = new ArrayList ();
+ imports.Add ("System");
+ imports.Add ("System.Collections");
+ imports.Add ("System.Collections.Specialized");
+ imports.Add ("System.Configuration");
+ imports.Add ("System.Text");
+ imports.Add ("System.Text.RegularExpressions");
+ imports.Add ("System.Web");
+ imports.Add ("System.Web.Caching");
+ imports.Add ("System.Web.Security");
+ imports.Add ("System.Web.SessionState");
+ imports.Add ("System.Web.UI");
+ imports.Add ("System.Web.UI.WebControls");
+ imports.Add ("System.Web.UI.HtmlControls");
+
+ assemblies = new ArrayList ();
+ foreach (string a in CompilationConfig.Assemblies)
+ AddAssemblyByName (a);
+ if (CompilationConfig.AssembliesInBin)
+ AddAssembliesInBin ();
+
+ language = CompilationConfig.DefaultLanguage;
+ }
+
+ internal void AddApplicationAssembly ()
+ {
+ string location = Context.ApplicationInstance.AssemblyLocation;
+ if (location != typeof (TemplateParser).Assembly.Location) {
+ appAssemblyIndex = assemblies.Add (location);
+ }
+ }
+
+ protected abstract Type CompileIntoType ();
+
+ internal virtual void HandleOptions (object obj)
+ {
+ }
+
+ internal static string GetOneKey (Hashtable tbl)
+ {
+ foreach (object key in tbl.Keys)
+ return key.ToString ();
+
+ return null;
+ }
+
+ internal virtual void AddDirective (string directive, Hashtable atts)
+ {
+ if (String.Compare (directive, DefaultDirectiveName, true) == 0) {
+ if (mainAttributes != null)
+ ThrowParseException ("Only 1 " + DefaultDirectiveName + " is allowed");
+
+ mainAttributes = atts;
+ ProcessMainAttributes (mainAttributes);
+ return;
+ }
+
+ int cmp = String.Compare ("Assembly", directive, true);
+ if (cmp == 0) {
+ string name = GetString (atts, "Name", null);
+ string src = GetString (atts, "Src", null);
+
+ if (atts.Count > 0)
+ ThrowParseException ("Attribute " + GetOneKey (atts) + " unknown.");
+
+ if (name == null && src == null)
+ ThrowParseException ("You gotta specify Src or Name");
+
+ if (name != null && src != null)
+ ThrowParseException ("Src and Name cannot be used together");
+
+ if (name != null) {
+ AddAssemblyByName (name);
+ } else {
+ GetAssemblyFromSource (src);
+ }
+
+ return;
+ }
+
+ cmp = String.Compare ("Import", directive, true);
+ if (cmp == 0) {
+ string namesp = GetString (atts, "Namespace", null);
+ if (atts.Count > 0)
+ ThrowParseException ("Attribute " + GetOneKey (atts) + " unknown.");
+
+ if (namesp != null && namesp != "")
+ AddImport (namesp);
+ return;
+ }
+
+ cmp = String.Compare ("Implements", directive, true);
+ if (cmp == 0) {
+ string ifacename = GetString (atts, "Interface", "");
+
+ if (atts.Count > 0)
+ ThrowParseException ("Attribute " + GetOneKey (atts) + " unknown.");
+
+ Type iface = LoadType (ifacename);
+ if (iface == null)
+ ThrowParseException ("Cannot find type " + ifacename);
+
+ if (!iface.IsInterface)
+ ThrowParseException (iface + " is not an interface");
+
+ AddInterface (iface.FullName);
+ return;
+ }
+
+ cmp = String.Compare ("OutputCache", directive, true);
+ if (cmp == 0) {
+ output_cache = true;
+
+ if (atts ["Duration"] == null)
+ ThrowParseException ("The directive is missing a 'duration' attribute.");
+ if (atts ["VaryByParam"] == null)
+ ThrowParseException ("This directive is missing a 'VaryByParam' " +
+ "attribute, which should be set to \"none\", \"*\", " +
+ "or a list of name/value pairs.");
+
+ foreach (DictionaryEntry entry in atts) {
+ string key = (string) entry.Key;
+ switch (key.ToLower ()) {
+ case "duration":
+ oc_duration = Int32.Parse ((string) entry.Value);
+ if (oc_duration < 1)
+ ThrowParseException ("The 'duration' attribute must be set " +
+ "to a positive integer value");
+ break;
+ case "varybyparam":
+ oc_param = (string) entry.Value;
+ if (String.Compare (oc_param, "none") == 0)
+ oc_param = null;
+ break;
+ case "varybyheader":
+ oc_header = (string) entry.Value;
+ break;
+ case "varybycustom":
+ oc_custom = (string) entry.Value;
+ break;
+ case "location":
+ if (!(this is PageParser))
+ goto default;
+
+ try {
+ oc_location = (OutputCacheLocation) Enum.Parse (
+ typeof (OutputCacheLocation), (string) entry.Value, true);
+ } catch {
+ ThrowParseException ("The 'location' attribute is case sensitive and " +
+ "must be one of the following values: Any, Client, " +
+ "Downstream, Server, None, ServerAndClient.");
+ }
+ break;
+ case "varybycontrol":
+ if (this is PageParser)
+ goto default;
+
+ oc_controls = (string) entry.Value;
+ break;
+ case "shared":
+ if (this is PageParser)
+ goto default;
+
+ try {
+ oc_shared = Boolean.Parse ((string) entry.Value);
+ } catch {
+ ThrowParseException ("The 'shared' attribute is case sensitive" +
+ " and must be set to 'true' or 'false'.");
+ }
+ break;
+ default:
+ ThrowParseException ("The '" + key + "' attribute is not " +
+ "supported by the 'Outputcache' directive.");
+ break;
+ }
+
+ }
+
+ return;
+ }
+
+ ThrowParseException ("Unknown directive: " + directive);
+ }
+
+ internal Type LoadType (string typeName)
+ {
+ // First try loaded assemblies, then try assemblies in Bin directory.
+ Type type = null;
+ bool seenBin = false;
+ Assembly [] assemblies = AppDomain.CurrentDomain.GetAssemblies ();
+ foreach (Assembly ass in assemblies) {
+ type = ass.GetType (typeName);
+ if (type == null)
+ continue;
+
+ if (Path.GetDirectoryName (ass.Location) != PrivateBinPath) {
+ AddAssembly (ass, true);
+ } else {
+ seenBin = true;
+ }
+
+ AddDependency (ass.Location);
+ return type;
+ }
+
+ if (seenBin)
+ return null;
+
+ // Load from bin
+ if (!Directory.Exists (PrivateBinPath))
+ return null;
+
+ string [] binDlls = Directory.GetFiles (PrivateBinPath, "*.dll");
+ foreach (string s in binDlls) {
+ Assembly binA = Assembly.LoadFrom (s);
+ type = binA.GetType (typeName);
+ if (type == null)
+ continue;
+
+ AddDependency (binA.Location);
+ return type;
+ }
+
+ return null;
+ }
+
+ void AddAssembliesInBin ()
+ {
+ if (!Directory.Exists (PrivateBinPath))
+ return;
+
+ string [] binDlls = Directory.GetFiles (PrivateBinPath, "*.dll");
+ foreach (string s in binDlls) {
+ assemblies.Add (s);
+ }
+ }
+
+ internal virtual void AddInterface (string iface)
+ {
+ if (interfaces == null)
+ interfaces = new ArrayList ();
+
+ if (!interfaces.Contains (iface))
+ interfaces.Add (iface);
+ }
+
+ internal virtual void AddImport (string namesp)
+ {
+ if (imports == null)
+ imports = new ArrayList ();
+
+ if (!imports.Contains (namesp))
+ imports.Add (namesp);
+ }
+
+ internal virtual void AddDependency (string filename)
+ {
+ if (dependencies == null)
+ dependencies = new ArrayList ();
+
+ if (!dependencies.Contains (filename))
+ dependencies.Add (filename);
+ }
+
+ internal virtual void AddAssembly (Assembly assembly, bool fullPath)
+ {
+ if (anames == null)
+ anames = new Hashtable ();
+
+ string name = assembly.GetName ().Name;
+ string loc = assembly.Location;
+ if (fullPath) {
+ if (!assemblies.Contains (loc)) {
+ assemblies.Add (loc);
+ }
+
+ anames [name] = loc;
+ anames [loc] = assembly;
+ } else {
+ if (!assemblies.Contains (name)) {
+ assemblies.Add (name);
+ }
+
+ anames [name] = assembly;
+ }
+ }
+
+ internal virtual Assembly AddAssemblyByName (string name)
+ {
+ if (anames == null)
+ anames = new Hashtable ();
+
+ if (anames.Contains (name)) {
+ object o = anames [name];
+ if (o is string)
+ o = anames [o];
+
+ return (Assembly) o;
+ }
+
+ Assembly assembly = null;
+ try {
+ assembly = Assembly.Load (name);
+ } catch (Exception) {
+ try {
+ assembly = Assembly.LoadWithPartialName (name);
+ } catch (Exception e) {
+ ThrowParseException ("Assembly " + name + " not found", e);
+ }
+ }
+
+ AddAssembly (assembly, true);
+ return assembly;
+ }
+
+ internal virtual void ProcessMainAttributes (Hashtable atts)
+ {
+ atts.Remove ("Description"); // ignored
+ atts.Remove ("CodeBehind"); // ignored
+ atts.Remove ("AspCompat"); // ignored
+
+ debug = GetBool (atts, "Debug", true);
+ compilerOptions = GetString (atts, "CompilerOptions", "");
+ language = GetString (atts, "Language", CompilationConfig.DefaultLanguage);
+ strictOn = GetBool (atts, "Strict", CompilationConfig.Strict);
+ explicitOn = GetBool (atts, "Explicit", CompilationConfig.Explicit);
+ string src = GetString (atts, "Src", null);
+ if (src != null)
+ srcAssembly = GetAssemblyFromSource (src);
+
+ string inherits = GetString (atts, "Inherits", null);
+ if (inherits != null)
+ SetBaseType (inherits);
+
+ className = GetString (atts, "ClassName", null);
+ if (className != null && !CodeGenerator.IsValidLanguageIndependentIdentifier (className))
+ ThrowParseException (String.Format ("'{0}' is not valid for 'className'", className));
+
+ if (atts.Count > 0)
+ ThrowParseException ("Unknown attribute: " + GetOneKey (atts));
+ }
+
+ internal void SetBaseType (string type)
+ {
+ if (type == DefaultBaseTypeName)
+ return;
+
+ Type parent = null;
+ if (srcAssembly != null)
+ parent = srcAssembly.GetType (type);
+
+ if (parent == null)
+ parent = LoadType (type);
+
+ if (parent == null)
+ ThrowParseException ("Cannot find type " + type);
+
+ if (!DefaultBaseType.IsAssignableFrom (parent))
+ ThrowParseException ("The parent type does not derive from " + DefaultBaseType);
+
+ baseType = parent;
+ }
+
+ Assembly GetAssemblyFromSource (string vpath)
+ {
+ vpath = UrlUtils.Combine (BaseVirtualDir, vpath);
+ string realPath = MapPath (vpath, false);
+ if (!File.Exists (realPath))
+ ThrowParseException ("File " + vpath + " not found");
+
+ AddDependency (realPath);
+
+ CompilerResults result = CachingCompiler.Compile (language, realPath, realPath, assemblies);
+ if (result.NativeCompilerReturnValue != 0) {
+ StreamReader reader = new StreamReader (realPath);
+ throw new CompilationException (realPath, result.Errors, reader.ReadToEnd ());
+ }
+
+ AddAssembly (result.CompiledAssembly, true);
+ return result.CompiledAssembly;
+ }
+
+ internal abstract Type DefaultBaseType { get; }
+ internal abstract string DefaultBaseTypeName { get; }
+ internal abstract string DefaultDirectiveName { get; }
+
+ internal string InputFile
+ {
+ get { return inputFile; }
+ set { inputFile = value; }
+ }
+
+ internal string Text
+ {
+ get { return text; }
+ set { text = value; }
+ }
+
+ internal Type BaseType
+ {
+ get {
+ if (baseType == null)
+ baseType = DefaultBaseType;
+
+ return baseType;
+ }
+ }
+
+ internal string ClassName {
+ get {
+ if (className != null)
+ return className;
+
+ className = Path.GetFileName (inputFile).Replace ('.', '_');
+ className = className.Replace ('-', '_');
+ className = className.Replace (' ', '_');
+
+ if (Char.IsDigit(className[0])) {
+ className = "_" + className;
+ }
+
+ return className;
+ }
+ }
+
+ internal string PrivateBinPath {
+ get {
+ if (privateBinPath != null)
+ return privateBinPath;
+
+ AppDomainSetup setup = AppDomain.CurrentDomain.SetupInformation;
+ privateBinPath = Path.Combine (setup.ApplicationBase, setup.PrivateBinPath);
+
+ return privateBinPath;
+ }
+ }
+
+ internal ArrayList Scripts {
+ get {
+ if (scripts == null)
+ scripts = new ArrayList ();
+
+ return scripts;
+ }
+ }
+
+ internal ArrayList Imports {
+ get { return imports; }
+ }
+
+ internal ArrayList Assemblies {
+ get {
+ if (appAssemblyIndex != -1) {
+ object o = assemblies [appAssemblyIndex];
+ assemblies.RemoveAt (appAssemblyIndex);
+ assemblies.Add (o);
+ appAssemblyIndex = -1;
+ }
+
+ return assemblies;
+ }
+ }
+
+ internal ArrayList Interfaces {
+ get { return interfaces; }
+ }
+
+ internal RootBuilder RootBuilder {
+ get { return rootBuilder; }
+ set { rootBuilder = value; }
+ }
+
+ internal ArrayList Dependencies {
+ get { return dependencies; }
+ }
+
+ internal string CompilerOptions {
+ get { return compilerOptions; }
+ }
+
+ internal string Language {
+ get { return language; }
+ }
+
+ internal bool StrictOn {
+ get { return strictOn; }
+ }
+
+ internal bool ExplicitOn {
+ get { return explicitOn; }
+ }
+
+ internal bool Debug {
+ get { return debug; }
+ }
+
+ internal bool OutputCache {
+ get { return output_cache; }
+ }
+
+ internal int OutputCacheDuration {
+ get { return oc_duration; }
+ }
+
+ internal string OutputCacheVaryByHeader {
+ get { return oc_header; }
+ }
+
+ internal string OutputCacheVaryByCustom {
+ get { return oc_custom; }
+ }
+
+ internal string OutputCacheVaryByControls {
+ get { return oc_controls; }
+ }
+
+ internal bool OutputCacheShared {
+ get { return oc_shared; }
+ }
+
+ internal OutputCacheLocation OutputCacheLocation {
+ get { return oc_location; }
+ }
+
+ internal string OutputCacheVaryByParam {
+ get { return oc_param; }
+ }
+
+ internal PagesConfiguration PagesConfig {
+ get { return PagesConfiguration.GetInstance (Context); }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/ThemeableAttribute.cs b/mcs/class/System.Web/System.Web.UI/ThemeableAttribute.cs
new file mode 100644
index 00000000000..32c30443e84
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ThemeableAttribute.cs
@@ -0,0 +1,108 @@
+//
+// System.Web.UI.ThemeableAttribute
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+using System;
+using System.ComponentModel;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
+ public sealed class ThemeableAttribute : Attribute, IDisposable
+ {
+ private bool themeable;
+ private bool dispose;
+
+ public ThemeableAttribute (bool themeable)
+ {
+ this.themeable = themeable;
+ }
+
+ public static readonly ThemeableAttribute Default = new ThemeableAttribute (true);
+
+ public static readonly ThemeableAttribute No = new ThemeableAttribute (false);
+
+ public static readonly ThemeableAttribute Yes = new ThemeableAttribute (true);
+
+ public bool Themeable {
+ get { return themeable; }
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ private void Dispose (bool disposing)
+ {
+ if (!this.dispose){
+ //Do nothing
+ this.dispose = true;
+ }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj != null && obj is ThemeableAttribute) {
+ ThemeableAttribute ta = (ThemeableAttribute) obj;
+ return (this.themeable == ta.themeable);
+ }
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return this.themeable.GetHashCode ();
+ }
+
+ public override bool IsDefaultAttribute()
+ {
+ return Equals (Default);
+ }
+
+ public static bool IsObjectThemeable (object obj)
+ {
+
+ return IsTypeThemeable (obj.GetType ());
+ }
+
+ public static bool IsTypeThemeable (Type type)
+ {
+ Object [] attributes = type.GetCustomAttributes (typeof (ThemeableAttribute), false);
+ if (attributes.Length != 0) {
+ foreach (Attribute attrib in attributes)
+ if (attrib is ThemeableAttribute)
+ return true;
+ }
+ return false;
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/ToolboxDataAttribute.cs b/mcs/class/System.Web/System.Web.UI/ToolboxDataAttribute.cs
new file mode 100644
index 00000000000..cc8565f33b0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ToolboxDataAttribute.cs
@@ -0,0 +1,79 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI
+ * Class: ToolboxDataAttribute
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+
+namespace System.Web.UI
+{
+ [AttributeUsage(AttributeTargets.Class)]
+ public sealed class ToolboxDataAttribute : Attribute
+ {
+ public static readonly ToolboxDataAttribute Default = new ToolboxDataAttribute("");
+
+ private string data;
+
+ public ToolboxDataAttribute(string data)
+ {
+ this.data = data;
+ }
+
+ public string Data
+ {
+ get
+ {
+ return data;
+ }
+ }
+
+ public override bool IsDefaultAttribute()
+ {
+ return Default.Equals(this);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if(obj != null && obj is ToolboxDataAttribute)
+ {
+ ToolboxDataAttribute tda = (ToolboxDataAttribute)obj;
+ return (tda.Data == Data);
+ }
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/Triplet.cs b/mcs/class/System.Web/System.Web.UI/Triplet.cs
new file mode 100755
index 00000000000..c3d3046adb5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/Triplet.cs
@@ -0,0 +1,61 @@
+//
+// System.Web.UI.Triplet.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+//
+// 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;
+
+namespace System.Web.UI {
+
+#if NET_2_0
+ [Serializable]
+ sealed
+#endif
+ public class Triplet
+ {
+ public object First;
+ public object Second;
+ public object Third;
+
+ public Triplet ()
+ {
+ }
+
+ public Triplet (object x, object y)
+ {
+ First = x;
+ Second = y;
+ }
+
+ public Triplet (object x, object y, object z)
+ {
+ First = x;
+ Second = y;
+ Third = z;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/TwoWayBoundPropertyEntry.cs b/mcs/class/System.Web/System.Web.UI/TwoWayBoundPropertyEntry.cs
new file mode 100644
index 00000000000..0fa5586d3b8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/TwoWayBoundPropertyEntry.cs
@@ -0,0 +1,61 @@
+//
+// System.Web.UI.TwoWayBoundPropertyEntry
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// Copyright (c) 2005 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
+// "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.
+//
+#if NET_2_0
+namespace System.Web.UI
+{
+ public class TwoWayBoundPropertyEntry : BoundPropertyEntry {
+ string controlID;
+ Type controlType;
+ string fieldName;
+ string formatString;
+
+ public string ControlID {
+ get { return controlID; }
+ set { controlID = value; }
+ }
+
+ public Type ControlType {
+ get { return controlType; }
+ set { controlType = value; }
+ }
+
+ public string FieldName {
+ get { return fieldName; }
+ set { fieldName = value; }
+ }
+
+ public string FormatString {
+ get { return formatString; }
+ set { formatString = value; }
+ }
+ }
+}
+#endif // NET_2_0
+
diff --git a/mcs/class/System.Web/System.Web.UI/UrlPropertyAttribute.cs b/mcs/class/System.Web/System.Web.UI/UrlPropertyAttribute.cs
new file mode 100644
index 00000000000..0f23dddf0dc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/UrlPropertyAttribute.cs
@@ -0,0 +1,84 @@
+//
+// System.Web.UI.UrlPropertyAttribute
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+#if NET_2_0
+using System;
+using System.ComponentModel;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
+ public sealed class UrlPropertyAttribute : Attribute
+ {
+ private string filter = "*.*";
+ private UrlTypes urlTypes = UrlTypes.Absolute |
+ UrlTypes.AppRelative |
+ UrlTypes.DocRelative |
+ UrlTypes.RootRelative;
+
+ public UrlPropertyAttribute ()
+ {
+ }
+
+ public UrlPropertyAttribute (string filter)
+ {
+ this.filter = filter;
+ }
+
+ public UrlPropertyAttribute (string filter, UrlTypes urlTypes)
+ {
+ this.filter = filter;
+ this.urlTypes = urlTypes;
+ }
+
+ public string Filter {
+ get { return filter; }
+ }
+
+ public UrlTypes AllowedTypes {
+ get { return urlTypes; }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj != null && obj is UrlPropertyAttribute) {
+ UrlPropertyAttribute upa = (UrlPropertyAttribute)obj;
+ return (filter.Equals (upa.Filter)
+ && urlTypes.Equals (upa.AllowedTypes));
+ }
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return this.filter.GetHashCode ();
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/UrlTypes.cs b/mcs/class/System.Web/System.Web.UI/UrlTypes.cs
new file mode 100644
index 00000000000..6fd54304e6f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/UrlTypes.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.UI.UrlTypes.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI {
+ [FlagsAttribute, SerializableAttribute]
+ public enum UrlTypes {
+ Absolute = 1,
+ AppRelative = 2,
+ DocRelative = 4,
+ RootRelative = 8
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/UserControl.cs b/mcs/class/System.Web/System.Web.UI/UserControl.cs
new file mode 100644
index 00000000000..a7739b171ee
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/UserControl.cs
@@ -0,0 +1,261 @@
+//
+// System.Web.UI.UserControl.cs
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.ComponentModel.Design.Serialization;
+using System.Web.Caching;
+using System.Web.SessionState;
+
+namespace System.Web.UI
+{
+ [ControlBuilder (typeof (UserControlControlBuilder))]
+ [DefaultEvent ("Load"), DesignerCategory ("ASPXCodeBehind")]
+ [ToolboxItem (false), ParseChildren (true)]
+ [Designer ("System.Web.UI.Design.UserControlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ [Designer ("Microsoft.VSDesigner.WebForms.WebFormDesigner, " + Consts.AssemblyMicrosoft_VSDesigner, typeof (IRootDesigner))]
+ [RootDesignerSerializer ("Microsoft.VSDesigner.WebForms.RootCodeDomSerializer, " + Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design, true)]
+ public class UserControl : TemplateControl, IAttributeAccessor, IUserControlDesignerAccessor
+ {
+ private bool initialized;
+ private AttributeCollection attributes;
+ private StateBag attrBag;
+
+ public UserControl ()
+ {
+ //??
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public HttpApplicationState Application
+ {
+ get {
+ Page p = Page;
+ if (p == null)
+ return null;
+ return p.Application;
+ }
+ }
+
+ private void EnsureAttributes ()
+ {
+ if (attributes == null) {
+ attrBag = new StateBag (true);
+ if (IsTrackingViewState)
+ attrBag.TrackViewState ();
+ attributes = new AttributeCollection (attrBag);
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public AttributeCollection Attributes
+ {
+ get {
+ return attributes;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public Cache Cache
+ {
+ get {
+ Page p = Page;
+ if (p == null)
+ return null;
+ return p.Cache;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public bool IsPostBack
+ {
+ get {
+ Page p = Page;
+ if (p == null)
+ return false;
+ return p.IsPostBack;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public HttpRequest Request
+ {
+ get {
+ Page p = Page;
+ if (p == null)
+ return null;
+ return p.Request;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public HttpResponse Response
+ {
+ get {
+ Page p = Page;
+ if (p == null)
+ return null;
+ return p.Response;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public HttpServerUtility Server
+ {
+ get {
+ Page p = Page;
+ if (p == null)
+ return null;
+ return p.Server;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public HttpSessionState Session
+ {
+ get {
+ Page p = Page;
+ if (p == null)
+ return null;
+ return p.Session;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public TraceContext Trace
+ {
+ get {
+ Page p = Page;
+ if (p == null)
+ return null;
+ return p.Trace;
+ }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public void DesignerInitialize ()
+ {
+ InitRecursive (null);
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public void InitializeAsUserControl (Page page)
+ {
+ if (initialized)
+ return;
+ initialized = true;
+ this.Page = page;
+ WireupAutomaticEvents ();
+ FrameworkInitialize ();
+ }
+
+ public string MapPath (string virtualPath)
+ {
+ return Request.MapPath (virtualPath, TemplateSourceDirectory, true);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState != null) {
+ Pair p = (Pair) savedState;
+ base.LoadViewState (p.First);
+ if (p.Second != null) {
+ EnsureAttributes ();
+ attrBag.LoadViewState (p.Second);
+ }
+ }
+
+ }
+
+ protected override void OnInit (EventArgs e)
+ {
+ InitializeAsUserControl (Page);
+
+ base.OnInit(e);
+ }
+
+ protected override object SaveViewState ()
+ {
+ object baseState = base.SaveViewState();
+ object attrState = null;
+ if (attributes != null)
+ attrState = attrBag.SaveViewState ();
+ if (baseState == null && attrState == null)
+ return null;
+ return new Pair (baseState, attrState);
+ }
+
+ string IAttributeAccessor.GetAttribute (string name)
+ {
+ if (attributes == null)
+ return null;
+ return attributes [name];
+ }
+
+ void IAttributeAccessor.SetAttribute (string name, string value)
+ {
+ EnsureAttributes ();
+ Attributes [name] = value;
+ }
+
+ string IUserControlDesignerAccessor.InnerText
+ {
+ get {
+ string innerText = ((string) ViewState["!DesignTimeInnerText"]);
+ if (innerText == null)
+ return string.Empty;
+ return innerText;
+ }
+ set { ViewState["!DesignTimeInnerText"] = value; }
+ }
+
+ string IUserControlDesignerAccessor.TagName
+ {
+ get {
+ string innerTag = ((string) ViewState["!DesignTimeTagName"]);
+ if (innerTag == null)
+ return string.Empty;
+ return innerTag;
+ }
+ set { ViewState["!DesignTimeTagName"] = value; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/UserControlControlBuilder.cs b/mcs/class/System.Web/System.Web.UI/UserControlControlBuilder.cs
new file mode 100644
index 00000000000..2f25376bd54
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/UserControlControlBuilder.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.UI.UserControlControlBuilder
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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.
+//
+
+namespace System.Web.UI
+{
+ public class UserControlControlBuilder : ControlBuilder
+ {
+ public override bool NeedsTagInnerText ()
+ {
+ return false;
+ }
+
+ [MonoTODO]
+ public override void SetTagInnerText (string text)
+ {
+ // Do something with the text
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/UserControlParser.cs b/mcs/class/System.Web/System.Web.UI/UserControlParser.cs
new file mode 100644
index 00000000000..49f029e101d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/UserControlParser.cs
@@ -0,0 +1,86 @@
+//
+// System.Web.UI.UserControlParser
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002,2003 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+using System.IO;
+using System.Web;
+using System.Web.Compilation;
+using System.Web.Util;
+
+namespace System.Web.UI
+{
+ internal class UserControlParser : TemplateControlParser
+ {
+ internal UserControlParser (string virtualPath, string inputFile, HttpContext context)
+ : this (virtualPath, inputFile, context, null)
+ {
+ }
+
+ internal UserControlParser (string virtualPath, string inputFile, HttpContext context, string type)
+ {
+ if (type == null) type = PagesConfig.UserControlBaseType;
+ Context = context;
+ BaseVirtualDir = UrlUtils.GetDirectory (virtualPath);
+ InputFile = inputFile;
+ SetBaseType (type);
+ AddApplicationAssembly ();
+ }
+
+ public static Type GetCompiledType (string virtualPath, string inputFile, HttpContext context)
+ {
+ UserControlParser ucp = new UserControlParser (virtualPath, inputFile, context);
+ return ucp.CompileIntoType ();
+ }
+
+ protected override Type CompileIntoType ()
+ {
+ AspGenerator generator = new AspGenerator (this);
+ return generator.GetCompiledType ();
+ }
+
+ internal override void ProcessMainAttributes (Hashtable atts)
+ {
+ base.ProcessMainAttributes (atts);
+ }
+
+ internal override Type DefaultBaseType {
+ get { return typeof (UserControl); }
+ }
+
+ internal override string DefaultBaseTypeName {
+ get { return "System.Web.UI.UserControl"; }
+ }
+
+ internal override string DefaultDirectiveName {
+ get { return "control"; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/Utils.cs b/mcs/class/System.Web/System.Web.UI/Utils.cs
new file mode 100644
index 00000000000..d6bd93efe75
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/Utils.cs
@@ -0,0 +1,96 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI
+ * Class: Utils
+ *
+ * Author: Gaurav Vaish
+ * Maintainer-> gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Reflection;
+
+namespace System.Web.UI
+{
+ internal class Utils
+ {
+ internal static object InvokeMethod(MethodInfo info, object obj, object[] parameters)
+ {
+ object retVal = null;
+ try
+ {
+ retVal = info.Invoke(obj, parameters);
+ } catch(TargetInvocationException tie)
+ {
+ throw tie.InnerException;
+ }
+ return retVal;
+ }
+
+ internal static string GetClientValidatedEvent(Page page)
+ {
+ return "if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate();";
+ }
+
+ internal static string GetClientValidatedPostBack(Control control)
+ {
+ return (" { if (typeof(Page_ClientValidate) != 'function' || Page_ClientValidate()) " +
+ control.Page.ClientScript.GetPostBackEventReference(control) +
+ " } " );
+ }
+
+ [MonoTODO]
+ internal static string GetScriptLocation(HttpContext context)
+ {
+ IDictionary dict = context.GetConfig("system.web/webControls")
+ as IDictionary;
+ string loc = null;
+ if(dict != null)
+ {
+ loc = dict["clientScriptsLocation"] as string;
+ }
+ if(loc == null)
+ {
+ throw new HttpException("Missing_clientScriptsLocation");
+ }
+ if(loc.IndexOf("{0}") > 0)
+ {
+ //FIXME: Version Number of the ASP.Net should come into play.
+ //Like if ASP 1.0 and 1.1 both are installed, the script
+ // locations are in /aspnet_client/system_web/1_0_3705_0/
+ // and /aspnet_client/system_web/1_1_4322/
+ // (these entries are from my machine
+ // So, first I should get this Version Info from somewhere
+ loc = String.Format(loc, "system_web");
+ }
+ return loc;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ValidationPropertyAttribute.cs b/mcs/class/System.Web/System.Web.UI/ValidationPropertyAttribute.cs
new file mode 100644
index 00000000000..57a337f9841
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ValidationPropertyAttribute.cs
@@ -0,0 +1,48 @@
+//
+// System.Web.UI.ValidationPropertyAttribute.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+//
+// 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;
+
+namespace System.Web.UI {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class ValidationPropertyAttribute : Attribute
+ {
+ string name;
+
+ public ValidationPropertyAttribute (string name)
+ {
+ this.name = name;
+ }
+
+ public string Name {
+ get { return name; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/ValidatorCollection.cs b/mcs/class/System.Web/System.Web.UI/ValidatorCollection.cs
new file mode 100755
index 00000000000..18f11146efd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ValidatorCollection.cs
@@ -0,0 +1,90 @@
+//
+// System.Web.UI.ValidatorCollection.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.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;
+using System.Collections;
+
+namespace System.Web.UI {
+
+ public sealed class ValidatorCollection : ICollection, IEnumerable
+ {
+ private ArrayList _validators;
+
+ public ValidatorCollection ()
+ {
+ _validators = new ArrayList ();
+ }
+
+ public int Count {
+ get { return _validators.Count; }
+ }
+
+ public bool IsReadOnly {
+ get { return _validators.IsReadOnly; }
+ }
+
+ public bool IsSynchronized {
+ get { return _validators.IsSynchronized; }
+ }
+
+ public IValidator this [int index] {
+ get { return (IValidator) _validators [index]; }
+ }
+
+ public object SyncRoot {
+ get { return this; }
+ }
+
+ public void Add (IValidator validator)
+ {
+ _validators.Add (validator);
+ }
+
+ public bool Contains (IValidator validator)
+ {
+ return _validators.Contains (validator);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ _validators.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return _validators.GetEnumerator ();
+ }
+
+ public void Remove (IValidator validator)
+ {
+ _validators.Remove (validator);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/VerificationConditionalOperator.cs b/mcs/class/System.Web/System.Web.UI/VerificationConditionalOperator.cs
new file mode 100644
index 00000000000..558e8dea688
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/VerificationConditionalOperator.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.UI.VerificationConditionalOperator.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI {
+ public enum VerificationConditionalOperator {
+ Equals = 0,
+ NotEquals = 1
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/VerificationReportLevel.cs b/mcs/class/System.Web/System.Web.UI/VerificationReportLevel.cs
new file mode 100644
index 00000000000..74d9553d9cc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/VerificationReportLevel.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.UI.VerificationReportLevel.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI {
+ public enum VerificationReportLevel {
+ Error = 0,
+ Warning = 1,
+ Guideline = 2
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/VerificationRule.cs b/mcs/class/System.Web/System.Web.UI/VerificationRule.cs
new file mode 100644
index 00000000000..a03e2cb167a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/VerificationRule.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.UI.VerificationRule.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI {
+ public enum VerificationRule {
+ Required = 0,
+ Prohibited = 1,
+ NotEmptyString = 2
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/WebHandlerParser.cs b/mcs/class/System.Web/System.Web.UI/WebHandlerParser.cs
new file mode 100644
index 00000000000..f069ef398e8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/WebHandlerParser.cs
@@ -0,0 +1,60 @@
+//
+// System.Web.UI.WebHandlerParser
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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.Web;
+using System.Web.Compilation;
+
+namespace System.Web.UI
+{
+ class WebHandlerParser : SimpleWebHandlerParser
+ {
+ private WebHandlerParser (HttpContext context, string virtualPath, string physicalPath)
+ : base (context, virtualPath, physicalPath)
+ {
+ }
+
+ public static Type GetCompiledType (HttpContext context, string virtualPath, string physicalPath)
+ {
+ WebHandlerParser parser = new WebHandlerParser (context, virtualPath, physicalPath);
+ Type type = parser.GetCompiledTypeFromCache ();
+ if (type != null)
+ return type;
+
+ return WebServiceCompiler.CompileIntoType (parser);
+ }
+
+ protected override string DefaultDirectiveName {
+ get {
+ return "webhandler";
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/WebResourceAttribute.cs b/mcs/class/System.Web/System.Web.UI/WebResourceAttribute.cs
new file mode 100644
index 00000000000..d662b7a3999
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/WebResourceAttribute.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.UI.WebResourceAttribute
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+#if NET_2_0
+namespace System.Web.UI {
+ [AttributeUsage (AttributeTargets.Assembly, AllowMultiple = true)]
+ public sealed class WebResourceAttribute : Attribute {
+ public WebResourceAttribute (string webResource, string contentType) : this (webResource, contentType, false) {}
+ public WebResourceAttribute (string webResource, string contentType, bool performSubstitution)
+ {
+ this.webResource = webResource;
+ this.contentType = contentType;
+ this.performSubstitution = performSubstitution;
+ }
+
+ public string ContentType { get { return contentType; } }
+ public bool PerformSubstitution { get { return performSubstitution; } }
+ public string WebResource { get { return webResource; } }
+
+ bool performSubstitution;
+ string webResource, contentType;
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI/WebServiceParser.cs b/mcs/class/System.Web/System.Web.UI/WebServiceParser.cs
new file mode 100644
index 00000000000..694b57da961
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/WebServiceParser.cs
@@ -0,0 +1,60 @@
+//
+// System.Web.UI.WebServiceParser
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.Web;
+using System.Web.Compilation;
+
+namespace System.Web.UI
+{
+ public class WebServiceParser : SimpleWebHandlerParser
+ {
+ private WebServiceParser (HttpContext context, string virtualPath, string physicalPath)
+ : base (context, virtualPath, physicalPath)
+ {
+ }
+
+ public static Type GetCompiledType (string inputFile, HttpContext context)
+ {
+ WebServiceParser parser = new WebServiceParser (context, null, inputFile);
+ Type type = parser.GetCompiledTypeFromCache ();
+ if (type != null)
+ return type;
+
+ return WebServiceCompiler.CompileIntoType (parser);
+ }
+
+ protected override string DefaultDirectiveName {
+ get {
+ return "webservice";
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/XPathBinder.cs b/mcs/class/System.Web/System.Web.UI/XPathBinder.cs
new file mode 100644
index 00000000000..69cdb9af6f8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/XPathBinder.cs
@@ -0,0 +1,103 @@
+//
+// System.Web.UI.XPathBinder
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Xml.XPath;
+using System.Xml;
+
+namespace System.Web.UI {
+ public sealed class XPathBinder {
+ private XPathBinder ()
+ {
+ }
+
+ public static object Eval (object container, string xpath)
+ {
+ if (xpath == null || xpath.Length == 0)
+ throw new ArgumentNullException ("xpath");
+
+ IXPathNavigable factory = container as IXPathNavigable;
+
+ if (factory == null)
+ throw new ArgumentException ("container");
+
+ object result = factory.CreateNavigator ().Evaluate (xpath);
+
+ XPathNodeIterator itr = result as XPathNodeIterator;
+ if (itr != null) {
+ if (itr.MoveNext())
+ return itr.Current.Value;
+ else
+ return null;
+ }
+ return result;
+ }
+
+ public static string Eval (object container, string xpath, string format)
+ {
+ object result = Eval (container, xpath);
+
+ if (result == null)
+ return String.Empty;
+ if (format == null || format.Length == 0)
+ return result.ToString ();
+
+ return String.Format (format, result);
+ }
+
+ public static IEnumerable Select (object container, string xpath)
+ {
+ if (xpath == null || xpath.Length == 0)
+ throw new ArgumentNullException ("xpath");
+
+ IXPathNavigable factory = container as IXPathNavigable;
+
+ if (factory == null)
+ throw new ArgumentException ("container");
+
+ XPathNodeIterator itr = factory.CreateNavigator ().Select (xpath);
+ ArrayList ret = new ArrayList ();
+
+ while (itr.MoveNext ()) {
+ IHasXmlNode nodeAccessor = itr.Current as IHasXmlNode;
+ if (nodeAccessor == null)
+ throw new InvalidOperationException ();
+ ret.Add (nodeAccessor.GetNode ());
+ }
+ return ret;
+ }
+
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.UI/XhtmlMobileDocType.cs b/mcs/class/System.Web/System.Web.UI/XhtmlMobileDocType.cs
new file mode 100644
index 00000000000..7344d709e7f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/XhtmlMobileDocType.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.UI.XhtmlMobileDocType.cs
+//
+// Authors:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+namespace System.Web.UI {
+ public enum XhtmlMobileDocType {
+ XhtmlBasic = 0,
+ XhtmlMobileProfile = 1,
+ Wml20 = 2
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web.Util/.cvsignore b/mcs/class/System.Web/System.Web.Util/.cvsignore
new file mode 100644
index 00000000000..04bc145deea
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/.cvsignore
@@ -0,0 +1 @@
+_*
diff --git a/mcs/class/System.Web/System.Web.Util/AltSerialization.cs b/mcs/class/System.Web/System.Web.Util/AltSerialization.cs
new file mode 100644
index 00000000000..98116fb897f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/AltSerialization.cs
@@ -0,0 +1,183 @@
+//
+// System.Web.Util.AltSerialization
+//
+// Author(s):
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2003 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
+// "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;
+using System.IO;
+using System.Collections;
+using System.Runtime.Serialization.Formatters.Binary;
+
+namespace System.Web.Util {
+
+ internal sealed class AltSerialization {
+
+ private static ArrayList types;
+
+ internal static readonly int NullIndex = 16;
+
+ private AltSerialization () { }
+
+
+ static AltSerialization ()
+ {
+ types = new ArrayList ();
+ types.Add ("");
+ types.Add (typeof (string));
+ types.Add (typeof (int));
+ types.Add (typeof (bool));
+ types.Add (typeof (DateTime));
+ types.Add (typeof (Decimal));
+ types.Add (typeof (Byte));
+ types.Add (typeof (Char));
+ types.Add (typeof (Single));
+ types.Add (typeof (Double));
+ types.Add (typeof (short));
+ types.Add (typeof (long));
+ types.Add (typeof (ushort));
+ types.Add (typeof (uint));
+ types.Add (typeof (ulong));
+ }
+
+ internal static void SerializeByType (BinaryWriter w, object value)
+ {
+ Type type = value.GetType ();
+ int i = types.IndexOf (type);
+ if (i == -1) {
+ w.Write (15); // types.Count
+ BinaryFormatter bf = new BinaryFormatter ();
+ bf.Serialize (w.BaseStream, value);
+ return;
+ }
+
+ w.Write (i);
+ switch (i) {
+ case 1:
+ w.Write ((string) value);
+ break;
+ case 2:
+ w.Write ((int) value);
+ break;
+ case 3:
+ w.Write ((bool) value);
+ break;
+ case 4:
+ w.Write (((DateTime) value).Ticks);
+ break;
+ case 5:
+ w.Write ((decimal) value);
+ break;
+ case 6:
+ w.Write ((byte) value);
+ break;
+ case 7:
+ w.Write ((char) value);
+ break;
+ case 8:
+ w.Write ((float) value);
+ break;
+ case 9:
+ w.Write ((double) value);
+ break;
+ case 10:
+ w.Write ((short) value);
+ break;
+ case 11:
+ w.Write ((long) value);
+ break;
+ case 12:
+ w.Write ((ushort) value);
+ break;
+ case 13:
+ w.Write ((uint) value);
+ break;
+ case 14:
+ w.Write ((ulong) value);
+ break;
+ }
+ }
+
+ internal static object DeserializeFromIndex (int index, BinaryReader r)
+ {
+ if (index == 15){
+ BinaryFormatter bf = new BinaryFormatter ();
+ return bf.Deserialize (r.BaseStream);
+ }
+
+ object value = null;
+ switch (index) {
+ case 1:
+ value = r.ReadString ();
+ break;
+ case 2:
+ value = r.ReadInt32 ();
+ break;
+ case 3:
+ value = r.ReadBoolean ();
+ break;
+ case 4:
+ value = new DateTime (r.ReadInt64 ());
+ break;
+ case 5:
+ value = r.ReadDecimal ();
+ break;
+ case 6:
+ value = r.ReadByte ();
+ break;
+ case 7:
+ value = r.ReadChar ();
+ break;
+ case 8:
+ value = r.ReadSingle ();
+ break;
+ case 9:
+ value = r.ReadDouble ();
+ break;
+ case 10:
+ value = r.ReadInt16 ();
+ break;
+ case 11:
+ value = r.ReadInt64 ();
+ break;
+ case 12:
+ value = r.ReadUInt16 ();
+ break;
+ case 13:
+ value = r.ReadUInt32 ();
+ break;
+ case 14:
+ value = r.ReadUInt64 ();
+ break;
+ }
+
+ return value;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Util/ChangeLog b/mcs/class/System.Web/System.Web.Util/ChangeLog
new file mode 100644
index 00000000000..f82b06ce1b8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/ChangeLog
@@ -0,0 +1,232 @@
+2004-11-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: made (Insert|Get|Remove)SessionId use the appRoot +
+ SessionID + vpath format.
+
+2004-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: don't pass double slash when the path begins with a
+ tilde. Fixes bug #61654.
+
+2004-05-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs:
+ (GetFile): not public, and fixed to really return just the file name.
+ (InsertSessionId): ensure that the directory ends with a "/". This
+ fixes cookieless sessions.
+ (RemoveSessionId): don't return "/" twice.
+
+ Fixed bug #59051.
+
+2004-05-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: respect trailing slashes. Fixes bug #56802.
+
+2004-05-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: no more ^Ms.
+
+2004-04-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: MakeRelative was returning null for virtual paths without
+ directory.
+
+2004-04-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FileAction.cs:
+ * FileChangeEventHandler.cs:
+ * FileChangedEventArgs.cs:
+ * FileChangesMonitor.cs:
+ * FilePathParser.cs: removed unused/obsolete files.
+
+2004-04-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: fixed MakeRelative. nGallery goes one step further.
+
+2004-03-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: small fix from George Kodinov for Combine when ~ is used.
+
+2004-02-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: ~ is not always /. Fixed.
+
+2004-02-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs:
+ (Combine): handle subdirectories and tilde. Fixes bug 54231.
+
+2004-02-01 Alon Gazit <along@mainsoft.com>
+
+ * UrlUtils.cs: little fix in GetDirectory ().
+
+2004-01-11 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * TransactedCallback.cs:
+ * WorkItemCallback.cs:
+ * WorkItem.cs:
+ * Transactions.cs: Added and stubbed/ implemented
+
+2004-01-11 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * WebEqualComparer.cs:
+ * WebHashCodeProvider.cs:
+ * FileAction.cs:
+ * FileChangeEventHandler.cs:
+ * NativeFileChangeEventHandler.cs: Monostyled header, internalized
+
+2004-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: make reduce not to throw an exception for '../'. Fixes
+ bug #52599.
+
+2003-12-03 Jackson Harper <jackson@ximian.com>
+
+ * UrlUtils.cs: Some methods for working with session ids in urls.
+
+2003-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebEncoding.cs: use the Default encoding when the globalization
+ configuration is not available.
+
+2003-12-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: don't forget basePath when relative path is not rooted.
+ Fixes bug #51522.
+
+2003-11-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: fix bug introduced with last change that makes relative
+ paths fail. Closes bug #51448.
+
+2003-11-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: fixed Combine() handling of ~.
+
+2003-11-25 Jackson Harper <jackson@ximian.com>
+
+ * AltSerialization.cs: Utility methods for optimized serializing.
+
+2003-11-13 Jackson Harper <jackson@ximian.com>
+
+ * TimeUtil.cs: Utility methods for dealing with time.
+
+2003-11-08 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * UrlUtils.cs: new function to do the app mapping, but make
+ it return a physical path.
+
+2003-11-07 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * UrlUtils.cs: add a new function for mapping app absolute
+ paths to virual paths (ie, ~/blah/ to /application/root/blah/)
+
+2003-11-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebEncoding.cs: added properties to access configuration files
+ encoding.
+
+2003-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ICalls.cs: holds a couple of icalls.
+
+2003-08-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: made Reduce work when a "/" is passed.
+
+2003-05-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: fixed Combine and reworked Reduce.
+
+2003-03-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: another little fix in Combine ().
+
+2003-01-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: fixed Combine ().
+
+2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: fixed IsRelativeUrl and IsRootUrl.
+
+2002-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PathUtil.cs: removed.
+ * UrlUtils.cs: fixed Combine to handle '~'.
+
+2002-12-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PathUtil.cs: some path handling methods that are not available in
+ System.IO.Path.
+
+2002-10-28 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataSourceHelper.cs : Fresh implementation. Moved from
+ System.Web.UI.WebControls.DataGrid
+ ::ResolveData(object, string).
+
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebTrace.cs: fixed namespace.
+
+ * WebEncoding.cs: new class that holds the default encoding for
+ System.Web.
+
+2002-01-03 Nick Drochak <ndrochak@gol.com>
+
+ * FileChangesMonitor.cs: remove redundant using statement; use int
+ for MAXLEN; capitalize correctly 'WebHashCodeProvider';
+ fix typo rsLock -> rwLock; Change IsRooted to IsPathRooted;
+ set out parameter value where needed
+ * FilePathParser.cs: qualify method GetPathRoot() with 'Path.'
+ * IISVersionInfo.cs: initialize static member to avoid compile error.
+ * WebEqualComparer.cs: static member defC shouldn't be readonly;
+ the string comparer had some typos (fixed)
+ * WebHashCodeProvider.cs: needed System.Globalization; static member
+ defHcp shouldn't be readonly; remove double equal typo.
+
+2002-01-02 Nick Drochak <ndrochak@gol.com>
+
+ * FileAction.cs: Use 0x7FFFFFFF as enum value for error. 0xFFFFFFFF
+ is too big for Int32.
+ * FileChangeEventHandler.cs: put missing 'void' return type on delegate
+ FileChangeEventHandler()
+ * FileChangedEventArgs.cs: ditto for FileChangedEvent()
+ * NativeFileChangeEventHandler.cs: ditto for NativeFileChangeEventHandler()
+ * FileChangesMonitor.cs: add needed namespaces and comment out imcomplete
+ code.
+
+2001-12-21 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * ApacheVersionInfo.cs - Dummy class, for later use.
+ * FileAction.cs:
+ * FileChangeEventHandler.cs:
+ * FileChangeEventArgs.cs:
+ * FileChangesMonitor.cs:
+ * NativeFileChangeEventHandler.cs
+ - To be used in System.Web/Http* classes.
+ Initially needed for HttpRuntime
+ * IISVersionInfo.cs - Some useful methods
+
+
+2001-12-17 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * UrlUtils.cs - Added functions Combine and Reduce
+
+2001-12-16 Miguel de Icaza <miguel@ximian.com>
+
+ * DataSourceHelper.cs, UrlUtils.cs: Set the correct namespace.
+
+2001-11-30
+ Gaurav Vaish <gvaish@iitk.ac.in>
+ * DataSourceHelper.cs - Resolving DataSource objects
+
+2001-11-09
+ Gaurav Vaish <gvaish@iitk.ac.in>
+ * UrlUtil.cs - Some basic functions
+
+2001-11-08
+ Gaurav Vaish <gvaish@iitk.ac.in>
+ * Namespace - Created the namespace for commonly used,
+ otherwise not available functions
diff --git a/mcs/class/System.Web/System.Web.Util/DataSourceHelper.cs b/mcs/class/System.Web/System.Web.Util/DataSourceHelper.cs
new file mode 100644
index 00000000000..e387d038917
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/DataSourceHelper.cs
@@ -0,0 +1,88 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.Util
+ * Class: DataSourceHelper
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Status: 10%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Web.Util
+{
+ internal class DataSourceHelper
+ {
+ public static IEnumerable GetResolvedDataSource(object source, string member)
+ {
+ if(source != null && source is IListSource)
+ {
+ IListSource src = (IListSource)source;
+ IList list = src.GetList();
+ if(!src.ContainsListCollection)
+ {
+ return list;
+ }
+ if(list != null && list is ITypedList)
+ {
+ ITypedList tlist = (ITypedList)list;
+ PropertyDescriptorCollection pdc = tlist.GetItemProperties(new PropertyDescriptor[0]);
+ if(pdc != null && pdc.Count > 0)
+ {
+ PropertyDescriptor pd = null;
+ if(member != null && member.Length > 0)
+ {
+ pd = pdc.Find(member, true);
+ } else
+ {
+ pd = pdc[0];
+ }
+ if(pd != null)
+ {
+ object rv = pd.GetValue(list[0]);
+ if(rv != null && rv is IEnumerable)
+ {
+ return (IEnumerable)rv;
+ }
+ }
+ throw new HttpException(
+ HttpRuntime.FormatResourceString("ListSource_Missing_DataMember", member));
+ }
+ throw new HttpException(
+ HttpRuntime.FormatResourceString("ListSource_Without_DataMembers"));
+ }
+ }
+ if(source is IEnumerable)
+ {
+ return (IEnumerable)source;
+ }
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/ICalls.cs b/mcs/class/System.Web/System.Web.Util/ICalls.cs
new file mode 100644
index 00000000000..cf2fcbde1a7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/ICalls.cs
@@ -0,0 +1,45 @@
+//
+// System.Web.Util.ICalls
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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.Runtime.CompilerServices;
+namespace System.Web.Util
+{
+ class ICalls
+ {
+ private ICalls () {}
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern static public string GetMachineConfigPath ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern static public string GetMachineInstallDirectory ();
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Util/NativeFileChangeEventHandler.cs b/mcs/class/System.Web/System.Web.Util/NativeFileChangeEventHandler.cs
new file mode 100644
index 00000000000..f1082aca972
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/NativeFileChangeEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.Util.NativeFileChangeEventHandler.cs
+//
+// Authors:
+// Gaurav Vaish (my_scripts2001@yahoo.com, gvaish@iitk.ac.in)
+//
+// (c) Gaurav Vaish 2001
+//
+
+//
+// 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.
+//
+
+namespace System.Web.Util
+{
+ internal delegate void NativeFileChangeEventHandler(object sender, int method);
+}
diff --git a/mcs/class/System.Web/System.Web.Util/TimeUtil.cs b/mcs/class/System.Web/System.Web.Util/TimeUtil.cs
new file mode 100644
index 00000000000..47ef8ef4e40
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/TimeUtil.cs
@@ -0,0 +1,45 @@
+//
+// System.Web.Util.TimeUtil
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2003 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
+// "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;
+
+namespace System.Web.Util {
+
+ internal sealed class TimeUtil {
+
+ private TimeUtil () { }
+
+ internal static string ToUtcTimeString (DateTime dt)
+ {
+ return dt.ToUniversalTime ().ToString ("ddd, d MMM yyyy HH:mm:ss ") + "GMT";
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Util/TransactedCallback.cs b/mcs/class/System.Web/System.Web.Util/TransactedCallback.cs
new file mode 100644
index 00000000000..c6b5299cd52
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/TransactedCallback.cs
@@ -0,0 +1,32 @@
+//
+// System.Web.Util.TransactedCallback.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.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.
+//
+
+namespace System.Web.Util
+{
+ public delegate void TransactedCallback ();
+}
diff --git a/mcs/class/System.Web/System.Web.Util/Transactions.cs b/mcs/class/System.Web/System.Web.Util/Transactions.cs
new file mode 100644
index 00000000000..340abf776fe
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/Transactions.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.Util.Transactions.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.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;
+using System.EnterpriseServices;
+
+namespace System.Web.Util
+{
+ public class Transactions
+ {
+ public Transactions ()
+ {
+ }
+
+ public static void InvokeTransacted (TransactedCallback callback, TransactionOption mode)
+ {
+ bool abortedTransaction = false;
+ InvokeTransacted (callback, mode, ref abortedTransaction);
+ }
+
+ public static void InvokeTransacted (TransactedCallback callback,
+ TransactionOption mode,
+ ref bool transactionAborted)
+ {
+ throw new PlatformNotSupportedException ("Not supported on mono");
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/UrlUtils.cs b/mcs/class/System.Web/System.Web.Util/UrlUtils.cs
new file mode 100644
index 00000000000..b01ab2b5b7c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/UrlUtils.cs
@@ -0,0 +1,427 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web.UI.Util
+ * Class: UrlUtils
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Text;
+using System.Web.SessionState;
+
+namespace System.Web.Util
+{
+ internal class UrlUtils
+ {
+ /*
+ * I could not find these functions in the class System.Uri
+ * Besides, an instance of Uri will not be formed until and unless the address is of
+ * the form protocol://[user:pass]host[:port]/[fullpath]
+ * ie, a protocol, and that too without any blanks before,
+ * is a must which may not be the case here.
+ * Important: Escaped URL is assumed here. nothing like .aspx?path=/something
+ * It should be .aspx?path=%2Fsomething
+ */
+ public static string GetProtocol(string url)
+ {
+ //Taking code from Java Class java.net.URL
+ if(url!=null)
+ {
+ if(url.Length>0)
+ {
+
+ int i, start = 0, limit;
+ limit = url.Length;
+ char c;
+ bool aRef = false;
+ while( (limit > 0) && (url[limit-1] <= ' '))
+ {
+ limit --;
+ }
+ while( (start < limit) && (url[start] <= ' '))
+ {
+ start++;
+ }
+ if(RegionMatches(true, url, start, "url:", 0, 4))
+ {
+ start += 4;
+ }
+ if(start < url.Length && url[start]=='#')
+ {
+ aRef = true;
+ }
+ for(i = start; !aRef && (i < limit) && ((c=url[i]) != '/'); i++)
+ {
+ if(c==':')
+ {
+ return url.Substring(start, i - start);
+ }
+ }
+ }
+ }
+ return String.Empty;
+ }
+
+ public static bool IsRelativeUrl(string url)
+ {
+ if (url.IndexOf(':') == -1)
+ return !IsRooted(url);
+
+ return false;
+ }
+
+ public static bool IsRootUrl(string url)
+ {
+ if(url!=null)
+ {
+ if(url.Length>0)
+ {
+ return IsValidProtocol(GetProtocol(url).ToLower());
+ }
+ }
+ return true;
+ }
+
+ public static bool IsRooted(string path)
+ {
+ if(path!=null && path.Length > 0)
+ {
+ return (path[0]=='/' || path[0]=='\\');
+ }
+ return true;
+ }
+
+ public static void FailIfPhysicalPath(string path)
+ {
+ if(path!= null && path.Length > 1)
+ {
+ if(path[1]==':' || path.StartsWith(@"\\"))
+ throw new HttpException(HttpRuntime.FormatResourceString("Physical_path_not_allowed", path));
+ }
+ }
+
+ public static string Combine (string basePath, string relPath)
+ {
+ if (relPath == null)
+ throw new ArgumentNullException ("relPath");
+
+ int rlength = relPath.Length;
+ if (rlength == 0)
+ return "";
+
+ FailIfPhysicalPath (relPath);
+ relPath = relPath.Replace ("\\", "/");
+ if (IsRooted (relPath))
+ return Reduce (relPath);
+
+ char first = relPath [0];
+ if (rlength < 3 || first == '~' || first == '/' || first == '\\') {
+ if (basePath == null || (basePath.Length == 1 && basePath [0] == '/'))
+ basePath = String.Empty;
+
+ string slash = (first == '/') ? "" : "/";
+ if (first == '~') {
+ if (rlength == 1) {
+ relPath = "";
+ } else if (rlength > 1 && relPath [1] == '/') {
+ relPath = relPath.Substring (2);
+ slash = "/";
+ }
+
+ string appvpath = HttpRuntime.AppDomainAppVirtualPath;
+ if (appvpath.EndsWith ("/"))
+ slash = "";
+
+ return Reduce (appvpath + slash + relPath);
+ }
+
+ return Reduce (basePath + slash + relPath);
+ }
+
+ if (basePath == null || basePath == "")
+ basePath = HttpRuntime.AppDomainAppVirtualPath;
+
+ if (basePath.Length <= 1)
+ basePath = String.Empty;
+
+ return Reduce (basePath + "/" + relPath);
+ }
+
+ public static bool IsValidProtocol(string protocol)
+ {
+ if(protocol.Length < 1)
+ return false;
+ char c = protocol[0];
+ if(!Char.IsLetter(c))
+ {
+ return false;
+ }
+ for(int i=1; i < protocol.Length; i++)
+ {
+ c = protocol[i];
+ if(!Char.IsLetterOrDigit(c) && c!='.' && c!='+' && c!='-')
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /*
+ * MakeRelative("http://www.foo.com/bar1/bar2/file","http://www.foo.com/bar1")
+ * will return "bar2/file"
+ * while MakeRelative("http://www.foo.com/bar1/...","http://www.anotherfoo.com")
+ * return 'null' and so does the call
+ * MakeRelative("http://www.foo.com/bar1/bar2","http://www.foo.com/bar")
+ */
+ public static string MakeRelative(string fullUrl, string relativeTo)
+ {
+ if (fullUrl == relativeTo)
+ return String.Empty;
+
+ if (fullUrl.IndexOf (relativeTo) != 0)
+ return null;
+
+ string leftOver = fullUrl.Substring (relativeTo.Length);
+ if (leftOver.Length > 0 && leftOver [0] == '/')
+ leftOver = leftOver.Substring (1);
+
+ leftOver = Reduce (leftOver);
+ if (leftOver.Length > 0 && leftOver [0] == '/')
+ leftOver = leftOver.Substring (1);
+
+ return leftOver;
+ }
+
+ /*
+ * Check JavaDocs for java.lang.String#RegionMatches(bool, int, String, int, int)
+ * Could not find anything similar in the System.String class
+ */
+ public static bool RegionMatches(bool ignoreCase, string source, int start, string match, int offset, int len)
+ {
+ if(source!=null || match!=null)
+ {
+ if(source.Length>0 && match.Length>0)
+ {
+ char[] ta = source.ToCharArray();
+ char[] pa = match.ToCharArray();
+ if((offset < 0) || (start < 0) || (start > (source.Length - len)) || (offset > (match.Length - len)))
+ {
+ return false;
+ }
+ while(len-- > 0)
+ {
+ char c1 = ta[start++];
+ char c2 = pa[offset++];
+ if(c1==c2)
+ continue;
+ if(ignoreCase)
+ {
+ if(Char.ToUpper(c1)==Char.ToUpper(c2))
+ continue;
+ // Check for Gregorian Calendar where the above may not hold good
+ if(Char.ToLower(c1)==Char.ToLower(c2))
+ continue;
+ }
+ return false;
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static string Reduce (string path)
+ {
+ path = path.Replace ('\\','/');
+
+ string [] parts = path.Split ('/');
+ ArrayList result = new ArrayList ();
+
+ int end = parts.Length;
+ for (int i = 0; i < end; i++) {
+ string current = parts [i];
+ if (current == "." )
+ continue;
+
+ if (current == "..") {
+ if (result.Count == 0) {
+ if (i == 1) // see bug 52599
+ continue;
+
+ throw new HttpException ("Invalid path.");
+ }
+
+ result.RemoveAt (result.Count - 1);
+ continue;
+ }
+
+ result.Add (current);
+ }
+
+ if (result.Count == 0)
+ return "/";
+
+ return String.Join ("/", (string []) result.ToArray (typeof (string)));
+ }
+
+ public static string GetDirectory(string url)
+ {
+ if(url==null)
+ {
+ return null;
+ }
+ if(url.Length==0)
+ {
+ return String.Empty;
+ }
+ url = url.Replace('\\','/');
+
+ string baseDir = "";
+ int last = url.LastIndexOf ('/');
+ if (last > 0)
+ baseDir = url.Substring(0, url.LastIndexOf('/'));
+
+ if(baseDir.Length==0)
+ {
+ baseDir = "/";
+ }
+ return baseDir;
+ }
+
+ static string GetFile (string url)
+ {
+ if (url == null)
+ return null;
+
+ if (url.Length == 0)
+ return String.Empty;
+
+ url = url.Replace ('\\', '/');
+
+ int last = url.LastIndexOf ('/') + 1;
+ if (last != 0) {
+ url = url.Substring (last);
+ }
+
+ return url;
+ }
+
+ // appRoot + SessionID + vpath
+ public static string InsertSessionId (string id, string path)
+ {
+ string dir = GetDirectory (path);
+ if (!dir.EndsWith ("/"))
+ dir += "/";
+
+ string appvpath = HttpRuntime.AppDomainAppVirtualPath;
+ if (!appvpath.EndsWith ("/"))
+ appvpath += "/";
+
+ if (path.StartsWith (appvpath))
+ path = path.Substring (appvpath.Length);
+
+ if (path [0] == '/')
+ path = path.Length > 1 ? path.Substring (1) : "";
+
+ return Reduce (appvpath + "(" + id + ")/" + path);
+ }
+
+ public static string GetSessionId (string path)
+ {
+ string appvpath = HttpRuntime.AppDomainAppVirtualPath;
+ if (path.Length <= appvpath.Length)
+ return null;
+
+ path = path.Substring (appvpath.Length);
+ if (path.Length == 0 || path [0] != '/')
+ path = '/' + path;
+
+ int len = path.Length;
+ if ((len < SessionId.IdLength + 3) || (path [1] != '(') ||
+ (path [SessionId.IdLength + 2] != ')'))
+ return null;
+
+ return path.Substring (2, SessionId.IdLength);
+ }
+
+ public static string RemoveSessionId (string base_path, string file_path)
+ {
+ // Caller did a GetSessionId first
+ int idx = base_path.IndexOf ("/(");
+ string dir = base_path.Substring (0, idx + 1);
+ if (!dir.EndsWith ("/"))
+ dir += "/";
+
+ idx = base_path.IndexOf (")/");
+ if (idx != -1 && base_path.Length > idx + 2) {
+ string dir2 = base_path.Substring (idx + 2);
+ if (!dir2.EndsWith ("/"))
+ dir2 += "/";
+
+ dir += dir2;
+ }
+
+ return Reduce (dir + GetFile (file_path));
+ }
+
+ public static string ResolveVirtualPathFromAppAbsolute (string path)
+ {
+ if (path [0] != '~') return path;
+
+ if (path.Length == 1)
+ return HttpRuntime.AppDomainAppVirtualPath;
+
+ if (path [1] == '/' || path [1] == '\\') {
+ string appPath = HttpRuntime.AppDomainAppVirtualPath;
+ if (appPath.Length > 1)
+ return appPath + "/" + path.Substring (2);
+ return "/" + path.Substring (2);
+ }
+ return path;
+ }
+
+ public static string ResolvePhysicalPathFromAppAbsolute (string path)
+ {
+ if (path [0] != '~') return path;
+
+ if (path.Length == 1)
+ return HttpRuntime.AppDomainAppPath;
+
+ if (path [1] == '/' || path [1] == '\\') {
+ string appPath = HttpRuntime.AppDomainAppPath;
+ if (appPath.Length > 1)
+ return appPath + "/" + path.Substring (2);
+ return "/" + path.Substring (2);
+ }
+ return path;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Util/WebEncoding.cs b/mcs/class/System.Web/System.Web.Util/WebEncoding.cs
new file mode 100644
index 00000000000..df2e4247f57
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/WebEncoding.cs
@@ -0,0 +1,70 @@
+//
+// System.Web.Util.WebEncoding
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+// (C) 2003 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
+// "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.Text;
+using System.Web.Configuration;
+
+namespace System.Web.Util
+{
+ internal class WebEncoding
+ {
+ static public Encoding FileEncoding {
+ get {
+ GlobalizationConfiguration gc = GlobalizationConfiguration.GetInstance (null);
+ if (gc == null)
+ return Encoding.Default;
+
+ return gc.FileEncoding;
+ }
+ }
+
+ static public Encoding ResponseEncoding {
+ get {
+ GlobalizationConfiguration gc = GlobalizationConfiguration.GetInstance (null);
+ if (gc == null)
+ return Encoding.Default;
+
+ return gc.ResponseEncoding;
+ }
+ }
+
+ static public Encoding RequestEncoding {
+ get {
+ GlobalizationConfiguration gc = GlobalizationConfiguration.GetInstance (null);
+ if (gc == null)
+ return Encoding.Default;
+
+ return gc.RequestEncoding;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Util/WebEqualComparer.cs b/mcs/class/System.Web/System.Web.Util/WebEqualComparer.cs
new file mode 100644
index 00000000000..c72fbb51f19
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/WebEqualComparer.cs
@@ -0,0 +1,124 @@
+//
+// System.Web.Util.WebEqualComparer.cs
+//
+// Authors:
+// Gaurav Vaish (my_scripts2001@yahoo.com, gvaish@iitk.ac.in)
+//
+// (c) Gaurav Vaish 2001
+//
+
+//
+// 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;
+using System.Globalization;
+using System.Collections;
+
+namespace System.Web.Util
+{
+ internal class WebEqualComparer : IComparer
+ {
+ private static IComparer defC;
+
+ public WebEqualComparer()
+ {
+ }
+
+ public static IComparer Default
+ {
+ get
+ {
+ if(defC == null)
+ {
+ defC = new WebEqualComparer();
+ }
+ return defC;
+ }
+ }
+
+ /// <summary>
+ /// To compare two strings
+ /// </summary>
+ /// <remarks>
+ /// Cannot apply String.Compare(..) since I am at web
+ /// </remarks>
+ int IComparer.Compare(object left, object right)
+ {
+ string leftStr, rightStr;
+ leftStr = null;
+ rightStr = null;
+ if(left is string)
+ {
+ leftStr = (string)left;
+ }
+ if(right is string)
+ {
+ rightStr = (string)right;
+ }
+
+ if(leftStr==null || rightStr==null)
+ {
+ throw new ArgumentException();
+ }
+
+ int ll = leftStr.Length;
+ int lr = rightStr.Length;
+ if(ll==0 && lr==0)
+ {
+ return 0;
+ }
+
+ if(ll==0 || lr==0)
+ {
+ return ( (ll > 0) ? 1 : -1);
+ }
+
+ char cl,cr;
+ int i=0;
+ for(i=0; i < leftStr.Length; i++)
+ {
+ if(i==lr)
+ {
+ return 1;
+ }
+ cl = leftStr[i];
+ cr = leftStr[i];
+ if(cl==cr)
+ {
+ continue;
+ }
+ UnicodeCategory ucl = Char.GetUnicodeCategory(cl);
+ UnicodeCategory ucr = Char.GetUnicodeCategory(cr);
+ if(ucl==ucr)
+ {
+ return ( (cl > cr) ? 1 : -1 );
+ }
+ cl = Char.ToLower(cl);
+ cr = Char.ToLower(cr);
+ if(cl!=cr)
+ {
+ return ( (cl > cr) ? 1 : -1);
+ }
+ }
+ return ( (i==lr) ? 0 : -1 );
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/WebHashCodeProvider.cs b/mcs/class/System.Web/System.Web.Util/WebHashCodeProvider.cs
new file mode 100644
index 00000000000..66c70da2433
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/WebHashCodeProvider.cs
@@ -0,0 +1,61 @@
+//
+// System.Web.Util.WebHashCodeProvider.cs
+//
+// Authors:
+// Gaurav Vaish (my_scripts2001@yahoo.com, gvaish@iitk.ac.in)
+//
+// (c) Gaurav Vaish 2001
+//
+
+//
+// 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.Collections;
+using System.Globalization;
+
+namespace System.Web.Util
+{
+ internal class WebHashCodeProvider : IHashCodeProvider
+ {
+ private static IHashCodeProvider defHcp;
+
+ public WebHashCodeProvider()
+ {
+ }
+
+ int IHashCodeProvider.GetHashCode(object key)
+ {
+ return Default.GetHashCode(key);
+ }
+
+ public static IHashCodeProvider Default
+ {
+ get
+ {
+ if(defHcp==null)
+ {
+ defHcp = new CaseInsensitiveHashCodeProvider(CultureInfo.InvariantCulture);
+ }
+ return defHcp;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/WebTrace.cs b/mcs/class/System.Web/System.Web.Util/WebTrace.cs
new file mode 100644
index 00000000000..c81a3354faa
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/WebTrace.cs
@@ -0,0 +1,119 @@
+//
+// System.Web.Util.WebTrace
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.Collections;
+using System.Diagnostics;
+
+namespace System.Web.Util
+{
+ internal class WebTrace
+ {
+ static Stack ctxStack;
+ static bool trace;
+
+ static WebTrace ()
+ {
+ ctxStack = new Stack ();
+ }
+
+ [Conditional("WEBTRACE")]
+ static public void PushContext (string context)
+ {
+ ctxStack.Push (context);
+ Trace.Indent ();
+ }
+
+ [Conditional("WEBTRACE")]
+ static public void PopContext ()
+ {
+ if (ctxStack.Count == 0)
+ return;
+
+ Trace.Unindent ();
+ ctxStack.Pop ();
+ }
+
+ static public string Context
+ {
+ get {
+ if (ctxStack.Count == 0)
+ return "No context";
+
+ return (string) ctxStack.Peek ();
+ }
+ }
+
+ static public bool StackTrace
+ {
+ get { return trace; }
+
+ set { trace = value; }
+ }
+
+ [Conditional("WEBTRACE")]
+ static public void WriteLine (string msg)
+ {
+ Trace.WriteLine (Format (msg));
+ }
+
+ [Conditional("WEBTRACE")]
+ static public void WriteLine (string msg, object arg)
+ {
+ Trace.WriteLine (Format (String.Format (msg, arg)));
+ }
+
+ [Conditional("WEBTRACE")]
+ static public void WriteLine (string msg, object arg1, object arg2)
+ {
+ Trace.WriteLine (Format (String.Format (msg, arg1, arg2)));
+ }
+
+ [Conditional("WEBTRACE")]
+ static public void WriteLine (string msg, object arg1, object arg2, object arg3)
+ {
+ Trace.WriteLine (Format (String.Format (msg, arg1, arg2, arg3)));
+ }
+
+ [Conditional("WEBTRACE")]
+ static public void WriteLine (string msg, params object [] args)
+ {
+ Trace.WriteLine (Format (String.Format (msg, args)));
+ }
+
+ static string Format (string msg)
+ {
+ if (trace)
+ return String.Format ("{0}: {1}\n{2}", Context, msg, Environment.StackTrace);
+ else
+ return String.Format ("{0}: {1}", Context, msg);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Util/WorkItem.cs b/mcs/class/System.Web/System.Web.Util/WorkItem.cs
new file mode 100644
index 00000000000..92361e4bfb8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/WorkItem.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.Util.WorkItem.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.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;
+
+namespace System.Web.Util
+{
+ public class WorkItem
+ {
+ public WorkItem ()
+ {
+ }
+
+ public static void Post (WorkItemCallback callback)
+ {
+ throw new PlatformNotSupportedException ("Not supported on mono");
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/WorkItemCallback.cs b/mcs/class/System.Web/System.Web.Util/WorkItemCallback.cs
new file mode 100644
index 00000000000..9bb18db44e2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/WorkItemCallback.cs
@@ -0,0 +1,32 @@
+//
+// System.Web.Util.WorkItemCallback.cs
+//
+// Authors:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.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.
+//
+
+namespace System.Web.Util
+{
+ public delegate void WorkItemCallback ();
+}
diff --git a/mcs/class/System.Web/System.Web.dll.sources b/mcs/class/System.Web/System.Web.dll.sources
new file mode 100755
index 00000000000..b734da2c246
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.dll.sources
@@ -0,0 +1,892 @@
+Assembly/AssemblyInfo.cs
+Assembly/Consts.cs
+Assembly/Locale.cs
+System.Web.Administration/WebAdminUserControl.cs
+System.Web.Caching/Cache.cs
+System.Web.Caching/CacheDefinitions.cs
+System.Web.Caching/CacheDependency.cs
+System.Web.Caching/CacheEntry.cs
+System.Web.Caching/CacheExpires.cs
+System.Web.Caching/CachedRawResponse.cs
+System.Web.Caching/CachedVaryBy.cs
+System.Web.Caching/ExpiresBuckets.cs
+System.Web.Caching/OutputCacheModule.cs
+System.Web.Compilation/AspComponentFoundry.cs
+System.Web.Compilation/AspGenerator.cs
+System.Web.Compilation/AspParser.cs
+System.Web.Compilation/AspTokenizer.cs
+System.Web.Compilation/BaseCompiler.cs
+System.Web.Compilation/BuildProviderResultFlags.cs
+System.Web.Compilation/CachingCompiler.cs
+System.Web.Compilation/CompilationException.cs
+System.Web.Compilation/Directive.cs
+System.Web.Compilation/ExpressionBuilder.cs
+System.Web.Compilation/ExpressionBuilderContext.cs
+System.Web.Compilation/GlobalAsaxCompiler.cs
+System.Web.Compilation/IImplicitResourceProvider.cs
+System.Web.Compilation/ILocation.cs
+System.Web.Compilation/IResourceReader.cs
+System.Web.Compilation/ImplicitResourceKey.cs
+System.Web.Compilation/Location.cs
+System.Web.Compilation/PageCompiler.cs
+System.Web.Compilation/ParseException.cs
+System.Web.Compilation/TagAttributes.cs
+System.Web.Compilation/TagType.cs
+System.Web.Compilation/TemplateControlCompiler.cs
+System.Web.Compilation/UserControlCompiler.cs
+System.Web.Compilation/WebServiceCompiler.cs
+System.Web.Configuration/AdapterDictionary.cs
+System.Web.Configuration/AnonymousIdentificationSection.cs
+System.Web.Configuration/AssemblyCollection.cs
+System.Web.Configuration/AssemblyInfo.cs
+System.Web.Configuration/AuthenticationSection.cs
+System.Web.Configuration/AuthConfig.cs
+System.Web.Configuration/AuthenticationConfigHandler.cs
+System.Web.Configuration/AuthenticationMode.cs
+System.Web.Configuration/AuthorizationConfig.cs
+System.Web.Configuration/AuthorizationConfigHandler.cs
+System.Web.Configuration/AuthorizationRuleAction.cs
+System.Web.Configuration/BuildProvider.cs
+System.Web.Configuration/BuildProviderAppliesTo.cs
+System.Web.Configuration/BuildProviderCollection.cs
+System.Web.Configuration/ClientTargetSectionHandler.cs
+System.Web.Configuration/CodeSubDirectoriesCollection.cs
+System.Web.Configuration/CodeSubDirectory.cs
+System.Web.Configuration/CompilationConfiguration.cs
+System.Web.Configuration/CompilationConfigurationHandler.cs
+System.Web.Configuration/CompilationSection.cs
+System.Web.Configuration/Compiler.cs
+System.Web.Configuration/CompilerCollection.cs
+System.Web.Configuration/CustomErrorsConfigHandler.cs
+System.Web.Configuration/CustomErrorsMode.cs
+System.Web.Configuration/ExpressionBuilder.cs
+System.Web.Configuration/ExpressionBuilderCollection.cs
+System.Web.Configuration/FormsAuthenticationConfiguration.cs
+System.Web.Configuration/FormsAuthPasswordFormat.cs
+System.Web.Configuration/FormsProtectionEnum.cs
+System.Web.Configuration/GlobalizationConfiguration.cs
+System.Web.Configuration/GlobalizationConfigurationHandler.cs
+System.Web.Configuration/HandlerFactoryConfiguration.cs
+System.Web.Configuration/HandlerFactoryProxy.cs
+System.Web.Configuration/HandlerItem.cs
+System.Web.Configuration/HttpCapabilitiesBase.cs
+System.Web.Configuration/HttpConfigurationContext.cs
+System.Web.Configuration/HttpHandlersSectionHandler.cs
+System.Web.Configuration/HttpModulesConfigurationHandler.cs
+System.Web.Configuration/HttpRuntimeConfig.cs
+System.Web.Configuration/HttpRuntimeConfigurationHandler.cs
+System.Web.Configuration/InternalSection.cs
+System.Web.Configuration/IRemoteWebConfigurationHostServer.cs
+System.Web.Configuration/MachineKeyConfig.cs
+System.Web.Configuration/MachineKeyConfigHandler.cs
+System.Web.Configuration/MachineKeyValidation.cs
+System.Web.Configuration/ModuleItem.cs
+System.Web.Configuration/ModulesConfiguration.cs
+System.Web.Configuration/PagesConfiguration.cs
+System.Web.Configuration/PagesConfigurationHandler.cs
+System.Web.Configuration/PagesEnableSessionState.cs
+System.Web.Configuration/PagesToCountAction.cs
+System.Web.Configuration/PassportAuthentication.cs
+System.Web.Configuration/ProcessModelComAuthenticationLevel.cs
+System.Web.Configuration/ProcessModelComImpersonationLevel.cs
+System.Web.Configuration/ProcessModelLogLevel.cs
+System.Web.Configuration/SerializationMode.cs
+System.Web.Configuration/SiteMapSection.cs
+System.Web.Configuration/TraceConfig.cs
+System.Web.Configuration/TraceConfigurationHandler.cs
+System.Web.Configuration/TraceDisplayMode.cs
+System.Web.Configuration/WebConfigurationSettings.cs
+System.Web.Configuration/WebControlsSectionHandler.cs
+System.Web.Handlers/AssemblyResourceLoader.cs
+System.Web.Handlers/TraceHandler.cs
+System.Web.Hosting/AppDomainFactory.cs
+System.Web.Hosting/ApplicationHost.cs
+System.Web.Hosting/IAppDomainFactory.cs
+System.Web.Hosting/IAppManagerAppDomainFactory.cs
+System.Web.Hosting/IApplicationHost.cs
+System.Web.Hosting/IHttpWorkerRequestHandler.cs
+System.Web.Hosting/IISAPIRuntime.cs
+System.Web.Hosting/IProcessHost.cs
+System.Web.Hosting/IProcessHostFactoryHelper.cs
+System.Web.Hosting/IProcessHostSupportFunction.cs
+System.Web.Hosting/IProcessPingCallback.cs
+System.Web.Hosting/IQueueHost.cs
+System.Web.Hosting/IRegisteredObject.cs
+System.Web.Hosting/ISAPIRuntime.cs
+System.Web.Hosting/SimpleWorkerRequest.cs
+System.Web.Mail/Base64AttachmentEncoder.cs
+System.Web.Mail/IAttachmentEncoder.cs
+System.Web.Mail/MailAddress.cs
+System.Web.Mail/MailAddressCollection.cs
+System.Web.Mail/MailAttachment.cs
+System.Web.Mail/MailEncoding.cs
+System.Web.Mail/MailFormat.cs
+System.Web.Mail/MailHeader.cs
+System.Web.Mail/MailMessage.cs
+System.Web.Mail/MailMessageWrapper.cs
+System.Web.Mail/MailPriority.cs
+System.Web.Mail/MailUtil.cs
+System.Web.Mail/SmtpClient.cs
+System.Web.Mail/SmtpException.cs
+System.Web.Mail/SmtpMail.cs
+System.Web.Mail/SmtpResponse.cs
+System.Web.Mail/SmtpStream.cs
+System.Web.Mail/ToUUEncodingTransform.cs
+System.Web.Mail/RelatedBodyPart.cs
+System.Web.Mail/UUAttachmentEncoder.cs
+System.Web.Management/EventNotificationType.cs
+System.Web.Management/IRegiisUtility.cs
+System.Web.Management/IRegisterCreateITypeLib.cs
+System.Web.Management/IWebEventCustomEvaluator.cs
+System.Web.Management/RuleFiringRecord.cs
+System.Web.Management/SessionStateType.cs
+System.Web.Management/SqlFeatures.cs
+System.Web.Management/WebApplicationInformation.cs
+System.Web.Management/WebBaseEvent.cs
+System.Web.Management/WebEventFormatter.cs
+System.Web.Profile/ProfileAuthenticationOption.cs
+System.Web.Security/ActiveDirectoryMembershipProvider.cs
+System.Web.Security/AccessMembershipProvider.cs
+System.Web.Security/AccessRoleProvider.cs
+System.Web.Security/AnonymousIdentificationEventArgs.cs
+System.Web.Security/AnonymousIdentificationEventHandler.cs
+System.Web.Security/AnonymousIdentificationModule.cs
+System.Web.Security/CookieProtection.cs
+System.Web.Security/DefaultAuthenticationEventArgs.cs
+System.Web.Security/DefaultAuthenticationEventHandler.cs
+System.Web.Security/DefaultAuthenticationModule.cs
+System.Web.Security/FileAuthorizationModule.cs
+System.Web.Security/FormsAuthentication.cs
+System.Web.Security/FormsAuthenticationEventArgs.cs
+System.Web.Security/FormsAuthenticationEventHandler.cs
+System.Web.Security/FormsAuthenticationModule.cs
+System.Web.Security/FormsAuthenticationTicket.cs
+System.Web.Security/FormsIdentity.cs
+System.Web.Security/MembershipProvider.cs
+System.Web.Security/RoleProvider.cs
+System.Web.Security/Membership.cs
+System.Web.Security/MembershipCreateStatus.cs
+System.Web.Security/MembershipCreateUserException.cs
+System.Web.Security/MembershipOnlineStatus.cs
+System.Web.Security/MembershipPasswordException.cs
+System.Web.Security/MembershipPasswordFormat.cs
+System.Web.Security/MembershipProviderCollection.cs
+System.Web.Security/MembershipSortOptions.cs
+System.Web.Security/MembershipUser.cs
+System.Web.Security/MembershipUserCollection.cs
+System.Web.Security/PassportAuthenticationEventArgs.cs
+System.Web.Security/PassportAuthenticationEventHandler.cs
+System.Web.Security/PassportAuthenticationModule.cs
+System.Web.Security/PassportIdentity.cs
+System.Web.Security/RoleManagerEventArgs.cs
+System.Web.Security/RoleManagerEventHandler.cs
+System.Web.Security/RoleManagerModule.cs
+System.Web.Security/RolePrincipal.cs
+System.Web.Security/RoleProviderCollection.cs
+System.Web.Security/Roles.cs
+System.Web.Security/SqlMembershipProvider.cs
+System.Web.Security/SqlRoleProvider.cs
+System.Web.Security/UrlAuthorizationModule.cs
+System.Web.Security/WindowsAuthenticationEventArgs.cs
+System.Web.Security/WindowsAuthenticationEventHandler.cs
+System.Web.Security/WindowsAuthenticationModule.cs
+System.Web.SessionState/HttpSessionState.cs
+System.Web.SessionState/IHttpSessionState.cs
+System.Web.SessionState/IReadOnlySessionState.cs
+System.Web.SessionState/IRequiresSessionState.cs
+System.Web.SessionState/ISessionHandler.cs
+System.Web.SessionState/ISessionIDModule.cs
+System.Web.SessionState/ISessionStateItemCollection.cs
+System.Web.SessionState/IStateRuntime.cs
+System.Web.SessionState/RemoteStateServer.cs
+System.Web.SessionState/SessionConfig.cs
+System.Web.SessionState/SessionDictionary.cs
+System.Web.SessionState/SessionId.cs
+System.Web.SessionState/SessionInProcHandler.cs
+System.Web.SessionState/SessionSQLServerHandler.cs
+System.Web.SessionState/SessionStateActionFlags.cs
+System.Web.SessionState/SessionStateItemExpireCallback.cs
+System.Web.SessionState/SessionStateMode.cs
+System.Web.SessionState/SessionStateModule.cs
+System.Web.SessionState/SessionStateSectionHandler.cs
+System.Web.SessionState/SessionStateServerHandler.cs
+System.Web.SessionState/SessionStateStoreData.cs
+System.Web.SessionState/StateRuntime.cs
+System.Web.SessionState/StateServerItem.cs
+System.Web.UI.HtmlControls/HtmlAnchor.cs
+System.Web.UI.HtmlControls/HtmlButton.cs
+System.Web.UI.HtmlControls/HtmlContainerControl.cs
+System.Web.UI.HtmlControls/HtmlControl.cs
+System.Web.UI.HtmlControls/HtmlControlBuilder.cs
+System.Web.UI.HtmlControls/HtmlForm.cs
+System.Web.UI.HtmlControls/HtmlGenericControl.cs
+System.Web.UI.HtmlControls/HtmlHead.cs
+System.Web.UI.HtmlControls/HtmlHeadBuilder.cs
+System.Web.UI.HtmlControls/HtmlImage.cs
+System.Web.UI.HtmlControls/HtmlInputButton.cs
+System.Web.UI.HtmlControls/HtmlInputCheckBox.cs
+System.Web.UI.HtmlControls/HtmlInputControl.cs
+System.Web.UI.HtmlControls/HtmlInputFile.cs
+System.Web.UI.HtmlControls/HtmlInputHidden.cs
+System.Web.UI.HtmlControls/HtmlInputImage.cs
+System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
+System.Web.UI.HtmlControls/HtmlInputText.cs
+System.Web.UI.HtmlControls/HtmlSelect.cs
+System.Web.UI.HtmlControls/HtmlSelectBuilder.cs
+System.Web.UI.HtmlControls/HtmlTable.cs
+System.Web.UI.HtmlControls/HtmlTableCell.cs
+System.Web.UI.HtmlControls/HtmlTableCellCollection.cs
+System.Web.UI.HtmlControls/HtmlTableRow.cs
+System.Web.UI.HtmlControls/HtmlTableRowCollection.cs
+System.Web.UI.HtmlControls/HtmlTextArea.cs
+System.Web.UI.HtmlControls/HtmlTitle.cs
+System.Web.UI.WebControls/AccessDataSource.cs
+System.Web.UI.WebControls/AccessDataSourceView.cs
+System.Web.UI.WebControls/AdCreatedEventArgs.cs
+System.Web.UI.WebControls/AdCreatedEventHandler.cs
+System.Web.UI.WebControls/AdRotator.cs
+System.Web.UI.WebControls/AdType.cs
+System.Web.UI.WebControls/AssociatedControlConverter.cs
+System.Web.UI.WebControls/AuthenticateEventArgs.cs
+System.Web.UI.WebControls/AuthenticateEventHandler.cs
+System.Web.UI.WebControls/AutoCompleteType.cs
+System.Web.UI.WebControls/AutoGeneratedField.cs
+System.Web.UI.WebControls/AutoGeneratedFieldProperties.cs
+System.Web.UI.WebControls/BaseCompareValidator.cs
+System.Web.UI.WebControls/BaseDataBoundControl.cs
+System.Web.UI.WebControls/BaseDataList.cs
+System.Web.UI.WebControls/BaseValidator.cs
+System.Web.UI.WebControls/BorderStyle.cs
+System.Web.UI.WebControls/BoundColumn.cs
+System.Web.UI.WebControls/BoundField.cs
+System.Web.UI.WebControls/BulletStyle.cs
+System.Web.UI.WebControls/BulletedList.cs
+System.Web.UI.WebControls/BulletedListDisplayMode.cs
+System.Web.UI.WebControls/BulletedListEventArgs.cs
+System.Web.UI.WebControls/BulletedListEventHandler.cs
+System.Web.UI.WebControls/Button.cs
+System.Web.UI.WebControls/ButtonColumn.cs
+System.Web.UI.WebControls/ButtonColumnType.cs
+System.Web.UI.WebControls/ButtonFieldBase.cs
+System.Web.UI.WebControls/ButtonField.cs
+System.Web.UI.WebControls/ButtonType.cs
+System.Web.UI.WebControls/Calendar.cs
+System.Web.UI.WebControls/CalendarDay.cs
+System.Web.UI.WebControls/CalendarSelectionMode.cs
+System.Web.UI.WebControls/CheckBox.cs
+System.Web.UI.WebControls/CheckBoxField.cs
+System.Web.UI.WebControls/CheckBoxList.cs
+System.Web.UI.WebControls/ChildTable.cs
+System.Web.UI.WebControls/CollectionDataSource.cs
+System.Web.UI.WebControls/Content.cs
+System.Web.UI.WebControls/ContentControlBuilder.cs
+System.Web.UI.WebControls/ContentPlaceHolder.cs
+System.Web.UI.WebControls/ContentPlaceHolderBuilder.cs
+System.Web.UI.WebControls/ControlIDConverter.cs
+System.Web.UI.WebControls/CommandEventArgs.cs
+System.Web.UI.WebControls/CommandEventHandler.cs
+System.Web.UI.WebControls/CommandField.cs
+System.Web.UI.WebControls/CompareValidator.cs
+System.Web.UI.WebControls/CompositeControl.cs
+System.Web.UI.WebControls/CompositeDataBoundControl.cs
+System.Web.UI.WebControls/ContentDirection.cs
+System.Web.UI.WebControls/ControlParameter.cs
+System.Web.UI.WebControls/ControlPropertyNameConverter.cs
+System.Web.UI.WebControls/CookieParameter.cs
+System.Web.UI.WebControls/CreateUserErrorEventArgs.cs
+System.Web.UI.WebControls/CreateUserErrorEventHandler.cs
+System.Web.UI.WebControls/CustomValidator.cs
+System.Web.UI.WebControls/DataBoundControl.cs
+System.Web.UI.WebControls/DataControlButton.cs
+System.Web.UI.WebControls/DataControlCellType.cs
+System.Web.UI.WebControls/DataControlField.cs
+System.Web.UI.WebControls/DataControlFieldCollection.cs
+System.Web.UI.WebControls/DataControlFieldCell.cs
+System.Web.UI.WebControls/DataControlFieldHeaderCell.cs
+System.Web.UI.WebControls/DataControlRowState.cs
+System.Web.UI.WebControls/DataControlRowType.cs
+System.Web.UI.WebControls/DataGrid.cs
+System.Web.UI.WebControls/DataGridColumn.cs
+System.Web.UI.WebControls/DataGridColumnCollection.cs
+System.Web.UI.WebControls/DataGridCommandEventArgs.cs
+System.Web.UI.WebControls/DataGridCommandEventHandler.cs
+System.Web.UI.WebControls/DataGridItem.cs
+System.Web.UI.WebControls/DataGridItemCollection.cs
+System.Web.UI.WebControls/DataGridItemEventArgs.cs
+System.Web.UI.WebControls/DataGridItemEventHandler.cs
+System.Web.UI.WebControls/DataGridLinkButton.cs
+System.Web.UI.WebControls/DataGridPageChangedEventArgs.cs
+System.Web.UI.WebControls/DataGridPageChangedEventHandler.cs
+System.Web.UI.WebControls/DataGridPagerStyle.cs
+System.Web.UI.WebControls/DataGridSortCommandEventArgs.cs
+System.Web.UI.WebControls/DataGridSortCommandEventHandler.cs
+System.Web.UI.WebControls/DataGridTableInternal.cs
+System.Web.UI.WebControls/DataKey.cs
+System.Web.UI.WebControls/DataKeyArray.cs
+System.Web.UI.WebControls/DataKeyCollection.cs
+System.Web.UI.WebControls/DataList.cs
+System.Web.UI.WebControls/DataListCommandEventArgs.cs
+System.Web.UI.WebControls/DataListCommandEventHandler.cs
+System.Web.UI.WebControls/DataListItem.cs
+System.Web.UI.WebControls/DataListItemCollection.cs
+System.Web.UI.WebControls/DataListItemEventArgs.cs
+System.Web.UI.WebControls/DataListItemEventHandler.cs
+System.Web.UI.WebControls/DataSourceInternal.cs
+System.Web.UI.WebControls/DayNameFormat.cs
+System.Web.UI.WebControls/DayRenderEventArgs.cs
+System.Web.UI.WebControls/DayRenderEventHandler.cs
+System.Web.UI.WebControls/DetailsView.cs
+System.Web.UI.WebControls/DetailsViewCommandEventArgs.cs
+System.Web.UI.WebControls/DetailsViewCommandEventHandler.cs
+System.Web.UI.WebControls/DetailsViewDeletedEventArgs.cs
+System.Web.UI.WebControls/DetailsViewDeletedEventHandler.cs
+System.Web.UI.WebControls/DetailsViewDeleteEventArgs.cs
+System.Web.UI.WebControls/DetailsViewDeleteEventHandler.cs
+System.Web.UI.WebControls/DetailsViewInsertedEventArgs.cs
+System.Web.UI.WebControls/DetailsViewInsertedEventHandler.cs
+System.Web.UI.WebControls/DetailsViewInsertEventArgs.cs
+System.Web.UI.WebControls/DetailsViewInsertEventHandler.cs
+System.Web.UI.WebControls/DetailsViewMode.cs
+System.Web.UI.WebControls/DetailsViewModeEventArgs.cs
+System.Web.UI.WebControls/DetailsViewModeEventHandler.cs
+System.Web.UI.WebControls/DetailsViewPageEventArgs.cs
+System.Web.UI.WebControls/DetailsViewPageEventHandler.cs
+System.Web.UI.WebControls/DetailsViewRow.cs
+System.Web.UI.WebControls/DetailsViewRowCollection.cs
+System.Web.UI.WebControls/DetailsViewUpdatedEventArgs.cs
+System.Web.UI.WebControls/DetailsViewUpdatedEventHandler.cs
+System.Web.UI.WebControls/DetailsViewUpdateEventArgs.cs
+System.Web.UI.WebControls/DetailsViewUpdateEventHandler.cs
+System.Web.UI.WebControls/DropDownList.cs
+System.Web.UI.WebControls/DynamicImageParameterMode.cs
+System.Web.UI.WebControls/EditCommandColumn.cs
+System.Web.UI.WebControls/FirstDayOfWeek.cs
+System.Web.UI.WebControls/FontInfo.cs
+System.Web.UI.WebControls/FontNamesConverter.cs
+System.Web.UI.WebControls/FontSize.cs
+System.Web.UI.WebControls/FontUnit.cs
+System.Web.UI.WebControls/FontUnitConverter.cs
+System.Web.UI.WebControls/FormParameter.cs
+System.Web.UI.WebControls/FormView.cs
+System.Web.UI.WebControls/FormViewCommandEventArgs.cs
+System.Web.UI.WebControls/FormViewCommandEventHandler.cs
+System.Web.UI.WebControls/FormViewDeletedEventArgs.cs
+System.Web.UI.WebControls/FormViewDeletedEventHandler.cs
+System.Web.UI.WebControls/FormViewDeleteEventArgs.cs
+System.Web.UI.WebControls/FormViewDeleteEventHandler.cs
+System.Web.UI.WebControls/FormViewInsertedEventArgs.cs
+System.Web.UI.WebControls/FormViewInsertedEventHandler.cs
+System.Web.UI.WebControls/FormViewInsertEventArgs.cs
+System.Web.UI.WebControls/FormViewInsertEventHandler.cs
+System.Web.UI.WebControls/FormViewMode.cs
+System.Web.UI.WebControls/FormViewModeEventArgs.cs
+System.Web.UI.WebControls/FormViewModeEventHandler.cs
+System.Web.UI.WebControls/FormViewPageEventArgs.cs
+System.Web.UI.WebControls/FormViewPageEventHandler.cs
+System.Web.UI.WebControls/FormViewRow.cs
+System.Web.UI.WebControls/FormViewUpdatedEventArgs.cs
+System.Web.UI.WebControls/FormViewUpdatedEventHandler.cs
+System.Web.UI.WebControls/FormViewUpdateEventArgs.cs
+System.Web.UI.WebControls/FormViewUpdateEventHandler.cs
+System.Web.UI.WebControls/GridLines.cs
+System.Web.UI.WebControls/GridView.cs
+System.Web.UI.WebControls/GridViewCancelEditEventArgs.cs
+System.Web.UI.WebControls/GridViewCancelEditEventHandler.cs
+System.Web.UI.WebControls/GridViewCommandEventArgs.cs
+System.Web.UI.WebControls/GridViewCommandEventHandler.cs
+System.Web.UI.WebControls/GridViewDeletedEventArgs.cs
+System.Web.UI.WebControls/GridViewDeletedEventHandler.cs
+System.Web.UI.WebControls/GridViewDeleteEventArgs.cs
+System.Web.UI.WebControls/GridViewDeleteEventHandler.cs
+System.Web.UI.WebControls/GridViewEditEventArgs.cs
+System.Web.UI.WebControls/GridViewEditEventHandler.cs
+System.Web.UI.WebControls/GridViewPageEventArgs.cs
+System.Web.UI.WebControls/GridViewPageEventHandler.cs
+System.Web.UI.WebControls/GridViewRow.cs
+System.Web.UI.WebControls/GridViewRowCollection.cs
+System.Web.UI.WebControls/GridViewRowEventArgs.cs
+System.Web.UI.WebControls/GridViewRowEventHandler.cs
+System.Web.UI.WebControls/GridViewSelectEventArgs.cs
+System.Web.UI.WebControls/GridViewSelectEventHandler.cs
+System.Web.UI.WebControls/GridViewSortEventArgs.cs
+System.Web.UI.WebControls/GridViewSortEventHandler.cs
+System.Web.UI.WebControls/GridViewUpdatedEventArgs.cs
+System.Web.UI.WebControls/GridViewUpdatedEventHandler.cs
+System.Web.UI.WebControls/GridViewUpdateEventArgs.cs
+System.Web.UI.WebControls/GridViewUpdateEventHandler.cs
+System.Web.UI.WebControls/HierarchicalDataBoundControl.cs
+System.Web.UI.WebControls/HiddenField.cs
+System.Web.UI.WebControls/HorizontalAlign.cs
+System.Web.UI.WebControls/HorizontalAlignConverter.cs
+System.Web.UI.WebControls/HotSpotMode.cs
+System.Web.UI.WebControls/HyperLink.cs
+System.Web.UI.WebControls/HyperLinkColumn.cs
+System.Web.UI.WebControls/HyperLinkControlBuilder.cs
+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/IPostBackContainer.cs
+System.Web.UI.WebControls/IRepeatInfoUser.cs
+System.Web.UI.WebControls/Image.cs
+System.Web.UI.WebControls/ImageAlign.cs
+System.Web.UI.WebControls/ImageButton.cs
+System.Web.UI.WebControls/ImageField.cs
+System.Web.UI.WebControls/ImageFieldMode.cs
+System.Web.UI.WebControls/ImageMapEventArgs.cs
+System.Web.UI.WebControls/ImageMapEventHandler.cs
+System.Web.UI.WebControls/Label.cs
+System.Web.UI.WebControls/LabelControlBuilder.cs
+System.Web.UI.WebControls/LinkButton.cs
+System.Web.UI.WebControls/LinkButtonControlBuilder.cs
+System.Web.UI.WebControls/LinkButtonInternal.cs
+System.Web.UI.WebControls/ListBox.cs
+System.Web.UI.WebControls/ListControl.cs
+System.Web.UI.WebControls/ListItem.cs
+System.Web.UI.WebControls/ListItemCollection.cs
+System.Web.UI.WebControls/ListItemControlBuilder.cs
+System.Web.UI.WebControls/ListItemType.cs
+System.Web.UI.WebControls/ListSelectionMode.cs
+System.Web.UI.WebControls/Literal.cs
+System.Web.UI.WebControls/LiteralControlBuilder.cs
+System.Web.UI.WebControls/LiteralMode.cs
+System.Web.UI.WebControls/Localize.cs
+System.Web.UI.WebControls/LoginFailureAction.cs
+System.Web.UI.WebControls/LoginTextLayout.cs
+System.Web.UI.WebControls/LogoutAction.cs
+System.Web.UI.WebControls/MailMessageEventArgs.cs
+System.Web.UI.WebControls/MailMessageEventHandler.cs
+System.Web.UI.WebControls/Menu.cs
+System.Web.UI.WebControls/MenuEventArgs.cs
+System.Web.UI.WebControls/MenuEventHandler.cs
+System.Web.UI.WebControls/MenuItem.cs
+System.Web.UI.WebControls/MenuItemBinding.cs
+System.Web.UI.WebControls/MenuItemBindingCollection.cs
+System.Web.UI.WebControls/MenuItemCollection.cs
+System.Web.UI.WebControls/MenuItemStyle.cs
+System.Web.UI.WebControls/MenuItemStyleCollection.cs
+System.Web.UI.WebControls/MenuItemTemplateContainer.cs
+System.Web.UI.WebControls/MonthChangedEventArgs.cs
+System.Web.UI.WebControls/MonthChangedEventHandler.cs
+System.Web.UI.WebControls/MultiView.cs
+System.Web.UI.WebControls/ObjectDataSource.cs
+System.Web.UI.WebControls/ObjectDataSourceDisposingEventArgs.cs
+System.Web.UI.WebControls/ObjectDataSourceDisposingEventHandler.cs
+System.Web.UI.WebControls/ObjectDataSourceEventArgs.cs
+System.Web.UI.WebControls/ObjectDataSourceEventHandler.cs
+System.Web.UI.WebControls/ObjectDataSourceFilteringEventArgs.cs
+System.Web.UI.WebControls/ObjectDataSourceFilteringEventHandler.cs
+System.Web.UI.WebControls/ObjectDataSourceMethodEventArgs.cs
+System.Web.UI.WebControls/ObjectDataSourceMethodEventHandler.cs
+System.Web.UI.WebControls/ObjectDataSourceSelectingEventArgs.cs
+System.Web.UI.WebControls/ObjectDataSourceSelectingEventHandler.cs
+System.Web.UI.WebControls/ObjectDataSourceStatusEventArgs.cs
+System.Web.UI.WebControls/ObjectDataSourceStatusEventHandler.cs
+System.Web.UI.WebControls/ObjectDataSourceView.cs
+System.Web.UI.WebControls/Orientation.cs
+System.Web.UI.WebControls/NextPrevFormat.cs
+System.Web.UI.WebControls/PagedDataSource.cs
+System.Web.UI.WebControls/PagerButtons.cs
+System.Web.UI.WebControls/PagerMode.cs
+System.Web.UI.WebControls/PagerPosition.cs
+System.Web.UI.WebControls/PagerSettings.cs
+System.Web.UI.WebControls/Panel.cs
+System.Web.UI.WebControls/Parameter.cs
+System.Web.UI.WebControls/ParameterCollection.cs
+System.Web.UI.WebControls/PathDirection.cs
+System.Web.UI.WebControls/PlaceHolder.cs
+System.Web.UI.WebControls/PlaceHolderControlBuilder.cs
+System.Web.UI.WebControls/QueryStringParameter.cs
+System.Web.UI.WebControls/RadioButton.cs
+System.Web.UI.WebControls/RadioButtonList.cs
+System.Web.UI.WebControls/RangeValidator.cs
+System.Web.UI.WebControls/RegularExpressionValidator.cs
+System.Web.UI.WebControls/RepeatDirection.cs
+System.Web.UI.WebControls/RepeatInfo.cs
+System.Web.UI.WebControls/RepeatLayout.cs
+System.Web.UI.WebControls/Repeater.cs
+System.Web.UI.WebControls/RepeaterCommandEventArgs.cs
+System.Web.UI.WebControls/RepeaterCommandEventHandler.cs
+System.Web.UI.WebControls/RepeaterItem.cs
+System.Web.UI.WebControls/RepeaterItemCollection.cs
+System.Web.UI.WebControls/RepeaterItemEventArgs.cs
+System.Web.UI.WebControls/RepeaterItemEventHandler.cs
+System.Web.UI.WebControls/RequiredFieldValidator.cs
+System.Web.UI.WebControls/ScrollBars.cs
+System.Web.UI.WebControls/SelectedDatesCollection.cs
+System.Web.UI.WebControls/SendMailErrorEventArgs.cs
+System.Web.UI.WebControls/SendMailErrorEventHandler.cs
+System.Web.UI.WebControls/ServerValidateEventArgs.cs
+System.Web.UI.WebControls/ServerValidateEventHandler.cs
+System.Web.UI.WebControls/SessionParameter.cs
+System.Web.UI.WebControls/SiteMapDataSource.cs
+System.Web.UI.WebControls/SiteMapDataSourceView.cs
+System.Web.UI.WebControls/SiteMapHierarchicalDataSourceView.cs
+System.Web.UI.WebControls/SiteMapNodeItemType.cs
+System.Web.UI.WebControls/SiteMapNodeType.cs
+System.Web.UI.WebControls/SortDirection.cs
+System.Web.UI.WebControls/SqlDataSource.cs
+System.Web.UI.WebControls/SqlDataSourceCommandEventArgs.cs
+System.Web.UI.WebControls/SqlDataSourceCommandEventHandler.cs
+System.Web.UI.WebControls/SqlDataSourceMode.cs
+System.Web.UI.WebControls/SqlDataSourceStatusEventArgs.cs
+System.Web.UI.WebControls/SqlDataSourceStatusEventHandler.cs
+System.Web.UI.WebControls/SqlDataSourceView.cs
+System.Web.UI.WebControls/StringArrayConverter.cs
+System.Web.UI.WebControls/Style.cs
+System.Web.UI.WebControls/SubMenuStyle.cs
+System.Web.UI.WebControls/Table.cs
+System.Web.UI.WebControls/TableCaptionAlign.cs
+System.Web.UI.WebControls/TableCell.cs
+System.Web.UI.WebControls/TableCellCollection.cs
+System.Web.UI.WebControls/TableCellControlBuilder.cs
+System.Web.UI.WebControls/TableHeaderCell.cs
+System.Web.UI.WebControls/TableHeaderScope.cs
+System.Web.UI.WebControls/TableItemStyle.cs
+System.Web.UI.WebControls/TableRow.cs
+System.Web.UI.WebControls/TableRowCollection.cs
+System.Web.UI.WebControls/TableRowSection.cs
+System.Web.UI.WebControls/TableStyle.cs
+System.Web.UI.WebControls/TableViewMode.cs
+System.Web.UI.WebControls/TargetConverter.cs
+System.Web.UI.WebControls/TemplateColumn.cs
+System.Web.UI.WebControls/TemplateField.cs
+System.Web.UI.WebControls/TextAlign.cs
+System.Web.UI.WebControls/TextBox.cs
+System.Web.UI.WebControls/TextBoxControlBuilder.cs
+System.Web.UI.WebControls/TextBoxMode.cs
+System.Web.UI.WebControls/TreeNode.cs
+System.Web.UI.WebControls/TreeNodeBinding.cs
+System.Web.UI.WebControls/TreeNodeBindingCollection.cs
+System.Web.UI.WebControls/TreeNodeCollection.cs
+System.Web.UI.WebControls/TreeNodeEventArgs.cs
+System.Web.UI.WebControls/TreeNodeEventHandler.cs
+System.Web.UI.WebControls/TreeNodeSelectAction.cs
+System.Web.UI.WebControls/TreeNodeStyle.cs
+System.Web.UI.WebControls/TreeNodeStyleCollection.cs
+System.Web.UI.WebControls/TreeNodeTypes.cs
+System.Web.UI.WebControls/TreeView.cs
+System.Web.UI.WebControls/TreeViewImageSet.cs
+System.Web.UI.WebControls/TitleFormat.cs
+System.Web.UI.WebControls/Unit.cs
+System.Web.UI.WebControls/UnitConverter.cs
+System.Web.UI.WebControls/UnitType.cs
+System.Web.UI.WebControls/ValidatedControlConverter.cs
+System.Web.UI.WebControls/ValidationCompareOperator.cs
+System.Web.UI.WebControls/ValidationDataType.cs
+System.Web.UI.WebControls/ValidationSummary.cs
+System.Web.UI.WebControls/ValidationSummaryDisplayMode.cs
+System.Web.UI.WebControls/ValidatorDisplay.cs
+System.Web.UI.WebControls/VerticalAlign.cs
+System.Web.UI.WebControls/VerticalAlignConverter.cs
+System.Web.UI.WebControls/View.cs
+System.Web.UI.WebControls/ViewCollection.cs
+System.Web.UI.WebControls/WebColorConverter.cs
+System.Web.UI.WebControls/WebControl.cs
+System.Web.UI.WebControls/WizardNavigationEventArgs.cs
+System.Web.UI.WebControls/WizardNavigationEventHandler.cs
+System.Web.UI.WebControls/WizardStepType.cs
+System.Web.UI.WebControls/Xml.cs
+System.Web.UI.WebControls/XmlBuilder.cs
+System.Web.UI.WebControls/XmlDataSource.cs
+System.Web.UI.WebControls/XmlDataSourceNodeDescriptor.cs
+System.Web.UI.WebControls/XmlDataSourcePropertyDescriptor.cs
+System.Web.UI.WebControls/XmlDataSourceView.cs
+System.Web.UI.WebControls/XmlHierarchicalDataSourceView.cs
+System.Web.UI.WebControls/XmlHierarchicalEnumerable.cs
+System.Web.UI.WebControls/XmlHierarchyData.cs
+System.Web.UI.WebControls.WebParts/ConnectionConsumerCallback.cs
+System.Web.UI.WebControls.WebParts/ConnectionPoint.cs
+System.Web.UI.WebControls.WebParts/ConnectionPointType.cs
+System.Web.UI.WebControls.WebParts/ConnectionProviderCallback.cs
+System.Web.UI.WebControls.WebParts/ConsumerConnectionPoint.cs
+System.Web.UI.WebControls.WebParts/IField.cs
+System.Web.UI.WebControls.WebParts/IFilter.cs
+System.Web.UI.WebControls.WebParts/IParameters.cs
+System.Web.UI.WebControls.WebParts/IPersonalizable.cs
+System.Web.UI.WebControls.WebParts/IRow.cs
+System.Web.UI.WebControls.WebParts/ITable.cs
+System.Web.UI.WebControls.WebParts/ITrackingPersonalizable.cs
+System.Web.UI.WebControls.WebParts/ITransformerConfigurationControl.cs
+System.Web.UI.WebControls.WebParts/IVersioningPersonalizable.cs
+System.Web.UI.WebControls.WebParts/IWebActionable.cs
+System.Web.UI.WebControls.WebParts/IWebPart.cs
+System.Web.UI.WebControls.WebParts/IWebPartHttpHandler.cs
+System.Web.UI.WebControls.WebParts/Part.cs
+System.Web.UI.WebControls.WebParts/PartChromeState.cs
+System.Web.UI.WebControls.WebParts/PartChromeType.cs
+System.Web.UI.WebControls.WebParts/PersonalizationScope.cs
+System.Web.UI.WebControls.WebParts/ProviderConnectionPoint.cs
+System.Web.UI.WebControls.WebParts/TypeCollection.cs
+System.Web.UI.WebControls.WebParts/WebPart.cs
+System.Web.UI.WebControls.WebParts/WebPartAuthorizationEventArgs.cs
+System.Web.UI.WebControls.WebParts/WebPartAuthorizationEventHandler.cs
+System.Web.UI.WebControls.WebParts/WebPartCancelEventArgs.cs
+System.Web.UI.WebControls.WebParts/WebPartCancelEventHandler.cs
+System.Web.UI.WebControls.WebParts/WebPartEventArgs.cs
+System.Web.UI.WebControls.WebParts/WebPartEventHandler.cs
+System.Web.UI.WebControls.WebParts/WebPartExportMode.cs
+System.Web.UI.WebControls.WebParts/WebPartHelpMode.cs
+System.Web.UI.WebControls.WebParts/WebPartPageMenuMode.cs
+System.Web.UI.WebControls.WebParts/WebPartVerb.cs
+System.Web.UI.WebControls.WebParts/WebPartVerbCollection.cs
+System.Web.UI.WebControls.WebParts/WebPartVerbsEventArgs.cs
+System.Web.UI.WebControls.WebParts/WebPartVerbsEventHandler.cs
+System.Web.UI/ApplicationFileParser.cs
+System.Web.UI/AttributeCollection.cs
+System.Web.UI/BaseParser.cs
+System.Web.UI/BasePartialCachingControl.cs
+System.Web.UI/BoundPropertyEntry.cs
+System.Web.UI/BuildMethod.cs
+System.Web.UI/BuildTemplateMethod.cs
+System.Web.UI/ClientScriptManager.cs
+System.Web.UI/CodeBuilder.cs
+System.Web.UI/CodeRenderBuilder.cs
+System.Web.UI/CollectionBuilder.cs
+System.Web.UI/CompilationMode.cs
+System.Web.UI/CompiledBindableTemplateBuilder.cs
+System.Web.UI/CompiledTemplateBuilder.cs
+System.Web.UI/ConflictOptions.cs
+System.Web.UI/ConstructorNeedsTagAttribute.cs
+System.Web.UI/Control.cs
+System.Web.UI/ControlBuilder.cs
+System.Web.UI/ControlBuilderAttribute.cs
+System.Web.UI/ControlCollection.cs
+System.Web.UI/ControlSkinProc.cs
+System.Web.UI/ControlValuePropertyAttribute.cs
+System.Web.UI/CssStyleCollection.cs
+System.Web.UI/DataBinder.cs
+System.Web.UI/DataBinding.cs
+System.Web.UI/DataBindingBuilder.cs
+System.Web.UI/DataBindingCollection.cs
+System.Web.UI/DataBindingHandlerAttribute.cs
+System.Web.UI/DataBoundLiteralControl.cs
+System.Web.UI/DataSourceCacheExpiry.cs
+System.Web.UI/DataSourceCapabilities.cs
+System.Web.UI/DataSourceControl.cs
+System.Web.UI/DataSourceOperation.cs
+System.Web.UI/DataSourceSelectArguments.cs
+System.Web.UI/DataSourceView.cs
+System.Web.UI/DataSourceViewOperationCallback.cs
+System.Web.UI/DataSourceViewSelectCallback.cs
+System.Web.UI/DesignTimeParseData.cs
+System.Web.UI/DesignTimeTemplateParser.cs
+System.Web.UI/DesignerDataBoundLiteralControl.cs
+System.Web.UI/EmptyControlCollection.cs
+System.Web.UI/ExpressionBinding.cs
+System.Web.UI/ExpressionBindingCollection.cs
+System.Web.UI/ExtractTemplateValuesMethod.cs
+System.Web.UI/FilterableAttribute.cs
+System.Web.UI/HierarchicalDataSourceControl.cs
+System.Web.UI/HierarchicalDataSourceView.cs
+System.Web.UI/Html32TextWriter.cs
+System.Web.UI/HtmlControlPersistableAttribute.cs
+System.Web.UI/HtmlTextWriter.cs
+System.Web.UI/HtmlTextWriterAttribute.cs
+System.Web.UI/HtmlTextWriterStyle.cs
+System.Web.UI/HtmlTextWriterTag.cs
+System.Web.UI/IAttributeAccessor.cs
+System.Web.UI/IBindableTemplate.cs
+System.Web.UI/ICallbackEventHandler.cs
+System.Web.UI/ICheckBoxControl.cs
+System.Web.UI/IEditableTextControl.cs
+System.Web.UI/IStaticTextControl.cs
+System.Web.UI/ITextControl.cs
+System.Web.UI/IControlBuilderAccessor.cs
+System.Web.UI/IControlDesignerAccessor.cs
+System.Web.UI/IControlTypeFilter.cs
+System.Web.UI/IDataBindingsAccessor.cs
+System.Web.UI/IDataItemContainer.cs
+System.Web.UI/IDataSource.cs
+System.Web.UI/IDataSourceViewSchemaAccessor.cs
+System.Web.UI/IDReferencePropertyAttribute.cs
+System.Web.UI/IExpressionsAccessor.cs
+System.Web.UI/IFilterResolutionService.cs
+System.Web.UI/IHierarchicalDataSource.cs
+System.Web.UI/IHierarchicalEnumerable.cs
+System.Web.UI/IHierarchyData.cs
+System.Web.UI/IItemPaginationInfo.cs
+System.Web.UI/IMobileTextWriter.cs
+System.Web.UI/INamingContainer.cs
+System.Web.UI/INavigateUIData.cs
+System.Web.UI/IPageHeader.cs
+System.Web.UI/IPaginationContainer.cs
+System.Web.UI/IPaginationInfo.cs
+System.Web.UI/IParserAccessor.cs
+System.Web.UI/IPostBackDataHandler.cs
+System.Web.UI/IPostBackEventHandler.cs
+System.Web.UI/IResourceResolutionService.cs
+System.Web.UI/IResourceUrlGenerator.cs
+System.Web.UI/IStateFormatter.cs
+System.Web.UI/IStateManager.cs
+System.Web.UI/IStyleSheet.cs
+System.Web.UI/ITagNameToTypeMapper.cs
+System.Web.UI/ITemplate.cs
+System.Web.UI/IUrlResolutionService.cs
+System.Web.UI/IUserControlDesignerAccessor.cs
+System.Web.UI/IUserControlTypeResolutionService.cs
+System.Web.UI/IValidator.cs
+System.Web.UI/IgnoreUnknownContentAttribute.cs
+System.Web.UI/ImageClickEventArgs.cs
+System.Web.UI/ImageClickEventHandler.cs
+System.Web.UI/KeyedList.cs
+System.Web.UI/KeyedListEnumerator.cs
+System.Web.UI/ListSourceHelper.cs
+System.Web.UI/LiteralControl.cs
+System.Web.UI/LosFormatter.cs
+System.Web.UI/MasterPage.cs
+System.Web.UI/MasterPageParser.cs
+System.Web.UI/ObjectConverter.cs
+System.Web.UI/ObjectStateFormatter.cs
+System.Web.UI/ObjectTag.cs
+System.Web.UI/ObjectTagBuilder.cs
+System.Web.UI/OutputCacheLocation.cs
+System.Web.UI/Page.cs
+System.Web.UI/PageHandlerFactory.cs
+System.Web.UI/PageParser.cs
+System.Web.UI/Pair.cs
+System.Web.UI/ParseChildrenAttribute.cs
+System.Web.UI/PartialCachingAttribute.cs
+System.Web.UI/PartialCachingControl.cs
+System.Web.UI/PersistChildrenAttribute.cs
+System.Web.UI/PersistenceMode.cs
+System.Web.UI/PersistenceModeAttribute.cs
+System.Web.UI/PostBackOptions.cs
+System.Web.UI/PropertyConverter.cs
+System.Web.UI/PropertyEntry.cs
+System.Web.UI/RenderMethod.cs
+System.Web.UI/RootBuilder.cs
+System.Web.UI/SimpleHandlerFactory.cs
+System.Web.UI/SimplePropertyEntry.cs
+System.Web.UI/SimpleWebHandlerParser.cs
+System.Web.UI/StateBag.cs
+System.Web.UI/StateItem.cs
+System.Web.UI/StateManagedCollection.cs
+System.Web.UI/StaticPartialCachingControl.cs
+System.Web.UI/TagPrefixAttribute.cs
+System.Web.UI/TemplateBuilder.cs
+System.Web.UI/TemplateContainerAttribute.cs
+System.Web.UI/TemplateContentType.cs
+System.Web.UI/TemplateControl.cs
+System.Web.UI/TemplateControlParser.cs
+System.Web.UI/TemplateInstance.cs
+System.Web.UI/TemplateParser.cs
+System.Web.UI/ThemeableAttribute.cs
+System.Web.UI/ToolboxDataAttribute.cs
+System.Web.UI/Triplet.cs
+System.Web.UI/TwoWayBoundPropertyEntry.cs
+System.Web.UI/UrlPropertyAttribute.cs
+System.Web.UI/UrlTypes.cs
+System.Web.UI/UserControl.cs
+System.Web.UI/UserControlControlBuilder.cs
+System.Web.UI/UserControlParser.cs
+System.Web.UI/Utils.cs
+System.Web.UI/ValidationPropertyAttribute.cs
+System.Web.UI/ValidatorCollection.cs
+System.Web.UI/VerificationConditionalOperator.cs
+System.Web.UI/VerificationReportLevel.cs
+System.Web.UI/VerificationRule.cs
+System.Web.UI/WebHandlerParser.cs
+System.Web.UI/WebResourceAttribute.cs
+System.Web.UI/WebServiceParser.cs
+System.Web.UI/XhtmlMobileDocType.cs
+System.Web.UI/XPathBinder.cs
+System.Web.UI.Adapters/WmlPostFieldType.cs
+System.Web.UI.Imaging/ImageScaleMode.cs
+System.Web.UI.Imaging/ImageType.cs
+System.Web.UI.Imaging/StorageType.cs
+System.Web.Util/AltSerialization.cs
+System.Web.Util/DataSourceHelper.cs
+System.Web.Util/ICalls.cs
+System.Web.Util/NativeFileChangeEventHandler.cs
+System.Web.Util/TimeUtil.cs
+System.Web.Util/TransactedCallback.cs
+System.Web.Util/Transactions.cs
+System.Web.Util/UrlUtils.cs
+System.Web.Util/WebEncoding.cs
+System.Web.Util/WebEqualComparer.cs
+System.Web.Util/WebHashCodeProvider.cs
+System.Web.Util/WebTrace.cs
+System.Web.Util/WorkItem.cs
+System.Web.Util/WorkItemCallback.cs
+System.Web/ApplicationShutdownReason.cs
+System.Web/BeginEventHandler.cs
+System.Web/CapabilitiesLoader.cs
+System.Web/EndEventHandler.cs
+System.Web/HtmlizedException.cs
+System.Web/HttpApplication.cs
+System.Web/HttpApplicationFactory.cs
+System.Web/HttpApplicationState.cs
+System.Web/HttpAsyncResult.cs
+System.Web/HttpBrowserCapabilities.cs
+System.Web/HttpCachePolicy.cs
+System.Web/HttpCacheRevalidation.cs
+System.Web/HttpCacheValidateHandler.cs
+System.Web/HttpCacheVaryByHeaders.cs
+System.Web/HttpCacheVaryByParams.cs
+System.Web/HttpCacheability.cs
+System.Web/HttpClientCertificate.cs
+System.Web/HttpCompileException.cs
+System.Web/HttpContext.cs
+System.Web/HttpCookie.cs
+System.Web/HttpCookieCollection.cs
+System.Web/HttpCookieMode.cs
+System.Web/HttpDataTransferMode.cs
+System.Web/HttpException.cs
+System.Web/HttpFileCollection.cs
+System.Web/HttpForbiddenHandler.cs
+System.Web/HttpHelper.cs
+System.Web/HttpMethodNotAllowedHandler.cs
+System.Web/HttpModuleCollection.cs
+System.Web/HttpMultipartContentParser.cs
+System.Web/HttpParseException.cs
+System.Web/HttpPostedFile.cs
+System.Web/HttpRequest.cs
+System.Web/HttpRequestPriority.cs
+System.Web/HttpRequestStream.cs
+System.Web/HttpRequestValidationException.cs
+System.Web/HttpResponse.cs
+System.Web/HttpResponseHeader.cs
+System.Web/HttpResponseStream.cs
+System.Web/HttpResponseStreamProxy.cs
+System.Web/HttpRuntime.cs
+System.Web/HttpServerUtility.cs
+System.Web/HttpStaticObjectsCollection.cs
+System.Web/HttpUnhandledException.cs
+System.Web/HttpUtility.cs
+System.Web/HttpValidationStatus.cs
+System.Web/HttpValueCollection.cs
+System.Web/HttpWorkerRequest.cs
+System.Web/HttpWriter.cs
+System.Web/IHttpAsyncHandler.cs
+System.Web/IHttpHandler.cs
+System.Web/IHttpHandlerFactory.cs
+System.Web/IHttpMapPath.cs
+System.Web/IHttpModule.cs
+System.Web/MimeTypes.cs
+System.Web/NoParamsInvoker.cs
+System.Web/ParserError.cs
+System.Web/ParserErrorCollection.cs
+System.Web/ProcessInfo.cs
+System.Web/ProcessModelInfo.cs
+System.Web/ProcessShutdownReason.cs
+System.Web/ProcessStatus.cs
+System.Web/QueueManager.cs
+System.Web/ReusableMemoryStream.cs
+System.Web/ServerVariablesCollection.cs
+System.Web/SiteMap.cs
+System.Web/SiteMapNode.cs
+System.Web/SiteMapNodeCollection.cs
+System.Web/SiteMapProvider.cs
+System.Web/SiteMapProviderCollection.cs
+System.Web/SiteMapResolveEventArgs.cs
+System.Web/StaticFileHandler.cs
+System.Web/TODOAttribute.cs
+System.Web/TimeoutManager.cs
+System.Web/TraceContext.cs
+System.Web/TraceData.cs
+System.Web/TraceManager.cs
+System.Web/TraceMode.cs
+System.Web/WebCategoryAttribute.cs
+System.Web/WebSysDescriptionAttribute.cs
+System.Web/XmlSiteMapProvider.cs
diff --git a/mcs/class/System.Web/System.Web/.cvsignore b/mcs/class/System.Web/System.Web/.cvsignore
new file mode 100644
index 00000000000..1c320f3b4df
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/.cvsignore
@@ -0,0 +1,2 @@
+_*
+semantic.cache
diff --git a/mcs/class/System.Web/System.Web/ApplicationShutdownReason.cs b/mcs/class/System.Web/System.Web/ApplicationShutdownReason.cs
new file mode 100644
index 00000000000..603651effc6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ApplicationShutdownReason.cs
@@ -0,0 +1,52 @@
+//
+// System.Web.ApplicationShutdownReason.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web
+{
+ [Serializable]
+ public enum ApplicationShutdownReason
+ {
+ None = 0,
+ HostingEnvironment = 1,
+ ChangeInGlobalAsax = 2,
+ ConfigurationChange = 3,
+ UnloadAppDomainCalled = 4,
+ ChangeInSecurityPolicyFile = 5,
+ BinDirChangeOrDirectoryRename = 6,
+ BrowsersDirChangeOrDirectoryRename = 7,
+ CodeDirChangeOrDirectoryRename = 8,
+ ResourcesDirChangeOrDirectoryRename = 9,
+ IdleTimeout = 10,
+ PhysicalApplicationPathChanged = 11,
+ HttpRuntimeClose = 12,
+ InitializationError = 13,
+ MaxRecompilationsReached = 14
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web/BeginEventHandler.cs b/mcs/class/System.Web/System.Web/BeginEventHandler.cs
new file mode 100644
index 00000000000..36858a2358e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/BeginEventHandler.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.BeginEventHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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.
+//
+
+namespace System.Web
+{
+ public delegate IAsyncResult BeginEventHandler(object sender,
+ EventArgs e,
+ AsyncCallback cb,
+ object extraData);
+}
diff --git a/mcs/class/System.Web/System.Web/CapabilitiesLoader.cs b/mcs/class/System.Web/System.Web/CapabilitiesLoader.cs
new file mode 100644
index 00000000000..23c8ec8a37d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/CapabilitiesLoader.cs
@@ -0,0 +1,259 @@
+//
+// System.Web.CapabilitiesLoader
+//
+// Loads data from browscap.ini file provided by Gary J. Keith from
+// http://www.GaryKeith.com/browsers. Please don't abuse the
+// site when updating browscap.ini file. Use the update-browscap.exe tool.
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2003 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
+// "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;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.IO;
+using System.Text.RegularExpressions;
+using System.Web.Configuration;
+
+namespace System.Web
+{
+ class BrowserData
+ {
+ static char [] wildchars = new char [] {'*', '?'};
+ BrowserData parent;
+ string text;
+ string pattern;
+ Regex regex;
+ ListDictionary data;
+
+ public BrowserData (string pattern)
+ {
+ int norx = pattern.IndexOfAny (wildchars);
+ if (norx == -1) {
+ text = pattern;
+ } else {
+ this.pattern = pattern.Substring (norx);
+ text = pattern.Substring (0, norx);
+ if (text.Length == 0)
+ text = null;
+
+ this.pattern = this.pattern.Replace (".", "\\.");
+ this.pattern = this.pattern.Replace ("(", "\\(");
+ this.pattern = this.pattern.Replace (")", "\\)");
+ this.pattern = this.pattern.Replace ("[", "\\[");
+ this.pattern = this.pattern.Replace ("]", "\\]");
+ this.pattern = this.pattern.Replace ("?", ".");
+ this.pattern = this.pattern.Replace ("*", ".*");
+ }
+ }
+
+ public BrowserData Parent {
+ get { return parent; }
+ set { parent = value; }
+ }
+
+ public void Add (string key, string value)
+ {
+ if (data == null)
+ data = new ListDictionary ();
+
+ data.Add (key, value);
+ }
+
+ public Hashtable GetProperties (Hashtable tbl)
+ {
+ if (parent != null)
+ parent.GetProperties (tbl);
+
+ foreach (string key in data.Keys)
+ tbl [key] = data [key];
+
+ return tbl;
+ }
+
+ public string GetParentName ()
+ {
+ return (string) data ["parent"];
+ }
+
+ public string GetAlternateBrowser ()
+ {
+ return (pattern == null) ? text : null;
+ }
+
+ public string GetBrowser ()
+ {
+ if (pattern == null)
+ return text;
+
+ return (string) data ["browser"];
+ }
+
+ public bool IsMatch (string expression)
+ {
+ if (expression == null || expression.Length == 0)
+ return false;
+
+ if (text != null) {
+ if (text [0] != expression [0] ||
+ String.Compare (text, 1, expression, 1,
+ text.Length - 1, false,
+ CultureInfo.InvariantCulture) != 0) {
+ return false;
+ }
+ expression = expression.Substring (text.Length);
+ }
+
+ if (pattern == null)
+ return expression.Length == 0;
+
+ lock (this) {
+ if (regex == null)
+ regex = new Regex (pattern);
+ }
+
+ return regex.Match (expression).Success;
+ }
+ }
+
+ class CapabilitiesLoader : MarshalByRefObject
+ {
+ static bool loaded;
+ static ICollection alldata;
+ static Hashtable defaultCaps;
+ private CapabilitiesLoader () {}
+
+ public static Hashtable GetCapabilities (string userAgent)
+ {
+ Init ();
+ if (userAgent != null)
+ userAgent = userAgent.Trim ();
+
+ if (alldata == null || userAgent == null || userAgent == "")
+ return DefaultCapabilities;
+
+ foreach (BrowserData bd in alldata) {
+ if (bd.IsMatch (userAgent)) {
+ return bd.GetProperties (new Hashtable ());
+ }
+ }
+
+ return DefaultCapabilities;
+ }
+
+ static void Init ()
+ {
+ if (loaded)
+ return;
+
+ lock (typeof (CapabilitiesLoader)) {
+ if (loaded)
+ return;
+
+ string dir = Path.GetDirectoryName (WebConfigurationSettings.MachineConfigPath);
+ string filepath = Path.Combine (dir, "browscap.ini");
+ if (!File.Exists (filepath)) {
+ // try removing the trailing version directory
+ dir = Path.GetDirectoryName (dir);
+ filepath = Path.Combine (dir, "browscap.ini");
+ }
+
+ try {
+ LoadFile (filepath);
+ } catch (Exception) { }
+
+ loaded = true;
+ }
+ }
+
+ static void LoadFile (string filename)
+ {
+ if (!File.Exists (filename))
+ return;
+
+ TextReader input = new StreamReader (File.OpenRead (filename));
+ string str;
+ Hashtable allhash = new Hashtable ();
+ int aux = 0;
+ while ((str = input.ReadLine ()) != null) {
+ if (str.Length == 0 || str [0] == ';')
+ continue;
+
+ string userAgent = str.Substring (1, str.Length - 2);
+ BrowserData data = new BrowserData (userAgent);
+ ReadCapabilities (input, data);
+
+ /* Ignore default browser and file version information */
+ if (userAgent == "*" || userAgent == "GJK_Browscap_Version")
+ continue;
+
+ string key = data.GetBrowser ();
+ if (key == null || allhash.ContainsKey (key)) {
+ allhash.Add (aux++, data);
+ } else {
+ allhash.Add (key, data);
+ }
+ }
+
+ alldata = allhash.Values;
+ foreach (BrowserData data in alldata) {
+ if (data.Parent != null)
+ continue;
+
+ string pname = data.GetParentName ();
+ if (pname != null)
+ data.Parent = (BrowserData) allhash [pname];
+ }
+ }
+
+ static char [] eq = new char []{'='};
+ static void ReadCapabilities (TextReader input, BrowserData data)
+ {
+ string str;
+ while ((str = input.ReadLine ()) != null && str.Length != 0) {
+ string [] keyvalue = str.Split (eq, 2);
+ data.Add (keyvalue [0], keyvalue [1]);
+ }
+ }
+
+ static Hashtable DefaultCapabilities {
+ get {
+ lock (typeof (CapabilitiesLoader)) {
+ if (defaultCaps != null)
+ return defaultCaps;
+
+ defaultCaps = new Hashtable ();
+ defaultCaps.Add ("frames", "True");
+ defaultCaps.Add ("tables", "True");
+ return defaultCaps;
+ }
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/ChangeLog b/mcs/class/System.Web/System.Web/ChangeLog
new file mode 100644
index 00000000000..6ebe1a80b83
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ChangeLog
@@ -0,0 +1,1685 @@
+2005-05-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: ignore any exception thrown when invoking
+ an application event.
+
+2005-04-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpBrowserCapabilities.cs: fix Win32 property.
+
+2005-04-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: only add the charset when explicitly set or for
+ well-known content types.
+
+2005-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpCachePolicy.cs:
+ * HttpAsyncResult.cs:
+ * HttpClientCertificate.cs:
+ * HttpException.cs:
+ * HttpRuntime.cs:
+ * HttpCacheVaryByHeaders.cs:
+ * HttpBrowserCapabilities.cs:
+ * HttpUtility.cs:
+ * HttpCacheVaryByParams.cs: no more warnings.
+
+ * QueueManager.cs: check for local connections with minLocalFreeThreads.
+
+2005-04-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ServerVariablesCollection.cs: shuffled variables, added missing ones
+ and call a method in HttpRequest to set the HTTP_ variables.
+
+ * HttpRequest.cs: new method to add HTTP_ variables to a collection.
+
+2005-04-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: GetAllHeaders was returning the value twice instead
+ of 'name: value'. When HTTP_ is requested on the output, don't include
+ unknown headers.
+
+2005-03-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpCookieCollection.cs: when adding more than one cookie with the
+ same name, the last one is the winner.
+
+2005-03-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: correctly store the value cookies in Params. Fixes
+ bug #73345.
+
+2005-02-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: Path and FilePath also change when RewritePath is
+ called. Fixes bug #73055.
+
+2005-02-23 Sebastien Pouliot <sebastien@ximian.com>
+
+ * HttpRequest.cs: Make sure that any access after a ValidateInput
+ throws an exception if the data isn't safe.
+
+2005-02-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CapabilitiesLoader.cs: fix the path, as machine.config is now in a
+ x.x/ directory below $PREFIX/etc/mono.
+
+2005-02-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: fail on unicode full-width '<' and '>' too. Fixes
+ a security report (http://secunia.com/advisories/14325) that wan't
+ reported to us before public disclosure.
+
+2005-02-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: send the calculated content length even when it's 0.
+ Fixes bug #72655.
+
+2005-02-04 Lluis Sanchez Gual <lluis@novell.com>
+
+ * HttpContext.cs: Added internal property to keep a reference to
+ the last accessed page. Page uses this to implement PreviousPage.
+
+2005-02-02 Lluis Sanchez Gual <lluis@novell.com>
+
+ * ProcessModelInfo.cs: Fixed warning.
+
+2005-02-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TraceContext.cs: writing a message without any other argument is not
+ a warniing. Fixes bug #72017.
+
+2005-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: if there are no more handlers, finish the
+ request and ensure we call Complete on it. Now FreeTextBox 3.0 works.
+
+2004-12-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: honor the maxRequestSize limit from machine.config.
+
+2004-12-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: reread application CultureInfo as web.config
+ might have changed. Fixes bug #62539.
+
+2004-11-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: fixed ApplyAppPathModifier to insert the session ID.
+
+2004-11-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: monitor changes in global.asax and bin
+ directory and shutdown the application when that happens. Fixes bug
+ #49651.
+
+2004-11-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ReusableMemoryStream.cs: copied from System.IO.MemoryStream and
+ slightly modified to allow expanding the buffer for cases on which the
+ regular MemoryStream don't allow it.
+
+ * HttpWriter.cs: use the new ReusableMemoryStream and fix bug #59841.
+ Otherwise we would have to allocate a new MemoryStream...
+
+2004-11-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: Create() is now GetInstance().
+
+2004-11-18 Lluis Sanchez Gual <lluis@novell.com>
+
+ * SiteMapNodeCollection.cs: Added missing properties.
+ * HttpParseException.cs: Added 2.0 methods and properties.
+ * SiteMapNode.cs: Added missing methods and properties.
+ * SiteMapProvider.cs, XmlSiteMapProvider.cs,
+ SiteMapProviderCollection.cs: IProvider does not exist any
+ more, it is now ProviderBase.
+ * ISiteMapProvider.cs: Deleted.
+ * ParserErrorCollection.cs, ParserError.cs, SiteMapResolveEventArgs.cs:
+ Implemented.
+ * SiteMap.cs: Minor fixes.
+
+2004-11-15 Lluis Sanchez Gual <lluis@novell.com>
+
+ * SiteMapProviderCollection.cs: Fixed warning.
+ * HttpApplication.cs: Added new 2.0 events.
+
+2004-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: added internl SetHeadersSent.
+ * HttpRuntime.cs: don't throw the 'headers already sent' exception
+ if we're sending a runtime error.
+
+2004-11-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: undo the TimeoutManager.(Add|Remove) shuffling.
+ It causes troubles under heavy load.
+
+2004-11-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SiteMap.cs: don't lock on Type.
+ * CapabilitiesLoader.cs: avoid 2 locks when loading data.
+
+2004-11-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: patch by Dennis Gervalle that fixes PhysicalPath in
+ presence of rewriting.
+
+2004-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: don't hang if a sync step is aborted. Fixes the
+ system.web portion of bug #68270.
+
+2004-10-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TraceContext.cs: don't cast to Page is the handler it's
+ not a page.
+
+2004-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: CurrentExecutionFilePath is the one that
+ changes when Transfer or Execute are used, not FilePath.
+
+ * HttpServerUtility.cs: moved form saving/restoring from
+ Transfer to Execute, as it's needed there too. the query string is
+ correctly set now. Fixes bug #67388.
+
+ * HttpContext.cs: use SetCurrentExePath instead of SetFilePath.
+
+2004-10-03 Ben Maurer <bmaurer@ximian.com>
+
+ * HttpResponse.cs: use UtcNow
+
+2004-10-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: SuppressContent does not throw and clears all the
+ buffered output. Fixes bug #67213.
+
+2004-09-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpUtility.cs: UrlPathEncode is static. Fixes bug #67155.
+
+2004-09-29 Ben Maurer <bmaurer@ximian.com>
+
+ * HttpContext.cs, TimeoutManager: Use DateTime.UtcNow.
+
+2004-09-25 Ben Maurer <bmaurer@ximian.com>
+
+ * HttpApplication.cs: Make sure requests are removed from
+ the timeout manager. Fixes a major leak. #66751.
+
+2004-09-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs:
+ * HttpRuntime.cs: implemented UnloadAppDomain and be ready for domain
+ unloading.
+
+2004-09-12 Ben Maurer <bmaurer@ximian.com>
+
+ * HttpContext.cs: use CallContext. It is a little bit faster.
+
+2004-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpStaticObjectsCollection.cs: don't share static session objects
+ declared in the application file across the application, but on a
+ per-session basis. Fixes bug #65446.
+
+2004-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpServerUtility.cs: in Transfer(path), don't keep form data if
+ the transfer is done from inside a page that received a postback.
+ Fixes bug #65613.
+
+2004-09-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpValueCollection.cs: fixed signature of ToString (). Closes bug
+ #65392.
+
+2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * HttpWriter.cs (.ctor): Dont create teh StreamWriter twice
+ (Clear): Don't recreate the MemoryStream and StreamWriter
+
+2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: only add/remove to/from the timeout
+ manager when we're in a interruptible step.
+
+2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TraceContext.cs: when IsEnabled has not been set, return the value
+ from the TraceManager. Fixes bug #63469.
+
+2004-08-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRuntime.cs: initialize the response writer when finishing a
+ request because it cannot be queued. Under heavy load we made new
+ requests be processed before the ones that might be queued. This is
+ no longer the case.
+
+ * QueueManager.cs: instead of queueing/dequeuing separately, we now
+ have a single method that does everything needed to decide which one
+ will be the next request processed.
+
+2004-08-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRuntime.cs: removed initializations to null in .cctor. Prevent
+ other requests from avoiding the lock if they are received before the
+ configuration system is inited. Ensure that the queue manager is not
+ null before using it (it can be null while the first request is being
+ processed).
+
+2004-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpServerUtility.cs: ensure we have a full virtual path for the
+ request being executed.
+
+2004-08-02 Duncan Mak <duncan@ximian.com>
+
+ * ApplicationShutdownReason.cs: Fixed typos.
+
+ * HttpCookieMode.cs:
+ * HttpDataTransferMode.cs:
+ * HttpRequestPriority.cs: Added [Serializable] attribute.
+
+2004-08-02 Duncan Mak <duncan@ximian.com>
+
+ * ApplicationShutdownReason.cs:
+ * HttpCookieMode.cs:
+ * HttpDataTransferMode.cs:
+ * HttpRequestPriority.cs: Added 2.0 enumerations.
+
+2004-07-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: the file not found might be a dependency.
+
+2004-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpCookie.cs: use invariant when formatting expires date. Fixes bug
+ #61690.
+
+2004-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: don't keep the session around if we got it from
+ the context. Fixes bug #61232.
+
+2004-07-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpUtility.cs: fixed stupid bug in UrlDecode from bytes. Closes bug
+ #61181.
+
+2004-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TraceContext.cs: added internal HaveTrace property whose
+ value is true when the page has a Trace attribute.
+
+2004-06-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TraceData.cs: fixed <br> output. Closes bug #60181.
+
+2004-06-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpUtility.cs: check for control characters in the string to encode
+ or decode and return the same string if there are none.
+
+2004-06-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: change/restore the IPrincipal in their own methods
+ and make them internal.
+
+2004-06-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpContext.cs: reverting Pedro's patch and sending mail with test
+ to mono-devel.
+
+2004-06-09 Pedro Martínez Juliá <yoros@wanadoo.es>
+
+ * HttpContext: User property returns its own "user" value because
+ the context can walk through different Threads. When "User" property
+ is changed, change "Thread.CurrentPrincipal" too.
+
+2004-06-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: removed extra ^Ms and fixed style of last patch.
+
+2004-06-08 Alon Gazit <along@mainsoft.com>
+
+ * HttpRequest.cs: Add a patch for HttpRequest.ServerVariables.
+
+2004-06-07 Sebastien Pouliot <sebastien@ximian.com>
+
+ * HttpContext.cs: User property now get/set Thread.CurrentPrincipal.
+ Fix (at least partially) #59683.
+
+2004-06-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: reverting patch from Alon Gazit. Uses the above file
+ that doesn't compile.
+
+2004-06-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TraceData.cs: fixes nullref in an application that relies on
+ r ["Message"] not being null. Closes bug #59679.
+
+2004-06-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpCachePolicy.cs: implemented SetAllowResponseInBrowserHistory.
+
+2004-06-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRuntime.cs: implemented a 5 simple properties that were TODOs.
+
+2004-06-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpBrowserCapabilities.cs: implemented ClrVersion and GetClrVersions.
+ * HttpException.cs: removed MonoTODO.
+
+2004-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TraceContext.cs: don't check if HttpRuntime.TraceManager
+ is enabled when writing.
+
+2004-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: added ClientTarget internal property.
+
+2004-06-03 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * HttpApplication.cs: Clear the http handler list after releasing the
+ handlers.
+
+2004-06-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TraceData.cs: html-encode the messages written to the trace. Fixes
+ bug #59431.
+
+2004-06-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpWorkerRequest.cs: the hashtables are now case-insensitive. Thanks
+ to Markus Kräutner.
+
+2004-05-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: nullify _sRequestRootVirtualDir and baseVirtualDir
+ when SetFilePath is called. This way the cached values are reset and
+ get the right value in case someone (namely SessionStateModule +
+ cookieless session) changes the FilePath after the property cached its
+ value. Fixes bug #59364.
+
+2004-05-27 Patrik Torstensson <totte@hiddenpeaks.com>
+
+ * HttpApplicationFactory.cs: Added SignalError (still todo)
+
+2004-05-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: remove hardcoded "HTTP/1.0" version that kept
+ chunked encoding disabled. Fixed chunked suffix and end. Send the
+ 'lastchunk' marked when in the final Flush even if the content length
+ is 0. This makes mod-mono-server work fine with chunked encoding.
+
+ * HttpRuntime.cs: Set the _firstRequest* variables to true
+ earlier. TraceContext don't take any parameter now.
+
+ * TraceManager.cs: don't need a context. Use GetAppConfig.
+
+2004-05-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: set culture/uiculture from configuration and
+ restore it after each step. Fixes bug #52851.
+
+2004-05-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpUtility.cs: use lower case in UrlEncode like MS does. Delay
+ entities hashtable creation until it's really needed.
+
+2004-05-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: if no module matches the name found for a
+ possible event, ignore it. Fixes bug #58542.
+
+2004-05-16 Patrik Torstensson <totte@hiddenpeaks.com>
+
+ * HttpRuntime (Init): Removed old todo
+ * HttApplication : Implemented IHttpHandlerFactory recycling
+
+2004-04-28 Patrik Torstensson
+
+ * HttpApplicationState.cs: Performance, usage of ReaderWriter lock,
+ removed MonoTodo
+
+2004-04-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpUtility.cs: return null in HtmlDecode for null input instead of
+ throwing an exception. Patch by Jan Jaros (bug #57083).
+
+2004-04-10 Vladimir Vukicevic <vladimir@pobox.com>
+
+ * TimeoutManager.cs: Swap the order of initialization of contexts
+ and the Timer, to avoid race condition of CheckTimeouts being called
+ before contexts gets initialized.
+
+2004-03-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequestStream.cs: patch from Jan Jaros that fixes bug #56080.
+ Now the posted file content does not have the boundaries and headers
+ included.
+
+2004-03-25 Alon Gazit <along@mainsoft.com>
+
+ * HttpRequest.cs: fix ValidateCookieCollection() to prevent
+ InvalidCastException.
+
+2004-03-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpValueCollection.cs: don't UrlDecode cookies. Fixes bug #55254.
+
+2004-03-01 Larry Ewing <lewing@ximian.com>
+
+ * HttpUtility.cs: fix UrlEncodeToBytes count check.
+
+2004-02-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpServerUtility.cs:
+ * HttpUtility.cs: added some checks for null. Fixed UrlPathEncode (bug
+ #53670).
+
+2004-02-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpUtility.cs: fixed length check. Closes bug #54201.
+ Thanks to Michal Moskal. Use MemoryStream instead of an ArrayList when
+ decoding.
+
+2004-02-11 Jackson Harper <jackson@ximian.com>
+
+ * TraceData.cs: Use ToString for cookie/header/var name values so
+ null is handled properly.
+
+2004-02-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: ApplicationState is inited by the factory so,
+ return that value in the property. when we use the context Session,
+ cache it in the instance field.
+
+ * HttpApplicationFactory.cs: fixed target Type for the event when
+ hooking application and module events. Initialize application
+ and session scope objects. Fixes non-aplication events hook up.
+
+ * HttpStaticObjectsCollection.cs: added StaticItem and delay the
+ creation of the objects until they are requested.
+
+2004-01-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: fixlet for session events hook.
+
+2004-01-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: attach all events from Type and BaseType
+ at the same time. Fixes bug #53454.
+
+2004-01-27 Jackson Harper <jackson@ximian.com>
+
+ * HttpCachePolicy.cs: varybyparams::GetResponseHeader can return
+ null now, dont hadd the header if it does.
+ * HttpCacheVaryByParams.cs: Return null if there are no items.
+
+2004-01-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpCachePolicy.cs: it's not public.
+ * HttpRuntime.cs: wait for requests before disposing the queue.
+
+2004-01-15 Jackson Harper <jackson@ximian.com>
+
+ * HttpCachePolicy.cs: Fix typo causing varyby params headers to be
+ created when they shouldn't be.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * TraceData.cs: Fix some typos in the output text. Fix control
+ position when adding controls recursively.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * HttpCachePolicy.cs: Expose duration and sliding properties.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * HttpCachePolicy.cs: Add an event that is fired when the
+ cacheability is updated. The response uses this to determine
+ whether or not it needs to cache itself.
+ * HttpResponse.cs: When the cacheability is updated either create
+ or dispose of the cached raw response based on whether or not we
+ wil need it. This allows output caching to be controlled
+ programatically.
+
+2004-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpContext.cs: add setter for ConfigTimeout.
+ * HttpException.cs: added Description property and HTML encode some
+ unescaped values.
+
+ * HttpRequest.cs: support request validation.
+
+ * HttpRequestValidationException.cs: added message and description.
+
+ * HttpServerUtility.cs: implemented ScriptTimeout.
+
+2004-01-11 Jackson Harper <jackson@ximian.com>
+
+ * TraceManager.cs: Dont crash if there is no trace config element.
+
+2004-01-11 Jackson Harper <jackson@ximian.com>
+
+ * HttpRequest.cs: Add property for determining if the request is
+ local or not.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * TraceContext.cs: Handle tracing when it is enabled in the config
+ file but not on the page.
+ * TraceManager.cs: Get settings from the configuration object.
+ * HttpRuntime.cs: Create trace manager in the first request start
+ so it can get configuration settings.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * TraceContext.cs: Save the request path in the trace data.
+ * TraceData.cs: Add RequestPath property, make some rendering
+ methods internal static so the TraceHandler can use them.
+ * TraceManager.cs: Expose trace data, add a method for clearing
+ trace data.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * HttpRuntime.cs: Add trace manager
+ * TraceManager.cs: New class for handling trace configuration and
+ storing trace data objects.
+ * TraceContext.cs: Save trace data to the trace manager. Fix typo.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * TraceData.cs: New class for storing trace data. Data is stored
+ here instead of the trace context so it can be saved and accessed
+ from the trace handler.
+ * TraceContext.cs: Save data in the TraceData object, let the
+ trace data object handle the rendering.
+
+2004-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: use ContentEncoding for QueryString. Fixes bug #52577.
+ Thanks to Jan Jaros (mono-bug@jerryweb.info).
+
+ * HttpRequestValidationException.cs: fix comment.
+
+2004-01-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpException.cs: default to error 500. Fixes bug #52623.
+
+2004-01-04 Jackson Harper <jackson@ximian.com>
+
+ * TraceContext.cs: Store and render trace info times. Also render
+ cookie sizes. Remove debug code.
+
+2004-01-04 Jackson Harper <jackson@ximian.com>
+
+ * HttpResponse.cs: Set the cached response date header so it can
+ be updated.
+ * HttpResponseHeader.cs: Let values be set so we can update cached
+ response header values.
+
+2004-01-04 Jackson Harper <jackson@ximian.com>
+
+ * HttpResponse.cs: Implement RemoveOutputCacheItem.
+
+2004-01-04 Jackson Harper <jackson@ximian.com>
+
+ * HttpCachePolicy.cs: Add internal method to get the vary by custom string
+ * HttpCacheVaryByHeaders.cs: Add internal method to get the header names.
+
+2004-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRuntime.cs: implemented MachineConfigurationDirectory,
+
+2004-1-1 Alon Gazit <along@mainsoft.com>
+ * HttpWriter.cs: add check in Write() in order to prevent
+ NullReferenceException.
+
+2004-1-1 Alon Gazit <along@mainsoft.com>
+ * HttpResponse.cs: implemented ExpiresAbsolute and Expires.
+
+2003-12-18 Jackson Harper <jackson@ximian.com>
+
+ * TraceContext.cs: Write () methods are not warnings.
+
+2003-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpBrowserCapabilities.cs: added GetClrVersions ().
+ * HttpCachePolicy.cs: added SetAllowResponseInBrowserHistory ().
+ * HttpContext.cs: added set_Current and RewritePath (s, s, s) for 1.1.
+ * HttpRequest.cs: added set_ContentType, SetPathInfo and ValidateInput.
+ * HttpRequestValidationException.cs: new class for 1.1
+ * HttpResponse.cs: added RedirectLocation.
+ * HttpRuntime.cs: added UnloadAppDomain.
+ * HttpServerUtility.cs: Execute (s, t, b) is internal for < 1.2
+ * HttpUtility.cs: copied UrlPathEncode from HttpServerUtility.
+ * HttpWorkerRequest.cs: added [ComVisible] and made the ctor public.
+
+2003-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpContext.cs: implemented IsCustomErrorEnabled and
+ IsDebuggingEnabled. Added internal ErrorPage property.
+
+ * HttpRuntime.cs: on error, check if we have a custom error page enabled
+ to handle it and redirect.
+
+ * HttpResponse.cs: added RedirectCustomError (), which actually does
+ the redirection to the error page.
+
+2003-12-16 Jackson Harper <jackson@ximian.com>
+
+ * TraceContext.cs: Render all the data, and the stylesheet.
+
+2003-12-16 Jackson Harper <jackson@ximian.com>
+
+ * TraceContext.cs: Add incomplete render method.
+
+2003-12-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CapabilitiesLoader.cs: loads browser detection and capabilities data
+ from browscap.ini file by Gary J. Keith.
+
+ * HttpBrowserCapabilities.cs: removed almost all TODOs.
+
+ * HttpRequest.cs: fixed Browser property.
+
+2003-12-15 Jackson Harper <jackson@ximian.com>
+
+ * TraceContext.cs: Initial implementation of storing data.
+ * HttpContext.cs: Create and expose a trace object.
+
+2003-12-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: ThreadAbortException is ok on Redirect.
+ * HttpContext.cs: added TimeoutPossible property.
+ * HttpResponse.cs: throw ThreadAbortException if End () is called within
+ a step in which is possible to timeout.
+
+ Fixes bug #51703.
+
+2003-12-04 Jackson Harper <jackson@ximian.com>
+
+ * HttpRequest.cs: Cleanup method.
+
+2003-12-04 Jackson Harper <jackson@ximian.com>
+
+ * HttpValueCollection.cs: Allow blank value names. Posting
+ <blank>=SomeValue is valid. And occurs if a radio button does
+ not have its name set.
+
+2003-12-03 Jackson Harper <jackson@ximian.com>
+
+ * HttpResponse.cs: Actually apply an app path modifier in
+ ApplyAppPathModifer and add a method to set the app path modifier.
+ * HttpRequest.cs: Add utility method for setting a request header.
+
+2003-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: handle FileNotFound and DirectoryNotFound
+ exceptions when creating the handler to generate a better error page.
+
+ * HttpException.cs: display the http_code if available. Changed all
+ \n by \r\n to make the hidden stack trace readable.
+
+ * StaticFileHandler.cs: don't send the real path in th eerror.
+
+2003-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpContext.cs: updated GetConfig and GetAppConfig to new API.
+
+ * HttpResponse.cs: separate initialization of the HttpWriter, as it
+ tries to read configuration settings while the config. system is not
+ available (ie, before the first request).
+
+ * HttpRuntime.cs: delayed queueManager and response writer
+ initialization until the configuration system is working.
+
+2003-11-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRuntime.cs: added request queue handling.
+
+ * QueueManager.cs: simple request queue.
+
+ * TimeoutManager.cs: added some locks to prevent the enumerator used in
+ CheckTimeouts to be out of synch.
+
+2003-11-25 Jackson Harper <jackson@ximian.com>
+
+ * HttpStaticObjectsCollection.cs: Add methods for serialization
+ and conversion to/from byte arrays.
+
+2003-11-21 Jackson Harper <jackson@ximian.com>
+
+ * HttpResponse.cs: When caching data set the content length in the
+ cached repsonse so that only that amount will be written back to
+ the client. Add method to write a range of binary data.
+ * HttpCacheVaryByParams.cs: Add method to retrieve param names.
+
+2003-11-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs:
+ * HttpContext.cs:
+ * HttpRuntime.cs: add timeout handling.
+ * TimeoutManager.cs: new class that takes care of aborting threads on
+ timeout.
+
+2003-11-19 Jackson Harper <jackson@ximian.com>
+
+ * HttpWriter.cs: Use a constant for the buffer size so the cache
+ can get the buffer size. Add method to get the buffer.
+ * HttpResponse.cs: Methods for getting data to cache, and setting
+ vars from the cache.
+ * HttpCachePolicy.cs: Expose a pages cache expire time.
+
+2003-11-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs:
+ * HttpWriter.cs: some fixes to allow closing a response stream without
+ messing the rest.
+
+2003-11-13 Jackson Harper <jackson@ximian.com>
+
+ * HttpCachePolicy.cs: Make sure cacheability and maxage get
+ set. Add method to set Http response header data
+ * HttpCacheVaryByParams.cs: Add method to create a response header.
+ * HttpCacheability.cs: Add ServerAndPrivate and ServerAndNoCache.
+ * HttpResponse.cs: Set cache headers.
+
+2003-11-11 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * HttpModuleCollection.cs (GetKey): Recursion, again!
+
+2003-11-11 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * HttpClientCertificate.cs (ValidUntil): recursion!
+
+2003-11-08 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * SiteMapNode.cs (GetDataSourceView): Implement.
+ * SiteMapProvider.cs: Typo fixing.
+ * XmlSiteMapProvider.cs: We shouldnt resolve here.
+
+2003-11-08 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * SiteMap.cs (Init): implement a hack that doesnt need the config
+ stuff. Should do that later.
+ * SiteMapNodeCollection (OnValidate): Fix recursion.
+ * SiteMapProvider.cs: We dont implement some culture stuff work
+ around it. Fix typo.
+ * XmlSiteMapProvider.cs: Added.
+
+2003-11-07 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * ISiteMapProvider.cs:
+ * SiteMap.cs:
+ * SiteMapNode.cs:
+ * SiteMapNodeCollection.cs:
+ * SiteMapProvider.cs:
+ * SiteMapProviderCollection.cs: V2 sitemap related stuff.
+
+2003-11-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: don't attempt to read more bytes than specified
+ content length.
+
+2003-11-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs:
+ * HttpResponse.cs:
+ * HttpUtility.cs:
+ * HttpValueCollection.cs: encoding fixes/updates.
+
+ * HttpWriter.cs: when updating the encoding, flush the existing stream.
+ Encoding updates.
+
+2003-11-04 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * HttpContext.cs (IsCustomErrorEnabled): dont throw exception, just
+ return false (which makes sense, as the custom errors *arent* enabled;
+ ie they dont work.
+ * HttpResponseStream.cs: you actually can write with len = 0
+
+2003-11-03 Jackson Harper <jackson@ximian.com>
+
+ * HttpResponse.cs (ContentEncoding): Throw
+ ArgumentNullException. Patch by Yaron Shkop.
+
+2003-10-30 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * HttpMultipartContentParser.cs : Quick fix for cygwin build.
+ CSC complains that constant char cannot be casted as byte.
+
+2003-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: added AssemblyLocation property.
+
+2003-10-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: use NoParamsInvoker.
+ * HttpRequest.cs: support request filters.
+ * HttpRequestStream.cs: mono-stylized and added new Set method.
+
+ * NoParamsInvoker.cs: proxy class to invoke user-provided methods
+ without parameters that are invoked by EventHandlers.
+
+2003-10-13 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * HttpResponse.cs: Changed harcoded switch to en-US culture to a switch
+ to invariant culture.
+
+2003-10-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs:
+ * HttpServerUtility.cs: change the response writer in Execute. Thanks
+ to Rich Alimi <rich@velvetsea.net> for noticing this.
+
+2003-10-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: support for wiring up events without
+ parameters.
+
+2003-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpUtility.cs: small memory usage reduction.
+
+2003-10-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: pass the Uri, not the file path to
+ when looking for a handler.
+
+2003-09-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: small fix needed when reading big POST data.
+
+2003-09-04 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * HttpRequest.cs: Url property: use GetLocalAddress() to get the address
+ (this will get the address from the request headers).
+
+2003-09-04 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * HttpServerUtility.cs: In Transfer(), preserve the query string if
+ told to do so.
+
+2003-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: ensure we do all the EndRequest steps. Don't
+ filter the output on error.
+
+ * HttpResponse.cs: modified DoFilter to allow bypassing filtering.
+
+2003-08-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: when the request is completed or an
+ error happens, execute all the delegates attached to EndRequest, not
+ only the last one. This makes xsp/test/authtest work again.
+
+ * HttpMethodNotAllowedHandler.cs: fixed description for http
+ status code.
+
+2003-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: quick way of checking that the path is within the
+ root for the application. Thanks to Johannes for reporting.
+
+ * HttpRuntime.cs: use the status code from teh exception when it'ss a
+ HttpException.
+
+ * StaticFileHandler.cs: forbidden is 403.
+
+2003-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpServerUtility.cs: fixed path and query. Path by Rich Alimi
+ <rich@velvetsea.net>.
+
+2003-08-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpException.cs: make the unhandled error more like the MS one.
+ * HttpRuntime.cs: set a 500 error code on unhandled exceptions.
+
+2003-08-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: flush headers when the body length is 0.
+ * StaticFileHandler.cs: added If-Modified-Since handling patch slightly
+ modified from the original by Piers Haken <piersh@friskit.com>.
+
+2003-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: another patch from totte and me. This one prevents
+ writing output if the client have disconnected and filters the data
+ when there's a non-final Flush in the middle of the process.
+
+2003-08-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: fixed typos. Closes bug #44197.
+
+2003-08-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs:
+ * HttpApplicationFactory.cs: fix duplicate application OnStart events.
+
+ Patch by Patrik Torstensson.
+
+2003-08-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: use the correct Delegate.CreateDelegate
+ overload. The previous one only admits static methods.
+
+2003-08-01 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * ProcessModelInfo.cs: Fixed signature
+
+2003-07-30 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * WebCategoryAttribute.cs: Implemented localization
+ * WebSysDescriptionAttribute.cs: Implemented localization
+
+2003-07-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRuntime.cs: also clear the headers that may have been set upon
+ error processing the request.
+
+2003-07-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponseStreamProxy.cs: reformatted. Fixed infinite recursion in
+ Write method.
+
+ * HttpWriter.cs: flush the filter after writing.
+
+2003-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpWriter.cs: avoid duplicating the MemoryStream byte buffer.
+
+2003-07-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpContext.cs: Session doesn't have a setter.
+
+ * HttpResponse.cs: Request is private.
+
+2003-07-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: fixed Headers property. It was getting known headers
+ values instead of known headers names.
+
+2003-07-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: prevent nullref if an error happens before context
+ is set.
+ * HttpException.cs: small fix in the stack trace sent.
+ * HttpUtility.cs: the lock is not needed.
+
+2003-06-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: added REMOTE_PORT.
+ * HttpValueCollection.cs: fixed bug #45490.
+
+2003-05-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs:
+ * HttpApplicationFactory.cs: fire application start and session
+ start/end events.
+
+2003-05-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpException.cs: encode as HTML the inner exception that
+ is appended as a comment at the end of error pages.
+
+2003-05-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpWriter.cs: don't do anything in Flush. Fixes #42249.
+
+2003-05-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlizedException.cs: added more virtual methods.
+
+ * HttpException.cs: some work on the output when there's a source
+ file present.
+
+2003-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlizedException.cs: simplified to cope with the new interface.
+
+ * HttpApplicationFactory.cs: use the application file parser to get the
+ application Type.
+
+ * HttpException.cs: small changes. Needs some more work on
+ ParseExceptions.
+
+2003-03-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: fixed Url property.
+
+2003-03-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlizedException.cs:
+ * HttpException.cs: display the correct line number in error messages.
+
+2003-03-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpCachePolicy.cs: implemented all TODOs.
+ * HttpRequestStream.cs: make it internal.
+
+2003-03-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpContext.cs: implemented RewritePath in other way.
+ * HttpRequest.cs: removed SetPhysicalPath and added SetForm.
+ * HttpServerUtility.cs: implemented Transfer (string, bool).
+
+2003-03-16 Daniel Lopez Ridruejo <daniel @ rawbyte.com>
+ * HttpContext.cs : Implemented RewritePath
+ * HttpRequest.cs : Added internal function SetPhysicalPath
+
+2003-03-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpServerUtility.cs: implemented Transfer ().
+
+2003-03-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRuntime.cs: Cache no longer have a Dispose method.
+
+ * HttpServerUtility.cs: removed MonoTODO.
+
+2003-03-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpHelper.cs: store the values in an ArrayList to get them in correct
+ order.
+
+2003-02-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: Global.asax takes precedence over
+ global.asax if it exists.
+
+ * HttpRequest.cs: use allowCrossAppMapping in MapPath.
+
+2003-02-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: CreateHttpHandler is now internal.
+
+ * HttpRequest.cs: allow setting QueryStringRaw, which
+ invalidates the data obtained from the previous value. Added internal
+ SetFilePath method.
+
+ * HttpServerUtility.cs: implemented Execute and GetLastError.
+
+2003-02-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpServerUtility.cs: style.
+
+2003-02-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: only execute the EndRequest step on error
+ condition or request marked as completed. This prevent page events from
+ being called when, for example, the url authorization module forbids
+ the request.
+
+2003-02-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: implemented the indexer.
+
+2003-02-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlizedException.cs: base class for exceptions that makes it easy to
+ generate error pages.
+
+ * HttpException.cs: improved error displaying.
+
+ * HttpRuntime.cs: removed debugging output.
+
+2003-02-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: display the error instead of hanging when we get
+ any error before the last step of the request.
+
+2003-02-04 Tim Haynes <thaynes@openlinksw.com>
+
+ * HttpApplicationFactory.cs: fixed HttpRuntime.Close() to decrement
+ instance counter.
+
+2003-01-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: added BaseVirtualDir property and use it in MapPath.
+
+2003-01-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: implemented CurrentExecutionFilePath.
+
+2003-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: keep _lasterror if no context. Attach
+ application events *after* modules initialization (if not, User is not
+ set when the user handler is called).
+
+ * HttpApplicationFactory.cs: made all methods related to
+ AttachEvents static. I will fix OnStart/OnEnd for application and
+ session later.
+
+ * HttpRequest.cs: don't initialize cookies twice.
+
+2003-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs:
+ (ApplyAppPathModifiers): return the root directory for "".
+
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpUtility.cs: fixed HtmlDecode to avoid ArgumentOutOfRangeException.
+
+2003-01-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: added new state to handle default authentication.
+
+2003-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpContext.cs: removed hack to get the User.
+
+2003-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpUtility.cs: fixed bug #36038. Thanks to juancri@tagnet.org for
+ reporting the bug and how to fix it.
+
+2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpCookie.cs: send 'expires' in the header.
+
+2002-12-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpValueCollection.cs: patch from Botjan Vizin
+ <bostjan.vizin@siol.net> that implements ToString (bool).
+
+2002-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: add the context as parameter when building
+ the application Type.
+
+ * HttpCookie.cs: new internal constructor.
+ * HttpCookieCollection.cs: new internal method to make a cookie expire.
+
+ * HttpRequest.cs: MapPath fixes.
+ * HttpResponse.cs: implemented ApplyAppPathModifier.
+ * HttpRuntime.cs: fixed typo in AppDomainAppVirtualPath.
+
+2002-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpContext.cs: hack to create a default user when there's no one.
+ Implemented GetConfig (string).
+
+ * HttpRequest.cs: fixes to MapPath (string).
+
+2002-12-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRuntime.cs: avoid nulls and exception when getting resource
+ format strings.
+
+ * StaticFileHandler.cs: added file name to error message.
+
+2002-12-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: avoid sending chunked content for HTTP/1.1.
+
+2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: get the events from the application class,
+ fire Application/Session Start/End and add the others as application
+ events.
+
+2002-11-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: compile global.asax file if it exists.
+
+2002-11-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: provide a default Browser until we detect it.
+ * HttpResponse.cs:
+ (End): do not close the connection here.
+ (Flush (bool)): send the headers when, for example, Redirect () is
+ called.
+
+2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpException.cs: simple error output.
+
+2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: style.
+ * HttpException.cs: style.
+ * HttpRuntime.cs: only flush the response if there are no errors.
+ Otherwise, write an error output.
+ * HttpWriter.cs: change Unicode to UTF8.
+
+2002-11-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: don't begin the request using ExecuteNextAsync
+ (it fails to work on NetServ).
+
+ * HttpWorkerRequest.cs: typo.
+
+2002-11-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpValueCollection.cs: the value may contain trailing '=' as it is
+ UrlEncoded. Don't split name=value based on '='.
+
+2002-11-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpCookie.cs: made GetCookieHeader internal.
+
+ * HttpRequest.cs: get cookies from request.
+
+ * HttpResponse.cs: send cookies. Implemented
+ AddFileDependencies (). Added check for _Writer == null in Flush
+ (Patrik ;-). Clear the content if HEAD or SupressContent == true.
+ Removed redirect hack used in old server.
+
+2002-10-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: fixed GetRawContent (). Now it only tries to read at
+ most ContentLength bytes.
+
+ * HttpResponse.cs: now it sends the headers. Added
+ X-Powered-By header :-).
+
+ * HttpRuntime.cs: fixed typo.
+
+ * HttpValueCollection.cs: cosmetic changes.
+
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: reenabled a few lines of code
+ (ThreadPool already fixed).
+
+ * HttpRequest.cs:
+ * HttpResponse.cs:
+ * HttpUtility.cs:
+ * HttpValueCollection.cs:
+ * HttpWriter.cs: Use WebEncoding.Encoding.
+
+2002-10-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpWriter.cs: changed encoding of the writer from Unicode to UTF8.
+ This fixes sending bytes and allows mixing byte with chars.
+
+2002-10-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: implemented WriteFile methods.
+ * MimeTypes.cs: removed duplicated entries.
+
+2002-10-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: don't throw exception in a couple of
+ methods not yet implemented.
+
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: fixed type and handle factories when creating
+ IHttpHandler for a request.
+
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: use handlers from configuration.
+ * HttpContext.cs: get handlers from ConfigurationSettings.
+
+2002-10-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpMethodNotAllowedHandler.cs:
+ * HttpRuntime.cs:
+ * StaticFileHandler.cs: Modified file.
+
+ * HttpUtility.cs: implemented all missing methods.
+
+
+2002-09-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web/HttpApplication.cs: use the static file handler.
+ * System.Web/HttpForbiddenHandler.cs: handler to forbid access.
+ * System.Web/HttpMethodNotAllowedHandler.cs: handler for method not
+ allowed.
+
+ * System.Web/HttpUtility.cs: finished all UrlDecode methods.
+ * System.Web/MimeTypes.cs: map from file extension to MIME type.
+ * System.Web/StaticFileHandler.cs: serves static files
+
+2002-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web/HttpApplication.cs:
+ * System.Web/HttpApplicationFactory.cs:
+ * System.Web/HttpRequest.cs:
+ * System.Web/HttpRuntime.cs: we are now able to compile pages and use
+ HttpApplication, HttpRuntime and SimpleWorkerRequest.
+
+2002-09-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: added some missing methods.
+ * HttpApplicationFactory.cs: get event handlers for the application.
+ * HttpAsyncResult.cs: little fixes.
+ * HttpRequest.cs: make Encoding work even with no worker request.
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpWorkerRequest.cs: mcs doesn't go crazy. It's just me, that forgot
+ to add HttpMapPath to the list file...
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpWorkerRequest.cs: fixes compilation with mcs. I will add a bug
+ report when i get a test case.
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs:
+ * HttpCachePolicy.cs:
+ * HttpResponseHeader.cs:
+ * HttpResponseStream.cs:
+ * HttpResponseStreamProxy.cs:
+ * HttpValueCollection.cs: misc. fixes based on class status page.
+
+ * IHttpMapPath.cs: New file.
+
+ * HttpRequest.cs: implemented ContentEncoding.
+ * HttpWorkerRequest.cs: mono-stylized and implemented
+ SendResponseFromMemory.
+
+2002-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpContext.cs: reformatted.
+ * HttpStaticObjectsCollection.cs: implemented GetEnumertor, CopyTo and
+ the indexer.
+
+2002-08-05 Patrik Torstensson <ptorsten@hotmail.com>
+
+ * HttpApplication.cs: Implemented a state machine to allow handling of
+ HttpModules and HttpHandlers. Implementation of async handlers.
+
+ * HttpApplicationFactory.cs: Factory for creating HttpApplication
+ instances, including caching.
+
+ * HttpRuntime.cs: Usage of the new HttpApplicationFactory to get a
+ application instance to execute requests in and implementation of
+ request execution (still no request queue).
+
+ * HttpAsyncResult.cs: New file to handle async module results.
+
+ * HttpRequest.cs: Change signature of Dispose
+ * HttpResponse.cs: new internal method allowing filtering to happen
+ during the request flow in the state machine.
+
+2002-07-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: events were not being initialized.
+
+2002-07-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ProcessModelInfo.cs: fixed compilation.
+
+2002-07-25 Tim Coleman <tim@timcoleman.com>
+ * ProcessModelInfo.cs:
+ New class added
+ * HttpParseException.cs:
+ * HttpCompileException.cs:
+ * HttpUnhandledException.cs:
+ Internal constructors added to these
+
+2002-07-24 Tim Coleman <tim@timcoleman.com>
+ * ProcessInfo.cs:
+ Fix constructor, reference to shutdownreason.
+
+2002-07-24 Tim Coleman <tim@timcoleman.com>
+ * HttpCachePolicy.cs:
+ Added stubbs to this class.
+ * HttpCacheability.cs:
+ * HttpCacheRevalidation.cs:
+ * HttpValidationStatus.cs:
+ * ProcessShutdownReason.cs:
+ * ProcessStatus.cs:
+ * TraceMode.cs:
+ Reorder the enumerations (and in some cases make
+ one-based) in order to agree with the .NET
+ implementation, based on the class status page.
+ * ProcessInfo.cs:
+ Implementation of this class.
+
+2002-07-23 Tim Coleman <tim@timcoleman.com>
+ * HttpCompileException.cs:
+ * HttpParseException.cs:
+ * HttpUnhandledException.cs:
+ New stubbs created.
+ * HttpApplication.cs:
+ * HttpBrowserCapabilities.cs:
+ Added missing methods stubbs and attributes based
+ on the class status page. Also reformatted some
+ source for consistency.
+
+2002-07-23 Tim Coleman <tim@timcoleman.com>
+ * HttpUtility.cs: Moved entities hashtable into main
+ class as a static object, so we don't instantiate
+ a new one every time. Also put the hashtable
+ building into a lock block.
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * HttpUtility.cs: Cleanup of the code, implementation
+ of HtmlDecode/HtmlEncode functions
+
+2002-07-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: quick&dirty hack to make redirection work. Should
+ be out of there once we have SimpleWorkerRequest.
+
+2002-07-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpUtility.cs: little typo, big headache.
+
+2002-07-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRuntime.cs: don't throw NotImplemented in a couple of methods.
+
+2002-06-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web/HttpResponse.cs:
+
+ Fixes based on class status page:
+
+ - Add attributes (DefaultEvent, ParseChildren).
+ - Fix declarations.
+ - Explicitly implement some interfaces (IPostBackDataHandler
+ and IPostBackEventHandler).
+ - Implemented some missing methods.
+
+2002-06-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpContext.cs:
+ (Session): return null instead of throwing an exception.
+
+ * HttpRequest.cs:
+ (HttpMethod): return RequestType if not set.
+ (GetRawContent): return QueryString if we don't have a
+ HttpWorkerRequest.
+
+ * HttpUtility.cs: fixed Decode and Encode.
+
+2002-06-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs:
+ * HttpContext.cs: added System.Web.SessionState namespace.
+
+ * HttpSessionState.cs: removed. It is under
+ System.Web.SessionState.
+
+2002-06-10 Duncan Mak <duncan@ximian.com>
+
+ * HttpBrowserCapabilities.cs (BackgroundSounds): Fixed typo.
+
+2002-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: implemented Browser property.
+
+2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpBrowserCapabilities.cs: stubbed out.
+
+2002-05-18 Miguel de Icaza <miguel@ximian.com>
+
+ * HttpRuntime.cs: Reformat file.
+
+2002-05-07 Duncan Mak <duncan@ximian.com>
+
+ * HttpBrowserCapabilities.cs: Added, replacing
+ HttpBrowserCapabilites because of typo.
+
+ * HttpBrowserCapabilites.cs: Removed, replaced by above.
+
+ * HttpRequest.cs (Browser): Fixed typo.
+
+2002-04-12 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * HttpApplication.cs: Minor updates
+ * HttpApplicationState.cs: Ready.
+ * HttpClientCertificate.cs: Signature updates
+ * HttpValueCollection.cs: ready
+ * HttpStaticObjectsCollection.cs: ready
+ * HttpResponseHeader.cs: made internal only
+ * HttpResponse.cs: Signature updates
+ * HttpPostedFile.cs: ready
+ * HttpCacheVaryByHeaders.cs: ready (except communication to policy)
+ * HttpCacheVaryByParams.cs: ready (except communication to policy)
+
+ System.Web is now over 60% ready..
+
+2002-04-11 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * HttpException.cs: 95% ready, only windows dependent code left
+ * HttpFileCollection.cs: Finished.
+ * HttpRequest.cs: Minor fixes and fixed signature problems
+ * HttpResponse.cs: Implementation of missing methods and signature problems
+ * HttpResponseHeader.cs: Fixed signature problems
+ * HttpRuntime.cs: Fixed signature problems
+ * HttpServerUtility.cs: Added support for HttpApplication
+ * HttpSessionState.cs: Fixed signature issues
+ * HttpUtility.cs: fixed signature issues
+ * HttpValueCollection.cs: Support for cookie parsing and fixed signature issues
+ * HttpWorkerRequest.cs: Fixed small signature issue
+ * HttpWriter.cs: Fixed signature issue
+ * HttpApplication.cs: Basic implementation
+ * HttpApplicationState.cs: Small fixes to support major change comming up
+ * HttpBrowserCapabilities.cs: Added Type method
+ * HttpClientCertificate.cs: Almost ready, needs to parse certificate.
+ * HttpContext.cs: Fixed signature issues and added last methods.
+ * HttpCookie.cs: Full implementation
+ * HttpCookieCollection.cs: Full implementation
+ * TraceContext.cs: Methods implemented.
+ * HttpPostedFile.cs: Placeholder
+ * HttpStaticObjectsCollection.cs: Placeholder
+ * HttpModuleCollection.cs: Ready, will be used during the major revamp.
+
+ * Fixed a number of other small signature problems also (class status page)
+
+
+2002-04-10 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * HttpWorkerRequest.EndOfSendNotification.cs Removed (included in WorkerRequest)
+ * Checkin of all new files (noted in last changenote)
+
+2002-04-10 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * HttpContext.cs: First implementation (basic support, few methods left to impl)
+ * HttpException.cs: Partial implementation (basic support)
+ * HttpHelper.cs: Header parse helper, used by runtime (non public)
+ * HttpRequest.cs: Implementation (all methods there, not all fully impl)
+ * HttpRequestStream.cs: Full implementation
+ * HttpResponse.cs: Partial implementation(almost all methods)
+ * HttpResponseHeader.cs: Header helper
+ * HttpResponseStream.cs: Full implementation - Response stream support
+ * HttpResponseStreamProxy.cs: Implementation - filter support
+ * HttpRuntime.cs: Rewrite to support one IHttpModule (use for testing the runtime)
+ * HttpServerUtility.cs: Implemented usage of HttpContext for methods
+ and moved encoding functions to HttpUtility.
+
+ * HttpUtility.cs: Added encoding/decoding functions from HttpServerUtility and
+ added the Attribute encoding functions.
+
+ * HttpValueCollection.cs: Implementation.
+ * HttpWorkerRequest.cs: Rewrite and implementation of all methods (ready)
+ * HttpWriter.cs: Implementation (with filter support)
+
+ * HttpFileCollection: Added dummy class (placeholder)
+ * HttpApplication.cs: Added dummy class (placeholder)
+ * HttpApplicationState.cs: Added dummy class (placeholder)
+ * HttpBrowserCapabilities.cs: Added dummy class (placeholder)
+ * HtttpCachePolicy.cs: Added dummy class (placeholder)
+ * HttpClientCertificate.cs: Added dummy class (placeholder)
+ * HttpSessionState.cs: Added dummy class (placeholder)
+ * TraceContext.cs: Added dummy class (placeholder)
+
+
+2002/04/10 Nick Drochak <ndrochak@gol.com>
+
+ * HttpServerUtility.cs: Fix build breaker.
+
+2002-03-28 Wictor Wilén <wictor@iBizkit.se>
+
+ * HttpServerUtils.cs : Added some more functionality
+
+2002-03-28 Martin Baulig <martin@gnome.org>
+
+ * HttpServerUtils.cs (UrlDecode): You cannot implicitly cast a
+ char to a string, use ToString() instead.
+
+2002-03-16 Gaurav Vaish <gavish@iitk.ac.in>
+
+ * WebCategoryAttribute.cs
+ : Added private attribute.
+
+2002-03-16 Gaurav Vaish <gavish@iitk.ac.in>
+
+ * HttpRuntime.cs : Stubbed methods for
+ FormatStringResource(...) in agreement with the various
+ overloads available at String.Format(...)
+
+2002-01-08 Gaurav Vaish <gavish@iitk.ac.in>
+
+ * TODOAttribute.cs : Added, as an internal class to the assembly
+
+2002-01-03 Nick Drochak <ndrochak@gol.com>
+
+ * HttpRuntime.cs: remove uneeded exception variable from catch and
+ initialize remaining instance members to avoid compile warnings
+
+2002-01-02 Nick Drochak <ndrochak@gol.com>
+
+ * HttpRuntime.cs: fix spelling error/variable name change.
+
+2001-12-18 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * HttpRuntime.cs : Initial implementation
+
+2001-08-29 Bob Smith <bob@thestuff.net>
+
+ * HttpWorkerRequest.cs: Partial Implementation.
+
+2001-08-16 Bob Smith <bob@thestuff.net>
+
+ * HttpCookieCollection.cs, HttpCookie.cs: Bug fixes.
+
+2001-08-09 Bob Smith <bob@thestuff.net>
+
+ * BeginEventHandler.cs: Implemented.
+ * EndEventHandler.cs: Implemented.
+ * HttpCacheability.cs: Implemented.
+ * HttpCacheRevalidation.cs: Implemented.
+ * HttpCacheValidateHandler.cs: Implemented.
+ * HttpCookieCollection.cs: Implemented.
+ * HttpCookie.cs: Implemented.
+ * HttpValidationStatus.cs: Implemented.
+ * HttpWorkerRequest.EndOfSendNotification.cs: Implemented.
+ * IHttpAsyncHandler.cs: Implemented.
+ * IHttpHandler.cs: Implemented.
+ * IHttpHandlerFactory.cs: Implemented.
+ * IHttpModule.cs: Implemented.
+ * ProcessShutdownReason.cs: Implemented.
+ * ProcessStatus.cs: Implemented.
+ * TraceMode.cs: Implemented.
diff --git a/mcs/class/System.Web/System.Web/EndEventHandler.cs b/mcs/class/System.Web/System.Web/EndEventHandler.cs
new file mode 100644
index 00000000000..496a8e104bf
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/EndEventHandler.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.EndEventHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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.
+//
+
+namespace System.Web
+{
+ public delegate void EndEventHandler(IAsyncResult ar);
+}
diff --git a/mcs/class/System.Web/System.Web/HtmlizedException.cs b/mcs/class/System.Web/System.Web/HtmlizedException.cs
new file mode 100644
index 00000000000..f578ca2694c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HtmlizedException.cs
@@ -0,0 +1,63 @@
+//
+// System.Web.HtmlizedException
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.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;
+using System.IO;
+using System.Text;
+
+namespace System.Web
+{
+ internal abstract class HtmlizedException : Exception
+ {
+ protected HtmlizedException ()
+ {
+ }
+
+ protected HtmlizedException (string message)
+ : base (message)
+ {
+ }
+
+ protected HtmlizedException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ public abstract string Title { get; }
+ public abstract string Description { get; }
+ public abstract string ErrorMessage { get; }
+ public abstract string FileName { get; }
+ public abstract string SourceFile { get; }
+ public abstract string FileText { get; }
+ public abstract int [] ErrorLines { get; }
+ public abstract bool ErrorLinesPaired { get; }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpApplication.cs b/mcs/class/System.Web/System.Web/HttpApplication.cs
new file mode 100644
index 00000000000..68547d35398
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpApplication.cs
@@ -0,0 +1,1617 @@
+//
+// System.Web.HttpApplication
+//
+// Authors:
+// Patrik Torstensson (ptorsten@hotmail.com)
+// Tim Coleman (tim@timcoleman.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) Copyright 2002-2003 Ximian, Inc. (http://www.ximian.com)
+// (c) Copyright 2004 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
+// "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;
+using System.Collections;
+using System.ComponentModel;
+using System.Globalization;
+using System.IO;
+using System.Threading;
+using System.Security.Principal;
+using System.Runtime.Remoting.Messaging;
+using System.Web.UI;
+using System.Web.Configuration;
+using System.Web.SessionState;
+
+namespace System.Web
+{
+
+ [ToolboxItem(true)]
+ public class HttpApplication : IHttpAsyncHandler, IHttpHandler, IComponent, IDisposable
+ {
+
+#region Event Handlers
+
+ // Async event holders
+ AsyncEvents _acquireRequestStateAsync;
+ AsyncEvents _authenticateRequestAsync;
+ AsyncEvents _endRequestAsync;
+ AsyncEvents _beginRequestAsync;
+ AsyncEvents _authorizeRequestAsync;
+ AsyncEvents _updateRequestCacheAsync;
+ AsyncEvents _resolveRequestCacheAsync;
+ AsyncEvents _releaseRequestStateAsync;
+ AsyncEvents _preRequestHandlerExecuteAsync;
+ AsyncEvents _postRequestHandlerExecuteAsync;
+
+ // ID objects used to indentify the event
+ static object AcquireRequestStateId = new Object ();
+ static object AuthenticateRequestId = new Object ();
+ static object DefaultAuthenticationId = new Object ();
+ static object EndRequestId = new Object ();
+ static object DisposedId = new Object ();
+ static object BeginRequestId = new Object ();
+ static object AuthorizeRequestId = new Object ();
+ static object UpdateRequestCacheId = new Object ();
+ static object ResolveRequestCacheId = new Object ();
+ static object ReleaseRequestStateId = new Object ();
+ static object PreSendRequestContentId = new Object ();
+ static object PreSendRequestHeadersId = new Object ();
+ static object PreRequestHandlerExecuteId = new Object ();
+ static object PostRequestHandlerExecuteId = new Object ();
+ static object ErrorId = new Object ();
+
+#if NET_2_0
+ AsyncEvents _postAcquireRequestStateAsync;
+ AsyncEvents _postAuthenticateRequestAsync;
+ AsyncEvents _postAuthorizeRequestAsync;
+ AsyncEvents _postMapRequestHandlerAsync;
+ AsyncEvents _postReleaseRequestStateAsync;
+ AsyncEvents _postResolveRequestCacheAsync;
+ AsyncEvents _postUpdateRequestCacheAsync;
+ AsyncEvents _preAcquireRequestStateAsync;
+ AsyncEvents _preAuthenticateRequestAsync;
+ AsyncEvents _preAuthorizeRequestAsync;
+ AsyncEvents _preMapRequestHandlerAsync;
+ AsyncEvents _preReleaseRequestStateAsync;
+ AsyncEvents _preResolveRequestCacheAsync;
+ AsyncEvents _preUpdateRequestCacheAsync;
+
+ static object PostAcquireRequestStateId = new Object ();
+ static object PostAuthenticateRequestId = new Object ();
+ static object PostAuthorizeRequestId = new Object ();
+ static object PostMapRequestHandlerId = new Object ();
+ static object PostReleaseRequestStateId = new Object ();
+ static object PostResolveRequestCacheId = new Object ();
+ static object PostUpdateRequestCacheId = new Object ();
+ static object PreAcquireRequestStateId = new Object ();
+ static object PreAuthenticateRequestId = new Object ();
+ static object PreAuthorizeRequestId = new Object ();
+ static object PreMapRequestHandlerId = new Object ();
+ static object PreReleaseRequestStateId = new Object ();
+ static object PreResolveRequestCacheId = new Object ();
+ static object PreUpdateRequestCacheId = new Object ();
+#endif
+
+ // List of events
+ private EventHandlerList _Events;
+
+ public event EventHandler AcquireRequestState {
+ add { Events.AddHandler (AcquireRequestStateId, value); }
+ remove { Events.RemoveHandler (AcquireRequestStateId, value); }
+ }
+
+ public event EventHandler AuthenticateRequest {
+ add { Events.AddHandler (AuthenticateRequestId, value); }
+ remove { Events.RemoveHandler (AuthenticateRequestId, value); }
+ }
+
+ public event EventHandler AuthorizeRequest {
+ add { Events.AddHandler (AuthorizeRequestId, value); }
+ remove { Events.RemoveHandler (AuthorizeRequestId, value); }
+ }
+
+ public event EventHandler BeginRequest {
+ add { Events.AddHandler (BeginRequestId, value); }
+ remove { Events.RemoveHandler (BeginRequestId, value); }
+ }
+
+ public event EventHandler Disposed {
+ add { Events.AddHandler (DisposedId, value); }
+ remove { Events.RemoveHandler (DisposedId, value); }
+ }
+
+ public event EventHandler EndRequest {
+ add { Events.AddHandler (EndRequestId, value); }
+ remove { Events.RemoveHandler (EndRequestId, value); }
+ }
+
+ public event EventHandler Error {
+ add { Events.AddHandler (ErrorId, value); }
+ remove { Events.RemoveHandler (ErrorId, value); }
+ }
+
+ public event EventHandler PostRequestHandlerExecute {
+ add { Events.AddHandler (PostRequestHandlerExecuteId, value); }
+ remove { Events.RemoveHandler (PostRequestHandlerExecuteId, value); }
+ }
+
+ public event EventHandler PreRequestHandlerExecute {
+ add { Events.AddHandler (PreRequestHandlerExecuteId, value); }
+ remove { Events.RemoveHandler (PreRequestHandlerExecuteId, value); }
+ }
+
+ public event EventHandler PreSendRequestContent {
+ add { Events.AddHandler (PreSendRequestContentId, value); }
+ remove { Events.RemoveHandler (PreSendRequestContentId, value); }
+ }
+
+ public event EventHandler ReleaseRequestState {
+ add { Events.AddHandler (ReleaseRequestStateId, value); }
+ remove { Events.RemoveHandler (ReleaseRequestStateId, value); }
+ }
+
+ public event EventHandler ResolveRequestCache
+ {
+ add { Events.AddHandler (ResolveRequestCacheId, value); }
+ remove { Events.RemoveHandler (ResolveRequestCacheId, value); }
+ }
+
+ public event EventHandler UpdateRequestCache {
+ add { Events.AddHandler (UpdateRequestCacheId, value); }
+ remove { Events.RemoveHandler (UpdateRequestCacheId, value); }
+ }
+
+ public event EventHandler PreSendRequestHeaders {
+ add { Events.AddHandler (PreSendRequestHeadersId, value); }
+ remove { Events.RemoveHandler (PreSendRequestHeadersId, value); }
+ }
+
+ internal event EventHandler DefaultAuthentication {
+ add { Events.AddHandler (DefaultAuthenticationId, value); }
+ remove { Events.RemoveHandler (DefaultAuthenticationId, value); }
+ }
+
+ public void AddOnAcquireRequestStateAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _acquireRequestStateAsync)
+ _acquireRequestStateAsync = new AsyncEvents ();
+
+ _acquireRequestStateAsync.Add (beg, end);
+ }
+
+ public void AddOnAuthenticateRequestAsync(BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _authenticateRequestAsync)
+ _authenticateRequestAsync = new AsyncEvents ();
+
+ _authenticateRequestAsync.Add (beg, end);
+ }
+
+ public void AddOnAuthorizeRequestAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _authorizeRequestAsync)
+ _authorizeRequestAsync = new AsyncEvents ();
+
+ _authorizeRequestAsync.Add (beg, end);
+ }
+
+ public void AddOnBeginRequestAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _beginRequestAsync)
+ _beginRequestAsync = new AsyncEvents ();
+
+ _beginRequestAsync.Add (beg, end);
+ }
+
+ public void AddOnEndRequestAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _endRequestAsync)
+ _endRequestAsync = new AsyncEvents ();
+
+ _endRequestAsync.Add (beg, end);
+ }
+
+ public void AddOnPostRequestHandlerExecuteAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _postRequestHandlerExecuteAsync)
+ _postRequestHandlerExecuteAsync = new AsyncEvents ();
+
+ _postRequestHandlerExecuteAsync.Add (beg, end);
+ }
+
+ public void AddOnPreRequestHandlerExecuteAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _preRequestHandlerExecuteAsync)
+ _preRequestHandlerExecuteAsync = new AsyncEvents ();
+
+ _preRequestHandlerExecuteAsync.Add (beg, end);
+ }
+
+ public void AddOnReleaseRequestStateAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _releaseRequestStateAsync)
+ _releaseRequestStateAsync = new AsyncEvents ();
+
+ _releaseRequestStateAsync.Add (beg, end);
+ }
+
+ public void AddOnResolveRequestCacheAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _resolveRequestCacheAsync)
+ _resolveRequestCacheAsync = new AsyncEvents ();
+
+ _resolveRequestCacheAsync.Add (beg, end);
+ }
+
+ public void AddOnUpdateRequestCacheAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _updateRequestCacheAsync)
+ _updateRequestCacheAsync = new AsyncEvents ();
+
+ _updateRequestCacheAsync.Add (beg, end);
+ }
+
+#if NET_2_0
+ public event EventHandler PostAcquireRequestState {
+ add { Events.AddHandler (PostAcquireRequestStateId, value); }
+ remove { Events.RemoveHandler (PostAcquireRequestStateId, value); }
+ }
+
+ public event EventHandler PostAuthenticateRequest {
+ add { Events.AddHandler (PostAuthenticateRequestId, value); }
+ remove { Events.RemoveHandler (PostAuthenticateRequestId, value); }
+ }
+
+ public event EventHandler PostAuthorizeRequest {
+ add { Events.AddHandler (PostAuthorizeRequestId, value); }
+ remove { Events.RemoveHandler (PostAuthorizeRequestId, value); }
+ }
+
+ public event EventHandler PostMapRequestHandler {
+ add { Events.AddHandler (PostMapRequestHandlerId, value); }
+ remove { Events.RemoveHandler (PostMapRequestHandlerId, value); }
+ }
+
+ public event EventHandler PostReleaseRequestState {
+ add { Events.AddHandler (PostReleaseRequestStateId, value); }
+ remove { Events.RemoveHandler (PostReleaseRequestStateId, value); }
+ }
+
+ public event EventHandler PostResolveRequestCache {
+ add { Events.AddHandler (PostResolveRequestCacheId, value); }
+ remove { Events.RemoveHandler (PostResolveRequestCacheId, value); }
+ }
+
+ public event EventHandler PostUpdateRequestCache {
+ add { Events.AddHandler (PostUpdateRequestCacheId, value); }
+ remove { Events.RemoveHandler (PostUpdateRequestCacheId, value); }
+ }
+
+ public void AddOnAcquireRequestStateAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _acquireRequestStateAsync)
+ _acquireRequestStateAsync = new AsyncEvents ();
+
+ _acquireRequestStateAsync.Add (beg, end, state);
+ }
+
+ public void AddOnAuthenticateRequestAsync(BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _authenticateRequestAsync)
+ _authenticateRequestAsync = new AsyncEvents ();
+
+ _authenticateRequestAsync.Add (beg, end, state);
+ }
+
+ public void AddOnAuthorizeRequestAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _authorizeRequestAsync)
+ _authorizeRequestAsync = new AsyncEvents ();
+
+ _authorizeRequestAsync.Add (beg, end, state);
+ }
+
+ public void AddOnBeginRequestAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _beginRequestAsync)
+ _beginRequestAsync = new AsyncEvents ();
+
+ _beginRequestAsync.Add (beg, end, state);
+ }
+
+ public void AddOnEndRequestAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _endRequestAsync)
+ _endRequestAsync = new AsyncEvents ();
+
+ _endRequestAsync.Add (beg, end, state);
+ }
+
+ public void AddOnPostAcquireRequestStateAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ AddOnPostAcquireRequestStateAsync (beg, end, null);
+ }
+
+ public void AddOnPostAcquireRequestStateAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _postAcquireRequestStateAsync)
+ _postAcquireRequestStateAsync = new AsyncEvents ();
+
+ _postAcquireRequestStateAsync.Add (beg, end, state);
+ }
+
+ public void AddOnPostAuthenticateRequestAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ AddOnPostAuthenticateRequestAsync (beg, end, null);
+ }
+
+ public void AddOnPostAuthenticateRequestAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _postAuthenticateRequestAsync)
+ _postAuthenticateRequestAsync = new AsyncEvents ();
+
+ _postAuthenticateRequestAsync.Add (beg, end, state);
+ }
+
+ public void AddOnPostAuthorizeRequestAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ AddOnPostAuthorizeRequestAsync (beg, end, null);
+ }
+
+ public void AddOnPostAuthorizeRequestAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _postAuthorizeRequestAsync)
+ _postAuthorizeRequestAsync = new AsyncEvents ();
+
+ _postAuthorizeRequestAsync.Add (beg, end, state);
+ }
+
+ public void AddOnPostMapRequestHandlerAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ AddOnPostMapRequestHandlerAsync (beg, end, null);
+ }
+
+ public void AddOnPostMapRequestHandlerAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _postMapRequestHandlerAsync)
+ _postMapRequestHandlerAsync = new AsyncEvents ();
+
+ _postMapRequestHandlerAsync.Add (beg, end, state);
+ }
+
+ public void AddOnPostReleaseRequestStateAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ AddOnPostReleaseRequestStateAsync (beg, end, null);
+ }
+
+ public void AddOnPostReleaseRequestStateAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _postReleaseRequestStateAsync)
+ _postReleaseRequestStateAsync = new AsyncEvents ();
+
+ _postReleaseRequestStateAsync.Add (beg, end, state);
+ }
+
+ public void AddOnPostRequestHandlerExecuteAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _postRequestHandlerExecuteAsync)
+ _postRequestHandlerExecuteAsync = new AsyncEvents ();
+
+ _postRequestHandlerExecuteAsync.Add (beg, end, state);
+ }
+
+ public void AddOnPostResolveRequestCacheAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ AddOnPostResolveRequestCacheAsync (beg, end, null);
+ }
+
+ public void AddOnPostResolveRequestCacheAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _postResolveRequestCacheAsync)
+ _postResolveRequestCacheAsync = new AsyncEvents ();
+
+ _postResolveRequestCacheAsync.Add (beg, end, state);
+ }
+
+ public void AddOnPostUpdateRequestCacheAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ AddOnPostUpdateRequestCacheAsync (beg, end, null);
+ }
+
+ public void AddOnPostUpdateRequestCacheAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _postUpdateRequestCacheAsync)
+ _postUpdateRequestCacheAsync = new AsyncEvents ();
+
+ _postUpdateRequestCacheAsync.Add (beg, end, state);
+ }
+
+ public void AddOnPreAcquireRequestStateAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ AddOnPreAcquireRequestStateAsync (beg, end, null);
+ }
+
+ public void AddOnPreAcquireRequestStateAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _preAcquireRequestStateAsync)
+ _preAcquireRequestStateAsync = new AsyncEvents ();
+
+ _preAcquireRequestStateAsync.Add (beg, end, state);
+ }
+
+ public void AddOnPreAuthenticateRequestAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ AddOnPreAuthenticateRequestAsync (beg, end, null);
+ }
+
+ public void AddOnPreAuthenticateRequestAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _preAuthenticateRequestAsync)
+ _preAuthenticateRequestAsync = new AsyncEvents ();
+
+ _preAuthenticateRequestAsync.Add (beg, end, state);
+ }
+
+ public void AddOnPreAuthorizeRequestAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ AddOnPreAuthorizeRequestAsync (beg, end, null);
+ }
+
+ public void AddOnPreAuthorizeRequestAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _preAuthorizeRequestAsync)
+ _preAuthorizeRequestAsync = new AsyncEvents ();
+
+ _preAuthorizeRequestAsync.Add (beg, end, state);
+ }
+
+ public void AddOnPreMapRequestHandlerAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ AddOnPreMapRequestHandlerAsync (beg, end, null);
+ }
+
+ public void AddOnPreMapRequestHandlerAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _preMapRequestHandlerAsync)
+ _preMapRequestHandlerAsync = new AsyncEvents ();
+
+ _preMapRequestHandlerAsync.Add (beg, end, state);
+ }
+
+ public void AddOnPreReleaseRequestStateAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ AddOnPreReleaseRequestStateAsync (beg, end, null);
+ }
+
+ public void AddOnPreReleaseRequestStateAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _preReleaseRequestStateAsync)
+ _preReleaseRequestStateAsync = new AsyncEvents ();
+
+ _preReleaseRequestStateAsync.Add (beg, end, state);
+ }
+
+ public void AddOnPreRequestHandlerExecuteAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _preRequestHandlerExecuteAsync)
+ _preRequestHandlerExecuteAsync = new AsyncEvents ();
+
+ _preRequestHandlerExecuteAsync.Add (beg, end, state);
+ }
+
+ public void AddOnPreResolveRequestCacheAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ AddOnPreResolveRequestCacheAsync (beg, end, null);
+ }
+
+ public void AddOnPreResolveRequestCacheAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _preResolveRequestCacheAsync)
+ _preResolveRequestCacheAsync = new AsyncEvents ();
+
+ _preResolveRequestCacheAsync.Add (beg, end, state);
+ }
+
+ public void AddOnPreUpdateRequestCacheAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ AddOnPreUpdateRequestCacheAsync (beg, end, null);
+ }
+
+ public void AddOnPreUpdateRequestCacheAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _preUpdateRequestCacheAsync)
+ _preUpdateRequestCacheAsync = new AsyncEvents ();
+
+ _preUpdateRequestCacheAsync.Add (beg, end, state);
+ }
+
+ public void AddOnReleaseRequestStateAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _releaseRequestStateAsync)
+ _releaseRequestStateAsync = new AsyncEvents ();
+
+ _releaseRequestStateAsync.Add (beg, end, state);
+ }
+
+ public void AddOnResolveRequestCacheAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _resolveRequestCacheAsync)
+ _resolveRequestCacheAsync = new AsyncEvents ();
+
+ _resolveRequestCacheAsync.Add (beg, end, state);
+ }
+
+ public void AddOnUpdateRequestCacheAsync (BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ if (null == _updateRequestCacheAsync)
+ _updateRequestCacheAsync = new AsyncEvents ();
+
+ _updateRequestCacheAsync.Add (beg, end, state);
+ }
+#endif
+
+
+#endregion
+
+#region Recycle Helper
+ class HandlerFactory
+ {
+ public IHttpHandler Handler;
+ public IHttpHandlerFactory Factory;
+
+ public HandlerFactory (IHttpHandler handler, IHttpHandlerFactory factory)
+ {
+ this.Handler = handler;
+ this.Factory = factory;
+ }
+ }
+#endregion
+
+#region State Machine
+
+ interface IStateHandler
+ {
+ void Execute();
+ bool CompletedSynchronously { get; }
+ bool PossibleToTimeout { get; }
+ }
+
+ class EventState : IStateHandler
+ {
+ HttpApplication _app;
+ EventHandler _event;
+
+ public EventState (HttpApplication app, EventHandler evt)
+ {
+ _app = app;
+ _event = evt;
+ }
+
+ public void Execute ()
+ {
+ if (null != _event)
+ _event (_app, EventArgs.Empty);
+ }
+
+ public bool CompletedSynchronously {
+ get { return true; }
+ }
+
+ public bool PossibleToTimeout {
+ get { return true; }
+ }
+ }
+
+ class AsyncEventState : IStateHandler
+ {
+ HttpApplication _app;
+ BeginEventHandler _begin;
+ EndEventHandler _end;
+ AsyncCallback _callback;
+ bool _async;
+ object _state;
+
+ public AsyncEventState (HttpApplication app,
+ BeginEventHandler begin,
+ EndEventHandler end,
+ object state)
+ {
+ _async = false;
+ _app = app;
+ _begin = begin;
+ _end = end;
+ _callback = new AsyncCallback (OnAsyncReady);
+ }
+
+ public void Execute ()
+ {
+ _async = true;
+ IAsyncResult ar = _begin (_app, EventArgs.Empty, _callback, _state);
+ if (ar.CompletedSynchronously) {
+ _async = false;
+ _end (ar);
+ }
+ }
+
+ public bool CompletedSynchronously {
+ get { return !_async; }
+ }
+
+ public bool PossibleToTimeout {
+ get {
+ // We can't cancel a async event
+ return false;
+ }
+ }
+
+ private void OnAsyncReady (IAsyncResult ar)
+ {
+ if (ar.CompletedSynchronously)
+ return;
+
+ Exception error = null;
+
+ try {
+ // Invoke end handler
+ _end(ar);
+ } catch (Exception exc) {
+ // Flow this error to the next state (handle during state execution)
+ error = exc;
+ }
+
+ _app._state.ExecuteNextAsync (error);
+ }
+ }
+
+ class AsyncEvents
+ {
+ ArrayList _events;
+ class EventRecord {
+ public EventRecord(BeginEventHandler beg, EndEventHandler end, object state)
+ {
+ Begin = beg;
+ End = end;
+ State = state;
+ }
+
+ public BeginEventHandler Begin;
+ public EndEventHandler End;
+ public object State;
+ }
+
+ public AsyncEvents ()
+ {
+ _events = new ArrayList ();
+ }
+
+ public void Add (BeginEventHandler begin, EndEventHandler end)
+ {
+ _events.Add (new EventRecord (begin, end, null));
+ }
+
+ public void Add (BeginEventHandler begin, EndEventHandler end, object state)
+ {
+ _events.Add (new EventRecord (begin, end, state));
+ }
+
+ public void GetAsStates (HttpApplication app, ArrayList states)
+ {
+ foreach (object obj in _events)
+ states.Add (new AsyncEventState (app,
+ ((EventRecord) obj).Begin,
+ ((EventRecord) obj).End,
+ ((EventRecord) obj).State));
+ }
+ }
+
+
+ class ExecuteHandlerState : IStateHandler
+ {
+ HttpApplication _app;
+ AsyncCallback _callback;
+ IHttpAsyncHandler _handler;
+ bool _async;
+
+ public ExecuteHandlerState (HttpApplication app)
+ {
+ _app = app;
+ _callback = new AsyncCallback (OnAsyncReady);
+ }
+
+ private void OnAsyncReady (IAsyncResult ar)
+ {
+ if (ar.CompletedSynchronously)
+ return;
+
+ Exception error = null;
+
+ try {
+ // Invoke end handler
+ _handler.EndProcessRequest(ar);
+ } catch (Exception exc) {
+ // Flow this error to the next state (handle during state execution)
+ error = exc;
+ }
+
+ _handler = null;
+ _app._state.ExecuteNextAsync (error);
+ }
+
+ public void Execute ()
+ {
+ IHttpHandler handler = _app.Context.Handler;
+ if (handler == null)
+ return;
+
+ // Check if we can execute async
+ if (handler is IHttpAsyncHandler) {
+ _async = true;
+ _handler = (IHttpAsyncHandler) handler;
+
+ IAsyncResult ar = _handler.BeginProcessRequest (_app.Context,
+ _callback,
+ null);
+
+ if (ar.CompletedSynchronously) {
+ _async = false;
+ _handler = null;
+ ((IHttpAsyncHandler) handler).EndProcessRequest (ar);
+ }
+ } else {
+ _async = false;
+
+ // Sync handler
+ handler.ProcessRequest (_app.Context);
+ }
+ }
+
+ public bool CompletedSynchronously {
+ get { return !_async; }
+ }
+
+ public bool PossibleToTimeout {
+ get {
+ if (_app.Context.Handler is IHttpAsyncHandler)
+ return false;
+
+ return true;
+ }
+ }
+ }
+
+ class CreateHandlerState : IStateHandler
+ {
+ HttpApplication _app;
+
+ public CreateHandlerState (HttpApplication app)
+ {
+ _app = app;
+ }
+
+ public void Execute ()
+ {
+ _app.Context.Handler = _app.CreateHttpHandler ( _app.Context,
+ _app.Request.RequestType,
+ _app.Request.FilePath,
+ _app.Request.PhysicalPath);
+ }
+
+ public bool CompletedSynchronously {
+ get { return true; }
+ }
+
+ public bool PossibleToTimeout {
+ get { return false; }
+ }
+ }
+
+ class FilterHandlerState : IStateHandler
+ {
+ HttpApplication _app;
+
+ public FilterHandlerState (HttpApplication app)
+ {
+ _app = app;
+ }
+
+ public void Execute ()
+ {
+ _app.Context.Response.DoFilter (true);
+ }
+
+ public bool CompletedSynchronously {
+ get { return true; }
+ }
+
+ public bool PossibleToTimeout {
+ get { return true; }
+ }
+ }
+
+ class StateMachine
+ {
+ HttpApplication _app;
+ WaitCallback _asynchandler;
+
+ IStateHandler [] _handlers;
+ int _currentStateIdx;
+ int _endStateIdx;
+ int _endRequestStateIdx;
+ int _countSteps;
+ int _countSyncSteps;
+
+ // Helper to create the states for a normal event
+ private void GetAsStates (object Event, ArrayList states)
+ {
+ // Get list of clients for the sync events
+ Delegate evnt = _app.Events [Event];
+ if (evnt == null)
+ return;
+
+ System.Delegate [] clients = evnt.GetInvocationList();
+ foreach (Delegate client in clients)
+ states.Add (new EventState (_app, (EventHandler) client));
+ }
+
+ internal StateMachine (HttpApplication app)
+ {
+ _app = app;
+ }
+
+ internal void Init ()
+ {
+ _asynchandler = new WaitCallback (OnAsyncCallback);
+
+ // Create a arraylist of states to execute
+ ArrayList states = new ArrayList ();
+
+ // BeginRequest
+ if (null != _app._beginRequestAsync)
+ _app._beginRequestAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.BeginRequestId, states);
+
+#if NET_2_0
+ // PreAuthenticateRequest
+ if (null != _app._preAuthenticateRequestAsync)
+ _app._preAuthenticateRequestAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PreAuthenticateRequestId, states);
+#endif
+
+ // AuthenticateRequest
+ if (null != _app._authenticateRequestAsync)
+ _app._authenticateRequestAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.AuthenticateRequestId, states);
+
+ // DefaultAuthentication
+ EventHandler defaultAuthHandler = (EventHandler) _app.Events [HttpApplication.DefaultAuthenticationId];
+ states.Add (new EventState (_app, defaultAuthHandler));
+
+#if NET_2_0
+ // PostAuthenticateRequest
+ if (null != _app._postAuthenticateRequestAsync)
+ _app._postAuthenticateRequestAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PostAuthenticateRequestId, states);
+
+ // PreAuthorizeRequest
+ if (null != _app._preAuthorizeRequestAsync)
+ _app._preAuthorizeRequestAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PreAuthorizeRequestId, states);
+#endif
+
+ // AuthorizeRequest
+ if (null != _app._authorizeRequestAsync)
+ _app._authorizeRequestAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.AuthorizeRequestId, states);
+
+#if NET_2_0
+ // PostAuthorizeRequest
+ if (null != _app._postAuthorizeRequestAsync)
+ _app._postAuthorizeRequestAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PostAuthorizeRequestId, states);
+
+ // PreResolveRequestCache
+ if (null != _app._preResolveRequestCacheAsync)
+ _app._preResolveRequestCacheAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PreResolveRequestCacheId, states);
+#endif
+
+ // ResolveRequestCache
+ if (null != _app._resolveRequestCacheAsync)
+ _app._resolveRequestCacheAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.ResolveRequestCacheId, states);
+
+#if NET_2_0
+ // PostResolveRequestCache
+ if (null != _app._postResolveRequestCacheAsync)
+ _app._postResolveRequestCacheAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PostResolveRequestCacheId, states);
+
+ // PreMapRequestHandler
+ if (null != _app._preMapRequestHandlerAsync)
+ _app._preMapRequestHandlerAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PreMapRequestHandlerId, states);
+#endif
+
+ // [A handler (a page corresponding to the request URL) is created at this point.]
+ states.Add (new CreateHandlerState (_app));
+
+#if NET_2_0
+ // PostMapRequestHandler
+ if (null != _app._postMapRequestHandlerAsync)
+ _app._postMapRequestHandlerAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PostMapRequestHandlerId, states);
+
+ // PreAcquireRequestState
+ if (null != _app._preAcquireRequestStateAsync)
+ _app._preAcquireRequestStateAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PreAcquireRequestStateId, states);
+#endif
+
+ // AcquireRequestState
+ if (null != _app._acquireRequestStateAsync)
+ _app._acquireRequestStateAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.AcquireRequestStateId, states);
+
+#if NET_2_0
+ // PostAcquireRequestState
+ if (null != _app._postAcquireRequestStateAsync)
+ _app._postAcquireRequestStateAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PostAcquireRequestStateId, states);
+#endif
+
+ // PreRequestHandlerExecute
+ if (null != _app._preRequestHandlerExecuteAsync)
+ _app._preRequestHandlerExecuteAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PreRequestHandlerExecuteId, states);
+
+ // [The handler is executed.]
+ states.Add (new ExecuteHandlerState (_app));
+
+ // PostRequestHandlerExecute
+ if (null != _app._postRequestHandlerExecuteAsync)
+ _app._postRequestHandlerExecuteAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PostRequestHandlerExecuteId, states);
+
+#if NET_2_0
+ // PreReleaseRequestState
+ if (null != _app._preReleaseRequestStateAsync)
+ _app._preReleaseRequestStateAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PreReleaseRequestStateId, states);
+#endif
+
+ // ReleaseRequestState
+ if (null != _app._releaseRequestStateAsync)
+ _app._releaseRequestStateAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.ReleaseRequestStateId, states);
+
+#if NET_2_0
+ // PostReleaseRequestState
+ if (null != _app._postReleaseRequestStateAsync)
+ _app._postReleaseRequestStateAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PostReleaseRequestStateId, states);
+#endif
+
+ // [Response filters, if any, filter the output.]
+ states.Add (new FilterHandlerState (_app));
+
+#if NET_2_0
+ // PreUpdateRequestCache
+ if (null != _app._preUpdateRequestCacheAsync)
+ _app._preUpdateRequestCacheAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PreUpdateRequestCacheId, states);
+#endif
+
+ // UpdateRequestCache
+ if (null != _app._updateRequestCacheAsync)
+ _app._updateRequestCacheAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.UpdateRequestCacheId, states);
+
+#if NET_2_0
+ // PostUpdateRequestCache
+ if (null != _app._postUpdateRequestCacheAsync)
+ _app._postUpdateRequestCacheAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PostUpdateRequestCacheId, states);
+#endif
+
+ // EndRequest
+ _endRequestStateIdx = states.Count;
+ if (null != _app._endRequestAsync)
+ _app._endRequestAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.EndRequestId, states);
+
+ // Make list ready to execute
+ _handlers = new IStateHandler [states.Count];
+ states.CopyTo (_handlers);
+ }
+
+
+ internal void Reset ()
+ {
+ _countSyncSteps = 0;
+ _countSteps = 0;
+ _currentStateIdx = -1;
+ _endStateIdx = _handlers.Length - 1;
+ }
+
+ internal void Start ()
+ {
+ Reset ();
+ ExecuteNextAsync (null);
+ }
+
+ internal void ExecuteNextAsync (Exception lasterror)
+ {
+ if (!Thread.CurrentThread.IsThreadPoolThread)
+ ThreadPool.QueueUserWorkItem (_asynchandler, lasterror);
+ else
+ ExecuteNext (lasterror);
+ }
+
+ internal void ExecuteNext (Exception lasterror)
+ {
+ bool ready_sync = false;
+ IStateHandler handler;
+
+ lock (_app) {
+ _app.OnStateExecuteEnter ();
+ try {
+ do {
+ if (null != lasterror) {
+ _app.HandleError (lasterror);
+ lasterror = null;
+ }
+
+ // Check if request flow is to be stopped
+ if ((_app.GetLastError () != null || _app._CompleteRequest) &&
+ _currentStateIdx < _endRequestStateIdx) {
+ _currentStateIdx = _endRequestStateIdx;
+ // MS does not filter on error
+ _app._Context.Response.DoFilter (false);
+ } else if (_currentStateIdx < _endStateIdx) {
+ // Get next state handler
+ _currentStateIdx++;
+ }
+
+ if (_currentStateIdx >= _handlers.Length) {
+ _currentStateIdx = _endStateIdx;
+ break;
+ }
+
+ handler = _handlers [_currentStateIdx];
+ _countSteps++;
+ lasterror = ExecuteState (handler, ref ready_sync);
+ if (ready_sync)
+ _countSyncSteps++;
+ } while (_currentStateIdx < _endStateIdx);
+
+ if (null != lasterror)
+ _app.HandleError (lasterror);
+ } finally {
+ _app.OnStateExecuteLeave ();
+ }
+ }
+
+ // Finish the request off..
+ if (lasterror != null || _currentStateIdx == _endStateIdx) {
+ _app._asyncWebResult.Complete ((_countSyncSteps == _countSteps),
+ null,
+ null);
+
+ _app.Context.Handler = null;
+ _app.Context.ApplicationInstance = null;
+ _app.RecycleHandlers ();
+ _app._asyncWebResult = null;
+
+ HttpApplicationFactory.RecycleInstance (_app);
+ }
+ }
+
+ private void OnAsyncCallback (object obj)
+ {
+ ExecuteNext ((Exception) obj);
+ }
+
+ private Exception ExecuteState (IStateHandler state, ref bool readysync)
+ {
+ Exception lasterror = null;
+ try {
+ if (state.PossibleToTimeout) {
+ _app.Context.BeginTimeoutPossible ();
+ }
+
+ try {
+ state.Execute ();
+ } finally {
+ if (state.PossibleToTimeout) {
+ _app.Context.EndTimeoutPossible ();
+ }
+ }
+
+ if (state.PossibleToTimeout) {
+ // Async Execute
+ _app.Context.TryWaitForTimeout ();
+ }
+
+ readysync = state.CompletedSynchronously;
+ } catch (ThreadAbortException obj) {
+ object o = obj.ExceptionState;
+ Type type = (o != null) ? o.GetType () : null;
+ if (type == typeof (StepTimeout)) {
+ Thread.ResetAbort ();
+ lasterror = new HttpException ("The request timed out.");
+ _app.CompleteRequest ();
+ } else if (type == typeof (StepCompleteRequest)) {
+ Thread.ResetAbort ();
+ _app.CompleteRequest ();
+ }
+ } catch (Exception obj) {
+ lasterror = obj;
+ }
+
+ return lasterror;
+ }
+ }
+
+#endregion
+
+#region Fields
+
+ StateMachine _state;
+
+ bool _CompleteRequest;
+ HttpContext _Context;
+ Exception _lastError;
+
+ HttpContext _savedContext;
+ IPrincipal _savedUser;
+ HttpAsyncResult _asyncWebResult;
+
+ ISite _Site;
+ HttpModuleCollection _ModuleCollection;
+ HttpSessionState _Session;
+ HttpApplicationState _appState;
+ string assemblyLocation;
+ ArrayList _recycleHandlers;
+
+ bool _InPreRequestResponseMode;
+
+ CultureInfo appCulture;
+ CultureInfo appUICulture;
+ CultureInfo prevAppCulture;
+ CultureInfo prevAppUICulture;
+#endregion
+
+#region Constructor
+
+ public HttpApplication ()
+ {
+ assemblyLocation = GetType ().Assembly.Location;
+ }
+
+#endregion
+
+#region Methods
+ internal IHttpHandler CreateHttpHandler (HttpContext context,
+ string type,
+ string file,
+ string path)
+ {
+ HandlerFactoryConfiguration handler =
+ HttpContext.GetAppConfig ("system.web/httpHandlers")
+ as HandlerFactoryConfiguration;
+
+ if (handler == null)
+ throw new HttpException ("Cannot get system.web/httpHandlers handler.");
+
+ object result = handler.FindHandler (type, file).GetInstance ();
+ if (result is IHttpHandler)
+ return (IHttpHandler) result;
+
+ if (result is IHttpHandlerFactory) {
+ IHttpHandlerFactory factory = (IHttpHandlerFactory) result;
+ try {
+ IHttpHandler ret = factory.GetHandler (context, type, file, path);
+ if (null != ret) {
+ if (null == _recycleHandlers)
+ _recycleHandlers = new ArrayList();
+
+ _recycleHandlers.Add (new HandlerFactory (ret, factory));
+ }
+
+ return ret;
+ } catch (DirectoryNotFoundException) {
+ throw new HttpException (404, "Cannot find '" + file + "'.");
+ } catch (FileNotFoundException fnf) {
+ string fname = fnf.FileName;
+ if (fname != null && fname != "") {
+ file = Path.GetFileName (fname);
+ }
+
+ throw new HttpException (404, "Cannot find '" + file + "'.");
+ }
+ }
+
+ throw new HttpException ("Handler not found");
+ }
+
+ internal void RecycleHandlers ()
+ {
+ if (null == _recycleHandlers || _recycleHandlers.Count == 0)
+ return;
+
+ foreach (HandlerFactory item in _recycleHandlers)
+ item.Factory.ReleaseHandler (item.Handler);
+
+ _recycleHandlers.Clear ();
+ }
+
+ internal void InitModules ()
+ {
+ ModulesConfiguration modules;
+
+ modules = (ModulesConfiguration) HttpContext.GetAppConfig ("system.web/httpModules");
+ if (null == modules)
+ throw new HttpException (
+ HttpRuntime.FormatResourceString ("missing_modules_config"));
+
+ _ModuleCollection = modules.CreateCollection ();
+ if (_ModuleCollection == null)
+ return;
+
+ int pos, count;
+
+ count = _ModuleCollection.Count;
+ for (pos = 0; pos != count; pos++)
+ ((IHttpModule) _ModuleCollection.Get (pos)).Init (this);
+ }
+
+ internal void InitCulture ()
+ {
+ GlobalizationConfiguration cfg = GlobalizationConfiguration.GetInstance (null);
+ if (cfg != null) {
+ appCulture = cfg.Culture;
+ appUICulture = cfg.UICulture;
+ }
+ }
+
+ void SaveThreadCulture ()
+ {
+ Thread th = Thread.CurrentThread;
+
+ if (appCulture != null) {
+ prevAppCulture = th.CurrentCulture;
+ th.CurrentCulture = appCulture;
+ }
+
+ if (appUICulture != null) {
+ prevAppUICulture = th.CurrentUICulture;
+ th.CurrentUICulture = appUICulture;
+ }
+ }
+
+ void RestoreThreadCulture ()
+ {
+ Thread th = Thread.CurrentThread;
+
+ if (prevAppCulture != null) {
+ th.CurrentCulture = prevAppCulture;
+ prevAppCulture = null;
+ }
+
+ if (prevAppUICulture != null) {
+ th.CurrentUICulture = prevAppUICulture;
+ prevAppUICulture = null;
+ }
+ }
+
+ internal void OnStateExecuteEnter ()
+ {
+ InitCulture ();
+ SaveThreadCulture ();
+ _savedContext = HttpContext.Context;
+ HttpContext.Context = _Context;
+ HttpRuntime.TimeoutManager.Add (_Context);
+ SetPrincipal (Context.User);
+ }
+
+ internal void OnStateExecuteLeave ()
+ {
+ RestoreThreadCulture ();
+ HttpRuntime.TimeoutManager.Remove (_Context);
+ HttpContext.Context = _savedContext;
+ RestorePrincipal ();
+ }
+
+ internal void SetPrincipal (IPrincipal principal)
+ {
+ // Don't overwrite _savedUser if called from inside a step
+ if (_savedUser == null)
+ _savedUser = Thread.CurrentPrincipal;
+
+ Thread.CurrentPrincipal = principal;
+ }
+
+ internal void RestorePrincipal ()
+ {
+ if (_savedUser == null)
+ return;
+
+ Thread.CurrentPrincipal = _savedUser;
+ _savedUser = null;
+ }
+
+ internal void ClearError ()
+ {
+ _lastError = null;
+ }
+
+ internal Exception GetLastError ()
+ {
+ if (_Context == null)
+ return _lastError;
+
+ return _Context.Error;
+ }
+
+ internal void HandleError (Exception obj)
+ {
+ EventHandler handler;
+ bool fire = true;
+
+ if (null != _Context) {
+ if (null != _Context.Error)
+ fire = false;
+
+ _Context.AddError (obj);
+ } else {
+ if (null != _lastError)
+ fire = false;
+
+ _lastError = obj;
+ }
+
+ if (!fire)
+ return;
+
+ // Fire OnError event here
+ handler = (EventHandler) Events [HttpApplication.ErrorId];
+ if (null != handler) {
+ try {
+ handler (this, EventArgs.Empty);
+ } catch (Exception excp) {
+ if (null != _Context)
+ _Context.AddError (excp);
+ }
+ }
+ }
+
+ internal void Startup (HttpContext context, HttpApplicationState state)
+ {
+ _Context = context;
+
+ _appState = state;
+ _state = new StateMachine (this);
+
+ // Initialize all IHttpModule(s)
+ InitModules ();
+ HttpApplicationFactory.AttachEvents (this);
+ InitCulture ();
+
+ // Initialize custom application
+ _InPreRequestResponseMode = true;
+ try {
+ Init ();
+ } catch (Exception obj) {
+ HandleError (obj);
+ }
+
+ _InPreRequestResponseMode = false;
+
+ _state.Init ();
+ }
+
+ internal void Cleanup ()
+ {
+ try {
+ Dispose ();
+ } catch (Exception obj) {
+ HandleError (obj);
+ }
+
+ if (null != _ModuleCollection) {
+ int pos;
+ int count = _ModuleCollection.Count;
+
+ for (pos = 0; pos != count; pos++)
+ ((IHttpModule) _ModuleCollection.Get (pos)).Dispose ();
+
+ _ModuleCollection = null;
+ }
+
+ _state = null;
+ }
+
+ public void CompleteRequest ()
+ {
+ _CompleteRequest = true;
+ }
+
+ public virtual void Dispose ()
+ {
+ _Site = null;
+ EventHandler disposed = (EventHandler) Events [HttpApplication.DisposedId];
+ if (null != disposed)
+ disposed (this, EventArgs.Empty);
+ }
+
+ public virtual void Init ()
+ {
+ }
+
+ public virtual string GetVaryByCustomString (HttpContext context, string custom)
+ {
+ if (custom.ToLower () == "browser")
+ return context.Request.Browser.Type;
+
+ return null;
+ }
+
+ IAsyncResult IHttpAsyncHandler.BeginProcessRequest (HttpContext context,
+ AsyncCallback cb,
+ object extraData)
+ {
+ _Context = context;
+ _Context.ApplicationInstance = this;
+ _CompleteRequest = false;
+
+ _asyncWebResult = new HttpAsyncResult (cb, extraData);
+
+ _state.Start ();
+
+ return _asyncWebResult;
+ }
+
+ void IHttpAsyncHandler.EndProcessRequest (IAsyncResult result)
+ {
+ HttpAsyncResult ar = (HttpAsyncResult) result;
+
+ if (null != ar.Error)
+ throw ar.Error;
+ }
+
+ void IHttpHandler.ProcessRequest (HttpContext context)
+ {
+ throw new NotSupportedException (HttpRuntime.FormatResourceString("sync_not_supported"));
+ }
+
+ bool IHttpHandler.IsReusable {
+ get { return true; }
+ }
+#endregion
+
+#region Properties
+
+ internal string AssemblyLocation {
+ get { return assemblyLocation; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpApplicationState Application {
+ get { return _appState; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpContext Context {
+ get { return _Context; }
+ }
+
+ protected EventHandlerList Events {
+ get {
+ if (null == _Events)
+ _Events = new EventHandlerList ();
+
+ return _Events;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpModuleCollection Modules {
+ get {
+ if (null == _ModuleCollection)
+ _ModuleCollection = new HttpModuleCollection ();
+
+ return _ModuleCollection;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpRequest Request {
+ get {
+ if (null != _Context && (!_InPreRequestResponseMode))
+ return _Context.Request;
+
+ throw new HttpException ("Can't get request object");
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpResponse Response {
+ get {
+ if (null != _Context && (!_InPreRequestResponseMode))
+ return _Context.Response;
+
+ throw new HttpException ("Can't get response object");
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpServerUtility Server {
+ get {
+ if (null != _Context)
+ return _Context.Server;
+
+ return new HttpServerUtility (this);
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpSessionState Session {
+ get {
+ if (null != _Session)
+ return _Session;
+
+ if (null != _Context && null != _Context.Session)
+ return _Context.Session;
+
+ throw new HttpException ("Failed to get session object");
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public IPrincipal User {
+ get { return _Context.User; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public ISite Site {
+ get { return _Site; }
+ set { _Site = value; }
+ }
+#endregion Properties
+ }
+
+ // Used in HttpResponse.End ()
+ class StepCompleteRequest
+ {
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs b/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
new file mode 100644
index 00000000000..e63e8beeb58
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
@@ -0,0 +1,413 @@
+//
+// System.Web.HttpApplicationFactory
+//
+// Author:
+// Patrik Torstensson (ptorsten@hotmail.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2002,2003 Ximian, Inc. (http://www.ximian.com)
+// (c) Copyright 2004 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
+// "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;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Web.UI;
+using System.Web.Compilation;
+using System.Web.SessionState;
+
+namespace System.Web {
+ class HttpApplicationFactory {
+ private string _appFilename;
+ private Type _appType;
+
+ private bool _appInitialized;
+ private bool _appFiredEnd;
+
+ private Stack _appFreePublicList;
+ private int _appFreePublicInstances;
+
+ FileSystemWatcher appFileWatcher;
+ FileSystemWatcher binWatcher;
+
+ static private int _appMaxFreePublicInstances = 32;
+
+ private HttpApplicationState _state;
+
+ static IHttpHandler custApplication;
+
+ static private HttpApplicationFactory s_Factory = new HttpApplicationFactory();
+
+ public HttpApplicationFactory() {
+ _appInitialized = false;
+ _appFiredEnd = false;
+
+ _appFreePublicList = new Stack();
+ _appFreePublicInstances = 0;
+ }
+
+ static private string GetAppFilename (HttpContext context)
+ {
+ string physicalAppPath = context.Request.PhysicalApplicationPath;
+ string appFilePath = Path.Combine (physicalAppPath, "Global.asax");
+ if (File.Exists (appFilePath))
+ return appFilePath;
+
+ return Path.Combine (physicalAppPath, "global.asax");
+ }
+
+ void CompileApp (HttpContext context)
+ {
+ if (File.Exists (_appFilename)) {
+ _appType = ApplicationFileParser.GetCompiledApplicationType (_appFilename, context);
+ if (_appType == null) {
+ string msg = String.Format ("Error compiling application file ({0}).", _appFilename);
+ throw new ApplicationException (msg);
+ }
+
+ appFileWatcher = CreateWatcher (_appFilename, new FileSystemEventHandler (OnAppFileChanged));
+ } else {
+ _appType = typeof (System.Web.HttpApplication);
+ _state = new HttpApplicationState ();
+ }
+ }
+
+ static bool IsEventHandler (MethodInfo m)
+ {
+ if (m.ReturnType != typeof (void))
+ return false;
+
+ ParameterInfo [] pi = m.GetParameters ();
+ int length = pi.Length;
+ if (length == 0)
+ return true;
+
+ if (length != 2)
+ return false;
+
+ if (pi [0].ParameterType != typeof (object) ||
+ pi [1].ParameterType != typeof (EventArgs))
+ return false;
+
+ return true;
+ }
+
+ static void AddEvent (MethodInfo method, Hashtable appTypeEventHandlers)
+ {
+ string name = method.Name.Replace ("_On", "_");
+ if (appTypeEventHandlers [name] == null) {
+ appTypeEventHandlers [name] = method;
+ return;
+ }
+
+ ArrayList list;
+ if (appTypeEventHandlers [name] is MethodInfo)
+ list = new ArrayList ();
+ else
+ list = appTypeEventHandlers [name] as ArrayList;
+
+ list.Add (method);
+ }
+
+ static Hashtable GetApplicationTypeEvents (HttpApplication app)
+ {
+ Type appType = app.GetType ();
+ Hashtable appTypeEventHandlers = new Hashtable ();
+ BindingFlags flags = BindingFlags.Public |
+ BindingFlags.NonPublic |
+ BindingFlags.Instance |
+ BindingFlags.Static;
+
+ MethodInfo [] methods = appType.GetMethods (flags);
+ foreach (MethodInfo m in methods) {
+ if (IsEventHandler (m))
+ AddEvent (m, appTypeEventHandlers);
+ }
+
+ return appTypeEventHandlers;
+ }
+
+ static bool FireEvent (string method_name, object target, object [] args)
+ {
+ Hashtable possibleEvents = GetApplicationTypeEvents ((HttpApplication) target);
+ MethodInfo method = possibleEvents [method_name] as MethodInfo;
+ if (method == null)
+ return false;
+
+ if (method.GetParameters ().Length == 0)
+ args = null;
+
+ try {
+ method.Invoke (target, args);
+ } catch {
+ // Ignore any exception here
+ }
+ return true;
+ }
+
+ internal static void FireOnAppStart (HttpApplication app)
+ {
+ object [] args = new object [] {app, EventArgs.Empty};
+ FireEvent ("Application_Start", app, args);
+ }
+
+ void FireOnAppEnd ()
+ {
+ if (_appType == null)
+ return; // we didn't even get an application
+
+ HttpApplication app = (HttpApplication) HttpRuntime.CreateInternalObject (_appType);
+ AttachEvents (app);
+ FireEvent ("Application_End", app, new object [] {this, EventArgs.Empty});
+ app.Dispose ();
+ }
+
+ FileSystemWatcher CreateWatcher (string file, FileSystemEventHandler hnd)
+ {
+ FileSystemWatcher watcher = new FileSystemWatcher ();
+
+ watcher.Path = Path.GetFullPath (Path.GetDirectoryName (file));
+ watcher.Filter = Path.GetFileName (file);
+
+ watcher.Changed += hnd;
+ watcher.Created += hnd;
+ watcher.Deleted += hnd;
+
+ watcher.EnableRaisingEvents = true;
+
+ return watcher;
+ }
+
+ void OnAppFileChanged (object sender, FileSystemEventArgs args)
+ {
+ binWatcher.EnableRaisingEvents = false;
+ appFileWatcher.EnableRaisingEvents = false;
+ HttpRuntime.UnloadAppDomain ();
+ }
+
+ private void InitializeFactory (HttpContext context)
+ {
+ _appFilename = GetAppFilename (context);
+
+ CompileApp (context);
+
+ // Create a application object
+ HttpApplication app = (HttpApplication) HttpRuntime.CreateInternalObject (_appType);
+
+ // Startup
+ app.Startup(context, HttpApplicationFactory.ApplicationState);
+
+ // Shutdown the application if bin directory changes.
+ string binFiles = HttpRuntime.BinDirectory;
+ if (Directory.Exists (binFiles))
+ binFiles = Path.Combine (binFiles, "*.*");
+
+ binWatcher = CreateWatcher (binFiles, new FileSystemEventHandler (OnAppFileChanged));
+
+ // Fire OnAppStart
+ HttpApplicationFactory.FireOnAppStart (app);
+
+ // Recycle our application instance
+ RecyclePublicInstance(app);
+ }
+
+ private void Dispose() {
+ ArrayList torelease = new ArrayList();
+ lock (_appFreePublicList) {
+ while (_appFreePublicList.Count > 0) {
+ torelease.Add(_appFreePublicList.Pop());
+ _appFreePublicInstances--;
+ }
+ }
+
+ if (torelease.Count > 0) {
+ foreach (Object obj in torelease) {
+ ((HttpApplication) obj).Cleanup();
+ }
+ }
+
+ if (!_appFiredEnd) {
+ lock (this) {
+ if (!_appFiredEnd) {
+ FireOnAppEnd();
+ _appFiredEnd = true;
+ }
+ }
+ }
+ }
+
+ internal static IHttpHandler GetInstance(HttpContext context)
+ {
+ if (custApplication != null)
+ return custApplication;
+
+ if (!s_Factory._appInitialized) {
+ lock (s_Factory) {
+ if (!s_Factory._appInitialized) {
+ s_Factory.InitializeFactory(context);
+ s_Factory._appInitialized = true;
+ }
+ }
+ }
+
+ return s_Factory.GetPublicInstance(context);
+ }
+
+ internal static void RecycleInstance(HttpApplication app) {
+ if (!s_Factory._appInitialized)
+ throw new InvalidOperationException("Factory not intialized");
+
+ s_Factory.RecyclePublicInstance(app);
+ }
+
+ internal static void AttachEvents (HttpApplication app)
+ {
+ Hashtable possibleEvents = GetApplicationTypeEvents (app);
+ foreach (string key in possibleEvents.Keys) {
+ int pos = key.IndexOf ('_');
+ if (pos == -1 || key.Length <= pos + 1)
+ continue;
+
+ string moduleName = key.Substring (0, pos);
+ object target;
+ if (moduleName == "Application") {
+ target = app;
+ } else {
+ target = app.Modules [moduleName];
+ if (target == null)
+ continue;
+ }
+
+ string eventName = key.Substring (pos + 1);
+ EventInfo evt = target.GetType ().GetEvent (eventName);
+ if (evt == null)
+ continue;
+
+ string usualName = moduleName + "_" + eventName;
+ object methodData = possibleEvents [usualName];
+ if (methodData == null)
+ continue;
+
+ if (methodData is MethodInfo) {
+ AddHandler (evt, target, app, (MethodInfo) methodData);
+ continue;
+ }
+
+ ArrayList list = (ArrayList) methodData;
+ foreach (MethodInfo method in list)
+ AddHandler (evt, target, app, method);
+ }
+ }
+
+ static void AddHandler (EventInfo evt, object target, HttpApplication app, MethodInfo method)
+ {
+ int length = method.GetParameters ().Length;
+
+ if (length == 0) {
+ NoParamsInvoker npi = new NoParamsInvoker (app, method.Name);
+ evt.AddEventHandler (target, npi.FakeDelegate);
+ } else {
+ evt.AddEventHandler (target, Delegate.CreateDelegate (
+ typeof (EventHandler), app, method.Name));
+ }
+ }
+
+ private IHttpHandler GetPublicInstance(HttpContext context) {
+ HttpApplication app = null;
+
+ lock (_appFreePublicList) {
+ if (_appFreePublicInstances > 0) {
+ app = (HttpApplication) _appFreePublicList.Pop();
+ _appFreePublicInstances--;
+ }
+ }
+
+ if (app == null) {
+ // Create non-public object
+ app = (HttpApplication) HttpRuntime.CreateInternalObject(_appType);
+
+ app.Startup(context, HttpApplicationFactory.ApplicationState);
+ }
+
+ return (IHttpHandler) app;
+ }
+
+ internal void RecyclePublicInstance(HttpApplication app) {
+ lock (_appFreePublicList) {
+ if (_appFreePublicInstances < _appMaxFreePublicInstances) {
+ _appFreePublicList.Push(app);
+ _appFreePublicInstances++;
+
+ app = null;
+ }
+ }
+
+ if (app != null) {
+ app.Cleanup();
+ }
+ }
+
+ static HttpStaticObjectsCollection MakeStaticCollection (ArrayList list)
+ {
+ if (list == null || list.Count == 0)
+ return null;
+
+ HttpStaticObjectsCollection coll = new HttpStaticObjectsCollection ();
+ foreach (ObjectTagBuilder tag in list) {
+ coll.Add (tag);
+ }
+
+ return coll;
+ }
+
+ static internal HttpApplicationState ApplicationState {
+ get {
+ if (null == s_Factory._state) {
+ HttpStaticObjectsCollection app = MakeStaticCollection (GlobalAsaxCompiler.ApplicationObjects);
+ HttpStaticObjectsCollection ses = MakeStaticCollection (GlobalAsaxCompiler.SessionObjects);
+ s_Factory._state = new HttpApplicationState (app, ses);
+ }
+
+ return s_Factory._state;
+ }
+ }
+
+ internal static void EndApplication() {
+ s_Factory.Dispose();
+ }
+
+ public static void SetCustomApplication (IHttpHandler customApplication)
+ {
+ custApplication = customApplication;
+ }
+
+ internal Type AppType {
+ get { return _appType; }
+ }
+
+ internal static void SignalError(Exception exc) {
+ // TODO: Raise an error (we probably don't have a HttpContext)
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpApplicationState.cs b/mcs/class/System.Web/System.Web/HttpApplicationState.cs
new file mode 100644
index 00000000000..17f0968fe09
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpApplicationState.cs
@@ -0,0 +1,273 @@
+//
+// System.Web.HttpApplicationState
+//
+// Author:
+// Patrik Torstensson
+//
+
+//
+// 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;
+using System.Threading;
+using System.Web;
+using System.Collections.Specialized;
+
+namespace System.Web
+{
+
+ public sealed class HttpApplicationState : NameObjectCollectionBase
+ {
+ private HttpStaticObjectsCollection _AppObjects;
+ private HttpStaticObjectsCollection _SessionObjects;
+
+ private ReaderWriterLock _Lock;
+
+ internal HttpApplicationState ()
+ {
+ _AppObjects = new HttpStaticObjectsCollection ();
+ _SessionObjects = new HttpStaticObjectsCollection ();
+ _Lock = new ReaderWriterLock ();
+ }
+
+ internal HttpApplicationState (HttpStaticObjectsCollection AppObj,
+ HttpStaticObjectsCollection SessionObj)
+ {
+ if (null != AppObj)
+ {
+ _AppObjects = AppObj;
+ }
+ else
+ {
+ _AppObjects = new HttpStaticObjectsCollection ();
+ }
+
+ if (null != SessionObj)
+ {
+ _SessionObjects = SessionObj;
+ }
+ else
+ {
+ _SessionObjects = new HttpStaticObjectsCollection ();
+ }
+ _Lock = new ReaderWriterLock ();
+ }
+
+ public void Add (string name, object value)
+ {
+ _Lock.AcquireWriterLock (-1);
+ try
+ {
+ BaseAdd (name, value);
+ }
+ finally
+ {
+ _Lock.ReleaseWriterLock ();
+ }
+ }
+
+ public void Clear ()
+ {
+ _Lock.AcquireWriterLock (-1);
+ try
+ {
+ BaseClear ();
+ }
+ finally
+ {
+ _Lock.ReleaseWriterLock ();
+ }
+ }
+
+ public object Get (string name)
+ {
+ object ret = null;
+
+ _Lock.AcquireReaderLock (-1);
+ try
+ {
+ ret = BaseGet (name);
+ }
+ finally
+ {
+ _Lock.ReleaseReaderLock ();
+ }
+
+ return ret;
+ }
+
+ public object Get (int index)
+ {
+ object ret = null;
+
+ _Lock.AcquireReaderLock (-1);
+ try
+ {
+ ret = BaseGet (index);
+ }
+ finally
+ {
+ _Lock.ReleaseReaderLock ();
+ }
+
+ return ret;
+ }
+
+ public string GetKey (int index)
+ {
+ string ret = null;
+
+ _Lock.AcquireReaderLock (-1);
+ try
+ {
+ ret = BaseGetKey (index);
+ }
+ finally
+ {
+ _Lock.ReleaseReaderLock ();
+ }
+
+ return ret;
+ }
+
+ public void Lock ()
+ {
+ _Lock.AcquireWriterLock (-1);
+ }
+
+ public void Remove (string name)
+ {
+ _Lock.AcquireWriterLock (-1);
+ try
+ {
+ BaseRemove (name);
+ }
+ finally
+ {
+ _Lock.ReleaseWriterLock ();
+ }
+ }
+
+ public void RemoveAll ()
+ {
+ Clear ();
+ }
+
+ public void RemoveAt (int index)
+ {
+ _Lock.AcquireWriterLock (-1);
+ try
+ {
+ BaseRemoveAt (index);
+ }
+ finally
+ {
+ _Lock.ReleaseWriterLock ();
+ }
+ }
+
+ public void Set (string name, object value)
+ {
+ _Lock.AcquireWriterLock (-1);
+ try
+ {
+ BaseSet (name, value);
+ }
+ finally
+ {
+ _Lock.ReleaseWriterLock ();
+ }
+ }
+
+ public void UnLock ()
+ {
+ _Lock.ReleaseWriterLock ();
+ }
+
+ public string [] AllKeys
+ {
+ get
+ {
+ string [] ret = null;
+
+ _Lock.AcquireReaderLock (-1);
+ try
+ {
+ ret = BaseGetAllKeys ();
+ }
+ finally
+ {
+ _Lock.ReleaseReaderLock ();
+ }
+
+ return ret;
+ }
+ }
+
+ public HttpApplicationState Contents
+ {
+ get { return this; }
+ }
+
+ public override int Count
+ {
+ get
+ {
+ int ret = 0;
+
+ _Lock.AcquireReaderLock (-1);
+ try
+ {
+ ret = base.Count;
+ }
+ finally
+ {
+ _Lock.ReleaseReaderLock ();
+ }
+
+ return ret;
+ }
+ }
+
+ public object this [string name]
+ {
+ get { return Get (name); }
+ set { Set (name, value); }
+ }
+
+ public object this [int index]
+ {
+ get { return Get (index); }
+ }
+
+ // ASP Session based objects
+ internal HttpStaticObjectsCollection SessionObjects
+ {
+ get { return _SessionObjects; }
+ }
+
+ // ASP App based objects
+ public HttpStaticObjectsCollection StaticObjects
+ {
+ get { return _AppObjects; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpAsyncResult.cs b/mcs/class/System.Web/System.Web/HttpAsyncResult.cs
new file mode 100644
index 00000000000..fc5e0d1ba74
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpAsyncResult.cs
@@ -0,0 +1,85 @@
+//
+// System.Web.HttpAsyncResult
+//
+// Author:
+// Patrik Torstensson (ptorsten@hotmail.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;
+using System.Threading;
+
+namespace System.Web
+{
+ internal class HttpAsyncResult : IAsyncResult
+ {
+ private object _asyncState;
+ private AsyncCallback _callback;
+ private bool _ready;
+ private bool _readySync;
+ private Exception _error;
+
+ internal HttpAsyncResult(AsyncCallback callback, object state) {
+ _callback = callback;
+ _asyncState = state;
+ }
+
+ internal void Complete(bool sync, object result, Exception error) {
+ _ready = true;
+ _readySync = sync;
+ _error = error;
+ if (null != _callback) {
+ _callback(this);
+ }
+ }
+
+ internal Exception Error {
+ get {
+ return _error;
+ }
+ }
+
+ public object AsyncState {
+ get {
+ return _asyncState;
+ }
+ }
+
+ public WaitHandle AsyncWaitHandle {
+ get {
+ return null;
+ }
+ }
+
+ public bool CompletedSynchronously {
+ get {
+ return _readySync;
+ }
+ }
+
+ public bool IsCompleted {
+ get {
+ return _ready;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpBrowserCapabilities.cs b/mcs/class/System.Web/System.Web/HttpBrowserCapabilities.cs
new file mode 100755
index 00000000000..e94259f0ce6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpBrowserCapabilities.cs
@@ -0,0 +1,444 @@
+//
+// System.Web.HttpBrowserCapabilities
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2003 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
+// "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;
+using System.Collections;
+using System.Web.Configuration;
+using System.Web.UI;
+
+namespace System.Web
+{
+ public class HttpBrowserCapabilities : HttpCapabilitiesBase
+ {
+ const int HaveActiveXControls = 1;
+ const int HaveAOL = 2;
+ const int HaveBackGroundSounds = 3;
+ const int HaveBeta = 4;
+ const int HaveBrowser = 5;
+ const int HaveCDF = 6;
+ //const int HaveClrVersion = 7;
+ const int HaveCookies = 8;
+ const int HaveCrawler = 9;
+ //const int HaveEcmaScriptVersion = 10;
+ const int HaveFrames = 11;
+ const int HaveJavaApplets = 12;
+ const int HaveJavaScript = 13;
+ const int HaveMajorVersion = 14;
+ const int HaveMinorVersion = 15;
+ //const int HaveMSDomVersion = 16;
+ const int HavePlatform = 17;
+ const int HaveTables = 18;
+ //const int HaveTagWriter = 19;
+ const int HaveVBScript = 20;
+ const int HaveVersion = 21;
+ //const int HaveW3CDomVersion = 22;
+ const int HaveWin16 = 23;
+ const int HaveWin32 = 24;
+
+ int flags;
+ bool activeXControls;
+ bool aol;
+ bool backgroundSounds;
+ bool beta;
+ string browser;
+ bool cdf;
+ Version clrVersion;
+ bool cookies;
+ bool crawler;
+ //Version ecmaScriptVersion;
+ bool frames;
+ bool javaApplets;
+ bool javaScript;
+ int majorVersion;
+ double minorVersion;
+ //Version msDomVersion;
+ string platform;
+ bool tables;
+ //Type tagWriter;
+ bool vbscript;
+ string version;
+ //Version w3CDomVersion;
+ bool win16;
+ bool win32;
+ Version [] clrVersions;
+ internal string useragent;
+
+ public HttpBrowserCapabilities () { }
+
+ public bool ActiveXControls {
+ get {
+ if (!Get (HaveActiveXControls)) {
+ Set (HaveActiveXControls);
+ activeXControls = ReadBoolean ("activexcontrols", false);
+ }
+
+ return activeXControls;
+ }
+ }
+
+ public bool AOL {
+ get {
+ if (!Get (HaveAOL)) {
+ Set (HaveAOL);
+ aol = ReadBoolean ("aol", false);
+ }
+
+ return aol;
+ }
+ }
+
+ public bool BackgroundSounds {
+ get {
+ if (!Get (HaveBackGroundSounds)) {
+ Set (HaveBackGroundSounds);
+ backgroundSounds = ReadBoolean ("backgroundsounds", false);
+ }
+
+ return backgroundSounds;
+ }
+ }
+
+ public bool Beta {
+ get {
+ if (!Get (HaveBeta)) {
+ Set (HaveBeta);
+ beta = ReadBoolean ("beta", false);
+ }
+
+ return beta;
+ }
+ }
+
+ public string Browser {
+ get {
+ if (!Get (HaveBrowser)) {
+ Set (HaveBrowser);
+ browser = this ["browser"];
+ if (browser == null)
+ browser = "Unknown";
+ }
+
+ return browser;
+ }
+ }
+
+ public bool CDF {
+ get {
+ if (!Get (HaveCDF)) {
+ Set (HaveCDF);
+ cdf = ReadBoolean ("cdf", false);
+ }
+
+ return cdf;
+ }
+ }
+
+ public Version ClrVersion {
+ get {
+ if (clrVersion == null)
+ InternalGetClrVersions ();
+
+ return clrVersion;
+ }
+ }
+
+ public bool Cookies {
+ get {
+ if (!Get (HaveCookies)) {
+ Set (HaveCookies);
+ cookies = ReadBoolean ("cookies", false);
+ }
+
+ return cookies;
+ }
+ }
+
+ public bool Crawler {
+ get {
+ if (!Get (HaveCrawler)) {
+ Set (HaveCrawler);
+ crawler = ReadBoolean ("crawler", false);
+ }
+
+ return crawler;
+ }
+ }
+
+ [MonoTODO]
+ public Version EcmaScriptVersion {
+ get {
+ return new Version (0, 0);
+ }
+ }
+
+ public bool Frames {
+ get {
+ if (!Get (HaveFrames)) {
+ Set (HaveFrames);
+ frames = ReadBoolean ("frames", false);
+ }
+
+ return frames;
+ }
+ }
+
+ public bool JavaApplets {
+ get {
+ if (!Get (HaveJavaApplets)) {
+ Set (HaveJavaApplets);
+ javaApplets = ReadBoolean ("javaapplets", false);
+ }
+
+ return javaApplets;
+ }
+ }
+
+ public bool JavaScript {
+ get {
+ if (!Get (HaveJavaScript)) {
+ Set (HaveJavaScript);
+ javaScript = ReadBoolean ("javascript", false);
+ }
+
+ return javaScript;
+ }
+ }
+
+ public int MajorVersion {
+ get {
+ if (!Get (HaveMajorVersion)) {
+ Set (HaveMajorVersion);
+ majorVersion = ReadInt32 ("majorver", 0);
+ }
+
+ return majorVersion;
+ }
+ }
+
+ public double MinorVersion {
+ get {
+ if (!Get (HaveMinorVersion)) {
+ Set (HaveMinorVersion);
+ minorVersion = ReadDouble ("minorver", 0);
+ }
+
+ return minorVersion;
+ }
+ }
+
+ [MonoTODO]
+ public Version MSDomVersion {
+ get {
+ return new Version (0, 0);
+ }
+ }
+
+ public string Platform {
+ get {
+ if (!Get (HavePlatform)) {
+ Set (HavePlatform);
+ platform = this ["platform"];
+ if (platform == null)
+ platform = "";
+ }
+
+ return platform;
+ }
+ }
+
+ public bool Tables {
+ get {
+ if (!Get (HaveTables)) {
+ Set (HaveTables);
+ tables = ReadBoolean ("tables", false);
+ }
+
+ return tables;
+ }
+ }
+
+ [MonoTODO]
+ public Type TagWriter {
+ get {
+ return typeof (HtmlTextWriter);
+ }
+ }
+
+ public string Type {
+ get {
+ return Browser + MajorVersion;
+ }
+ }
+
+ public bool VBScript {
+ get {
+ if (!Get (HaveVBScript)) {
+ Set (HaveVBScript);
+ vbscript = ReadBoolean ("vbscript", false);
+ }
+
+ return vbscript;
+ }
+ }
+
+ public string Version {
+ get {
+ if (!Get (HaveVersion)) {
+ Set (HaveVersion);
+ version = this ["version"];
+ if (version == null)
+ version = "";
+ }
+
+ return version;
+ }
+ }
+
+ [MonoTODO]
+ public Version W3CDomVersion {
+ get {
+ return new Version (0, 0);
+ }
+ }
+
+ public bool Win16 {
+ get {
+ if (!Get (HaveWin16)) {
+ Set (HaveWin16);
+ win16 = ReadBoolean ("win16", false);
+ }
+
+ return win16;
+ }
+ }
+
+ public bool Win32 {
+ get {
+ if (!Get (HaveWin32)) {
+ Set (HaveWin32);
+ win32 = ReadBoolean ("win32", false);
+ }
+
+ return win32;
+ }
+ }
+
+#if NET_1_1
+ public Version [] GetClrVersions ()
+ {
+ if (clrVersions == null)
+ InternalGetClrVersions ();
+
+ return clrVersions;
+ }
+#endif
+
+ void InternalGetClrVersions ()
+ {
+ char [] anychars = new char [] { ';', ')' };
+ string s = useragent;
+ ArrayList list = null;
+ int idx;
+ while ((idx = s.IndexOf (".NET CLR ")) != -1) {
+ int end = s.IndexOfAny (anychars, idx + 9);
+ if (end == -1)
+ break;
+
+ string ver = s.Substring (idx + 9, end - idx - 9);
+ Version v = null;
+ try {
+ v = new Version (ver);
+ if (clrVersion == null || v > clrVersion)
+ clrVersion = v;
+
+ if (list == null)
+ list = new ArrayList (4);
+
+ list.Add (v);
+ } catch { }
+ s = s.Substring (idx + 9);
+ }
+
+ if (list == null || list.Count == 0) {
+ clrVersion = new Version ();
+ clrVersions = new Version [] { clrVersion };
+ } else {
+ list.Sort ();
+ clrVersions = (Version []) list.ToArray (typeof (Version));
+ }
+ }
+
+ bool ReadBoolean (string key, bool dflt)
+ {
+ string v = this [key];
+ if (v == null)
+ return dflt;
+
+ return (v == "True");
+ }
+
+ int ReadInt32 (string key, int dflt)
+ {
+ string v = this [key];
+ if (v == null)
+ return dflt;
+
+ try {
+ return Int32.Parse (v);
+ } catch {
+ return dflt;
+ }
+ }
+
+ double ReadDouble (string key, double dflt)
+ {
+ string v = this [key];
+ if (v == null)
+ return dflt;
+
+ try {
+ return Double.Parse (v);
+ } catch {
+ return dflt;
+ }
+ }
+
+ bool Get (int idx)
+ {
+ return (flags & (1 << idx)) != 0;
+ }
+
+ void Set (int idx)
+ {
+ flags |= (1 << idx);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpCachePolicy.cs b/mcs/class/System.Web/System.Web/HttpCachePolicy.cs
new file mode 100644
index 00000000000..8e3d2dfefff
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCachePolicy.cs
@@ -0,0 +1,345 @@
+//
+// System.Web.HttpCachePolicy
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Tim Coleman (tim@timcoleman.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.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;
+using System.Collections;
+using System.Text;
+using System.Web.UI;
+using System.Web.Util;
+
+namespace System.Web {
+
+ class CacheabilityUpdatedEventArgs : EventArgs {
+
+ public readonly HttpCacheability Cacheability;
+
+ public CacheabilityUpdatedEventArgs (HttpCacheability cacheability)
+ {
+ Cacheability = cacheability;
+ }
+ }
+
+ internal delegate void CacheabilityUpdatedCallback (object sender, CacheabilityUpdatedEventArgs args);
+
+ public sealed class HttpCachePolicy {
+
+ internal HttpCachePolicy ()
+ {
+ }
+
+ #region Fields
+
+ HttpCacheVaryByHeaders varyByHeaders = new HttpCacheVaryByHeaders ();
+ HttpCacheVaryByParams varyByParams = new HttpCacheVaryByParams ();
+ ArrayList validationCallbacks;
+ StringBuilder cacheExtension;
+ HttpCacheability cacheability;
+ string etag;
+ bool etagFromFileDependencies;
+ bool haveExpireDate;
+ DateTime expireDate;
+ bool haveLastModified;
+ DateTime lastModified;
+ //bool lastModifiedFromFileDependencies;
+ //bool noServerCaching;
+ //bool noStore;
+ //bool noTransforms;
+ HttpCacheRevalidation revalidation;
+ //bool validUntilExpires;
+ string varyByCustom;
+ bool haveMaxAge;
+ TimeSpan maxAge;
+ bool haveProxyMaxAge;
+ TimeSpan proxyMaxAge;
+ ArrayList fields;
+ bool slidingExpiration;
+ int duration;
+#if NET_1_1
+ bool allowResponseInBrowserHistory;
+#endif
+
+ #endregion
+
+ internal event CacheabilityUpdatedCallback CacheabilityUpdated;
+
+ #region Properties
+
+ public HttpCacheVaryByHeaders VaryByHeaders {
+ get { return varyByHeaders; }
+ }
+
+ public HttpCacheVaryByParams VaryByParams {
+ get { return varyByParams; }
+ }
+
+ internal DateTime Expires {
+ get { return expireDate; }
+ }
+
+ internal int Duration {
+ get { return duration; }
+ set { duration = value; }
+ }
+
+ internal bool Sliding {
+ get { return slidingExpiration; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void AddValidationCallback (HttpCacheValidateHandler handler, object data)
+ {
+ if (handler == null)
+ throw new ArgumentNullException ("handler");
+
+ if (validationCallbacks == null)
+ validationCallbacks = new ArrayList ();
+
+ validationCallbacks.Add (new Pair (handler, data));
+ }
+
+ public void AppendCacheExtension (string extension)
+ {
+ if (extension == null)
+ throw new ArgumentNullException ("extension");
+
+ if (cacheExtension == null)
+ cacheExtension = new StringBuilder (extension);
+ else
+ cacheExtension.Append (", " + extension);
+ }
+
+ public void SetCacheability (HttpCacheability cacheability)
+ {
+ if (cacheability < HttpCacheability.NoCache || cacheability > HttpCacheability.Public)
+ throw new ArgumentOutOfRangeException ("cacheability");
+
+ if (this.cacheability > 0 && cacheability > this.cacheability)
+ return;
+
+ this.cacheability = cacheability;
+
+ if (CacheabilityUpdated != null)
+ CacheabilityUpdated (this, new CacheabilityUpdatedEventArgs (cacheability));
+ }
+
+ public void SetCacheability (HttpCacheability cacheability, string field)
+ {
+ if (field == null)
+ throw new ArgumentNullException ("field");
+
+ if (cacheability != HttpCacheability.Private &&
+ cacheability != HttpCacheability.NoCache)
+ throw new ArgumentException ("Must be NoCache or Private", "cacheability");
+
+ if (fields == null)
+ fields = new ArrayList ();
+
+ fields.Add (new Pair (cacheability, field));
+ }
+
+ public void SetETag (string etag)
+ {
+ if (etag == null)
+ throw new ArgumentNullException ("etag");
+
+ if (this.etag != null)
+ throw new InvalidOperationException ("The ETag header has already been set");
+
+ if (etagFromFileDependencies)
+ throw new InvalidOperationException ("SetEtagFromFileDependencies has already been called");
+
+ this.etag = etag;
+ }
+
+ public void SetETagFromFileDependencies ()
+ {
+ if (this.etag != null)
+ throw new InvalidOperationException ("The ETag header has already been set");
+
+ etagFromFileDependencies = true;
+ }
+
+ public void SetExpires (DateTime date)
+ {
+ if (haveExpireDate && date > expireDate)
+ return;
+
+ haveExpireDate = true;
+ expireDate = date;
+ }
+
+ public void SetLastModified (DateTime date)
+ {
+ if (date > DateTime.Now)
+ throw new ArgumentOutOfRangeException ("date");
+
+ if (haveLastModified && date < lastModified)
+ return;
+
+ haveLastModified = true;
+ lastModified = date;
+ }
+
+ [MonoTODO]
+ public void SetLastModifiedFromFileDependencies ()
+ {
+ //lastModifiedFromFileDependencies = true;
+ }
+
+ public void SetMaxAge (TimeSpan date)
+ {
+ if (date < TimeSpan.Zero)
+ throw new ArgumentOutOfRangeException ("date");
+
+ if (haveMaxAge && maxAge < date)
+ return;
+
+ maxAge = date;
+ haveMaxAge = true;
+ }
+
+ [MonoTODO]
+ public void SetNoServerCaching ()
+ {
+ //noServerCaching = true;
+ }
+
+ [MonoTODO]
+ public void SetNoStore ()
+ {
+ //noStore = true;
+ }
+
+ [MonoTODO]
+ public void SetNoTransforms ()
+ {
+ //noTransforms = true;
+ }
+
+ public void SetProxyMaxAge (TimeSpan delta)
+ {
+ if (delta < TimeSpan.Zero)
+ throw new ArgumentOutOfRangeException ("delta");
+
+ if (haveProxyMaxAge && proxyMaxAge < delta)
+ return;
+
+ proxyMaxAge = delta;
+ }
+
+ public void SetRevalidation (HttpCacheRevalidation revalidation)
+ {
+ if (revalidation < HttpCacheRevalidation.AllCaches ||
+ revalidation > HttpCacheRevalidation.None)
+ throw new ArgumentOutOfRangeException ("revalidation");
+
+ if (this.revalidation > revalidation)
+ this.revalidation = revalidation;
+ }
+
+ public void SetSlidingExpiration (bool slide)
+ {
+ slidingExpiration = slide;
+ }
+
+ [MonoTODO]
+ public void SetValidUntilExpires (bool validUntilExpires)
+ {
+ //this.validUntilExpires = validUntilExpires;
+ }
+
+ public void SetVaryByCustom (string custom)
+ {
+ if (custom == null)
+ throw new ArgumentNullException ("custom");
+
+ if (varyByCustom != null)
+ throw new InvalidOperationException ("VaryByCustom has already been set.");
+
+ varyByCustom = custom;
+ }
+
+ internal string GetVaryByCustom ()
+ {
+ return varyByCustom;
+ }
+
+#if NET_1_1
+ public void SetAllowResponseInBrowserHistory (bool allow)
+ {
+ if (cacheability == HttpCacheability.NoCache ||
+ cacheability == HttpCacheability.ServerAndNoCache) {
+ allowResponseInBrowserHistory = allow;
+ }
+ }
+#endif
+
+ internal void SetHeaders (HttpResponse response, ArrayList headers)
+ {
+ string cc, expires;
+ if (cacheability > HttpCacheability.NoCache) {
+ cc = String.Format ("{0}, max-age={1}", cacheability, (long) maxAge.TotalSeconds);
+ expires = TimeUtil.ToUtcTimeString (expireDate);
+ headers.Add (new HttpResponseHeader ("Expires", expires));
+ } else {
+ cc = "no-cache";
+ response.CacheControl = cc;
+#if NET_1_1
+ if (!allowResponseInBrowserHistory)
+#endif
+ {
+ expires = "-1";
+ headers.Add (new HttpResponseHeader ("Expires", expires));
+ }
+ }
+
+ headers.Add (new HttpResponseHeader ("Cache-Control", cc));
+
+ if (etag != null)
+ headers.Add (new HttpResponseHeader ("ETag", etag));
+
+ if (haveLastModified)
+ headers.Add (new HttpResponseHeader ("Last-Modified",
+ TimeUtil.ToUtcTimeString (lastModified)));
+
+ if (!varyByParams.IgnoreParams) {
+ HttpResponseHeader vb = varyByParams.GetResponseHeader ();
+ if (vb != null)
+ headers.Add (vb);
+ }
+
+ }
+
+ #endregion // Methods
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpCacheRevalidation.cs b/mcs/class/System.Web/System.Web/HttpCacheRevalidation.cs
new file mode 100644
index 00000000000..afb4f5181eb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCacheRevalidation.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.HttpCacheRevalidation.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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.
+//
+
+namespace System.Web {
+ [Serializable]
+ public enum HttpCacheRevalidation {
+ AllCaches = 0x1,
+ ProxyCaches,
+ None,
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCacheValidateHandler.cs b/mcs/class/System.Web/System.Web/HttpCacheValidateHandler.cs
new file mode 100644
index 00000000000..3e2a69d24f2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCacheValidateHandler.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.HttpCacheValidateHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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.
+//
+
+namespace System.Web
+{
+ public delegate void HttpCacheValidateHandler(
+ HttpContext context,
+ object data,
+ ref HttpValidationStatus validationStatus);
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs b/mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs
new file mode 100644
index 00000000000..130b61cc98a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs
@@ -0,0 +1,140 @@
+//
+// System.Web.HttpCacheVaryByHeaders
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.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;
+using System.Collections;
+
+namespace System.Web {
+ public sealed class HttpCacheVaryByHeaders {
+ private Hashtable _Items;
+ private bool _Wildcard;
+
+ // TODO: We need internal methods here to communicate with CachePolicy
+
+ internal HttpCacheVaryByHeaders() {
+ }
+
+ public void VaryByUnspecifiedParameters() {
+ _Wildcard = true;
+ _Items = null;
+ }
+
+ public bool AcceptTypes {
+ get {
+ return this["Accept"];
+ }
+
+ set {
+ this["Accept"] = value;
+ }
+ }
+
+ public bool this[string header] {
+ get {
+ if (null == header) {
+ throw new ArgumentNullException("header");
+ }
+
+ if (header == "*") {
+ return _Wildcard;
+ }
+
+ if (null != _Items) {
+ return _Items.ContainsKey(header);
+ }
+
+ return false;
+ }
+
+ set {
+ if (null == header) {
+ throw new ArgumentNullException("header");
+ }
+
+ if (!(value)) {
+ return;
+ }
+
+ if (header == "*") {
+ VaryByUnspecifiedParameters();
+ return;
+ }
+
+ if (!_Wildcard) {
+ if (null == _Items) {
+ _Items = new Hashtable();
+ }
+
+ _Items[header] = true;
+ }
+ }
+ }
+
+ public bool UserAgent {
+ get {
+ return this["User-Agent"];
+ }
+
+ set {
+ this["User-Agent"] = value;
+ }
+ }
+
+ public bool UserCharSet {
+ get {
+ return this["Accept-Charset"];
+ }
+
+ set {
+ this["Accept-Charset"] = value;
+ }
+ }
+
+ public bool UserLanguage {
+ get {
+ return this["Accept-Language"];
+ }
+
+ set {
+ this["Accept-Language"] = value;
+ }
+ }
+
+ internal string [] GetHeaderNames ()
+ {
+ if (_Items == null)
+ return null;
+
+ string[] headers = new string [_Items.Count];
+ int i = 0;
+ foreach (string header in _Items.Keys)
+ headers [i++] = header;
+
+ return headers;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs b/mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs
new file mode 100644
index 00000000000..c15a41b9b10
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs
@@ -0,0 +1,133 @@
+//
+// System.Web.HttpCacheVaryByParams
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.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;
+using System.Text;
+using System.Collections;
+
+namespace System.Web {
+ public sealed class HttpCacheVaryByParams {
+ private Hashtable _Items;
+ private bool _IgnoreParams;
+ private bool _Wildcard;
+
+ // TODO: We need internal methods here to communicate with CachePolicy
+
+ internal HttpCacheVaryByParams() {
+ }
+
+ public bool IgnoreParams {
+ get {
+ return _IgnoreParams;
+ }
+
+ set {
+ if (_Wildcard || null != _Items) {
+ return;
+ }
+
+ _IgnoreParams = value;
+ }
+ }
+
+ internal HttpResponseHeader GetResponseHeader ()
+ {
+ if (_IgnoreParams)
+ throw new Exception ("Can not get VaryByParams Header when params are ignored.");
+
+ if (_Wildcard)
+ return new HttpResponseHeader ("Vary", "*");
+
+ if (_Items == null)
+ return null;
+
+ StringBuilder builder = new StringBuilder ();
+ foreach (string item in _Items.Keys) {
+ if (!(bool) _Items [item])
+ continue;
+ builder.Append (item + ";");
+ }
+
+ return new HttpResponseHeader ("Vary", builder.ToString ());
+ }
+
+ public bool this[string header] {
+ get {
+ if (null == header) {
+ throw new ArgumentNullException("header");
+ }
+
+ if (header == "*") {
+ return _Wildcard;
+ }
+
+ if (null != _Items) {
+ return _Items.ContainsKey(header);
+ }
+
+ return false;
+ }
+
+ set {
+ if (null == header) {
+ throw new ArgumentNullException("header");
+ }
+
+ if (!(value)) {
+ return;
+ }
+
+ if (header == "*") {
+ _Wildcard = true;
+ _Items = null;
+ return;
+ }
+
+ if (!_Wildcard) {
+ if (null == _Items) {
+ _Items = new Hashtable();
+ }
+
+ _Items[header] = true;
+ }
+ }
+ }
+
+ internal string [] GetParamNames ()
+ {
+ if (_Items == null)
+ return null;
+
+ string[] prms = new string [_Items.Count];
+ int i = 0;
+ foreach (string prm in _Items.Keys)
+ prms [i++] = prm;
+
+ return prms;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCacheability.cs b/mcs/class/System.Web/System.Web/HttpCacheability.cs
new file mode 100644
index 00000000000..f8f4fcb2923
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCacheability.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.HttpCacheability.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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.
+//
+
+namespace System.Web {
+ [Serializable]
+ public enum HttpCacheability {
+ NoCache = 0x1,
+ Private,
+ Server,
+ Public,
+ ServerAndPrivate,
+ ServerAndNoCache = 0x3
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpClientCertificate.cs b/mcs/class/System.Web/System.Web/HttpClientCertificate.cs
new file mode 100644
index 00000000000..928d4c99d9b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpClientCertificate.cs
@@ -0,0 +1,168 @@
+//
+// System.Web.HttpClientCertificate
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.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;
+using System.Web;
+using System.Collections.Specialized;
+
+namespace System.Web {
+ [MonoTODO()]
+ public class HttpClientCertificate : NameValueCollection {
+ //private HttpContext _Context;
+ private byte [] _BinaryIssuer;
+ private int _CertEncoding;
+ private byte [] _Certificate;
+ private string _Cookie;
+ private int _Flags;
+ private string _Issuer;
+ private int _KeySize;
+ private byte [] _PublicKey;
+ private int _SecretKeySize;
+ private string _SerialNumber;
+ private string _ServerIssuer;
+ private string _ServerSubject;
+ private string _Subject;
+
+ private DateTime _ValidFrom;
+ private DateTime _ValidTo;
+
+ [MonoTODO("Decode ceritificate from Server variables.. CGI standard?")]
+ internal HttpClientCertificate(HttpContext Context) {
+ //_Context = Context; not used
+ _Flags = 0;
+ }
+
+ public byte [] BinaryIssuer {
+ get {
+ return _BinaryIssuer;
+ }
+ }
+
+ public int CertEncoding {
+ get {
+ return _CertEncoding;
+ }
+ }
+
+ public byte [] Certificate {
+ get {
+ return _Certificate;
+ }
+ }
+
+ public string Cookie {
+ get {
+ return _Cookie;
+ }
+ }
+
+ public int Flags {
+ get {
+ return _Flags;
+ }
+ }
+
+ [MonoTODO()]
+ public bool IsPresent {
+ get {
+ return false;
+ }
+ }
+
+ public string Issuer {
+ get {
+ return _Issuer;
+ }
+ }
+
+ [MonoTODO()]
+ public bool IsValid {
+ get {
+ return false;
+ }
+ }
+
+ public int KeySize {
+ get {
+ return _KeySize;
+ }
+ }
+
+ public byte [] PublicKey {
+ get {
+ return _PublicKey;
+ }
+ }
+
+ public int SecretKeySize {
+ get {
+ return _SecretKeySize;
+ }
+ }
+
+ public string SerialNumber {
+ get {
+ return _SerialNumber;
+ }
+ }
+
+ public string ServerIssuer {
+ get {
+ return _ServerIssuer;
+ }
+ }
+
+ public string ServerSubject {
+ get {
+ return _ServerSubject;
+ }
+ }
+
+ public string Subject {
+ get {
+ return _Subject;
+ }
+ }
+
+ public DateTime ValidFrom {
+ get {
+ return _ValidFrom;
+ }
+ }
+
+ public DateTime ValidUntil {
+ get {
+ return _ValidTo;
+ }
+ }
+
+ [MonoTODO()]
+ public override string Get(string s) {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCompileException.cs b/mcs/class/System.Web/System.Web/HttpCompileException.cs
new file mode 100644
index 00000000000..98053b0563b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCompileException.cs
@@ -0,0 +1,66 @@
+//
+// System.Web.HttpCompileException.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+//
+// 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.CodeDom.Compiler;
+
+namespace System.Web {
+ public sealed class HttpCompileException : HttpException {
+
+ #region Fields
+
+ CompilerResults results;
+ string sourceCode;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal HttpCompileException (CompilerResults results, string sourceCode)
+ : base ()
+ {
+ this.results = results;
+ this.sourceCode = sourceCode;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public CompilerResults Results {
+ get { return results; }
+ }
+
+ public string SourceCode {
+ get { return sourceCode; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpContext.cs b/mcs/class/System.Web/System.Web/HttpContext.cs
new file mode 100644
index 00000000000..916aa0fb280
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpContext.cs
@@ -0,0 +1,431 @@
+//
+// System.Web.HttpContext
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2003, 2004 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
+// "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;
+using System.Collections;
+using System.Configuration;
+using System.Security.Principal;
+using System.Web.Caching;
+using System.Web.Configuration;
+using System.Web.Util;
+using System.Web.SessionState;
+using System.Threading;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Web
+{
+ public sealed class HttpContext : IServiceProvider
+ {
+ private ArrayList _arrExceptions;
+
+ private HttpResponse _oResponse;
+ private HttpRequest _oRequest;
+ private HttpServerUtility _Server;
+ private HttpApplication _oApplication;
+ private HttpSessionState _oSession;
+ private HttpWorkerRequest _oWorkerRequest;
+ private TraceContext _oTrace;
+ private IHttpHandler _Handler;
+ private IHttpAsyncHandler _AsyncHandler;
+
+ private bool _skipauth;
+ private Hashtable _oItems;
+ private DateTime _oTimestamp;
+ int timeoutPossible;
+ long timeoutBegin;
+ object configTimeout;
+ string errorPage;
+ IPrincipal user;
+
+#if NET_2_0
+ private System.Web.UI.Page lastPage;
+#endif
+
+ public HttpContext (HttpRequest Request, HttpResponse Response)
+ {
+ Context = this;
+
+ _arrExceptions = null;
+ _oItems = null;
+ _oTimestamp = DateTime.Now;
+ _oRequest = Request;
+ _oResponse = Response;
+ _oTrace = new TraceContext (this);
+ }
+
+ public HttpContext (HttpWorkerRequest WorkerRequest)
+ {
+ Context = this;
+
+ _arrExceptions = null;
+ _oItems = null;
+ _oTimestamp = DateTime.Now;
+ _oRequest = new HttpRequest (WorkerRequest, this);
+ _oResponse = new HttpResponse (WorkerRequest, this);
+ _oWorkerRequest = WorkerRequest;
+ _oTrace = new TraceContext (this);
+ }
+
+ internal HttpWorkerRequest WorkerRequest
+ {
+ get {
+ return _oWorkerRequest;
+ }
+ }
+
+ internal static HttpContext Context
+ {
+ get {
+ return (HttpContext) CallContext.GetData ("Context");
+ }
+
+ set {
+ CallContext.SetData ("Context", value);
+ }
+ }
+
+ public Exception [] AllErrors
+ {
+ get {
+ if (_arrExceptions == null || _arrExceptions.Count == 0)
+ return null;
+
+ return (Exception []) _arrExceptions.ToArray (typeof (Exception));
+ }
+ }
+
+ public HttpApplicationState Application
+ {
+ get {
+ return HttpApplicationFactory.ApplicationState;
+ }
+ }
+
+ public HttpApplication ApplicationInstance
+ {
+ get {
+ return _oApplication;
+ }
+ set {
+ _oApplication = value;
+ }
+ }
+
+ public Cache Cache
+ {
+ get {
+ return HttpRuntime.Cache;
+ }
+ }
+
+ public static HttpContext Current {
+ get { return Context; }
+#if NET_1_1
+ set { Context = value; }
+#endif
+ }
+
+ public Exception Error
+ {
+ get {
+ if (_arrExceptions == null || _arrExceptions.Count == 0)
+ return null;
+
+ return (Exception) _arrExceptions [0];
+ }
+ }
+
+ public IHttpHandler Handler
+ {
+ get {
+ return _Handler;
+ }
+
+ set {
+ _Handler = value;
+ }
+ }
+
+ internal IHttpAsyncHandler AsyncHandler
+ {
+ get {
+ return _AsyncHandler;
+ }
+
+ set {
+ _AsyncHandler = value;
+ }
+ }
+
+ public bool IsCustomErrorEnabled {
+ get {
+ CustomErrorsConfig cfg;
+ try {
+ cfg = (CustomErrorsConfig) GetConfig ("system.web/customErrors");
+ } catch (Exception) {
+ return false;
+ }
+
+ if (cfg == null)
+ return false;
+
+ CustomErrorMode mode = cfg.Mode;
+ if (mode == CustomErrorMode.On)
+ return true;
+
+ return (mode == CustomErrorMode.RemoteOnly &&
+ _oRequest.ServerVariables ["LOCAL_ADDR"] == _oRequest.UserHostAddress);
+ }
+ }
+
+ public bool IsDebuggingEnabled
+ {
+ get {
+ return CompilationConfiguration.GetInstance (this).Debug;
+ }
+ }
+
+ public IDictionary Items
+ {
+ get {
+ if (_oItems == null)
+ _oItems = new Hashtable ();
+
+ return _oItems;
+ }
+ }
+
+ public HttpRequest Request
+ {
+ get {
+ return _oRequest;
+ }
+ }
+
+ public HttpResponse Response
+ {
+ get {
+ return _oResponse;
+ }
+ }
+
+ public HttpServerUtility Server
+ {
+ get {
+ if (null == _Server)
+ _Server = new HttpServerUtility (this);
+
+ return _Server;
+ }
+ }
+
+ public HttpSessionState Session
+ {
+ get {
+ return (HttpSessionState) _oSession;
+ }
+ }
+
+ public bool SkipAuthorization
+ {
+ get {
+ return _skipauth;
+ }
+
+ set {
+ _skipauth = value;
+ }
+ }
+
+ public DateTime Timestamp
+ {
+ get {
+ return _oTimestamp;
+ }
+ }
+
+ public TraceContext Trace
+ {
+ get {
+ return _oTrace;
+ }
+ }
+
+ public IPrincipal User {
+ get { return user; }
+ set { user = value; }
+ }
+
+ internal bool TimeoutPossible {
+ get { return (Interlocked.CompareExchange (ref timeoutPossible, 1, 1) == 1); }
+ }
+
+ internal void BeginTimeoutPossible ()
+ {
+ timeoutPossible = 1;
+ timeoutBegin = DateTime.UtcNow.Ticks;
+ }
+
+ internal void EndTimeoutPossible ()
+ {
+ Interlocked.CompareExchange (ref timeoutPossible, 0, 1);
+ }
+
+ internal void TryWaitForTimeout ()
+ {
+ while (Interlocked.CompareExchange (ref timeoutPossible, 1, 1) == 1) {
+ Thread.Sleep (500);
+ }
+ }
+
+ internal bool CheckIfTimeout (DateTime dt)
+ {
+ TimeSpan ts = new TimeSpan (dt.Ticks - timeoutBegin);
+ return (ts > ConfigTimeout);
+ }
+
+ internal TimeSpan ConfigTimeout {
+ get {
+ if (configTimeout == null) {
+ HttpRuntimeConfig config = (HttpRuntimeConfig)
+ GetConfig ("system.web/httpRuntime");
+ configTimeout = new TimeSpan (0, 0, config.ExecutionTimeout);
+ }
+
+ return (TimeSpan) configTimeout;
+ }
+ set {
+ configTimeout = value;
+ }
+ }
+
+ internal string ErrorPage {
+ get { return errorPage; }
+ set { errorPage = value; }
+ }
+
+ internal void SetSession (HttpSessionState session)
+ {
+ _oSession = session;
+ }
+
+ public void AddError (Exception errorInfo)
+ {
+ if (_arrExceptions == null)
+ _arrExceptions = new ArrayList ();
+
+ _arrExceptions.Add (errorInfo);
+ }
+
+ public void ClearError ()
+ {
+ _arrExceptions = null;
+ }
+
+ public object GetConfig (string name)
+ {
+ return WebConfigurationSettings.GetConfig (name, this);
+ }
+
+ public static object GetAppConfig (string name)
+ {
+ return WebConfigurationSettings.GetConfig (name);
+ }
+
+ object IServiceProvider.GetService (Type service)
+ {
+ if (service == typeof (HttpWorkerRequest))
+ return _oWorkerRequest;
+
+ if (service == typeof (HttpRequest))
+ return Request;
+
+ if (service == typeof (HttpResponse))
+ return Response;
+
+ if (service == typeof (HttpApplication))
+ return ApplicationInstance;
+
+ if (service == typeof (HttpApplicationState))
+ return Application;
+
+ if (service == typeof (HttpSessionState))
+ return Session;
+
+ if (service == typeof (HttpServerUtility))
+ return Server;
+
+ return null;
+ }
+
+ public void RewritePath (string path)
+ {
+ //LAMESPEC: they say that they throw a ArgumentNullException, however,
+ // i get a NullReferenceException...
+ if (path == null)
+ throw new ArgumentNullException ("path");
+
+ string query;
+ int qmark = path.IndexOf ('?');
+ if (qmark == -1 || qmark + 1 >= path.Length) {
+ query = null;
+ } else {
+ query = path.Substring (qmark + 1);
+ path = path.Substring (0, qmark);
+ }
+
+ path = UrlUtils.Combine (Request.BaseVirtualDir, path);
+ if (!path.StartsWith (HttpRuntime.AppDomainAppVirtualPath))
+ throw new HttpException (404, "The virtual path '" + path +
+ "' maps to another application.");
+
+ Request.SetCurrentExePath (path);
+ Request.QueryStringRaw = query;
+ }
+
+#if NET_1_1
+ public void RewritePath (string filePath, string pathInfo, string queryString)
+ {
+ RewritePath (filePath + "?" + queryString);
+ Request.SetPathInfo (pathInfo);
+ }
+#endif
+
+#if NET_2_0
+ internal System.Web.UI.Page LastPage {
+ get { return lastPage; }
+ set { lastPage = value; }
+ }
+#endif
+
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpCookie.cs b/mcs/class/System.Web/System.Web/HttpCookie.cs
new file mode 100644
index 00000000000..c121772be1b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCookie.cs
@@ -0,0 +1,207 @@
+//
+// System.Web.HttpCookie
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.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;
+using System.Globalization;
+using System.Text;
+using System.Web;
+using System.Collections.Specialized;
+
+namespace System.Web
+{
+ public sealed class HttpCookie
+ {
+ string _Name;
+ string _Value;
+ string _Domain;
+ DateTime _Expires;
+ bool _ExpiresSet;
+ string _Path;
+ bool _Secure = false;
+
+ HttpValueCollection _Values;
+
+ internal HttpCookie ()
+ {
+ _Path = "/";
+ }
+
+ public HttpCookie (string name)
+ {
+ _Path = "/";
+ _Name = name;
+ }
+
+ public HttpCookie (string name, string value)
+ {
+ _Name = name;
+ _Value = value;
+ _Path = "/";
+ }
+
+ internal HttpCookie (string name, string value, string path, DateTime expires)
+ {
+ _Name = name;
+ _Value = value;
+ _Path = path;
+ if (expires != DateTime.MinValue)
+ Expires = expires;
+ }
+
+ internal HttpResponseHeader GetCookieHeader ()
+ {
+ StringBuilder oSetCookie = new StringBuilder ();
+
+ if (null != _Name && _Name.Length > 0) {
+ oSetCookie.Append (_Name);
+ oSetCookie.Append ("=");
+ }
+
+ if (null != _Values) {
+ oSetCookie.Append (_Values.ToString (false));
+ } else if (null != _Value) {
+ oSetCookie.Append (_Value);
+ }
+
+ if (null != _Domain && _Domain.Length > 0) {
+ oSetCookie.Append ("; domain=");
+ oSetCookie.Append (_Domain);
+ }
+
+ if (null != _Path && Path.Length > 0) {
+ oSetCookie.Append ("; path=");
+ oSetCookie.Append (_Path);
+ }
+
+ if (_ExpiresSet && _Expires != DateTime.MinValue) {
+ oSetCookie.Append ("; expires=");
+ DateTime ut = _Expires.ToUniversalTime ();
+ oSetCookie.Append (ut.ToString ("ddd, dd-MMM-yyyy HH':'mm':'ss 'GMT'",
+ DateTimeFormatInfo.InvariantInfo));
+ }
+
+ if (_Secure)
+ oSetCookie.Append ("; secure");
+
+ return new HttpResponseHeader (HttpWorkerRequest.HeaderSetCookie, oSetCookie.ToString());
+ }
+
+ public string Domain
+ {
+ get { return _Domain; }
+ set { _Domain = value; }
+ }
+
+ public DateTime Expires
+ {
+ get {
+ if (!_ExpiresSet)
+ return DateTime.MinValue;
+
+ return _Expires;
+ }
+
+ set {
+ _ExpiresSet = true;
+ _Expires = value;
+ }
+ }
+
+ public bool HasKeys
+ {
+ get {
+ return Values.HasKeys ();
+ }
+ }
+
+ public string this [string key]
+ {
+ get { return Values [key]; }
+ set { Values [key] = value; }
+ }
+
+ public string Name
+ {
+ get { return _Name; }
+ set { _Name = value; }
+ }
+
+ public string Path
+ {
+ get { return _Path; }
+ set { _Path = value; }
+ }
+
+ public bool Secure
+ {
+ get { return _Secure; }
+ set { _Secure = value; }
+ }
+
+ public string Value
+ {
+ get {
+ if (null != _Values)
+ return _Values.ToString (false);
+
+ return _Value;
+ }
+
+ set {
+ if (null != _Values) {
+ _Values.Reset ();
+ _Values.Add (null, value);
+ return;
+ }
+
+ _Value = value;
+ }
+ }
+
+ public NameValueCollection Values
+ {
+ get {
+ if (null == _Values) {
+ _Values = new HttpValueCollection ();
+ if (null != _Value) {
+ // Do we have multiple keys
+ if (_Value.IndexOf ("&") >= 0 || _Value.IndexOf ("=") >= 0) {
+ _Values.FillFromCookieString (_Value);
+ } else {
+ _Values.Add (null, _Value);
+ }
+
+ _Value = null;
+ }
+ }
+
+ return _Values;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpCookieCollection.cs b/mcs/class/System.Web/System.Web/HttpCookieCollection.cs
new file mode 100644
index 00000000000..80d64235461
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCookieCollection.cs
@@ -0,0 +1,171 @@
+//
+// System.Web.HttpCookieCollection
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// (First impl Bob Smith <bob@thestuff.net>)
+//
+
+//
+// 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;
+using System.Web;
+using System.Collections.Specialized;
+
+namespace System.Web
+{
+ public sealed class HttpCookieCollection : NameObjectCollectionBase
+ {
+ HttpCookie [] _AllCookies;
+ string [] _AllKeys;
+
+ HttpResponse _Response;
+
+ internal HttpCookieCollection(HttpResponse Response, bool ReadOnly) : base()
+ {
+ _Response = Response;
+ IsReadOnly = ReadOnly;
+ }
+
+ public HttpCookieCollection () { }
+
+ public string [] AllKeys
+ {
+ get {
+ if (null == _AllKeys)
+ _AllKeys = BaseGetAllKeys ();
+
+ return _AllKeys;
+ }
+ }
+
+ public HttpCookie this [int index]
+ {
+ get { return Get (index); }
+ }
+
+ public HttpCookie this [string name]
+ {
+ get { return Get (name); }
+ }
+
+ public void Add (HttpCookie cookie)
+ {
+ if (null != _Response)
+ _Response.GoingToChangeCookieColl ();
+
+ // empy performance cache
+ _AllCookies = null;
+ _AllKeys = null;
+
+ if (BaseGet (cookie.Name) == null)
+ BaseAdd (cookie.Name, cookie);
+ else
+ BaseSet (cookie.Name, cookie);
+
+ if (null != _Response)
+ _Response.OnCookieAdd (cookie);
+ }
+
+ public void Clear ()
+ {
+ _AllCookies = null;
+ _AllKeys = null;
+ BaseClear ();
+ }
+
+ public void CopyTo (Array dest, int index)
+ {
+ if (null == _AllCookies) {
+ _AllCookies = new HttpCookie [Count];
+
+ for (int i = 0; i != Count; i++)
+ _AllCookies [i] = Get (i);
+ }
+
+ _AllCookies.CopyTo (dest, index);
+ }
+
+ public HttpCookie Get (int index)
+ {
+ return BaseGet (index) as HttpCookie;
+ }
+
+ public HttpCookie Get (string name)
+ {
+ HttpCookie oRet = BaseGet (name) as HttpCookie;
+ if (null == oRet && _Response != null) {
+ _AllCookies = null;
+ _AllKeys = null;
+
+ _Response.GoingToChangeCookieColl ();
+
+ oRet = new HttpCookie (name);
+ BaseAdd (name, oRet);
+
+ _Response.OnCookieAdd (oRet);
+ }
+
+ return oRet;
+ }
+
+ public string GetKey (int index)
+ {
+ return BaseGetKey (index);
+ }
+
+ public void Remove (string name)
+ {
+ if (null != _Response)
+ _Response.GoingToChangeCookieColl ();
+
+ _AllCookies = null;
+ _AllKeys = null;
+ BaseRemove (name);
+
+ if (null != _Response)
+ _Response.ChangedCookieColl ();
+ }
+
+ public void Set (HttpCookie cookie)
+ {
+ if (null != _Response)
+ _Response.GoingToChangeCookieColl ();
+
+ _AllCookies = null;
+ _AllKeys = null;
+ BaseSet (cookie.Name, cookie);
+
+ if (null != _Response)
+ _Response.ChangedCookieColl();
+ }
+
+ internal void MakeCookieExpire (string name, string path)
+ {
+ DateTime expirationTime = new DateTime (1999, 10, 12); // This is the date MS sends!
+ HttpCookie willExpire = new HttpCookie (name, String.Empty, path, expirationTime);
+ Remove (name);
+ Add (willExpire);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpCookieMode.cs b/mcs/class/System.Web/System.Web/HttpCookieMode.cs
new file mode 100644
index 00000000000..bc48d6bb95a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCookieMode.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.HttpCookieMode.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web
+{
+ [Serializable]
+ public enum HttpCookieMode
+ {
+ UseUri = 0,
+ UseCookies = 1,
+ AutoDetect = 2,
+ UseDeviceProfile = 3,
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web/HttpDataTransferMode.cs b/mcs/class/System.Web/System.Web/HttpDataTransferMode.cs
new file mode 100644
index 00000000000..7690bfecb21
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpDataTransferMode.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.HttpDataTransferMode.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web
+{
+ [Serializable]
+ public enum HttpDataTransferMode
+ {
+ HttpDataStore = 0,
+ QueryString = 1
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web/HttpException.cs b/mcs/class/System.Web/System.Web/HttpException.cs
new file mode 100644
index 00000000000..a0ec3383e90
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpException.cs
@@ -0,0 +1,290 @@
+//
+// System.Web.HttpException
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2002 Patrik Torstensson
+// (c) 2003 Ximian, Inc. (http://www.ximian.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;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Web.Compilation;
+using System.Web.Util;
+
+namespace System.Web
+{
+#if NET_2_0
+ [Serializable]
+#endif
+ public class HttpException : ExternalException
+ {
+ int http_code = 500;
+
+ public HttpException () : base ()
+ {
+ }
+
+ public HttpException (string sMessage) : base (sMessage)
+ {
+ }
+
+ public HttpException (string sMessage, Exception InnerException)
+ : base (sMessage, InnerException)
+ {
+ }
+
+ public HttpException (int iHttpCode, string sMessage) : base (sMessage)
+ {
+ http_code = iHttpCode;
+ }
+
+#if NET_2_0
+ protected HttpException (SerializationInfo info, StreamingContext sc) : base (info, sc)
+ {
+ http_code = info.GetInt32 ("_httpCode");
+ }
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("_httpCode", http_code);
+ }
+#endif
+
+ public HttpException (int iHttpCode, string sMessage, int iHR) : base (sMessage, iHR)
+ {
+ http_code = iHttpCode;
+ }
+
+ public HttpException (string sMessage, int iHR) : base (sMessage, iHR)
+ {
+ }
+
+ public HttpException (int iHttpCode,
+ string sMessage,
+ Exception InnerException)
+ : base (sMessage, InnerException)
+ {
+ http_code = iHttpCode;
+ }
+
+ public string GetHtmlErrorMessage ()
+ {
+ if (!(this.InnerException is HtmlizedException))
+ return GetDefaultErrorMessage ();
+
+ return GetHtmlizedErrorMessage ();
+ }
+
+ internal virtual string Description {
+ get { return "Error processing request."; }
+ }
+
+ string GetDefaultErrorMessage ()
+ {
+ StringBuilder builder = new StringBuilder ("<html>\r\n<title>");
+ builder.Append ("Error");
+ if (http_code != 0)
+ builder.Append (" " + http_code);
+
+ builder.AppendFormat ("</title><body bgcolor=\"white\">" +
+ "<h1><font color=\"red\">Server error in '{0}' " +
+ "application</font></h1><hr>\r\n",
+ HtmlEncode (HttpRuntime.AppDomainAppVirtualPath));
+
+ builder.AppendFormat ("<h2><font color=\"maroon\"><i>{0}</i></font></h2>\r\n",
+ HtmlEncode (Message));
+
+ builder.AppendFormat ("<b>Description: </b>{0}\r\n<p>\r\n", Description);
+ builder.Append ("<b>Error Message: </b>");
+ if (http_code != 0)
+ builder.AppendFormat ("HTTP {0}. ", http_code);
+
+ builder.AppendFormat ("{0}\r\n<p>\r\n", HtmlEncode (this.Message));
+
+ if (InnerException != null) {
+ builder.AppendFormat ("<b>Stack Trace: </b>");
+ builder.Append ("<table summary=\"Stack Trace\" width=\"100%\" " +
+ "bgcolor=\"#ffffc\">\r\n<tr><td>");
+ WriteTextAsCode (builder, InnerException.ToString ());
+ builder.Append ("</td></tr>\r\n</table>\r\n<p>\r\n");
+ }
+
+ builder.Append ("<hr>\r\n</body>\r\n</html>\r\n");
+ builder.AppendFormat ("<!--\r\n{0}\r\n-->\r\n", HttpUtility.HtmlEncode (this.ToString ()));
+
+ return builder.ToString ();
+ }
+
+ static string HtmlEncode (string s)
+ {
+ if (s == null)
+ return s;
+
+ string res = HttpUtility.HtmlEncode (s);
+ return res.Replace ("\r\n", "<br />");
+ }
+
+ string GetHtmlizedErrorMessage ()
+ {
+ StringBuilder builder = new StringBuilder ("<html>\r\n<title>");
+ HtmlizedException exc = (HtmlizedException) this.InnerException;
+ builder.Append (exc.Title);
+ builder.AppendFormat ("</title><body bgcolor=\"white\">" +
+ "<h1><font color=\"red\">Server Error in '{0}' " +
+ "Application</font></h1><hr>\r\n",
+ HttpRuntime.AppDomainAppVirtualPath);
+
+ builder.AppendFormat ("<h2><font color=\"maroon\"><i>{0}</i></font></h2>\r\n", exc.Title);
+ builder.AppendFormat ("<b>Description: </b>{0}\r\n<p>\r\n", HtmlEncode (exc.Description));
+ builder.AppendFormat ("<b>Error message: </b>{0}\r\n<p>\r\n", HtmlEncode (exc.ErrorMessage));
+
+ if (exc.FileName != null)
+ builder.AppendFormat ("<b>File name: </b> {0}", HtmlEncode (exc.FileName));
+
+ if (exc.FileText != null) {
+ if (exc.SourceFile != exc.FileName)
+ builder.AppendFormat ("<p><b>Source File: </b>{0}", exc.SourceFile);
+
+ if (exc is ParseException) {
+ builder.Append ("&nbsp;&nbsp;&nbsp;&nbsp;<b>Line: <b>");
+ builder.Append (exc.ErrorLines [0]);
+ }
+
+ builder.Append ("\r\n<p>\r\n");
+
+ if (exc is ParseException) {
+ builder.Append ("<b>Source Error: </b>\r\n");
+ builder.Append ("<table summary=\"Source error\" width=\"100%\"" +
+ " bgcolor=\"#ffffc\">\r\n<tr><td>");
+ WriteSource (builder, exc);
+ builder.Append ("</td></tr>\r\n</table>\r\n<p>\r\n");
+ } else {
+ builder.Append ("<table summary=\"Source file\" width=\"100%\" " +
+ "bgcolor=\"#ffffc\">\r\n<tr><td>");
+ WriteSource (builder, exc);
+ builder.Append ("</td></tr>\r\n</table>\r\n<p>\r\n");
+ }
+ }
+
+ builder.Append ("<hr>\r\n</body>\r\n</html>\r\n");
+ builder.AppendFormat ("<!--\r\n{0}\r\n-->\r\n", HtmlEncode (exc.ToString ()));
+ return builder.ToString ();
+ }
+
+ static void WriteTextAsCode (StringBuilder builder, string text)
+ {
+ builder.Append ("<code><pre>\r\n");
+ builder.AppendFormat ("{0}", HtmlEncode (text));
+ builder.Append ("</pre></code>\r\n");
+ }
+
+ static void WriteSource (StringBuilder builder, HtmlizedException e)
+ {
+ builder.Append ("<code><pre>");
+ if (e is CompilationException)
+ WriteCompilationSource (builder, e);
+ else
+ WritePageSource (builder, e);
+
+ builder.Append ("</pre></code>\r\n");
+ }
+
+ static void WriteCompilationSource (StringBuilder builder, HtmlizedException e)
+ {
+ int [] a = e.ErrorLines;
+ string s;
+ int line = 0;
+ int index = 0;
+ int errline = 0;
+
+ if (a != null && a.Length > 0)
+ errline = a [0];
+
+ TextReader reader = new StringReader (e.FileText);
+ while ((s = reader.ReadLine ()) != null) {
+ line++;
+
+ if (errline == line)
+ builder.Append ("<span style=\"color: red\">");
+
+ builder.AppendFormat ("Line {0}: {1}\r\n", line, HtmlEncode (s));
+
+ if (line == errline) {
+ builder.Append ("</span>");
+ errline = (++index < a.Length) ? a [index] : 0;
+ }
+ }
+ }
+
+ static void WritePageSource (StringBuilder builder, HtmlizedException e)
+ {
+ string s;
+ int line = 0;
+ int beginerror = e.ErrorLines [0];
+ int enderror = e.ErrorLines [1];
+ int begin = beginerror - 3;
+ int end = enderror + 3;
+ if (begin <= 0)
+ begin = 1;
+
+ TextReader reader = new StringReader (e.FileText);
+ while ((s = reader.ReadLine ()) != null) {
+ line++;
+ if (line < begin)
+ continue;
+
+ if (line > end)
+ break;
+
+ if (beginerror == line)
+ builder.Append ("<span style=\"color: red\">");
+
+ builder.AppendFormat ("{0}\r\n", HtmlEncode (s));
+
+ if (enderror <= line) {
+ builder.Append ("</span>");
+ enderror = end + 1; // one shot
+ }
+ }
+ }
+
+ public int GetHttpCode ()
+ {
+ return http_code;
+ }
+
+ public static HttpException CreateFromLastError (string message)
+ {
+ WebTrace.WriteLine ("CreateFromLastError");
+ return new HttpException (message, 0);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpFileCollection.cs b/mcs/class/System.Web/System.Web/HttpFileCollection.cs
new file mode 100644
index 00000000000..674be52eee6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpFileCollection.cs
@@ -0,0 +1,94 @@
+//
+// System.Web.HttpFileCollection
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.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;
+using System.Collections.Specialized;
+
+namespace System.Web {
+ public sealed class HttpFileCollection : NameObjectCollectionBase {
+ private HttpPostedFile [] _AllFiles;
+ private string [] _AllKeys;
+
+ internal HttpFileCollection() : base() {
+ }
+
+ internal void AddFile(string name, HttpPostedFile file) {
+ _AllFiles = null;
+ _AllKeys = null;
+
+ BaseAdd(name, file);
+ }
+
+ public void CopyTo(Array Dest, int index) {
+ if (null == _AllFiles) {
+ _AllFiles = new HttpPostedFile[Count];
+ for (int i = 0; i != Count; i++) {
+ _AllFiles[i] = Get(i);
+ }
+ }
+
+ if (null != _AllFiles) {
+ _AllFiles.CopyTo(Dest, index);
+ }
+ }
+
+ public HttpPostedFile Get(string Name) {
+ return (HttpPostedFile) BaseGet(Name);
+ }
+
+ public HttpPostedFile Get(int index) {
+ return (HttpPostedFile) BaseGet(index);
+ }
+
+ public string GetKey(int index) {
+ return BaseGetKey(index);
+ }
+
+ public string [] AllKeys {
+ get {
+ if (null == _AllKeys) {
+ _AllKeys = BaseGetAllKeys();
+ }
+
+ return _AllKeys;
+ }
+ }
+
+ public HttpPostedFile this [string name] {
+ get {
+ return Get(name);
+ }
+ }
+
+ public HttpPostedFile this [int index] {
+ get {
+ return Get(index);
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpForbiddenHandler.cs b/mcs/class/System.Web/System.Web/HttpForbiddenHandler.cs
new file mode 100644
index 00000000000..6e3dff6688b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpForbiddenHandler.cs
@@ -0,0 +1,48 @@
+//
+// System.Web.HttpForbiddenHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.
+//
+
+namespace System.Web
+{
+ class HttpForbiddenHandler : IHttpHandler
+ {
+ public void ProcessRequest (HttpContext context)
+ {
+ throw new HttpException (403, "Forbidden");
+ }
+
+ public bool IsReusable
+ {
+ get {
+ return true;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpHelper.cs b/mcs/class/System.Web/System.Web/HttpHelper.cs
new file mode 100644
index 00000000000..66b344bb67a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpHelper.cs
@@ -0,0 +1,69 @@
+//
+// System.Web.HttpHelper
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.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;
+using System.Collections;
+using System.IO;
+
+namespace System.Web {
+ internal class HttpHelper {
+ internal static string [] ParseMultiValueHeader(string header) {
+ if (null == header) {
+ return null;
+ }
+
+ if (header.Length == 0) {
+ return null;
+ }
+
+ // Parse the , chars
+ ArrayList oValues = new ArrayList();
+
+ string sValue;
+
+ int iLastPos = -1;
+ int iPos = header.IndexOf(",");
+
+ while (iPos != -1) {
+ sValue = header.Substring(iLastPos + 1, iPos - iLastPos - 1).Trim();
+ iLastPos = iPos;
+
+ iPos = header.IndexOf(",", iPos + 1);
+ oValues.Add(sValue);
+ }
+
+ sValue = header.Substring(iLastPos + 1).Trim();
+ oValues.Add(sValue);
+
+ string [] arrValues = new string[oValues.Count];
+
+ Array.Copy(oValues.ToArray(), 0, arrValues, 0, oValues.Count);
+
+ return arrValues;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpMethodNotAllowedHandler.cs b/mcs/class/System.Web/System.Web/HttpMethodNotAllowedHandler.cs
new file mode 100644
index 00000000000..db686f11398
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpMethodNotAllowedHandler.cs
@@ -0,0 +1,45 @@
+//
+// System.Web.HttpMethodNotAllowedHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.
+//
+
+namespace System.Web
+{
+ class HttpMethodNotAllowedHandler : IHttpHandler
+ {
+ public void ProcessRequest (HttpContext context)
+ {
+ throw new HttpException (405, "Method not allowed");
+ }
+
+ public bool IsReusable {
+ get { return true; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpModuleCollection.cs b/mcs/class/System.Web/System.Web/HttpModuleCollection.cs
new file mode 100644
index 00000000000..d30cda70667
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpModuleCollection.cs
@@ -0,0 +1,94 @@
+//
+// System.Web.HttpModuleCollection
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.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;
+using System.Collections.Specialized;
+
+namespace System.Web {
+ public sealed class HttpModuleCollection : NameObjectCollectionBase {
+ private IHttpModule [] _Modules;
+ private string [] _Keys;
+
+ internal HttpModuleCollection() : base() {
+ }
+
+ internal void AddModule(string key, IHttpModule m) {
+ _Modules = null;
+ _Keys = null;
+
+ BaseAdd(key, m);
+ }
+
+ public void CopyTo(Array dest, int index) {
+ if (null == _Modules) {
+ _Modules = new IHttpModule[Count];
+
+ for (int i = 0; i != Count; i++) {
+ _Modules[i] = Get(i);
+ }
+ }
+
+ if (null != _Modules) {
+ _Modules.CopyTo(dest, index);
+ }
+ }
+
+ public IHttpModule Get(string key) {
+ return (IHttpModule) BaseGet(key);
+ }
+
+ public IHttpModule Get(int index) {
+ return (IHttpModule) BaseGet(index);
+ }
+
+ public string GetKey(int index) {
+ return BaseGetKey(index);
+ }
+
+ public string [] AllKeys {
+ get {
+ if (null == _Keys) {
+ _Keys = BaseGetAllKeys();
+ }
+
+ return _Keys;
+ }
+ }
+
+ public IHttpModule this [string key] {
+ get {
+ return Get(key);
+ }
+ }
+
+ public IHttpModule this [int index] {
+ get {
+ return Get(index);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpMultipartContentParser.cs b/mcs/class/System.Web/System.Web/HttpMultipartContentParser.cs
new file mode 100644
index 00000000000..0c47ccaced8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpMultipartContentParser.cs
@@ -0,0 +1,219 @@
+//
+// System.Web.HttpMultipartContentParser
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (c) 2003 Ben Maurer
+//
+
+//
+// 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;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Text;
+using System.Web.Configuration;
+using System.Web.Util;
+
+namespace System.Web {
+ internal class HttpMultipartContentParser {
+
+ const byte HYPHEN = (byte) '-', LF = (byte) '\n', CR = (byte) '\r';
+
+ public static MultipartContentElement [] Parse (byte [] data, byte [] boundary, Encoding encoding)
+ {
+ HttpMultipartContentParser p = new HttpMultipartContentParser (data, boundary, encoding);
+ p.ParseIntoElementList();
+
+ return (MultipartContentElement []) p.elements.ToArray (typeof (MultipartContentElement));
+ }
+
+ HttpMultipartContentParser (byte [] data, byte [] boundary, Encoding encoding)
+ {
+ this.data = data;
+ this.boundary = boundary;
+ this.enc = encoding;
+ this.len = data.Length;
+ }
+
+ bool IsAtBoundaryLine ()
+ {
+ int boundaryLen = boundary.Length;
+
+ if (lineLen != boundaryLen &&
+ lineLen != boundaryLen + 2)
+ return false;
+
+
+ for (int i = 0; i < boundaryLen; i++)
+ if (data [lineStart + i] != boundary [i])
+ return false;
+
+ if (lineLen == boundaryLen)
+ return true;
+
+ if (data [lineStart + boundaryLen ] != HYPHEN ||
+ data [lineStart + boundaryLen + 1] != HYPHEN)
+ return false;
+
+ lastBoundaryFound = true;
+ return true;
+ }
+
+ string GetAttributeFromContentDispositionHeader (string l, int pos, string name)
+ {
+ string nameEqQuote = name + "=\"";
+
+ int idxVal = l.IndexOf (nameEqQuote, pos);
+ if (idxVal < 0)
+ return null;
+ idxVal += nameEqQuote.Length;
+ int idxEndQuote = l.IndexOf ('"', idxVal);
+ if (idxEndQuote < 0)
+ return null;
+ if (idxEndQuote == idxVal)
+ return "";
+ return l.Substring (idxVal, idxEndQuote - idxVal);
+ }
+
+
+ bool IsAtEndOfData ()
+ {
+ return pos >= len || lastBoundaryFound;
+ }
+
+ private bool GetNextLine()
+ {
+ int pos = this.pos;
+ lineStart = -1;
+
+ while (pos < len && !(this.data [pos] == LF || ++pos + 1 == len))
+ ;
+
+ if (pos >= len)
+ return false;
+
+ lineStart = this.pos;
+ lineLen = pos - lineStart;
+ this.pos = pos + 1;
+
+ if (lineLen > 0 && data [pos - 1] == CR)
+ lineLen--;
+
+ return true;
+ }
+
+ void ParseIntoElementList ()
+ {
+ while (!IsAtBoundaryLine () && GetNextLine ())
+ ;
+
+ do {
+ partName = partFilename = partContentType = null;
+
+ while (this.GetNextLine () && lineLen != 0) {
+
+ string line = enc.GetString (data, lineStart, lineLen);
+ int colonPos = line.IndexOf(':');
+ if (colonPos < 0) continue;
+
+ string headerName = line.Substring (0, colonPos);
+ if (String.Compare (headerName, "Content-Disposition", true) == 0) {
+ partName = GetAttributeFromContentDispositionHeader (line, colonPos + 1, "name");
+ partFilename = GetAttributeFromContentDispositionHeader (line, colonPos + 1, "filename");
+ } else if (String.Compare (headerName, "Content-Type", true) == 0)
+ partContentType = line.Substring (colonPos + 1).Trim ();
+ }
+
+ if (IsAtEndOfData ()) break;
+
+ partDataStart = pos;
+ partDataLength = -1;
+
+ while (GetNextLine ()) {
+ if (!IsAtBoundaryLine ())
+ continue;
+
+ int end = lineStart - 1;
+ if (data [end] == LF) end--;
+ if (data [end] == CR) end--;
+
+ partDataLength = end - partDataStart + 1;
+ break;
+ }
+
+ if (partDataLength == -1) break;
+
+ if (partName != null) {
+ elements.Add (new MultipartContentElement (
+ partName, partFilename, partContentType,
+ data, partDataStart, partDataLength
+ ));
+ }
+ } while (!IsAtEndOfData ());
+ }
+
+ byte [] data, boundary;
+
+ ArrayList elements = new ArrayList ();
+ Encoding enc;
+ bool lastBoundaryFound;
+ int len, lineLen, lineStart;
+
+ int partDataStart, partDataLength;
+ string partContentType, partName, partFilename;
+ int pos;
+ }
+
+ internal class MultipartContentElement {
+ string name, fileName, contentType;
+ byte [] data;
+ int offset, len;
+
+ public MultipartContentElement (string name, string fileName, string contentType, byte [] data, int offset, int len)
+ {
+ this.name = name;
+ this.fileName = fileName;
+ this.contentType = contentType;
+ this.data = data;
+ this.offset = offset;
+ this.len = len;
+ }
+
+ public bool IsFile { get { return fileName != null; } }
+ public bool IsFormItem { get { return fileName == null; } }
+ public string Name { get { return name; } }
+
+ public string GetString (Encoding enc)
+ {
+ if (len == 0) return "";
+ return enc.GetString (data, offset, len);
+ }
+
+ public HttpPostedFile GetFile ()
+ {
+ return new HttpPostedFile (fileName, contentType, new HttpRequestStream (data, offset, len));
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web/HttpParseException.cs b/mcs/class/System.Web/System.Web/HttpParseException.cs
new file mode 100644
index 00000000000..7be72b16317
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpParseException.cs
@@ -0,0 +1,109 @@
+//
+// System.Web.HttpParseException.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+//
+// 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.Runtime.Serialization;
+
+namespace System.Web {
+
+#if NET_2_0
+ [Serializable]
+#endif
+ public class HttpParseException : HttpException {
+
+ int line;
+ string virtualPath;
+
+#if NET_2_0
+ ParserErrorCollection errors = new ParserErrorCollection ();
+#endif
+
+ internal HttpParseException (string message, string virtualPath, int line)
+ : base (message)
+ {
+ this.virtualPath = virtualPath;
+ this.line = line;
+ }
+
+#if NET_2_0
+
+ public HttpParseException (): this ("External component has thrown an exception")
+ {
+ }
+
+ public HttpParseException (string message)
+ : base (message)
+ {
+ errors.Add (new ParserError (message, null, 0));
+ }
+
+ public HttpParseException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ errors.Add (new ParserError (message, null, 0));
+ }
+
+ public HttpParseException (string message, Exception innerException, string virtualPath, string sourceCode, int line)
+ : base (message, innerException)
+ {
+ this.virtualPath = virtualPath;
+ this.line = line;
+ errors.Add (new ParserError (message, virtualPath, line));
+ }
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext ctx)
+ {
+ base.GetObjectData (info, ctx);
+ info.AddValue ("_virtualPath", virtualPath);
+ info.AddValue ("_parserErrors", errors);
+ info.AddValue ("_line", line);
+ }
+#endif
+
+ [MonoTODO]
+ public string FileName {
+ get { return virtualPath; }
+ }
+
+ public int Line {
+ get { return line; }
+ }
+
+#if NET_2_0
+ public string VirtualPath {
+ get { return virtualPath; }
+ }
+
+ public ParserErrorCollection ParserErrors {
+ get { return errors; }
+ }
+#endif
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpPostedFile.cs b/mcs/class/System.Web/System.Web/HttpPostedFile.cs
new file mode 100644
index 00000000000..8393e6e734b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpPostedFile.cs
@@ -0,0 +1,77 @@
+//
+// System.Web.HttpPostedFile
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.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;
+using System.IO;
+
+namespace System.Web {
+ public sealed class HttpPostedFile {
+ private HttpRequestStream _Stream;
+ private string _ContentType;
+ private string _FileName;
+
+ internal HttpPostedFile(string file, string type, HttpRequestStream data) {
+ _Stream = data;
+ _FileName = file;
+ _ContentType = type;
+ }
+
+ public void SaveAs(string filename) {
+ FileStream File = new FileStream(filename, FileMode.Create);
+ if (_Stream.DataLength > 0) {
+ File.Write(_Stream.Data, _Stream.DataOffset, _Stream.DataLength);
+ }
+
+ File.Flush();
+ File.Close();
+ }
+
+ public int ContentLength {
+ get {
+ return _Stream.DataLength;
+ }
+ }
+
+ public string ContentType {
+ get {
+ return _ContentType;
+ }
+ }
+
+ public string FileName {
+ get {
+ return _FileName;
+ }
+ }
+
+ public Stream InputStream {
+ get {
+ return _Stream;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpRequest.cs b/mcs/class/System.Web/System.Web/HttpRequest.cs
new file mode 100644
index 00000000000..bd423b55fb9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpRequest.cs
@@ -0,0 +1,1286 @@
+//
+// System.Web.HttpRequest
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2001, 2002 Patrick Torstensson
+// (c) 2002,2003 Ximian, Inc. (http://www.ximian.com)
+// (c) 2004 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
+// "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;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Text;
+using System.Web.Configuration;
+using System.Web.Util;
+
+namespace System.Web {
+ [MonoTODO("Review security in all path access function")]
+ public sealed class HttpRequest {
+ private string [] _arrAcceptTypes;
+ private string [] _arrUserLanguages;
+
+ private byte [] _arrRawContent;
+ private int _iContentLength;
+
+ private string _sContentType;
+ private string _sHttpMethod;
+ private string _sRawUrl;
+ private string _sUserAgent;
+ private string _sUserHostAddress;
+ private string _sUserHostName;
+ private string _sPath;
+ private string _sPathInfo;
+ private string _sFilePath;
+ private string baseVirtualDir;
+ private string _sPathTranslated;
+ private string _sQueryStringRaw;
+ private string _sRequestType;
+ private string _sRequestRootVirtualDir;
+
+ private Encoding _oContentEncoding;
+
+ private Uri _oUriReferrer;
+ private Uri _oUrl;
+
+ private int _iTotalBytes;
+
+ private HttpContext _oContext;
+
+ private HttpWorkerRequest _WorkerRequest;
+ private HttpRequestStream _oInputStream;
+ private HttpClientCertificate _ClientCert;
+
+ private HttpValueCollection _oServerVariables;
+ private HttpValueCollection _oHeaders;
+ private HttpValueCollection _oQueryString;
+ private HttpValueCollection _oFormData;
+ private HttpValueCollection _oParams;
+
+ private HttpBrowserCapabilities _browser;
+
+ private HttpCookieCollection cookies;
+ Stream userFilter;
+ HttpRequestStream requestFilter;
+ string clientTarget;
+ string currentExePath;
+#if NET_1_1
+ bool validateCookies;
+ bool validateForm;
+ bool validateQueryString;
+
+ bool checkedCookies;
+ bool checkedForm;
+ bool checkedQueryString;
+#endif
+
+ public HttpRequest(string Filename, string Url, string Querystring) {
+ _iContentLength = -1;
+ _iTotalBytes = -1;
+
+ _WorkerRequest = null;
+ _sPathTranslated = Filename;
+ _sRequestType = "GET";
+
+ _oUrl = new Uri(Url);
+ _sPath = _oUrl.AbsolutePath;
+
+ _sQueryStringRaw = Querystring;
+ _oQueryString = new HttpValueCollection(Querystring, true, Encoding.ASCII);
+ }
+
+ internal HttpRequest(HttpWorkerRequest WorkRequest, HttpContext Context) {
+ _WorkerRequest = WorkRequest;
+ _oContext = Context;
+
+ _iContentLength = -1;
+ _iTotalBytes = -1;
+ }
+
+ internal void AddHeaderVariables (ServerVariablesCollection coll)
+ {
+ if (null == _WorkerRequest)
+ return;
+
+ string hname;
+ string hvalue;
+
+ // Add all known headers
+ for (int i = 0; i < HttpWorkerRequest.RequestHeaderMaximum; i++) {
+ hvalue = _WorkerRequest.GetKnownRequestHeader (i);
+ if (null != hvalue && hvalue.Length > 0) {
+ hname = HttpWorkerRequest.GetKnownRequestHeaderName (i);
+ if (null != hname && hname.Length > 0)
+ coll.Add ("HTTP_" + hname.ToUpper ().Replace ('-', '_'), hvalue);
+ }
+ }
+
+ // Get all other headers
+ string [][] unknown = _WorkerRequest.GetUnknownRequestHeaders ();
+ if (null != unknown) {
+ for (int i = 0; i < unknown.Length; i++) {
+ hname = unknown [i][0];
+ hvalue = unknown [i][1];
+ coll.Add ("HTTP_" + hname.ToUpper ().Replace ('-', '_'), hvalue);
+ }
+ }
+ }
+
+ internal string GetAllHeaders(bool raw) {
+ StringBuilder oData;
+
+ if (null == _WorkerRequest) {
+ return null;
+ }
+
+ oData = new StringBuilder(512);
+
+ string sHeaderValue;
+ string sHeaderName;
+ int iCount = 0;
+
+ // Add all known headers
+ for (; iCount != HttpWorkerRequest.RequestHeaderMaximum; iCount++) {
+ sHeaderValue = _WorkerRequest.GetKnownRequestHeader(iCount);
+ if (null != sHeaderValue && sHeaderValue.Length > 0) {
+ sHeaderName = HttpWorkerRequest.GetKnownRequestHeaderName(iCount);
+ if (null != sHeaderName && sHeaderName.Length > 0) {
+ if (raw) {
+ oData.Append(sHeaderName);
+ } else {
+ oData.Append ("HTTP_");
+ oData.Append (sHeaderName.ToUpper ().Replace ('-', '_'));
+ }
+ oData.Append(": ");
+ oData.Append(sHeaderValue);
+ oData.Append("\r\n");
+ }
+ }
+ }
+
+ // Get all other headers
+ string [][] arrUnknownHeaders = _WorkerRequest.GetUnknownRequestHeaders();
+ if (null != arrUnknownHeaders) {
+ for (iCount = 0; iCount != arrUnknownHeaders.Length; iCount++) {
+ string hname = arrUnknownHeaders[iCount][0];
+ if (raw) {
+ oData.Append (hname);
+ } else {
+ oData.Append ("HTTP_");
+ oData.Append (hname.ToUpper ().Replace ('-', '_'));
+ }
+ oData.Append(": ");
+ oData.Append(arrUnknownHeaders[iCount][1]);
+ oData.Append("\r\n");
+ }
+ }
+
+ return oData.ToString();
+ }
+
+ [MonoTODO("We need to handly 'dynamic' variables like AUTH_USER, that can be changed during runtime... special collection")]
+ private void ParseServerVariables() {
+ if (null == _WorkerRequest) {
+ return;
+ }
+
+ if (_oServerVariables == null){
+ _oServerVariables = new ServerVariablesCollection (this);
+ _oServerVariables.MakeReadOnly ();
+ }
+ }
+
+ private void ParseFormData ()
+ {
+ string contentType = ContentType;
+ if (0 == String.Compare (contentType, "application/x-www-form-urlencoded", true)) {
+ byte [] arrData = GetRawContent ();
+ Encoding enc = ContentEncoding;
+ string data = enc.GetString (arrData);
+ _oFormData = new HttpValueCollection (data, true, enc);
+ return;
+ }
+ if (!ContentType.StartsWith ("multipart/form-data")) {
+ if (contentType.Length > 0)
+ Console.WriteLine ("Content-Type -> {0} not supported", contentType);
+ _oFormData = new HttpValueCollection ();
+ return;
+ }
+
+ MultipartContentElement [] parts = GetMultipartFormData ();
+ _oFormData = new HttpValueCollection ();
+ if (parts == null) return;
+
+ foreach (MultipartContentElement p in parts) {
+ if (!p.IsFormItem) continue;
+ _oFormData.Add (p.Name, p.GetString (ContentEncoding));
+ }
+
+ }
+
+ [MonoTODO("void Dispose")]
+ internal void Dispose() {
+ }
+
+ private byte [] GetRawContent ()
+ {
+ if (_arrRawContent != null)
+ return _arrRawContent;
+
+ if (null == _WorkerRequest) {
+ if (QueryStringRaw == null)
+ return null;
+ char [] q = QueryStringRaw.ToCharArray ();
+ _arrRawContent = new byte [q.Length];
+ for (int i = 0; i < q.Length; i++)
+ _arrRawContent [i] = (byte) q [i];
+ return _arrRawContent;
+ }
+
+ _arrRawContent = _WorkerRequest.GetPreloadedEntityBody ();
+ if (_arrRawContent == null)
+ _arrRawContent = new byte [0];
+
+ int length = ContentLength;
+ HttpRuntimeConfig cfg = (HttpRuntimeConfig) _oContext.GetConfig ("system.web/httpRuntime");
+ int maxRequestLength = cfg.MaxRequestLength * 1024;
+ if (ContentLength > maxRequestLength)
+ throw new HttpException (400, "Maximum request length exceeded.");
+
+ if (_WorkerRequest.IsEntireEntityBodyIsPreloaded () || length <= _arrRawContent.Length)
+ return _arrRawContent;
+
+ byte [] arrBuffer = new byte [Math.Min (16384, length)];
+ MemoryStream ms = new MemoryStream (arrBuffer.Length);
+ ms.Write (_arrRawContent, 0, _arrRawContent.Length);
+ int read = 0;
+ int bufLength = arrBuffer.Length;
+ for (int loaded = _arrRawContent.Length; loaded < length; loaded += read) {
+ if (length - loaded < bufLength)
+ bufLength = length - loaded;
+
+ read = _WorkerRequest.ReadEntityBody (arrBuffer, bufLength);
+ if (read == 0 ||read == -1 )
+ break;
+
+ if (ContentLength > maxRequestLength || ms.Length + read > maxRequestLength)
+ throw new HttpException (400, "Maximum request length exceeded.");
+
+ ms.Write (arrBuffer, 0, read);
+ }
+
+ byte [] msBuffer = ms.GetBuffer ();
+ if (msBuffer.Length == length)
+ _arrRawContent = msBuffer;
+ else
+ _arrRawContent = ms.ToArray ();
+
+ if (userFilter != null) {
+ requestFilter.Set (_arrRawContent, 0, _arrRawContent.Length);
+ int userLength = Convert.ToInt32 (userFilter.Length - userFilter.Position);
+ byte [] filtered = new byte [userLength];
+ userFilter.Read (filtered, 0, userLength);
+ _arrRawContent = filtered;
+ }
+
+ return _arrRawContent;
+ }
+
+ internal HttpContext Context {
+ get { return _oContext; }
+ }
+
+ internal HttpWorkerRequest WorkerRequest {
+ get { return _WorkerRequest; }
+ }
+
+ public string [] AcceptTypes {
+ get {
+ if (null == _arrAcceptTypes && null != _WorkerRequest) {
+ _arrAcceptTypes = HttpHelper.ParseMultiValueHeader(_WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderAccept));
+ }
+
+ return _arrAcceptTypes;
+
+ }
+ }
+
+ public string ApplicationPath {
+ get {
+ if (null != _WorkerRequest) {
+ return _WorkerRequest.GetAppPath();
+ }
+
+ return null;
+ }
+ }
+
+ public HttpBrowserCapabilities Browser {
+ get {
+ if (_browser == null) {
+ _browser = (HttpBrowserCapabilities)
+ HttpCapabilitiesBase.GetConfigCapabilities (null, this);
+ }
+
+ return _browser;
+ }
+
+ set { _browser = value; }
+ }
+
+ public HttpClientCertificate ClientCertificate {
+ get {
+ if (null == _ClientCert) {
+ _ClientCert = new HttpClientCertificate(_oContext);
+ }
+
+ return _ClientCert;
+ }
+ }
+
+ private string GetValueFromHeader (string header, string attr)
+ {
+ int where = header.IndexOf (attr + '=');
+ if (where == -1)
+ return null;
+
+ where += attr.Length + 1;
+ int max = header.Length;
+ if (where >= max)
+ return String.Empty;
+
+ char ending = header [where];
+ if (ending != '"')
+ ending = ' ';
+
+ int end = header.Substring (where + 1).IndexOf (ending);
+ if (end == -1)
+ return (ending == '"') ? null : header.Substring (where);
+
+ return header.Substring (where, end);
+ }
+
+ public Encoding ContentEncoding
+ {
+ get {
+ if (_oContentEncoding == null) {
+ if (_WorkerRequest != null &&
+ (!_WorkerRequest.HasEntityBody () || ContentType != String.Empty)) {
+ _oContentEncoding = WebEncoding.RequestEncoding;
+ } else {
+ string charset;
+ charset = GetValueFromHeader (_sContentType, "charset");
+ try {
+ _oContentEncoding = Encoding.GetEncoding (charset);
+ } catch {
+ _oContentEncoding = WebEncoding.RequestEncoding;
+ }
+ }
+ }
+
+ return _oContentEncoding;
+ }
+
+ set {
+ _oContentEncoding = value;
+ }
+ }
+
+ public int ContentLength {
+ get {
+ if (_iContentLength == -1 && null != _WorkerRequest) {
+ string sLength = _WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderContentLength);
+ if (sLength != null) {
+ try {
+ _iContentLength = Int32.Parse(sLength);
+ }
+ catch(Exception) {
+ }
+ }
+ }
+
+ if (_iContentLength < 0) {
+ _iContentLength = 0;
+ }
+
+ return _iContentLength;
+ }
+ }
+
+ public string ContentType {
+ get {
+ if (null == _sContentType) {
+ if (null != _WorkerRequest) {
+ _sContentType = _WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderContentType);
+ }
+
+ if (null == _sContentType) {
+ _sContentType = string.Empty;
+ }
+ }
+
+ return _sContentType;
+ }
+#if NET_1_1
+ set { _sContentType = value; }
+#endif
+ }
+
+ static private string GetCookieValue (string str, int length, ref int i)
+ {
+ if (i >= length)
+ return null;
+
+ int k = i;
+ while (k < length && Char.IsWhiteSpace (str [k]))
+ k++;
+
+ int begin = k;
+ while (k < length && str [k] != ';')
+ k++;
+
+ i = k;
+ return str.Substring (begin, i - begin).Trim ();
+ }
+
+ static private string GetCookieName (string str, int length, ref int i)
+ {
+ if (i >= length)
+ return null;
+
+ int k = i;
+ while (k < length && Char.IsWhiteSpace (str [k]))
+ k++;
+
+ int begin = k;
+ while (k < length && str [k] != ';' && str [k] != '=')
+ k++;
+
+ i = k + 1;
+ return str.Substring (begin, k - begin).Trim ();
+ }
+
+ private void GetCookies ()
+ {
+ string header = _WorkerRequest.GetKnownRequestHeader (HttpWorkerRequest.HeaderCookie);
+ if (header == null || header.Length == 0)
+ return;
+
+ /* RFC 2109
+ * cookie = "Cookie:" cookie-version
+ * 1*((";" | ",") cookie-value)
+ * cookie-value = NAME "=" VALUE [";" path] [";" domain]
+ * cookie-version = "$Version" "=" value
+ * NAME = attr
+ * VALUE = value
+ * path = "$Path" "=" value
+ * domain = "$Domain" "=" value
+ *
+ * MS ignores $Version!
+ * ',' as a separator produces errors.
+ */
+
+ string [] name_values = header.Trim ().Split (';');
+ int length = name_values.Length;
+ HttpCookie cookie = null;
+ int pos;
+ for (int i = 0; i < length; i++) {
+ pos = 0;
+ string name_value = name_values [i].Trim ();
+ string name = GetCookieName (name_value, name_value.Length, ref pos);
+ string value = GetCookieValue (name_value, name_value.Length, ref pos);
+ if (cookie != null) {
+ if (name == "$Path") {
+ cookie.Path = value;
+ continue;
+ } else if (name == "$Domain") {
+ cookie.Domain = value;
+ continue;
+ } else {
+ cookies.Add (cookie);
+ cookie = null;
+ }
+ }
+ cookie = new HttpCookie (name, value);
+ }
+
+ if (cookie != null)
+ cookies.Add (cookie);
+ }
+
+ public HttpCookieCollection Cookies
+ {
+ get {
+ if (cookies == null) {
+ cookies = new HttpCookieCollection (null, false);
+ if (_WorkerRequest != null)
+ GetCookies ();
+ }
+#if NET_1_1
+ if (validateCookies && !checkedCookies) {
+ ValidateCookieCollection (cookies);
+ checkedCookies = true;
+ }
+#endif
+ return cookies;
+ }
+ }
+
+ public string CurrentExecutionFilePath {
+ get {
+ if (currentExePath != null)
+ return currentExePath;
+
+ return FilePath;
+ }
+ }
+
+ public string FilePath {
+ get {
+ if (null == _sFilePath && null != _WorkerRequest) {
+ _sFilePath = _WorkerRequest.GetFilePath();
+ try {
+ _sFilePath = UrlUtils.Reduce (_sFilePath);
+ } catch (Exception) {
+ throw new HttpException (403, "Forbidden");
+ }
+ }
+
+ return _sFilePath;
+ }
+ }
+
+ HttpFileCollection files;
+ public HttpFileCollection Files {
+ get {
+ if (files != null)
+ return files;
+
+ files = new HttpFileCollection ();
+ FillPostedFiles ();
+ return files;
+
+ }
+ }
+
+ void FillPostedFiles ()
+ {
+ if (!ContentType.StartsWith ("multipart/form-data")) return;
+
+ MultipartContentElement [] parts = GetMultipartFormData ();
+ if (parts == null) return;
+
+ foreach (MultipartContentElement p in parts) {
+ if (!p.IsFile) continue;
+ files.AddFile (p.Name, p.GetFile ());
+ }
+ }
+
+ MultipartContentElement [] multipartContent;
+ MultipartContentElement [] GetMultipartFormData ()
+ {
+ if (multipartContent != null) return multipartContent;
+
+ byte [] raw = GetRawContent ();
+ byte [] boundary = Encoding.ASCII.GetBytes (("--" + GetValueFromHeader (ContentType, "boundary")));
+ return multipartContent = HttpMultipartContentParser.Parse (raw, boundary, ContentEncoding);
+ }
+
+ public Stream Filter {
+ get {
+ if (userFilter != null)
+ return userFilter;
+
+ if (requestFilter == null)
+ requestFilter = new HttpRequestStream ();
+
+ // This is an empty stream. It will not contain data until GetRawContent
+ return requestFilter;
+ }
+
+ set {
+ if (requestFilter == null)
+ throw new HttpException ("Invalid request filter.");
+
+ userFilter = value;
+ }
+ }
+
+ public NameValueCollection Form {
+ get {
+ if (_oFormData == null) {
+ ParseFormData ();
+ }
+#if NET_1_1
+ if (validateForm && !checkedForm) {
+ ValidateNameValueCollection ("Form", _oFormData);
+ checkedForm = true;
+ }
+#endif
+
+ return _oFormData;
+ }
+ }
+
+ public NameValueCollection Headers {
+ get {
+ if (_oHeaders == null) {
+ _oHeaders = new HttpValueCollection();
+
+ if (null != _WorkerRequest) {
+ string sHeaderValue;
+ string sHeaderName;
+ int iCount = 0;
+
+ // Add all know headers
+ for (; iCount != 40; iCount++) {
+ sHeaderValue = _WorkerRequest.GetKnownRequestHeader(iCount);
+ if (null != sHeaderValue && sHeaderValue.Length > 0) {
+ sHeaderName = HttpWorkerRequest.GetKnownRequestHeaderName(iCount);
+ if (null != sHeaderName && sHeaderName.Length > 0) {
+ _oHeaders.Add(sHeaderName, sHeaderValue);
+ }
+ }
+ }
+
+ // Get all other headers
+ string [][] arrUnknownHeaders = _WorkerRequest.GetUnknownRequestHeaders();
+ if (null != arrUnknownHeaders) {
+ for (iCount = 0; iCount != arrUnknownHeaders.Length; iCount++) {
+ _oHeaders.Add(arrUnknownHeaders[iCount][0], arrUnknownHeaders[iCount][1]);
+ }
+ }
+ }
+
+ // Make headers read-only
+ _oHeaders.MakeReadOnly();
+ }
+
+ return (NameValueCollection) _oHeaders;
+ }
+ }
+
+ public string HttpMethod {
+ get {
+ if (null == _sHttpMethod) {
+ if (null != _WorkerRequest) {
+ _sHttpMethod = _WorkerRequest.GetHttpVerbName().ToUpper();
+ }
+
+ if (_sHttpMethod == null) {
+ if (RequestType != null)
+ _sHttpMethod = RequestType;
+ else
+ _sHttpMethod = "GET";
+ }
+ }
+
+ return _sHttpMethod;
+ }
+ }
+
+ public Stream InputStream {
+ get {
+ if (_oInputStream == null) {
+ byte [] arrInputData = GetRawContent ();
+
+ if (null != arrInputData) {
+ _oInputStream = new HttpRequestStream(arrInputData, 0, arrInputData.Length);
+ } else {
+ _oInputStream = new HttpRequestStream(null, 0, 0);
+ }
+ }
+
+ return _oInputStream;
+ }
+ }
+
+ public bool IsAuthenticated {
+ get {
+ if (_oContext != null && _oContext.User != null && _oContext.User.Identity != null) {
+ return _oContext.User.Identity.IsAuthenticated;
+ }
+
+ return false;
+ }
+ }
+
+ public bool IsSecureConnection {
+ get {
+ if (null != _WorkerRequest) {
+ return _WorkerRequest.IsSecure();
+ }
+
+ return false;
+ }
+ }
+
+ public string this [string sKey] {
+ get {
+ string result = QueryString [sKey];
+ if (result != null)
+ return result;
+
+ result = Form [sKey];
+ if (result != null)
+ return result;
+
+ HttpCookie cookie = Cookies [sKey];
+ if (cookie != null)
+ return cookie.Value;
+
+ return ServerVariables [sKey];
+ }
+ }
+
+ public NameValueCollection Params {
+ get {
+ if (_oParams == null) {
+ _oParams = new HttpValueCollection();
+
+ _oParams.Merge(QueryString);
+ _oParams.Merge(Form);
+ _oParams.Merge(ServerVariables);
+ int count = Cookies.Count;
+ for (int i = 0; i< count; i++) {
+ HttpCookie cookie = Cookies [i];
+ _oParams.Add (cookie.Name, cookie.Value);
+ }
+ _oParams.MakeReadOnly();
+ }
+
+ return (NameValueCollection) _oParams;
+ }
+ }
+
+ public string Path {
+ get {
+ if (_sPath == null) {
+ if (null != _WorkerRequest) {
+ _sPath = _WorkerRequest.GetUriPath();
+ }
+
+ if (_sPath == null) {
+ _sPath = string.Empty;
+ }
+ }
+
+ return _sPath;
+ }
+ }
+
+ public string PathInfo {
+ get {
+ if (_sPathInfo == null) {
+ if (null != _WorkerRequest) {
+ _sPathInfo = _WorkerRequest.GetPathInfo();
+ }
+
+ if (_sPathInfo == null) {
+ _sPathInfo = string.Empty;
+ }
+ }
+
+ return _sPathInfo;
+ }
+ }
+
+ public string PhysicalApplicationPath {
+ get {
+ if (null != _WorkerRequest) {
+ return _WorkerRequest.GetAppPathTranslated();
+ }
+
+ return null;
+ }
+ }
+
+ public string PhysicalPath {
+ get {
+ if (_sPathTranslated == null && _WorkerRequest != null)
+ _sPathTranslated = _WorkerRequest.MapPath (CurrentExecutionFilePath);
+
+ return _sPathTranslated;
+ }
+ }
+
+ public NameValueCollection QueryString {
+ get {
+ if (_oQueryString == null) {
+ try {
+ _oQueryString = new HttpValueCollection(QueryStringRaw, true,
+ ContentEncoding);
+ } catch {
+ _oQueryString = new HttpValueCollection(QueryStringRaw, true,
+ Encoding.ASCII);
+ }
+ }
+#if NET_1_1
+ if (validateQueryString && !checkedQueryString) {
+ ValidateNameValueCollection ("QueryString", _oQueryString);
+ checkedQueryString = true;
+ }
+#endif
+ return _oQueryString;
+ }
+ }
+
+ // Used to parse the querystring
+ internal string QueryStringRaw {
+ get {
+ if (_sQueryStringRaw == null && null != _WorkerRequest) {
+ byte [] arrQuerystringBytes = _WorkerRequest.GetQueryStringRawBytes();
+ if (null != arrQuerystringBytes && arrQuerystringBytes.Length > 0) {
+ _sQueryStringRaw = ContentEncoding.GetString(arrQuerystringBytes);
+ } else {
+ _sQueryStringRaw = _WorkerRequest.GetQueryString();
+ }
+ }
+
+ if (_sQueryStringRaw == null) {
+ _sQueryStringRaw = string.Empty;
+ }
+
+ return _sQueryStringRaw;
+ }
+
+ set {
+ _sQueryStringRaw = value;
+ _oQueryString = null;
+ _arrRawContent = null;
+ _sRawUrl = null;
+ }
+ }
+
+ public string RawUrl {
+ get {
+ if (null == _sRawUrl) {
+ if (null != _WorkerRequest) {
+ _sRawUrl = _WorkerRequest.GetRawUrl();
+ } else {
+ _sRawUrl = Path;
+ if (QueryStringRaw != null && QueryStringRaw.Length > 0) {
+ _sRawUrl = _sRawUrl + "?" + QueryStringRaw;
+ }
+ }
+ }
+
+ return _sRawUrl;
+ }
+ }
+
+ public string RequestType {
+ get {
+ if (null == _sRequestType) {
+ return HttpMethod;
+ }
+
+ return _sRequestType;
+ }
+
+ set {
+ _sRequestType = value;
+ }
+ }
+
+
+ public NameValueCollection ServerVariables {
+ get {
+ ParseServerVariables();
+
+ return (NameValueCollection) _oServerVariables;
+ }
+ }
+
+ public int TotalBytes {
+ get {
+ if (_iTotalBytes == -1) {
+ if (null != InputStream) {
+ _iTotalBytes = (int) InputStream.Length;
+ } else {
+ _iTotalBytes = 0;
+ }
+ }
+
+ return _iTotalBytes;
+ }
+ }
+
+ public Uri Url {
+ get {
+ if (_oUrl != null || _WorkerRequest == null)
+ return _oUrl;
+
+ string qs = QueryStringRaw;
+ if (qs == null)
+ qs = "";
+ else
+ qs = "?" + qs;
+
+ UriBuilder ub = new UriBuilder (_WorkerRequest.GetProtocol (),
+ _WorkerRequest.GetServerName (),
+ _WorkerRequest.GetLocalPort (),
+ Path,
+ qs);
+
+ _oUrl = ub.Uri;
+ return _oUrl;
+ }
+ }
+
+ public Uri UrlReferrer {
+ get {
+ if (null == _oUriReferrer && null != _WorkerRequest) {
+ string sReferrer = _WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderReferer);
+ if (null != sReferrer && sReferrer.Length > 0) {
+ try {
+ if (sReferrer.IndexOf("://") >= 0) {
+ _oUriReferrer = new Uri(sReferrer);
+ } else {
+ _oUriReferrer = new Uri(this.Url, sReferrer);
+ }
+ }
+ catch (Exception) {
+ }
+ }
+ }
+
+ return _oUriReferrer;
+ }
+ }
+
+ public string UserAgent {
+ get {
+ if (_sUserAgent == null && _WorkerRequest != null) {
+ _sUserAgent = _WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderUserAgent);
+ }
+
+ if (_sUserAgent == null) {
+ _sUserAgent = string.Empty;
+ }
+
+ return _sUserAgent;
+ }
+ }
+
+ public string UserHostAddress {
+ get {
+ if (_sUserHostAddress == null && null != _WorkerRequest) {
+ _sUserHostAddress = _WorkerRequest.GetRemoteAddress();
+ }
+
+ if (_sUserHostAddress == null || _sUserHostAddress.Length == 0) {
+ _sUserHostAddress = "127.0.0.1";
+ }
+
+ return _sUserHostAddress;
+ }
+ }
+
+ public string UserHostName {
+ get {
+ if (_sUserHostName == null && null != _WorkerRequest) {
+ _sUserHostName = _WorkerRequest.GetRemoteName();
+ }
+
+ if (_sUserHostName == null || _sUserHostName.Length == 0) {
+ _sUserHostName = UserHostAddress;
+ }
+
+ return _sUserHostName;
+ }
+ }
+
+ public string [] UserLanguages {
+ get {
+ if (_arrUserLanguages == null && null != _WorkerRequest) {
+ _arrUserLanguages = HttpHelper.ParseMultiValueHeader(_WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderAcceptLanguage));
+ }
+
+ return _arrUserLanguages;
+ }
+ }
+
+ internal string RootVirtualDir {
+ get {
+ if (_sRequestRootVirtualDir == null) {
+ _sRequestRootVirtualDir = FilePath;
+ int pos = _sRequestRootVirtualDir.LastIndexOf ('/');
+ if (pos == -1 || pos == 0)
+ _sRequestRootVirtualDir = "/";
+ else
+ _sRequestRootVirtualDir = _sRequestRootVirtualDir.Substring (0, pos);
+ }
+
+ return _sRequestRootVirtualDir;
+ }
+ }
+
+ internal string BaseVirtualDir {
+ get {
+ if (baseVirtualDir == null)
+ baseVirtualDir = UrlUtils.GetDirectory (FilePath);
+
+ return baseVirtualDir;
+ }
+ }
+
+ internal bool IsLocal {
+ get {
+ return _WorkerRequest.GetLocalAddress () == "127.0.0.1";
+ }
+ }
+
+ public byte [] BinaryRead(int count) {
+ int iSize = TotalBytes;
+ if (iSize == 0) {
+ throw new ArgumentException();
+ }
+
+ byte [] arrData = new byte[iSize];
+
+ int iRetSize = InputStream.Read(arrData, 0, iSize);
+ if (iRetSize != iSize) {
+ byte [] tmpData = new byte[iRetSize];
+ if (iRetSize > 0) {
+ Array.Copy(arrData, 0, tmpData, 0, iRetSize);
+ }
+
+ arrData = tmpData;
+ }
+
+ return arrData;
+ }
+
+ public int [] MapImageCoordinates(string ImageFieldName) {
+ NameValueCollection oItems;
+
+ if (HttpMethod == "GET" || HttpMethod == "HEAD") {
+ oItems = QueryString;
+ } else if (HttpMethod == "POST") {
+ oItems = Form;
+ } else {
+ return null;
+ }
+
+ int [] arrRet = null;
+ try {
+ string sX = oItems.Get(ImageFieldName + ".x");
+ string sY = oItems.Get(ImageFieldName + ".y");
+
+ if (null != sX && null != sY) {
+ int [] arrTmp = new Int32[2];
+ arrRet[0] = Int32.Parse(sX);
+ arrRet[1] = Int32.Parse(sY);
+
+ arrRet = arrTmp;
+ }
+ }
+ catch (Exception) {
+ }
+
+ return arrRet;
+ }
+
+ public string MapPath (string VirtualPath)
+ {
+ return MapPath (VirtualPath, BaseVirtualDir, true);
+ }
+
+ public string MapPath (string virtualPath, string baseVirtualDir, bool allowCrossAppMapping)
+ {
+ if (_WorkerRequest == null)
+ throw new HttpException ("No HttpWorkerRequest!!!");
+
+ if (virtualPath == null || virtualPath.Length == 0)
+ virtualPath = ".";
+ else
+ virtualPath = virtualPath.Trim ();
+
+ if (virtualPath.IndexOf (':') != -1)
+ throw new ArgumentException ("Invalid path -> " + virtualPath);
+
+ if (System.IO.Path.DirectorySeparatorChar != '/')
+ virtualPath = virtualPath.Replace (System.IO.Path.DirectorySeparatorChar, '/');
+
+ if (UrlUtils.IsRooted (virtualPath)) {
+ virtualPath = UrlUtils.Reduce (virtualPath);
+ } else {
+ if (baseVirtualDir == null) {
+ virtualPath = UrlUtils.Combine (RootVirtualDir, virtualPath);
+ } else {
+ virtualPath = UrlUtils.Combine (baseVirtualDir, virtualPath);
+ }
+ }
+
+ if (!allowCrossAppMapping) {
+ if (!virtualPath.ToLower ().StartsWith (RootVirtualDir.ToLower ()))
+ throw new HttpException ("Mapping across applications not allowed.");
+
+ if (RootVirtualDir.Length > 1 && virtualPath.Length > 1 && virtualPath [0] != '/')
+ throw new HttpException ("Mapping across applications not allowed.");
+ }
+
+ return _WorkerRequest.MapPath (virtualPath);
+ }
+
+ public void SaveAs(string filename, bool includeHeaders) {
+ FileStream oFile;
+ TextWriter oWriter;
+ HttpRequestStream oData;
+
+ oFile = new FileStream(filename, FileMode.CreateNew);
+ if (includeHeaders) {
+ oWriter = new StreamWriter(oFile);
+ oWriter.Write(HttpMethod + " " + Path);
+
+ if (QueryStringRaw != null && QueryStringRaw.Length > 0)
+ oWriter.Write("?" + QueryStringRaw);
+ if (_WorkerRequest != null) {
+ oWriter.Write(" " + _WorkerRequest.GetHttpVersion() + "\r\n");
+ oWriter.Write(GetAllHeaders(true));
+ } else {
+ oWriter.Write("\r\n");
+ }
+
+ oWriter.Write("\r\n");
+ oWriter.Flush();
+ }
+
+ oData = (HttpRequestStream) InputStream;
+
+ if (oData.DataLength > 0) {
+ oFile.Write(oData.Data, oData.DataOffset, oData.DataLength);
+ }
+
+ oFile.Flush();
+ oFile.Close();
+ }
+
+#if NET_1_1
+ public void ValidateInput ()
+ {
+ validateCookies = true;
+ validateQueryString = true;
+ validateForm = true;
+ }
+#endif
+
+ internal void SetCurrentExePath (string filePath)
+ {
+ currentExePath = filePath;
+ _sPath = filePath;
+ _sFilePath = filePath;
+ _sRequestRootVirtualDir = null;
+ baseVirtualDir = null;
+ _sPathTranslated = null;
+ }
+
+ internal void SetPathInfo (string pathInfo)
+ {
+ _sPathInfo = pathInfo;
+ }
+
+ internal void SetForm (HttpValueCollection form)
+ {
+ _oFormData = form;
+ }
+
+ internal void SetHeader (string name, string value)
+ {
+ HttpValueCollection headers = (HttpValueCollection) Headers;
+ headers.MakeReadWrite ();
+ headers [name] = value;
+ headers.MakeReadOnly ();
+ }
+
+ internal string ClientTarget {
+ get { return clientTarget; }
+ set {
+ if (value != clientTarget) {
+ clientTarget = value;
+ _browser = null;
+ }
+ }
+ }
+
+#if NET_1_1
+ static void ValidateNameValueCollection (string name, NameValueCollection coll)
+ {
+ if (coll == null)
+ return;
+
+ foreach (string key in coll.Keys) {
+ string val = coll [key];
+ if (CheckString (val))
+ ThrowValidationException (name, key, val);
+ }
+ }
+
+ static void ValidateCookieCollection (HttpCookieCollection cookies)
+ {
+ if (cookies == null)
+ return;
+
+ int size = cookies.Count;
+ HttpCookie cookie;
+ for (int i = 0 ; i < size ; i++) {
+ cookie = cookies[i];
+ if (CheckString (cookie.Value))
+ ThrowValidationException ("Cookies", cookie.Name, cookie.Value);
+ }
+ }
+
+ static void ThrowValidationException (string name, string key, string value)
+ {
+ string v = "\"" + value + "\"";
+ if (v.Length > 20)
+ v = v.Substring (0, 16) + "...\"";
+
+ string msg = String.Format ("A potentially dangerous Request.{0} value was " +
+ "detected from the client ({1}={2}).", name, key, v);
+
+ throw new HttpRequestValidationException (msg);
+ }
+
+ static bool CheckString (string val)
+ {
+ if (val == null)
+ return false;
+
+ //TODO: More checks
+ foreach (char c in val) {
+ if (c == '<' || c == '>' || c == '\xff1c' || c == '\xff1e')
+ return true;
+ }
+
+ return false;
+ }
+#endif
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpRequestPriority.cs b/mcs/class/System.Web/System.Web/HttpRequestPriority.cs
new file mode 100644
index 00000000000..30d68b03936
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpRequestPriority.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.HttpRequestPriority.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.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.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+namespace System.Web
+{
+ [Serializable]
+ public enum HttpRequestPriority
+ {
+ Normal = 10,
+ High = 20,
+ Critical = 30,
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web/HttpRequestStream.cs b/mcs/class/System.Web/System.Web/HttpRequestStream.cs
new file mode 100644
index 00000000000..419ad9b2b40
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpRequestStream.cs
@@ -0,0 +1,165 @@
+//
+// System.Web.HttpRequestStream
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.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;
+using System.IO;
+
+namespace System.Web
+{
+ class HttpRequestStream : Stream
+ {
+ byte [] _arrData;
+ int _iLength;
+ int _iOffset;
+ int _iPos;
+
+ internal HttpRequestStream ()
+ {
+ }
+
+ internal HttpRequestStream (byte [] buffer, int offset, int length)
+ {
+ Set (buffer, offset, length);
+ }
+
+ void Reset ()
+ {
+ Set (null, 0, 0);
+ }
+
+ internal void Set (byte [] buffer, int offset, int length)
+ {
+ _iPos = 0;
+ _iOffset = offset;
+ _iLength = length;
+ _arrData = buffer;
+ }
+
+ public override void Flush ()
+ {
+ }
+
+ public override void Close ()
+ {
+ Reset ();
+ }
+
+ public override int Read (byte [] buffer, int offset, int length)
+ {
+ int iBytes = length;
+
+ if (_iPos < _iOffset)
+ _iPos = _iOffset;
+
+ if (_iPos + length > _iOffset + _iLength) {
+ iBytes = (int) _iOffset + _iLength - _iPos;
+ }
+
+ if (iBytes <= 0) {
+ return 0;
+ }
+
+ Buffer.BlockCopy (_arrData, _iPos, buffer, offset, iBytes);
+ _iPos += iBytes;
+
+ return iBytes;
+ }
+
+ public override long Seek (long offset, SeekOrigin origin)
+ {
+ switch (origin) {
+ case SeekOrigin.Begin:
+ if (offset > _arrData.Length) {
+ throw new ArgumentException ();
+ }
+ _iPos = (int) offset;
+ break;
+ case SeekOrigin.Current:
+ if (((long) _iPos + offset > _arrData.Length) || (_iPos + (int) offset < 0)) {
+ throw new ArgumentException ();
+ }
+ _iPos += Convert.ToInt32 (offset);
+ break;
+
+ case SeekOrigin.End:
+ if (_arrData.Length - offset < 0) {
+ throw new ArgumentException();
+ }
+
+ _iPos = Convert.ToInt32 ( _arrData.Length - offset);
+ break;
+ }
+
+ return (long) _iPos;
+ }
+
+ public override void SetLength (long length)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public override void Write (byte [] buffer, int offset, int length)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public override bool CanRead {
+ get { return true; }
+ }
+
+ public override bool CanSeek {
+ get { return true; }
+ }
+
+ public override bool CanWrite {
+ get { return false; }
+ }
+
+ public byte [] Data {
+ get { return _arrData; }
+ }
+
+ public int DataLength {
+ get { return _iLength; }
+ }
+
+ public int DataOffset {
+ get { return _iOffset; }
+ }
+
+ public override long Length {
+ get { return (long) _arrData.Length; }
+ }
+
+ public override long Position {
+ get { return (long) _iPos; }
+
+ set { Seek (value, SeekOrigin.Begin); }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpRequestValidationException.cs b/mcs/class/System.Web/System.Web/HttpRequestValidationException.cs
new file mode 100644
index 00000000000..10047ad6766
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpRequestValidationException.cs
@@ -0,0 +1,55 @@
+//
+// System.Web.HttpRequestValidationException
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2003 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
+// "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.
+//
+#if NET_1_1
+namespace System.Web
+{
+ public sealed class HttpRequestValidationException : HttpException
+ {
+ internal HttpRequestValidationException (string msg) : base (msg)
+ {
+ }
+
+ internal override string Description {
+ get {
+ return "Request validation detected a potentially dangerous input value " +
+ "from the client and aborted the request. This might be an attemp of " +
+ "using cross-site scripting to compromise the security of your site. " +
+ "You can disable request validation using the 'validateRequest=false' " +
+ "attribute in your page or setting it in your machine.config or web.config " +
+ "configuration files. If you disable it, you're encouraged to properly " +
+ "check the input values you get from the client.<br>\r\n" +
+ "You can get more information on input validation " +
+ "<a href=\"http://www.cert.org/tech_tips/malicious_code_mitigation.html\">" +
+ "here</a>.";
+ }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web/HttpResponse.cs b/mcs/class/System.Web/System.Web/HttpResponse.cs
new file mode 100644
index 00000000000..015c3ecc501
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpResponse.cs
@@ -0,0 +1,1074 @@
+//
+// System.Web.HttpResponse
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.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;
+using System.Collections;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using System.Threading;
+using System.Web.Util;
+using System.Web.Caching;
+
+namespace System.Web
+{
+ public sealed class HttpResponse
+ {
+ // Chunked encoding static helpers
+ static byte [] s_arrChunkSuffix = {13, 10};
+ static byte [] s_arrChunkEnd = {48, 13, 10, 13, 10};
+ static string s_sChunkedPrefix = "\r\n";
+
+ ArrayList _Headers;
+
+ bool _bClientDisconnected;
+ bool _bSuppressHeaders;
+ bool _bSuppressContent;
+ bool _bChunked;
+ bool _bEnded;
+ bool _bBuffering;
+ bool _bHeadersSent;
+ bool _bFlushing;
+ bool filtered;
+ long _lContentLength;
+ int _iStatusCode;
+
+ int _expiresInMinutes;
+ bool _expiresInMinutesSet;
+ DateTime _expiresAbsolute;
+ bool _expiresAbsoluteSet;
+
+ bool _ClientDisconnected;
+ bool closed;
+
+ string _sContentType;
+ string _sCacheControl;
+ string _sTransferEncoding;
+ string _sCharset;
+ string _sStatusDescription;
+ bool forced_charset;
+
+ HttpCookieCollection _Cookies;
+ HttpCachePolicy _CachePolicy;
+
+ Encoding _ContentEncoding;
+
+ HttpContext _Context;
+ HttpWriter _Writer;
+ TextWriter _TextWriter;
+
+ HttpWorkerRequest _WorkerRequest;
+
+ ArrayList fileDependencies;
+ CachedRawResponse cached_response;
+ ArrayList cached_headers;
+#if NET_1_1
+ string redirectLocation;
+#endif
+
+ string app_path_mod = null;
+
+ public HttpResponse (TextWriter output)
+ {
+ _bBuffering = true;
+ _bFlushing = false;
+ _bHeadersSent = false;
+
+ _Headers = new ArrayList ();
+
+ _sContentType = "text/html";
+
+ _iStatusCode = 200;
+ _sCharset = null;
+ _sCacheControl = null;
+
+ _lContentLength = 0;
+ _bSuppressContent = false;
+ _bSuppressHeaders = false;
+ _bClientDisconnected = false;
+
+ _bChunked = false;
+
+ _TextWriter = output;
+ }
+
+ internal HttpResponse (HttpWorkerRequest WorkerRequest, HttpContext Context)
+ {
+ _Context = Context;
+ _WorkerRequest = WorkerRequest;
+
+ _bBuffering = true;
+ _bFlushing = false;
+ _bHeadersSent = false;
+
+ _Headers = new ArrayList ();
+
+ _sContentType = "text/html";
+
+ _iStatusCode = 200;
+ _sCharset = null;
+ _sCacheControl = null;
+
+ _lContentLength = 0;
+ _bSuppressContent = false;
+ _bSuppressHeaders = false;
+ _bClientDisconnected = false;
+
+ _bChunked = false;
+ }
+
+ internal void InitializeWriter ()
+ {
+ // We cannot do this in the .ctor because HttpWriter uses configuration and
+ // it may not be initialized
+ if (_Writer == null) {
+ _Writer = new HttpWriter (this);
+ _TextWriter = _Writer;
+ }
+ }
+
+ internal void FinalFlush ()
+ {
+ Flush (true);
+ }
+
+ internal void DoFilter (bool really)
+ {
+ if (really && null != _Writer)
+ _Writer.FilterData (true);
+
+ filtered = true;
+ }
+
+ internal bool IsCached {
+ get { return cached_response != null; }
+ }
+
+ internal CachedRawResponse GetCachedResponse () {
+ cached_response.StatusCode = StatusCode;
+ cached_response.StatusDescription = StatusDescription;
+ return cached_response;
+ }
+
+ internal void SetCachedHeaders (ArrayList headers)
+ {
+ cached_headers = headers;
+ }
+
+ private ArrayList GenerateHeaders ()
+ {
+ ArrayList oHeaders = new ArrayList (_Headers.ToArray ());
+
+ oHeaders.Add (new HttpResponseHeader ("X-Powered-By", "Mono"));
+ // save culture info, we need us info here
+ CultureInfo oSavedInfo = Thread.CurrentThread.CurrentCulture;
+ Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
+
+ string date = DateTime.UtcNow.ToString ("ddd, d MMM yyyy HH:mm:ss ");
+ HttpResponseHeader date_header = new HttpResponseHeader ("Date", date + "GMT");
+ oHeaders.Add (date_header);
+
+ if (IsCached)
+ cached_response.DateHeader = date_header;
+
+ Thread.CurrentThread.CurrentCulture = oSavedInfo;
+
+ if (_lContentLength > 0) {
+ oHeaders.Add (new HttpResponseHeader (HttpWorkerRequest.HeaderContentLength,
+ _lContentLength.ToString ()));
+ }
+
+ // Apache2 only auto-adds 'charset=blah' for text/plain and text/html
+ if (_sContentType != null) {
+ string ctype = _sContentType;
+ if (forced_charset || _sContentType == "text/plain" || _sContentType == "text/html") {
+ if (_sContentType.IndexOf ("charset=") == -1) {
+ if (Charset.Length == 0)
+ Charset = ContentEncoding.HeaderName;
+
+ // Time to build our string
+ if (Charset.Length > 0)
+ ctype += "; charset=" + Charset;
+ }
+ }
+
+ oHeaders.Add (new HttpResponseHeader (HttpWorkerRequest.HeaderContentType, ctype));
+ }
+
+ if (_CachePolicy != null)
+ _CachePolicy.SetHeaders (this, oHeaders);
+
+ if (_sCacheControl != null) {
+ oHeaders.Add (new HttpResponseHeader (HttpWorkerRequest.HeaderPragma,
+ _sCacheControl));
+ }
+
+ if (_sTransferEncoding != null) {
+ oHeaders.Add (new HttpResponseHeader (HttpWorkerRequest.HeaderTransferEncoding,
+ _sTransferEncoding));
+ }
+
+ if (_Cookies != null) {
+ int length = _Cookies.Count;
+ for (int i = 0; i < length; i++) {
+ oHeaders.Add (_Cookies.Get (i).GetCookieHeader ());
+ }
+ }
+#if NET_1_1
+ if (redirectLocation != null)
+ oHeaders.Add (new HttpResponseHeader (HttpWorkerRequest.HeaderLocation,
+ redirectLocation));
+#endif
+ return oHeaders;
+ }
+
+ private void SendHeaders ()
+ {
+ _WorkerRequest.SendStatus (StatusCode, StatusDescription);
+
+ ArrayList oHeaders;
+
+ if (cached_headers != null)
+ oHeaders = cached_headers;
+ else
+ oHeaders = GenerateHeaders ();
+
+ if (cached_response != null)
+ cached_response.SetHeaders (oHeaders);
+
+ foreach (HttpResponseHeader oHeader in oHeaders)
+ oHeader.SendContent (_WorkerRequest);
+
+ _bHeadersSent = true;
+ }
+
+ public string Status
+ {
+ get {
+ return String.Format ("{0} {1}", StatusCode, StatusDescription);
+ }
+
+ set {
+ string sMsg = "OK";
+ int iCode = 200;
+
+ try {
+ iCode = Int32.Parse (value.Substring (0, value.IndexOf (' ')));
+ sMsg = value.Substring (value.IndexOf (' ') + 1);
+ } catch (Exception) {
+ throw new HttpException ("Invalid status string");
+ }
+
+ StatusCode = iCode;
+ StatusDescription = sMsg;
+ }
+ }
+
+ [MonoTODO()]
+ public void AddCacheItemDependencies (ArrayList cacheKeys)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO()]
+ public void AddCacheItemDependency(string cacheKey)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void AddFileDependencies (ArrayList filenames)
+ {
+ if (filenames == null || filenames.Count == 0)
+ return;
+
+ if (fileDependencies == null) {
+ fileDependencies = (ArrayList) filenames.Clone ();
+ return;
+ }
+
+ foreach (string fn in filenames)
+ AddFileDependency (fn);
+ }
+
+ public void AddFileDependency (string filename)
+ {
+ if (fileDependencies == null)
+ fileDependencies = new ArrayList ();
+
+ fileDependencies.Add (filename);
+ }
+
+ public void AddHeader (string name, string value)
+ {
+ AppendHeader(name, value);
+ }
+
+ public void AppendCookie (HttpCookie cookie)
+ {
+ if (_bHeadersSent)
+ throw new HttpException ("Cannot append cookies after HTTP headers have been sent");
+
+ Cookies.Add (cookie);
+ }
+
+ [MonoTODO()]
+ public void AppendToLog (string param)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string ApplyAppPathModifier (string virtualPath)
+ {
+ if (virtualPath == null)
+ return null;
+
+ if (virtualPath == "")
+ return _Context.Request.RootVirtualDir;
+
+ if (UrlUtils.IsRelativeUrl (virtualPath)) {
+ virtualPath = UrlUtils.Combine (_Context.Request.RootVirtualDir, virtualPath);
+ } else if (UrlUtils.IsRooted (virtualPath)) {
+ virtualPath = UrlUtils.Reduce (virtualPath);
+ }
+
+ if (app_path_mod != null && virtualPath.IndexOf (app_path_mod) < 0) {
+ string rvd = _Context.Request.RootVirtualDir;
+ string basevd = rvd.Replace (app_path_mod, "");
+
+ if (!virtualPath.StartsWith (basevd))
+ return virtualPath;
+
+ virtualPath = UrlUtils.Combine (rvd, virtualPath.Substring (basevd.Length));
+ }
+
+ return virtualPath;
+ }
+
+ internal void SetAppPathModifier (string app_path_mod)
+ {
+ this.app_path_mod = app_path_mod;
+ }
+
+ public bool Buffer
+ {
+ get {
+ return BufferOutput;
+ }
+
+ set {
+ BufferOutput = value;
+ }
+ }
+
+ public bool BufferOutput
+ {
+ get {
+ return _bBuffering;
+ }
+
+ set {
+ if (_Writer != null)
+ _Writer.Update ();
+
+ _bBuffering = value;
+ }
+ }
+
+ public HttpCachePolicy Cache
+ {
+ get {
+ if (null == _CachePolicy) {
+ _CachePolicy = new HttpCachePolicy ();
+ _CachePolicy.CacheabilityUpdated += new CacheabilityUpdatedCallback (
+ OnCacheabilityUpdated);
+ }
+
+ return _CachePolicy;
+ }
+ }
+
+ private void OnCacheabilityUpdated (object sender, CacheabilityUpdatedEventArgs e)
+ {
+ if (e.Cacheability >= HttpCacheability.Server && !IsCached)
+ cached_response = new CachedRawResponse (_CachePolicy);
+ else if (e.Cacheability <= HttpCacheability.Private)
+ cached_response = null;
+ }
+
+ [MonoTODO("Set status in the cache policy")]
+ public string CacheControl
+ {
+ get {
+ return _sCacheControl;
+ }
+
+ set {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ _sCacheControl = value;
+ }
+ }
+
+ public string Charset
+ {
+ get {
+ if (null == _sCharset)
+ _sCharset = ContentEncoding.WebName;
+
+ return _sCharset;
+ }
+
+ set {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ if (value == null)
+ value = "";
+
+ forced_charset = true;
+ _sCharset = value;
+ }
+ }
+
+ public Encoding ContentEncoding
+ {
+ get {
+ if (_ContentEncoding == null)
+ _ContentEncoding = WebEncoding.ResponseEncoding;
+
+ return _ContentEncoding;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("Can't set a null as encoding");
+
+ _ContentEncoding = value;
+
+ if (_Writer != null)
+ _Writer.Update ();
+ }
+ }
+
+ public string ContentType
+ {
+ get {
+ return _sContentType;
+ }
+
+ set {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ _sContentType = value;
+ }
+ }
+
+ public HttpCookieCollection Cookies
+ {
+ get {
+ if (null == _Cookies)
+ _Cookies = new HttpCookieCollection (this, false);
+
+ return _Cookies;
+ }
+ }
+
+ public int Expires
+ {
+ get {
+ return _expiresInMinutes;
+ }
+
+ set {
+ if (!_expiresInMinutesSet || (value < _expiresInMinutes))
+ {
+ _expiresInMinutes = value;
+ Cache.SetExpires(_Context.Timestamp.Add(new TimeSpan(0, _expiresInMinutes, 0)));
+ }
+ _expiresInMinutesSet = true;
+ }
+ }
+
+ public DateTime ExpiresAbsolute
+ {
+ get {
+ return _expiresAbsolute;
+ }
+
+ set {
+ if (!_expiresAbsoluteSet || value.CompareTo(_expiresAbsolute)<0)
+ {
+ _expiresAbsolute = value;
+ Cache.SetExpires(_expiresAbsolute);
+ }
+ _expiresAbsoluteSet = true;
+ }
+ }
+
+ public Stream Filter
+ {
+ get {
+ if (_Writer != null)
+ return _Writer.GetActiveFilter ();
+
+ return null;
+ }
+
+ set {
+ if (_Writer == null)
+ throw new HttpException ("Filtering is not allowed");
+
+ _Writer.ActivateFilter (value);
+ }
+ }
+
+ public bool IsClientConnected
+ {
+ get {
+ if (_ClientDisconnected)
+ return false;
+
+ if (null != _WorkerRequest && (!_WorkerRequest.IsClientConnected ())) {
+ _ClientDisconnected = false;
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+ public TextWriter Output
+ {
+ get {
+ return _TextWriter;
+ }
+ }
+
+ public Stream OutputStream
+ {
+ get {
+ if (_Writer == null)
+ throw new HttpException ("an Output stream not available when " +
+ "running with custom text writer");
+
+ return _Writer.OutputStream;
+ }
+ }
+
+#if NET_1_1
+ public string RedirectLocation {
+ get { return redirectLocation; }
+ set { redirectLocation = value; }
+ }
+#endif
+
+ public string StatusDescription
+ {
+ get {
+ if (null == _sStatusDescription)
+ _sStatusDescription =
+ HttpWorkerRequest.GetStatusDescription (_iStatusCode);
+
+ return _sStatusDescription;
+ }
+
+ set {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ _sStatusDescription = value;
+ }
+ }
+
+ public int StatusCode
+ {
+ get {
+ return _iStatusCode;
+ }
+
+ set {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ _sStatusDescription = null;
+ _iStatusCode = value;
+ }
+ }
+
+ public bool SuppressContent
+ {
+ get {
+ return _bSuppressContent;
+ }
+
+ set {
+ _bSuppressContent = true;
+ }
+ }
+
+ HttpRequest Request
+ {
+ get {
+ if (_Context == null)
+ return null;
+
+ return _Context.Request;
+ }
+ }
+
+ internal void AppendHeader (int iIndex, string value)
+ {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ switch (iIndex) {
+ case HttpWorkerRequest.HeaderContentLength:
+ _lContentLength = Int64.Parse (value);
+ break;
+ case HttpWorkerRequest.HeaderContentEncoding:
+ _sContentType = value;
+ break;
+ case HttpWorkerRequest.HeaderTransferEncoding:
+ _sTransferEncoding = value;
+ _bChunked = (value == "chunked");
+ break;
+ case HttpWorkerRequest.HeaderPragma:
+ _sCacheControl = value;
+ break;
+ default:
+ _Headers.Add (new HttpResponseHeader (iIndex, value));
+ break;
+ }
+ }
+
+ public void AppendHeader (string name, string value)
+ {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ switch (name.ToLower ()) {
+ case "content-length":
+ _lContentLength = Int64.Parse (value);
+ break;
+ case "content-type":
+ _sContentType = value;
+ break;
+ case "transfer-encoding":
+ _sTransferEncoding = value;
+ _bChunked = (value == "chunked");
+ break;
+ case "pragma":
+ _sCacheControl = value;
+ break;
+ default:
+ _Headers.Add (new HttpResponseHeader (name, value));
+ break;
+ }
+ }
+
+ internal TextWriter SetTextWriter (TextWriter w)
+ {
+ TextWriter prev = _TextWriter;
+ _TextWriter = w;
+ return prev;
+ }
+
+ public void BinaryWrite (byte [] buffer)
+ {
+ OutputStream.Write (buffer, 0, buffer.Length);
+ }
+
+ internal void BinaryWrite (byte [] buffer, int start, int length)
+ {
+ OutputStream.Write (buffer, start, length);
+ }
+
+ public void Clear ()
+ {
+ if (_Writer != null)
+ _Writer.Clear ();
+ }
+
+ public void ClearContent ()
+ {
+ Clear();
+ }
+
+ internal void SetHeadersSent (bool val)
+ {
+ _bHeadersSent = val;
+ }
+
+ public void ClearHeaders ()
+ {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ _sContentType = "text/html";
+ forced_charset = false;
+
+ _iStatusCode = 200;
+ _sCharset = null;
+ _Headers = new ArrayList ();
+ _sCacheControl = null;
+ _sTransferEncoding = null;
+
+ _lContentLength = 0;
+ _bSuppressContent = false;
+ _bSuppressHeaders = false;
+ _bClientDisconnected = false;
+ }
+
+ public void Close ()
+ {
+ if (closed && !_bClientDisconnected) {
+ _bClientDisconnected = false;
+ _WorkerRequest.CloseConnection ();
+ _bClientDisconnected = true;
+ }
+ }
+
+ internal void Dispose ()
+ {
+ if (_Writer != null) {
+ _Writer.Dispose ();
+ _Writer = null;
+ }
+ }
+
+ [MonoTODO("Handle callbacks into before done with session, needs to have a non ended flush here")]
+ internal void FlushAtEndOfRequest ()
+ {
+ Flush (true);
+ }
+
+ public void End ()
+ {
+ if (_bEnded)
+ return;
+
+ if (_Context.TimeoutPossible)
+ Thread.CurrentThread.Abort (new StepCompleteRequest ());
+
+ Flush ();
+ _bEnded = true;
+ _Context.ApplicationInstance.CompleteRequest ();
+ }
+
+ public void Flush ()
+ {
+ if (closed)
+ throw new HttpException ("Response already finished.");
+
+ Flush (false);
+ }
+
+ private void Flush (bool bFinish)
+ {
+ if (_bFlushing || closed)
+ return;
+
+ _bFlushing = true;
+
+ if (_Writer == null) {
+ _TextWriter.Flush ();
+ _bFlushing = false;
+ return;
+ }
+
+ try {
+ if (_bClientDisconnected)
+ return;
+
+ long length = _Writer.BufferSize;
+ if (!_bHeadersSent && !_bSuppressHeaders) {
+ if (bFinish) {
+ if (length == 0 && _lContentLength == 0)
+ _sContentType = null;
+
+ SendHeaders ();
+ length = _Writer.BufferSize;
+ _WorkerRequest.SendCalculatedContentLength ((int) length);
+ } else {
+ if (_lContentLength == 0 && _iStatusCode == 200 &&
+ _sTransferEncoding == null) {
+ // Check we are going todo chunked encoding
+ string sProto = Request.ServerVariables ["SERVER_PROTOCOL"];
+ if (sProto != null && sProto == "HTTP/1.1") {
+ AppendHeader (
+ HttpWorkerRequest.HeaderTransferEncoding,
+ "chunked");
+ } else {
+ // Just in case, the old browsers send a HTTP/1.0
+ // request with Connection: Keep-Alive
+ AppendHeader (
+ HttpWorkerRequest.HeaderConnection,
+ "Close");
+ }
+ }
+
+ length = _Writer.BufferSize;
+ SendHeaders ();
+ }
+ }
+
+ if (!filtered) {
+ _Writer.FilterData (false);
+ length = _Writer.BufferSize;
+ }
+
+ if (length == 0) {
+ if (bFinish && _bChunked) {
+ _WorkerRequest.SendResponseFromMemory (s_arrChunkEnd,
+ s_arrChunkEnd.Length);
+ }
+
+ _WorkerRequest.FlushResponse (bFinish);
+ if (!bFinish)
+ _Writer.Clear ();
+ return;
+ }
+
+ if (!_bSuppressContent && Request.HttpMethod == "HEAD")
+ _bSuppressContent = true;
+
+ if (_bSuppressContent)
+ _Writer.Clear ();
+
+ if (!_bSuppressContent) {
+ _bClientDisconnected = false;
+ if (_bChunked) {
+ Encoding oASCII = Encoding.ASCII;
+
+ string chunk = Convert.ToString(_Writer.BufferSize, 16);
+ byte [] arrPrefix = oASCII.GetBytes (chunk + s_sChunkedPrefix);
+
+ _WorkerRequest.SendResponseFromMemory (arrPrefix,
+ arrPrefix.Length);
+
+ _Writer.SendContent (_WorkerRequest);
+
+ _WorkerRequest.SendResponseFromMemory (s_arrChunkSuffix,
+ s_arrChunkSuffix.Length);
+ if (bFinish)
+ _WorkerRequest.SendResponseFromMemory (
+ s_arrChunkEnd, s_arrChunkEnd.Length);
+ } else {
+ _Writer.SendContent (_WorkerRequest);
+ }
+ }
+
+ _WorkerRequest.FlushResponse (bFinish);
+ if (IsCached) {
+ cached_response.ContentLength = (int) length;
+ cached_response.SetData (_Writer.GetBuffer ());
+ }
+ _Writer.Clear ();
+ } finally {
+ if (bFinish)
+ closed = true;
+ _bFlushing = false;
+ }
+ }
+
+ public void Pics (string value)
+ {
+ AppendHeader ("PICS-Label", value);
+ }
+
+
+ public void Redirect (string url)
+ {
+ Redirect (url, true);
+ }
+
+ public void Redirect (string url, bool endResponse)
+ {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ Clear ();
+
+ url = ApplyAppPathModifier (url);
+ StatusCode = 302;
+ AppendHeader (HttpWorkerRequest.HeaderLocation, url);
+
+ // Text for browsers that can't handle location header
+ Write ("<html><head><title>Object moved</title></head><body>\r\n");
+ Write ("<h2>Object moved to <a href='" + url + "'>here</a></h2>\r\n");
+ Write ("</body><html>\r\n");
+
+ if (endResponse)
+ End ();
+ }
+
+ internal bool RedirectCustomError (string errorPage)
+ {
+ if (_bHeadersSent)
+ return false;
+
+ if (Request.QueryString ["aspxerrorpath"] != null)
+ return false; // Prevent endless loop
+
+ Redirect (errorPage + "?aspxerrorpath=" + Request.Path, false);
+ return true;
+ }
+
+ public void Write (char ch)
+ {
+ _TextWriter.Write(ch);
+ }
+
+ public void Write (object obj)
+ {
+ _TextWriter.Write(obj);
+ }
+
+ public void Write (string str)
+ {
+ _TextWriter.Write (str);
+ }
+
+ public void Write (char [] buffer, int index, int count)
+ {
+ _TextWriter.Write (buffer, index, count);
+ }
+
+ public static void RemoveOutputCacheItem (string path)
+ {
+ if (path == null)
+ throw new ArgumentNullException ("path");
+
+ if (!UrlUtils.IsRooted (path))
+ throw new ArgumentException ("Invalid path for HttpResponse.RemoveOutputCacheItem '" +
+ path + "'. An absolute virtual path is expected.");
+
+ Cache cache = HttpRuntime.Cache;
+ cache.Remove (path);
+ }
+
+ public void SetCookie (HttpCookie cookie)
+ {
+ if (_bHeadersSent)
+ throw new HttpException ("Cannot append cookies after HTTP headers have been sent");
+
+ Cookies.Add (cookie);
+ }
+
+ private void WriteFromStream (Stream stream, long offset, long length, long bufsize)
+ {
+ if (offset < 0 || length <= 0)
+ return;
+
+ long stLength = stream.Length;
+ if (offset + length > stLength)
+ length = stLength - offset;
+
+ if (offset > 0)
+ stream.Seek (offset, SeekOrigin.Begin);
+
+ byte [] fileContent = new byte [bufsize];
+ int count = (int) Math.Min (Int32.MaxValue, bufsize);
+ while (length > 0 && (count = stream.Read (fileContent, 0, count)) != 0) {
+ _Writer.WriteBytes (fileContent, 0, count);
+ length -= count;
+ count = (int) Math.Min (length, fileContent.Length);
+ }
+ }
+
+ public void WriteFile (string filename)
+ {
+ WriteFile (filename, false);
+ }
+
+ public void WriteFile (string filename, bool readIntoMemory)
+ {
+ FileStream fs = null;
+ try {
+ fs = File.OpenRead (filename);
+ long size = fs.Length;
+ if (readIntoMemory) {
+ WriteFromStream (fs, 0, size, size);
+ } else {
+ WriteFromStream (fs, 0, size, 8192);
+ }
+ } finally {
+ if (fs != null)
+ fs.Close ();
+ }
+ }
+
+ public void WriteFile (string filename, long offset, long size)
+ {
+ FileStream fs = null;
+ try {
+ fs = File.OpenRead (filename);
+ WriteFromStream (fs, offset, size, 8192);
+ } finally {
+ if (fs != null)
+ fs.Close ();
+ }
+ }
+
+ public void WriteFile (IntPtr fileHandle, long offset, long size)
+ {
+ FileStream fs = null;
+ try {
+ fs = new FileStream (fileHandle, FileAccess.Read);
+ WriteFromStream (fs, offset, size, 8192);
+ } finally {
+ if (fs != null)
+ fs.Close ();
+ }
+ }
+
+ [MonoTODO()]
+ internal void OnCookieAdd (HttpCookie cookie)
+ {
+ }
+
+ [MonoTODO("Do we need this?")]
+ internal void OnCookieChange (HttpCookie cookie)
+ {
+ }
+
+ [MonoTODO()]
+ internal void GoingToChangeCookieColl ()
+ {
+ }
+
+ [MonoTODO()]
+ internal void ChangedCookieColl ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpResponseHeader.cs b/mcs/class/System.Web/System.Web/HttpResponseHeader.cs
new file mode 100644
index 00000000000..ca3fdf39266
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpResponseHeader.cs
@@ -0,0 +1,73 @@
+//
+// System.Web.HttpResponseHeader
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.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;
+
+namespace System.Web {
+ internal class HttpResponseHeader {
+ private string _sHeader;
+ private string _sValue;
+ private int _iKnowHeaderId;
+
+ internal HttpResponseHeader(int KnowHeaderId, string value) {
+ _iKnowHeaderId = KnowHeaderId;
+ _sValue = value;
+ }
+
+ internal HttpResponseHeader(string header, string value) {
+ _sHeader = header;
+ _sValue = value;
+ }
+
+ internal string Name {
+ get {
+ if (null == _sHeader) {
+ return HttpWorkerRequest.GetKnownResponseHeaderName(_iKnowHeaderId);
+ }
+
+ return _sHeader;
+ }
+ }
+
+ internal string Value {
+ get {
+ return _sValue;
+ }
+ set {
+ _sValue = value;
+ }
+ }
+
+ internal void SendContent(HttpWorkerRequest WorkerRequest) {
+ if (null != _sHeader) {
+ WorkerRequest.SendUnknownResponseHeader(_sHeader, _sValue);
+ } else {
+ WorkerRequest.SendKnownResponseHeader(_iKnowHeaderId, _sValue);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpResponseStream.cs b/mcs/class/System.Web/System.Web/HttpResponseStream.cs
new file mode 100644
index 00000000000..38798c6c0bd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpResponseStream.cs
@@ -0,0 +1,108 @@
+//
+// System.Web.HttpResponseStream
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.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;
+using System.IO;
+
+namespace System.Web {
+ /// <summary>
+ /// Simple wrapper around HttpWriter to support the Stream interface
+ /// </summary>
+ class HttpResponseStream : Stream {
+ private HttpWriter _Writer;
+
+ internal HttpResponseStream(HttpWriter Writer) {
+ _Writer = Writer;
+ }
+
+ public override void Flush() {
+ _Writer.Flush();
+ }
+
+ public override void Close() {
+ _Writer.Close();
+ }
+
+ public override int Read(byte [] buffer, int offset, int length) {
+ throw new NotSupportedException();
+ }
+
+ public override long Seek(long offset, SeekOrigin origin) {
+ throw new NotSupportedException();
+ }
+
+ public override void SetLength(long length) {
+ throw new NotSupportedException();
+ }
+
+ public override void Write(byte [] buffer, int offset, int length) {
+ if (offset < 0) {
+ throw new ArgumentOutOfRangeException("offset");
+ }
+
+ if (length < 0) {
+ throw new ArgumentOutOfRangeException("length");
+ }
+
+ _Writer.WriteBytes(buffer, offset, length);
+ }
+
+ public override bool CanRead {
+ get {
+ return false;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return false;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return true;
+ }
+ }
+
+ public override long Length {
+ get {
+ throw new NotSupportedException();
+ }
+ }
+
+ public override long Position {
+ get {
+ throw new NotSupportedException();
+ }
+
+ set {
+ throw new NotSupportedException();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpResponseStreamProxy.cs b/mcs/class/System.Web/System.Web/HttpResponseStreamProxy.cs
new file mode 100644
index 00000000000..29e3b3d3711
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpResponseStreamProxy.cs
@@ -0,0 +1,67 @@
+//
+// System.Web.HttpResponseStreamProxy
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.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;
+using System.IO;
+
+namespace System.Web
+{
+ class HttpResponseStreamProxy : HttpResponseStream
+ {
+ bool filteringActive;
+
+ internal HttpResponseStreamProxy (HttpWriter writer) : base (writer)
+ {
+ }
+
+ internal void CheckFilteringState ()
+ {
+ if (!filteringActive)
+ throw new HttpException ("Invalid response filter state");
+ }
+
+ internal bool Active {
+ get { return filteringActive; }
+ set { filteringActive = value; }
+ }
+
+ public override void Flush ()
+ {
+ }
+
+ public override void Close ()
+ {
+ }
+
+ public override void Write (byte [] buffer, int offset, int length)
+ {
+ CheckFilteringState ();
+ base.Write (buffer, offset, length);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpRuntime.cs b/mcs/class/System.Web/System.Web/HttpRuntime.cs
new file mode 100644
index 00000000000..44d63391509
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpRuntime.cs
@@ -0,0 +1,594 @@
+//
+// System.Web.HttpRuntime
+//
+// Authors:
+// Patrik Torstensson (ptorsten@hotmail.com)
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Gonzalo Paniagua Javier (gonzalo@ximian.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;
+using System.Collections;
+using System.IO;
+using System.Text;
+using System.Security;
+using System.Security.Permissions;
+using System.Threading;
+using System.Web.Configuration;
+using System.Web.UI;
+using System.Web.Util;
+using System.Web.Caching;
+
+namespace System.Web {
+
+ public sealed class HttpRuntime {
+
+ // Security permission helper objects
+ private static IStackWalk appPathDiscoveryStackWalk;
+ private static IStackWalk ctrlPrincipalStackWalk;
+ private static IStackWalk sensitiveInfoStackWalk;
+ private static IStackWalk unmgdCodeStackWalk;
+ private static IStackWalk unrestrictedStackWalk;
+ private static IStackWalk reflectionStackWalk;
+
+ private static HttpRuntime _runtime;
+ private static string appDomainAppId;
+ private static string appDomainId;
+ private static string appDomainAppPath;
+ private static string appDomainAppVirtualPath;
+ private Cache _cache;
+
+ private int _activeRequests;
+ private HttpWorkerRequest.EndOfSendNotification _endOfSendCallback;
+ private AsyncCallback _handlerCallback;
+ private WaitCallback unloadDomainCallback;
+
+ private bool _firstRequestStarted;
+ //private bool _firstRequestExecuted;
+
+ private Exception _initError;
+ private TimeoutManager timeoutManager;
+ private QueueManager queueManager;
+ private TraceManager traceManager;
+ private WaitCallback doRequestCallback;
+ private int pendingCallbacks;
+
+ static HttpRuntime ()
+ {
+ _runtime = new HttpRuntime ();
+ _runtime.Init();
+ }
+
+ public HttpRuntime ()
+ {
+ doRequestCallback = new WaitCallback (DoRequest);
+ }
+
+ static internal object CreateInternalObject(Type type) {
+ return Activator.CreateInstance(type, true);
+ }
+
+ private void Init ()
+ {
+ try {
+ _cache = new Cache ();
+ timeoutManager = new TimeoutManager ();
+
+ _endOfSendCallback = new HttpWorkerRequest.EndOfSendNotification (OnEndOfSend);
+ _handlerCallback = new AsyncCallback (OnHandlerReady);
+ unloadDomainCallback = new WaitCallback (DoUnload);
+ AppDomain.CurrentDomain.DomainUnload += new EventHandler (OnDomainUnload);
+ }
+ catch (Exception error) {
+ _initError = error;
+ }
+ }
+
+ private void OnFirstRequestStart(HttpContext context) {
+ if (_initError != null)
+ throw _initError;
+
+ try {
+ WebConfigurationSettings.Init (context);
+ traceManager = new TraceManager ();
+ queueManager = new QueueManager ();
+ } catch (Exception e) {
+ _initError = e;
+ }
+
+ // If we got an error during init, throw to client now..
+ if (null != _initError)
+ throw _initError;
+ }
+
+ /* Not used
+ private void OnFirstRequestEnd() {
+ }
+ */
+
+ private void OnHandlerReady(IAsyncResult ar) {
+ HttpContext context = (HttpContext) ar.AsyncState;
+ try {
+ IHttpAsyncHandler handler = context.AsyncHandler;
+
+ try {
+ handler.EndProcessRequest(ar);
+ }
+ catch (Exception error) {
+ context.AddError(error);
+ }
+ }
+ finally {
+ context.AsyncHandler = null;
+ }
+
+ FinishRequest(context, context.Error);
+ }
+
+ private void OnEndOfSend(HttpWorkerRequest request, object data) {
+ HttpContext context = (HttpContext) data;
+
+ context.Request.Dispose();
+ context.Response.Dispose();
+ }
+
+ internal void FinishRequest(HttpContext context, Exception error) {
+ if (error == null) {
+ try {
+ context.Response.FlushAtEndOfRequest();
+ } catch (Exception obj) {
+ error = obj;
+ }
+ }
+
+ HttpWorkerRequest request = context.WorkerRequest;
+ if (null != error) {
+ WebTrace.WriteLine (error.ToString ());
+
+ // We don't want the 'headers sent error'
+ context.Response.SetHeadersSent (false);
+ context.Response.Clear ();
+ context.Response.ClearHeaders ();
+
+ if (!(error is HttpException)) {
+ error = new HttpException (String.Empty, error);
+ context.Response.StatusCode = 500;
+ } else {
+ context.Response.StatusCode = ((HttpException) error).GetHttpCode ();
+ }
+
+ if (!RedirectCustomError (context))
+ context.Response.Write (((HttpException) error).GetHtmlErrorMessage ());
+
+ context.Response.FinalFlush ();
+ }
+
+ /*
+ * This is not being used. OnFirstRequestEnd is empty.
+ if (!_firstRequestExecuted) {
+ lock (this) {
+ if (!_firstRequestExecuted) {
+ _firstRequestExecuted = true;
+ OnFirstRequestEnd();
+ }
+ }
+ }
+ */
+
+ Interlocked.Decrement(ref _activeRequests);
+
+ if (null != request)
+ request.EndOfRequest();
+
+ TryExecuteQueuedRequests ();
+ }
+
+ bool RedirectCustomError (HttpContext context)
+ {
+ if (!context.IsCustomErrorEnabled)
+ return false;
+
+ CustomErrorsConfig config = null;
+ try {
+ config = (CustomErrorsConfig) context.GetConfig ("system.web/customErrors");
+ } catch { }
+
+ if (config == null) {
+ if (context.ErrorPage != null)
+ return context.Response.RedirectCustomError (context.ErrorPage);
+
+ return false;
+ }
+
+ string redirect = config [context.Response.StatusCode];
+ if (redirect == null) {
+ redirect = context.ErrorPage;
+ if (redirect == null)
+ redirect = config.DefaultRedirect;
+ }
+
+ if (redirect == null)
+ return false;
+
+ return context.Response.RedirectCustomError (redirect);
+ }
+
+ internal static void FinishUnavailable (HttpWorkerRequest wr)
+ {
+ HttpContext context = new HttpContext (wr);
+ HttpException exception = new HttpException (503, "Service unavailable");
+ Interlocked.Increment (ref _runtime._activeRequests);
+ context.Response.InitializeWriter ();
+ _runtime.FinishRequest (context, exception);
+ }
+
+ void DoUnload (object state)
+ {
+ AppDomain.Unload (AppDomain.CurrentDomain);
+ }
+
+ internal void Dispose() {
+ WaitForRequests (2000);
+ queueManager.Dispose (); // Send a 503 to all queued requests
+ queueManager = null;
+
+ _cache = null;
+ HttpApplicationFactory.EndApplication ();
+ }
+
+ void OnDomainUnload (object o, EventArgs args)
+ {
+ HttpApplicationFactory.EndApplication ();
+ }
+
+ internal void ByeByeDomain ()
+ {
+ HttpApplicationFactory.EndApplication ();
+ ThreadPool.QueueUserWorkItem (unloadDomainCallback);
+ }
+
+ internal void WaitForRequests(int ms) {
+ DateTime timeout = DateTime.Now.AddMilliseconds(ms);
+
+ do {
+ if (Interlocked.CompareExchange (ref _activeRequests, 0, 0) == 0)
+ return;
+
+ Thread.Sleep (100);
+ } while (timeout > DateTime.Now);
+ }
+
+ internal void InternalExecuteRequest (HttpWorkerRequest request)
+ {
+ IHttpHandler handler;
+ IHttpAsyncHandler async_handler;
+
+ HttpContext context = new HttpContext(request);
+
+ request.SetEndOfSendNotification(_endOfSendCallback, context);
+
+ Interlocked.Increment(ref _activeRequests);
+
+ try {
+ if (!_firstRequestStarted) {
+ lock (this) {
+ if (!_firstRequestStarted) {
+ OnFirstRequestStart(context);
+ _firstRequestStarted = true;
+ }
+ }
+ }
+
+ // This *must* be done after the configuration is initialized.
+ context.Response.InitializeWriter ();
+ handler = HttpApplicationFactory.GetInstance(context);
+ if (null == handler)
+ throw new HttpException(FormatResourceString("unable_to_create_app"));
+
+ if (handler is IHttpAsyncHandler) {
+ async_handler = (IHttpAsyncHandler) handler;
+
+ context.AsyncHandler = async_handler;
+ async_handler.BeginProcessRequest(context, _handlerCallback, context);
+ } else {
+ handler.ProcessRequest(context);
+ FinishRequest(context, null);
+ }
+ }
+ catch (Exception error) {
+ context.Response.InitializeWriter ();
+ FinishRequest(context, error);
+ }
+ }
+
+ void DoRequest (object o)
+ {
+ Interlocked.Decrement (ref pendingCallbacks);
+ InternalExecuteRequest ((HttpWorkerRequest) o);
+ }
+
+ void TryExecuteQueuedRequests ()
+ {
+ // Wait for pending jobs to start
+ if (Interlocked.CompareExchange (ref pendingCallbacks, 3, 3) >= 3)
+ return;
+
+ HttpWorkerRequest wr = queueManager.GetNextRequest (null);
+ if (wr == null)
+ return;
+
+ Interlocked.Increment (ref pendingCallbacks);
+ ThreadPool.QueueUserWorkItem (doRequestCallback, wr);
+ TryExecuteQueuedRequests ();
+ }
+
+ public static void ProcessRequest (HttpWorkerRequest request)
+ {
+ if (request == null)
+ throw new ArgumentNullException ("request");
+
+ QueueManager mgr = _runtime.queueManager;
+ if (_runtime._firstRequestStarted && mgr != null) {
+ request = mgr.GetNextRequest (request);
+ // We're busy, return immediately
+ if (request == null)
+ return;
+ }
+
+ _runtime.InternalExecuteRequest (request);
+ }
+
+#if NET_1_1
+ public static void UnloadAppDomain ()
+ {
+ _runtime.ByeByeDomain ();
+ }
+#endif
+ public static Cache Cache {
+ get {
+ return _runtime._cache;
+ }
+ }
+
+ public static string AppDomainAppId {
+ get {
+ if (appDomainAppId == null)
+ appDomainAppId = (string) AppDomain.CurrentDomain.GetData (".appId");
+
+ return appDomainAppId;
+ }
+ }
+
+ public static string AppDomainAppPath {
+ get {
+ if (appDomainAppPath == null)
+ appDomainAppPath = (string) AppDomain.CurrentDomain.GetData (".appPath");
+
+ return appDomainAppPath;
+ }
+ }
+
+ public static string AppDomainAppVirtualPath {
+ get {
+ if (appDomainAppVirtualPath == null)
+ appDomainAppVirtualPath = (string) AppDomain.CurrentDomain.GetData (".appVPath");
+
+ return appDomainAppVirtualPath;
+ }
+ }
+
+ public static string AppDomainId {
+ get {
+ if (appDomainId == null)
+ appDomainId = (string) AppDomain.CurrentDomain.GetData (".domainId");
+
+ return appDomainId;
+ }
+ }
+
+ public static string AspInstallDirectory {
+ get {
+ return ICalls.GetMachineInstallDirectory ();
+ }
+ }
+
+ public static string BinDirectory {
+ get {
+ return Path.Combine (AppDomainAppPath, "bin");
+ }
+ }
+
+ public static string ClrInstallDirectory {
+ get {
+ return ICalls.GetMachineInstallDirectory ();
+ }
+ }
+
+ public static string CodegenDir {
+ get {
+ return AppDomain.CurrentDomain.SetupInformation.DynamicBase;
+ }
+ }
+
+ public static bool IsOnUNCShare {
+ get {
+ // IsUnc broken under unix?
+ return (!((int) Environment.OSVersion.Platform == 128) &&
+ new Uri ("file://" + ClrInstallDirectory).IsUnc);
+ }
+ }
+
+ public static string MachineConfigurationDirectory {
+ get {
+ return Path.GetDirectoryName (WebConfigurationSettings.MachineConfigPath);
+ }
+ }
+
+ internal static TimeoutManager TimeoutManager {
+ get {
+ return HttpRuntime._runtime.timeoutManager;
+ }
+ }
+
+ internal static TraceManager TraceManager {
+ get {
+ return HttpRuntime._runtime.traceManager;
+ }
+ }
+
+ public static void Close ()
+ {
+ _runtime.Dispose ();
+ }
+
+ internal static string FormatResourceString (string key)
+ {
+ return GetResourceString (key);
+ }
+
+ internal static string FormatResourceString (string key, string arg0)
+ {
+ /*string format = GetResourceString (key);
+
+ if (format == null)
+ return null;
+
+ return String.Format (format, arg0);
+ */
+ return String.Format ("{0}: {1}", key, arg0);
+ }
+
+ [MonoTODO ("FormatResourceString (string, string, string)")]
+ internal static string FormatResourceString (string key, string arg0, string type) {
+ return String.Format ("{0}: {1} {2}", key, arg0, type);
+ }
+
+ [MonoTODO ("FormatResourceString (string, string, string, string)")]
+ internal static string FormatResourceString (string key, string arg0,
+ string arg1, string arg2)
+ {
+ return String.Format ("{0}: {1} {2} {3}", key, arg0, arg1, arg2);
+ }
+
+ [MonoTODO ("FormatResourceString (string, string[]")]
+ internal static string FormatResourceString (string key, string[] args)
+ {
+ //StringBuilder sb = new StringBuilder ();
+ /*sb.AppendFormat ("{0}: ", key);
+ foreach (string s in args)
+ sb.AppendFormat ("{0} ", s);
+
+ if (sb.Length > 0)
+ sb.Length--;
+ return sb.ToString ();*/
+ string s = key + ": ";
+ if (args != null)
+ foreach (string k in args)
+ s += k + " ";
+ return s;
+ }
+
+ private static string GetResourceString (string key) {
+ return _runtime.GetResourceStringFromResourceManager (key);
+ }
+
+ [MonoTODO ("GetResourceStringFromResourceManager (string)")]
+ private string GetResourceStringFromResourceManager (string key) {
+ return key;
+ }
+
+ #region Security Internal Methods (not impl)
+ [MonoTODO ("Get Application path from the appdomain object")]
+ internal static IStackWalk AppPathDiscovery {
+ get {
+ if (appPathDiscoveryStackWalk == null) {
+ appPathDiscoveryStackWalk = new FileIOPermission (
+ FileIOPermissionAccess.PathDiscovery, "<apppath>");
+ }
+ return appPathDiscoveryStackWalk;
+ }
+ }
+
+ internal static IStackWalk ControlPrincipal {
+ get {
+ if (ctrlPrincipalStackWalk == null) {
+ ctrlPrincipalStackWalk = new SecurityPermission (
+ SecurityPermissionFlag.ControlPrincipal);
+ }
+ return ctrlPrincipalStackWalk;
+ }
+ }
+
+ internal static IStackWalk Reflection {
+ get {
+ if (reflectionStackWalk == null) {
+ reflectionStackWalk = new ReflectionPermission (
+ ReflectionPermissionFlag.TypeInformation |
+ ReflectionPermissionFlag.MemberAccess);
+ }
+ return reflectionStackWalk;
+ }
+ }
+
+ internal static IStackWalk SensitiveInformation {
+ get {
+ if (sensitiveInfoStackWalk == null) {
+ sensitiveInfoStackWalk = new EnvironmentPermission (
+ PermissionState.Unrestricted);
+ }
+ return sensitiveInfoStackWalk;
+ }
+ }
+
+ internal static IStackWalk UnmanagedCode {
+ get {
+ if (unmgdCodeStackWalk == null) {
+ unmgdCodeStackWalk = new SecurityPermission (
+ SecurityPermissionFlag.UnmanagedCode);
+ }
+ return unmgdCodeStackWalk;
+ }
+ }
+
+ internal static IStackWalk Unrestricted {
+ get {
+ if (unrestrictedStackWalk == null) {
+ unrestrictedStackWalk = new PermissionSet (
+ PermissionState.Unrestricted);
+ }
+ return unrestrictedStackWalk;
+ }
+ }
+
+ internal static IStackWalk FileReadAccess (string file)
+ {
+ return new FileIOPermission (FileIOPermissionAccess.Read, file);
+ }
+
+ internal static IStackWalk PathDiscoveryAccess (string path)
+ {
+ return new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path);
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpServerUtility.cs b/mcs/class/System.Web/System.Web/HttpServerUtility.cs
new file mode 100644
index 00000000000..86c925de04b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpServerUtility.cs
@@ -0,0 +1,411 @@
+
+//
+// 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.
+//
+/**
+ * Namespace: System.Web
+ * Class: HttpServerUtility
+ *
+ * Authosr:
+ * Wictor Wilén (wictor@ibizkit.se)
+ * Patrik Torstensson (patrik.torstensson@labs2.com)
+ * Gonzalo Paniagua Javier (gonzalo@ximian.com)
+ *
+ * (c) Wictor Wilén (2002)
+ * (c) 2002 Patrik Torstensson
+ * (c) 2003 Ximian, Inc. (http://www.ximian.com)
+ *
+ * (This log is no longer maintained)
+ * ---------------------------------------
+ * 2002-03-27 Wictor Started implementation
+ * 2002-04-09 Patrik Added HttpContext constructor
+ * 2002-04-10 Patrik Moved encoding to HttpUtility and
+ * fixed all functions that used
+ * HttpContext
+ *
+ */
+using System;
+using System.Collections.Specialized;
+using System.IO;
+using System.Text;
+using System.Web.Hosting;
+using System.Web.UI;
+using System.Web.Util;
+
+namespace System.Web
+{
+ public sealed class HttpServerUtility
+ {
+ private static string _name;
+
+ private HttpContext _Context;
+ private HttpApplication _Application;
+
+ internal HttpServerUtility (HttpContext Context)
+ {
+ _Context = Context;
+ }
+
+ internal HttpServerUtility (HttpApplication app)
+ {
+ _Application = app;
+ }
+
+ // Properties
+
+
+ /// <summary>
+ /// Gets the server's computer name.
+ /// </summary>
+ public string MachineName {
+ get {
+ if(_name == null)
+ _name = Environment.MachineName;
+
+ return _name;
+ }
+ }
+
+ public int ScriptTimeout {
+ get {
+ return (int) _Context.ConfigTimeout.TotalSeconds;
+ }
+ set {
+ if (value <= 0)
+ throw new ArgumentOutOfRangeException ("value");
+
+ _Context.ConfigTimeout = new TimeSpan (0, 0, value);
+ }
+ }
+
+ // Methods
+
+ /// <summary>
+ /// Clears the previous exception.
+ /// </summary>
+ public void ClearError ()
+ {
+ if (null != _Context) {
+ _Context.ClearError ();
+ return;
+ }
+
+ if (null != _Application) {
+ _Application.ClearError ();
+ }
+ }
+
+
+ /// <summary>
+ /// Creates a server instance of a COM object identified by the object's Programmatic Identifier (ProgID).
+ /// </summary>
+ /// <param name="progID">The class or type of object to be instantiated. </param>
+ /// <returns>The new object.</returns>
+ public object CreateObject (string progID)
+ {
+ return CreateObject (Type.GetTypeFromProgID (progID));
+ }
+
+
+ /// <summary>
+ /// Creates a server instance of a COM object identified by the object's type.
+ /// </summary>
+ /// <param name="type">A Type representing the object to create. </param>
+ /// <returns>The new object.</returns>
+ public object CreateObject (Type type)
+ {
+ return Activator.CreateInstance (type);
+ }
+
+
+ /// <summary>
+ /// Creates a server instance of a COM object identified by the object's class identifier (CLSID).
+ /// </summary>
+ /// <param name="clsid">The class identifier of the object to be instantiated. </param>
+ /// <returns>The new object.</returns>
+ public object CreateObjectFromClsid (string clsid)
+ {
+ Guid guid = new Guid (clsid);
+ return CreateObject (Type.GetTypeFromCLSID (guid));
+ }
+
+
+ /// <summary>
+ /// Executes a request to another page using the specified URL path to the page.
+ /// </summary>
+ /// <param name="path">The URL path of the new request. </param>
+ public void Execute (string path)
+ {
+ Execute (path, null);
+ }
+
+
+ /// <summary>
+ /// Executes a request to another page using the specified URL path to the page.
+ /// A TextWriter captures output from the page.
+ /// </summary>
+ /// <param name="path">The URL path of the new request. </param>
+ /// <param name="writer">The TextWriter to capture the output. </param>
+ public void Execute (string path, TextWriter writer)
+ {
+ Execute (path, writer, false);
+ }
+
+#if NET_2_0
+ public
+#else
+ internal
+#endif
+ void Execute (string path, TextWriter writer, bool preserveQuery)
+ {
+ if (path == null)
+ throw new ArgumentNullException ("path");
+
+ if (_Context == null)
+ throw new HttpException ("No context available.");
+
+ if (path.IndexOf (':') != -1)
+ throw new ArgumentException ("Invalid path.");
+
+ int qmark = path.IndexOf ('?');
+ string query;
+ if (qmark != -1) {
+ query = path.Substring (qmark + 1);
+ path = path.Substring (0, qmark);
+ } else {
+ query = "";
+ }
+
+ HttpRequest request = _Context.Request;
+ HttpResponse response = _Context.Response;
+
+ string oldQuery = request.QueryStringRaw;
+ request.QueryStringRaw = query;
+
+ HttpValueCollection oldForm = null;
+ if (!preserveQuery) {
+ oldForm = _Context.Request.Form as HttpValueCollection;
+ _Context.Request.SetForm (new HttpValueCollection ());
+ }
+
+ string filePath = _Context.Request.MapPath (path);
+ TextWriter output = writer;
+ if (output == null)
+ output = response.Output;
+
+ string oldFilePath = request.FilePath;
+ request.SetCurrentExePath (UrlUtils.Combine (_Context.Request.BaseVirtualDir, path));
+ IHttpHandler handler = _Context.ApplicationInstance.CreateHttpHandler (_Context,
+ request.RequestType,
+ path,
+ filePath);
+ TextWriter previous = null;
+ try {
+ previous = response.SetTextWriter (output);
+ if (!(handler is IHttpAsyncHandler)) {
+ handler.ProcessRequest (_Context);
+ } else {
+ IHttpAsyncHandler asyncHandler = (IHttpAsyncHandler) handler;
+ IAsyncResult ar = asyncHandler.BeginProcessRequest (_Context, null, null);
+ ar.AsyncWaitHandle.WaitOne ();
+ asyncHandler.EndProcessRequest (ar);
+ }
+ } finally {
+ request.SetCurrentExePath (oldFilePath);
+ request.QueryStringRaw = oldQuery;
+ response.SetTextWriter (previous);
+ if (!preserveQuery)
+ _Context.Request.SetForm (oldForm);
+ }
+
+ }
+
+ /// <summary>
+ /// Returns the previous exception.
+ /// </summary>
+ /// <returns>The previous exception that was thrown.</returns>
+ public Exception GetLastError ()
+ {
+ if (_Context == null)
+ return null;
+
+ return _Context.Error;
+ }
+
+
+
+ /// <summary>
+ /// Decodes an HTML-encoded string and returns the decoded string.
+ /// </summary>
+ /// <param name="s">The HTML string to decode. </param>
+ /// <returns>The decoded text.</returns>
+ public string HtmlDecode (string s)
+ {
+ return HttpUtility.HtmlDecode (s);
+ }
+
+
+ /// <summary>
+ /// Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s">The HTML string to decode</param>
+ /// <param name="output">The TextWriter output stream containing the decoded string. </param>
+ public void HtmlDecode (string s, TextWriter output)
+ {
+ output.Write (HttpUtility.HtmlDecode (s));
+ }
+
+ /// <summary>
+ /// HTML-encodes a string and returns the encoded string.
+ /// </summary>
+ /// <param name="s">The text string to encode. </param>
+ /// <returns>The HTML-encoded text.</returns>
+ public string HtmlEncode (string s)
+ {
+ return HttpUtility.HtmlEncode (s);
+ }
+
+ /// <summary>
+ /// HTML-encodes a string and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s">The string to encode. </param>
+ /// <param name="output">The TextWriter output stream containing the encoded string. </param>
+ public void HtmlEncode (string s, TextWriter output)
+ {
+ output.Write (HtmlEncode (s));
+ }
+
+
+ /// <summary>
+ /// Returns the physical file path that corresponds to the specified virtual path on the Web server.
+ /// </summary>
+ /// <param name="path">The virtual path on the Web server. </param>
+ /// <returns>The physical file path that corresponds to path.</returns>
+ public string MapPath (string path)
+ {
+ if (null == _Context)
+ throw new HttpException ("MapPath is not available");
+
+ return _Context.Request.MapPath (path);
+ }
+
+ /// <summary>
+ /// Terminates execution of the current page and begins execution of a new page using the specified
+ /// URL path to the page.
+ /// </summary>
+ /// <param name="path">The URL path of the new page on the server to execute. </param>
+ public void Transfer (string path)
+ {
+ // If it's a page and a postback, don't pass form data
+ // See bug #65613.
+ bool preserveForm = true;
+ if (_Context.Handler is Page) {
+ Page page = (Page) _Context.Handler;
+ preserveForm = !page.IsPostBack;
+ }
+
+ Transfer (path, preserveForm);
+ }
+
+ /// <summary>
+ /// Terminates execution of the current page and begins execution of a new page using the specified
+ /// URL path to the page. Specifies whether to clear the QueryString and Form collections.
+ /// </summary>
+ /// <param name="path">The URL path of the new page on the server to execute. </param>
+ /// <param name="preserveForm">If true, the QueryString and Form collections are preserved. If false,
+ /// they are cleared. The default is false. </param>
+ public void Transfer (string path, bool preserveForm)
+ {
+ Execute (path, null, preserveForm);
+ _Context.Response.End ();
+ }
+
+ /// <summary>
+ /// URL-decodes a string and returns the decoded string.
+ /// </summary>
+ /// <param name="s">The text string to decode. </param>
+ /// <returns>The decoded text.</returns>
+ /// <remarks>
+ /// Post/html encoding @ ftp://ftp.isi.edu/in-notes/rfc1866.txt
+ /// Uncomment the line marked with RFC1738 to get pure RFC1738
+ /// and it will also consider the RFC1866 (ftp://ftp.isi.edu/in-notes/rfc1866.txt)
+ /// `application/x-www-form-urlencoded' format
+ /// </remarks>
+ public string UrlDecode (string s)
+ {
+ return HttpUtility.UrlDecode (s);
+ }
+
+ /// <summary>
+ /// Decodes an HTML string received in a URL and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s"></param>
+ /// <param name="output"></param>
+ public void UrlDecode (string s, TextWriter output)
+ {
+ if (s != null)
+ output.Write (UrlDecode (s));
+ }
+
+ /// <summary>
+ /// URL-encodes a string and returns the encoded string.
+ /// </summary>
+ /// <param name="s">The text to URL-encode. </param>
+ /// <returns>The URL encoded text.</returns>
+ public string UrlEncode (string s)
+ {
+ return HttpUtility.UrlEncode (s);
+ }
+
+ /// <summary>
+ /// URL encodes a string and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s">The text string to encode. </param>
+ /// <param name="output">The TextWriter output stream containing the encoded string. </param>
+ public void UrlEncode (string s, TextWriter output)
+ {
+ if (s != null)
+ output.Write (UrlEncode (s));
+ }
+
+ /// <summary>
+ /// URL-encodes the path portion of a URL string and returns the encoded string.
+ /// </summary>
+ /// <param name="s">The text to URL-encode.</param>
+ /// <returns>The URL encoded text.</returns>
+ /// <remarks>Does not do any browser specific adjustments, just encode everything</remarks>
+ public string UrlPathEncode (string s)
+ {
+ if (s == null)
+ return null;
+
+ int idx = s.IndexOf ("?");
+ string s2 = null;
+ if (idx != -1) {
+ s2 = s.Substring (0, idx-1);
+ s2 = UrlEncode (s2) + s.Substring (idx);
+ } else {
+ s2 = UrlEncode (s);
+ }
+
+ return s2;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs b/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs
new file mode 100644
index 00000000000..873da72de7c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs
@@ -0,0 +1,195 @@
+
+//
+// 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;
+using System.Collections;
+using System.IO;
+using System.Web.UI;
+
+namespace System.Web {
+ public sealed class HttpStaticObjectsCollection : ICollection, IEnumerable {
+ private Hashtable _Objects;
+
+ class StaticItem {
+ Type type;
+ object instance;
+
+ public StaticItem (Type type)
+ {
+ this.type = type;
+ }
+
+ public StaticItem (StaticItem item)
+ {
+ this.type = item.type;
+ }
+
+ public object Instance {
+ get {
+ lock (this) {
+ if (instance == null)
+ instance = Activator.CreateInstance (type);
+ }
+
+ return instance;
+ }
+ }
+ }
+
+ // Needs to hold object items that can be latebound and can be serialized
+ public HttpStaticObjectsCollection ()
+ {
+ _Objects = new Hashtable();
+ }
+
+ public object GetObject (string name)
+ {
+ return this [name];
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return _Objects.GetEnumerator ();
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ _Objects.CopyTo (array, index);
+ }
+
+ internal IDictionary GetObjects ()
+ {
+ return _Objects;
+ }
+
+ public object this [string name] {
+ get {
+ StaticItem item = _Objects [name] as StaticItem;
+ if (item == null)
+ return null;
+
+ return item.Instance;
+ }
+ }
+
+ public int Count {
+ get { return _Objects.Count; }
+ }
+
+ public bool IsReadOnly {
+ get { return true; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public object SyncRoot {
+ get { return this; }
+ }
+
+ internal HttpStaticObjectsCollection Clone ()
+ {
+ HttpStaticObjectsCollection coll = new HttpStaticObjectsCollection ();
+ coll._Objects = new Hashtable ();
+ foreach (string key in _Objects.Keys) {
+ StaticItem item = new StaticItem ((StaticItem) _Objects [key]);
+ coll._Objects [key] = item;
+ }
+
+ return coll;
+ }
+
+ internal void Add (ObjectTagBuilder tag)
+ {
+ _Objects.Add (tag.ObjectID, new StaticItem (tag.Type));
+ }
+
+ private void Set (string name, object obj)
+ {
+ _Objects [name] = obj;
+ }
+
+ internal void Serialize (BinaryWriter w)
+ {
+ lock (_Objects) {
+ w.Write (Count);
+ foreach (string key in _Objects.Keys) {
+ w.Write (key);
+ object value = _Objects [key];
+ if (value == null) {
+ w.Write (System.Web.Util.AltSerialization.NullIndex);
+ continue;
+ }
+
+ System.Web.Util.AltSerialization.SerializeByType (w, value);
+ }
+ }
+ }
+
+ internal static HttpStaticObjectsCollection Deserialize (BinaryReader r)
+ {
+ HttpStaticObjectsCollection result = new HttpStaticObjectsCollection ();
+ for (int i = r.ReadInt32 (); i > 0; i--) {
+ string key = r.ReadString ();
+ int index = r.ReadInt32 ();
+ if (index == System.Web.Util.AltSerialization.NullIndex)
+ result.Set (key, null);
+ else
+ result.Set (key, System.Web.Util.AltSerialization.DeserializeFromIndex (index, r));
+ }
+
+ return result;
+ }
+
+ internal byte [] ToByteArray ()
+ {
+ MemoryStream stream = null;
+ try {
+ stream = new MemoryStream ();
+ Serialize (new BinaryWriter (stream));
+ return stream.GetBuffer ();
+ } catch {
+ throw;
+ } finally {
+ if (stream != null)
+ stream.Close ();
+ }
+ }
+
+ internal static HttpStaticObjectsCollection FromByteArray (byte [] data)
+ {
+ HttpStaticObjectsCollection objs = null;
+ MemoryStream stream = null;
+ try {
+ stream = new MemoryStream (data);
+ objs = Deserialize (new BinaryReader (stream));
+ } catch {
+ throw;
+ } finally {
+ if (stream != null)
+ stream.Close ();
+ }
+ return objs;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpUnhandledException.cs b/mcs/class/System.Web/System.Web/HttpUnhandledException.cs
new file mode 100644
index 00000000000..611d9bfbdbc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpUnhandledException.cs
@@ -0,0 +1,48 @@
+//
+// System.Web.HttpUnhandledException.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+//
+// 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.
+//
+
+namespace System.Web {
+ public sealed class HttpUnhandledException : HttpException {
+
+ #region Constructors
+
+ internal HttpUnhandledException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ }
+
+ internal HttpUnhandledException (string message, string x, Exception innerException)
+ : base (message, innerException)
+ {
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpUtility.cs b/mcs/class/System.Web/System.Web/HttpUtility.cs
new file mode 100644
index 00000000000..84727e75c9b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpUtility.cs
@@ -0,0 +1,849 @@
+//
+// System.Web.HttpUtility
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Wictor Wilén (decode/encode functions) (wictor@ibizkit.se)
+// Tim Coleman (tim@timcoleman.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.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;
+using System.Collections;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using System.Web.Util;
+
+namespace System.Web {
+ public sealed class HttpUtility {
+
+ #region Fields
+
+ static Hashtable entities;
+ static object lock_ = new object ();
+
+ #endregion // Fields
+
+ static Hashtable Entities {
+ get {
+ lock (lock_) {
+ if (entities == null)
+ InitEntities ();
+
+ return entities;
+ }
+ }
+ }
+
+ #region Constructors
+
+ static void InitEntities ()
+ {
+ // Build the hash table of HTML entity references. This list comes
+ // from the HTML 4.01 W3C recommendation.
+ entities = new Hashtable ();
+ entities.Add ("nbsp", '\u00A0');
+ entities.Add ("iexcl", '\u00A1');
+ entities.Add ("cent", '\u00A2');
+ entities.Add ("pound", '\u00A3');
+ entities.Add ("curren", '\u00A4');
+ entities.Add ("yen", '\u00A5');
+ entities.Add ("brvbar", '\u00A6');
+ entities.Add ("sect", '\u00A7');
+ entities.Add ("uml", '\u00A8');
+ entities.Add ("copy", '\u00A9');
+ entities.Add ("ordf", '\u00AA');
+ entities.Add ("laquo", '\u00AB');
+ entities.Add ("not", '\u00AC');
+ entities.Add ("shy", '\u00AD');
+ entities.Add ("reg", '\u00AE');
+ entities.Add ("macr", '\u00AF');
+ entities.Add ("deg", '\u00B0');
+ entities.Add ("plusmn", '\u00B1');
+ entities.Add ("sup2", '\u00B2');
+ entities.Add ("sup3", '\u00B3');
+ entities.Add ("acute", '\u00B4');
+ entities.Add ("micro", '\u00B5');
+ entities.Add ("para", '\u00B6');
+ entities.Add ("middot", '\u00B7');
+ entities.Add ("cedil", '\u00B8');
+ entities.Add ("sup1", '\u00B9');
+ entities.Add ("ordm", '\u00BA');
+ entities.Add ("raquo", '\u00BB');
+ entities.Add ("frac14", '\u00BC');
+ entities.Add ("frac12", '\u00BD');
+ entities.Add ("frac34", '\u00BE');
+ entities.Add ("iquest", '\u00BF');
+ entities.Add ("Agrave", '\u00C0');
+ entities.Add ("Aacute", '\u00C1');
+ entities.Add ("Acirc", '\u00C2');
+ entities.Add ("Atilde", '\u00C3');
+ entities.Add ("Auml", '\u00C4');
+ entities.Add ("Aring", '\u00C5');
+ entities.Add ("AElig", '\u00C6');
+ entities.Add ("Ccedil", '\u00C7');
+ entities.Add ("Egrave", '\u00C8');
+ entities.Add ("Eacute", '\u00C9');
+ entities.Add ("Ecirc", '\u00CA');
+ entities.Add ("Euml", '\u00CB');
+ entities.Add ("Igrave", '\u00CC');
+ entities.Add ("Iacute", '\u00CD');
+ entities.Add ("Icirc", '\u00CE');
+ entities.Add ("Iuml", '\u00CF');
+ entities.Add ("ETH", '\u00D0');
+ entities.Add ("Ntilde", '\u00D1');
+ entities.Add ("Ograve", '\u00D2');
+ entities.Add ("Oacute", '\u00D3');
+ entities.Add ("Ocirc", '\u00D4');
+ entities.Add ("Otilde", '\u00D5');
+ entities.Add ("Ouml", '\u00D6');
+ entities.Add ("times", '\u00D7');
+ entities.Add ("Oslash", '\u00D8');
+ entities.Add ("Ugrave", '\u00D9');
+ entities.Add ("Uacute", '\u00DA');
+ entities.Add ("Ucirc", '\u00DB');
+ entities.Add ("Uuml", '\u00DC');
+ entities.Add ("Yacute", '\u00DD');
+ entities.Add ("THORN", '\u00DE');
+ entities.Add ("szlig", '\u00DF');
+ entities.Add ("agrave", '\u00E0');
+ entities.Add ("aacute", '\u00E1');
+ entities.Add ("acirc", '\u00E2');
+ entities.Add ("atilde", '\u00E3');
+ entities.Add ("auml", '\u00E4');
+ entities.Add ("aring", '\u00E5');
+ entities.Add ("aelig", '\u00E6');
+ entities.Add ("ccedil", '\u00E7');
+ entities.Add ("egrave", '\u00E8');
+ entities.Add ("eacute", '\u00E9');
+ entities.Add ("ecirc", '\u00EA');
+ entities.Add ("euml", '\u00EB');
+ entities.Add ("igrave", '\u00EC');
+ entities.Add ("iacute", '\u00ED');
+ entities.Add ("icirc", '\u00EE');
+ entities.Add ("iuml", '\u00EF');
+ entities.Add ("eth", '\u00F0');
+ entities.Add ("ntilde", '\u00F1');
+ entities.Add ("ograve", '\u00F2');
+ entities.Add ("oacute", '\u00F3');
+ entities.Add ("ocirc", '\u00F4');
+ entities.Add ("otilde", '\u00F5');
+ entities.Add ("ouml", '\u00F6');
+ entities.Add ("divide", '\u00F7');
+ entities.Add ("oslash", '\u00F8');
+ entities.Add ("ugrave", '\u00F9');
+ entities.Add ("uacute", '\u00FA');
+ entities.Add ("ucirc", '\u00FB');
+ entities.Add ("uuml", '\u00FC');
+ entities.Add ("yacute", '\u00FD');
+ entities.Add ("thorn", '\u00FE');
+ entities.Add ("yuml", '\u00FF');
+ entities.Add ("fnof", '\u0192');
+ entities.Add ("Alpha", '\u0391');
+ entities.Add ("Beta", '\u0392');
+ entities.Add ("Gamma", '\u0393');
+ entities.Add ("Delta", '\u0394');
+ entities.Add ("Epsilon", '\u0395');
+ entities.Add ("Zeta", '\u0396');
+ entities.Add ("Eta", '\u0397');
+ entities.Add ("Theta", '\u0398');
+ entities.Add ("Iota", '\u0399');
+ entities.Add ("Kappa", '\u039A');
+ entities.Add ("Lambda", '\u039B');
+ entities.Add ("Mu", '\u039C');
+ entities.Add ("Nu", '\u039D');
+ entities.Add ("Xi", '\u039E');
+ entities.Add ("Omicron", '\u039F');
+ entities.Add ("Pi", '\u03A0');
+ entities.Add ("Rho", '\u03A1');
+ entities.Add ("Sigma", '\u03A3');
+ entities.Add ("Tau", '\u03A4');
+ entities.Add ("Upsilon", '\u03A5');
+ entities.Add ("Phi", '\u03A6');
+ entities.Add ("Chi", '\u03A7');
+ entities.Add ("Psi", '\u03A8');
+ entities.Add ("Omega", '\u03A9');
+ entities.Add ("alpha", '\u03B1');
+ entities.Add ("beta", '\u03B2');
+ entities.Add ("gamma", '\u03B3');
+ entities.Add ("delta", '\u03B4');
+ entities.Add ("epsilon", '\u03B5');
+ entities.Add ("zeta", '\u03B6');
+ entities.Add ("eta", '\u03B7');
+ entities.Add ("theta", '\u03B8');
+ entities.Add ("iota", '\u03B9');
+ entities.Add ("kappa", '\u03BA');
+ entities.Add ("lambda", '\u03BB');
+ entities.Add ("mu", '\u03BC');
+ entities.Add ("nu", '\u03BD');
+ entities.Add ("xi", '\u03BE');
+ entities.Add ("omicron", '\u03BF');
+ entities.Add ("pi", '\u03C0');
+ entities.Add ("rho", '\u03C1');
+ entities.Add ("sigmaf", '\u03C2');
+ entities.Add ("sigma", '\u03C3');
+ entities.Add ("tau", '\u03C4');
+ entities.Add ("upsilon", '\u03C5');
+ entities.Add ("phi", '\u03C6');
+ entities.Add ("chi", '\u03C7');
+ entities.Add ("psi", '\u03C8');
+ entities.Add ("omega", '\u03C9');
+ entities.Add ("thetasym", '\u03D1');
+ entities.Add ("upsih", '\u03D2');
+ entities.Add ("piv", '\u03D6');
+ entities.Add ("bull", '\u2022');
+ entities.Add ("hellip", '\u2026');
+ entities.Add ("prime", '\u2032');
+ entities.Add ("Prime", '\u2033');
+ entities.Add ("oline", '\u203E');
+ entities.Add ("frasl", '\u2044');
+ entities.Add ("weierp", '\u2118');
+ entities.Add ("image", '\u2111');
+ entities.Add ("real", '\u211C');
+ entities.Add ("trade", '\u2122');
+ entities.Add ("alefsym", '\u2135');
+ entities.Add ("larr", '\u2190');
+ entities.Add ("uarr", '\u2191');
+ entities.Add ("rarr", '\u2192');
+ entities.Add ("darr", '\u2193');
+ entities.Add ("harr", '\u2194');
+ entities.Add ("crarr", '\u21B5');
+ entities.Add ("lArr", '\u21D0');
+ entities.Add ("uArr", '\u21D1');
+ entities.Add ("rArr", '\u21D2');
+ entities.Add ("dArr", '\u21D3');
+ entities.Add ("hArr", '\u21D4');
+ entities.Add ("forall", '\u2200');
+ entities.Add ("part", '\u2202');
+ entities.Add ("exist", '\u2203');
+ entities.Add ("empty", '\u2205');
+ entities.Add ("nabla", '\u2207');
+ entities.Add ("isin", '\u2208');
+ entities.Add ("notin", '\u2209');
+ entities.Add ("ni", '\u220B');
+ entities.Add ("prod", '\u220F');
+ entities.Add ("sum", '\u2211');
+ entities.Add ("minus", '\u2212');
+ entities.Add ("lowast", '\u2217');
+ entities.Add ("radic", '\u221A');
+ entities.Add ("prop", '\u221D');
+ entities.Add ("infin", '\u221E');
+ entities.Add ("ang", '\u2220');
+ entities.Add ("and", '\u2227');
+ entities.Add ("or", '\u2228');
+ entities.Add ("cap", '\u2229');
+ entities.Add ("cup", '\u222A');
+ entities.Add ("int", '\u222B');
+ entities.Add ("there4", '\u2234');
+ entities.Add ("sim", '\u223C');
+ entities.Add ("cong", '\u2245');
+ entities.Add ("asymp", '\u2248');
+ entities.Add ("ne", '\u2260');
+ entities.Add ("equiv", '\u2261');
+ entities.Add ("le", '\u2264');
+ entities.Add ("ge", '\u2265');
+ entities.Add ("sub", '\u2282');
+ entities.Add ("sup", '\u2283');
+ entities.Add ("nsub", '\u2284');
+ entities.Add ("sube", '\u2286');
+ entities.Add ("supe", '\u2287');
+ entities.Add ("oplus", '\u2295');
+ entities.Add ("otimes", '\u2297');
+ entities.Add ("perp", '\u22A5');
+ entities.Add ("sdot", '\u22C5');
+ entities.Add ("lceil", '\u2308');
+ entities.Add ("rceil", '\u2309');
+ entities.Add ("lfloor", '\u230A');
+ entities.Add ("rfloor", '\u230B');
+ entities.Add ("lang", '\u2329');
+ entities.Add ("rang", '\u232A');
+ entities.Add ("loz", '\u25CA');
+ entities.Add ("spades", '\u2660');
+ entities.Add ("clubs", '\u2663');
+ entities.Add ("hearts", '\u2665');
+ entities.Add ("diams", '\u2666');
+ entities.Add ("quot", '\u0022');
+ entities.Add ("amp", '\u0026');
+ entities.Add ("lt", '\u003C');
+ entities.Add ("gt", '\u003E');
+ entities.Add ("OElig", '\u0152');
+ entities.Add ("oelig", '\u0153');
+ entities.Add ("Scaron", '\u0160');
+ entities.Add ("scaron", '\u0161');
+ entities.Add ("Yuml", '\u0178');
+ entities.Add ("circ", '\u02C6');
+ entities.Add ("tilde", '\u02DC');
+ entities.Add ("ensp", '\u2002');
+ entities.Add ("emsp", '\u2003');
+ entities.Add ("thinsp", '\u2009');
+ entities.Add ("zwnj", '\u200C');
+ entities.Add ("zwj", '\u200D');
+ entities.Add ("lrm", '\u200E');
+ entities.Add ("rlm", '\u200F');
+ entities.Add ("ndash", '\u2013');
+ entities.Add ("mdash", '\u2014');
+ entities.Add ("lsquo", '\u2018');
+ entities.Add ("rsquo", '\u2019');
+ entities.Add ("sbquo", '\u201A');
+ entities.Add ("ldquo", '\u201C');
+ entities.Add ("rdquo", '\u201D');
+ entities.Add ("bdquo", '\u201E');
+ entities.Add ("dagger", '\u2020');
+ entities.Add ("Dagger", '\u2021');
+ entities.Add ("permil", '\u2030');
+ entities.Add ("lsaquo", '\u2039');
+ entities.Add ("rsaquo", '\u203A');
+ entities.Add ("euro", '\u20AC');
+ }
+
+ public HttpUtility ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ public static void HtmlAttributeEncode (string s, TextWriter output)
+ {
+ output.Write(HtmlAttributeEncode(s));
+ }
+
+ public static string HtmlAttributeEncode (string s)
+ {
+ if (null == s)
+ return null;
+
+ if (s.IndexOf ('&') == -1 && s.IndexOf ('"') == -1)
+ return s;
+
+ StringBuilder output = new StringBuilder ();
+ foreach (char c in s)
+ switch (c) {
+ case '&' :
+ output.Append ("&amp;");
+ break;
+ case '"' :
+ output.Append ("&quot;");
+ break;
+ default:
+ output.Append (c);
+ break;
+ }
+
+ return output.ToString();
+ }
+
+ public static string UrlDecode (string str)
+ {
+ return UrlDecode(str, Encoding.UTF8);
+ }
+
+ private static char [] GetChars (MemoryStream b, Encoding e)
+ {
+ return e.GetChars (b.GetBuffer (), 0, (int) b.Length);
+ }
+
+ public static string UrlDecode (string s, Encoding e)
+ {
+ if (null == s)
+ return null;
+
+ if (s.IndexOf ('%') == -1 && s.IndexOf ('+') == -1)
+ return s;
+
+ if (e == null)
+ e = Encoding.UTF8;
+
+ StringBuilder output = new StringBuilder ();
+ long len = s.Length;
+ NumberStyles hexa = NumberStyles.HexNumber;
+ MemoryStream bytes = new MemoryStream ();
+
+ for (int i = 0; i < len; i++) {
+ if (s [i] == '%' && i + 2 < len) {
+ if (s [i + 1] == 'u' && i + 5 < len) {
+ if (bytes.Length > 0) {
+ output.Append (GetChars (bytes, e));
+ bytes.SetLength (0);
+ }
+ output.Append ((char) Int32.Parse (s.Substring (i + 2, 4), hexa));
+ i += 5;
+ } else {
+ bytes.WriteByte ((byte) Int32.Parse (s.Substring (i + 1, 2), hexa));
+ i += 2;
+ }
+ continue;
+ }
+
+ if (bytes.Length > 0) {
+ output.Append (GetChars (bytes, e));
+ bytes.SetLength (0);
+ }
+
+ if (s [i] == '+') {
+ output.Append (' ');
+ } else {
+ output.Append (s [i]);
+ }
+ }
+
+ if (bytes.Length > 0) {
+ output.Append (GetChars (bytes, e));
+ }
+
+ bytes = null;
+ return output.ToString ();
+ }
+
+ public static string UrlDecode (byte [] bytes, Encoding e)
+ {
+ if (bytes == null)
+ return null;
+
+ return UrlDecode (bytes, 0, bytes.Length, e);
+ }
+
+ private static int GetInt (byte b)
+ {
+ char c = Char.ToUpper ((char) b);
+ if (c >= '0' && c <= '9')
+ return c - '0';
+
+ if (c < 'A' || c > 'F')
+ return 0;
+
+ return (c - 'A' + 10);
+ }
+
+ private static char GetChar (byte [] bytes, int offset, int length)
+ {
+ int value = 0;
+ int end = length + offset;
+ for (int i = offset; i < end; i++)
+ value = (value << 4) + GetInt (bytes [i]);
+
+ return (char) value;
+ }
+
+ public static string UrlDecode (byte [] bytes, int offset, int count, Encoding e)
+ {
+ if (bytes == null || count == 0)
+ return null;
+
+ if (bytes == null)
+ throw new ArgumentNullException ("bytes");
+
+ if (offset < 0 || offset > bytes.Length)
+ throw new ArgumentOutOfRangeException ("offset");
+
+ if (count < 0 || offset + count > bytes.Length)
+ throw new ArgumentOutOfRangeException ("count");
+
+ StringBuilder output = new StringBuilder ();
+ MemoryStream acc = new MemoryStream ();
+
+ int end = count + offset;
+ for (int i = offset; i < end; i++) {
+ if (bytes [i] == '%' && i + 2 < count) {
+ if (bytes [i + 1] == (byte) 'u' && i + 5 < end) {
+ if (acc.Length > 0) {
+ output.Append (GetChars (acc, e));
+ acc.SetLength (0);
+ }
+ output.Append (GetChar (bytes, i + 2, 4));
+ i += 5;
+ } else {
+ acc.WriteByte ((byte) GetChar (bytes, i + 1, 2));
+ i += 2;
+ }
+ continue;
+ }
+
+ if (acc.Length > 0) {
+ output.Append (GetChars (acc, e));
+ acc.SetLength (0);
+ }
+
+ if (bytes [i] == '+') {
+ output.Append (' ');
+ } else {
+ output.Append ((char) bytes [i]);
+ }
+ }
+
+ if (acc.Length > 0) {
+ output.Append (GetChars (acc, e));
+ }
+
+ acc = null;
+ return output.ToString ();
+ }
+
+ public static byte [] UrlDecodeToBytes (byte [] bytes)
+ {
+ if (bytes == null)
+ return null;
+
+ return UrlDecodeToBytes (bytes, 0, bytes.Length);
+ }
+
+ public static byte [] UrlDecodeToBytes (string str)
+ {
+ return UrlDecodeToBytes (str, Encoding.UTF8);
+ }
+
+ public static byte [] UrlDecodeToBytes (string str, Encoding e)
+ {
+ if (str == null)
+ return null;
+
+ if (e == null)
+ throw new ArgumentNullException ("e");
+
+ return UrlDecodeToBytes (e.GetBytes (str));
+ }
+
+ public static byte [] UrlDecodeToBytes (byte [] bytes, int offset, int count)
+ {
+ if (bytes == null)
+ return null;
+
+ int len = bytes.Length;
+ if (offset < 0 || offset >= len)
+ throw new ArgumentOutOfRangeException("offset");
+
+ if (count < 0 || offset > len - count)
+ throw new ArgumentOutOfRangeException("count");
+
+ MemoryStream result = new MemoryStream ();
+ int end = offset + count;
+ for (int i = offset; i < end; i++){
+ char c = (char) bytes [i];
+ if (c == '+')
+ c = ' ';
+ else if (c == '%' && i < end - 2) {
+ c = GetChar (bytes, i, 2);
+ i += 2;
+ }
+ result.WriteByte ((byte) c);
+ }
+
+ return result.ToArray ();
+ }
+
+ public static string UrlEncode(string str)
+ {
+ return UrlEncode(str, Encoding.UTF8);
+ }
+
+ public static string UrlEncode (string s, Encoding Enc)
+ {
+ if (s == null)
+ return null;
+
+ if (s == "")
+ return "";
+
+ byte [] bytes = Enc.GetBytes (s);
+ return Encoding.ASCII.GetString (UrlEncodeToBytes (bytes, 0, bytes.Length));
+ }
+
+ public static string UrlEncode (byte [] bytes)
+ {
+ if (bytes == null)
+ return null;
+
+ if (bytes.Length == 0)
+ return "";
+
+ return Encoding.ASCII.GetString (UrlEncodeToBytes (bytes, 0, bytes.Length));
+ }
+
+ public static string UrlEncode (byte [] bytes, int offset, int count)
+ {
+ if (bytes == null)
+ return null;
+
+ if (bytes.Length == 0)
+ return "";
+
+ return Encoding.ASCII.GetString (UrlEncodeToBytes (bytes, offset, count));
+ }
+
+ public static byte [] UrlEncodeToBytes (string str)
+ {
+ return UrlEncodeToBytes (str, Encoding.UTF8);
+ }
+
+ public static byte [] UrlEncodeToBytes (string str, Encoding e)
+ {
+ if (str == null)
+ return null;
+
+ if (str == "")
+ return new byte [0];
+
+ byte [] bytes = e.GetBytes (str);
+ return UrlEncodeToBytes (bytes, 0, bytes.Length);
+ }
+
+ public static byte [] UrlEncodeToBytes (byte [] bytes)
+ {
+ if (bytes == null)
+ return null;
+
+ if (bytes.Length == 0)
+ return new byte [0];
+
+ return UrlEncodeToBytes (bytes, 0, bytes.Length);
+ }
+
+ static char [] hexChars = "0123456789abcdef".ToCharArray ();
+
+ public static byte [] UrlEncodeToBytes (byte [] bytes, int offset, int count)
+ {
+ if (bytes == null)
+ return null;
+
+ int len = bytes.Length;
+ if (len == 0)
+ return new byte [0];
+
+ if (offset < 0 || offset >= len)
+ throw new ArgumentOutOfRangeException("offset");
+
+ if (count < 0 || count > len - offset)
+ throw new ArgumentOutOfRangeException("count");
+
+ MemoryStream result = new MemoryStream ();
+ int end = offset + count;
+ for (int i = offset; i < end; i++) {
+ char c = (char) bytes [i];
+ if ((c == ' ') || (c < '0' && c != '-' && c != '.') ||
+ (c < 'A' && c > '9') ||
+ (c > 'Z' && c < 'a' && c != '_') ||
+ (c > 'z')) {
+ result.WriteByte ((byte) '%');
+ int idx = ((int) c) >> 4;
+ result.WriteByte ((byte) hexChars [idx]);
+ idx = ((int) c) & 0x0F;
+ result.WriteByte ((byte) hexChars [idx]);
+ } else {
+ result.WriteByte ((byte) c);
+ }
+ }
+
+ return result.ToArray ();
+ }
+
+ public static string UrlEncodeUnicode (string str)
+ {
+ if (str == null)
+ return null;
+
+ StringBuilder result = new StringBuilder ();
+ int end = str.Length;
+ for (int i = 0; i < end; i++) {
+ int idx;
+ char c = str [i];
+ if (c > 255) {
+ result.Append ("%u");
+ idx = ((int) c) >> 24;
+ result.Append (hexChars [idx]);
+ idx = (((int) c) >> 16) & 0x0F;
+ result.Append (hexChars [idx]);
+ idx = (((int) c) >> 8) & 0x0F;
+ result.Append (hexChars [idx]);
+ idx = ((int) c) & 0x0F;
+ result.Append (hexChars [idx]);
+ continue;
+ }
+
+ if ((c == ' ') || (c < '0' && c != '-' && c != '.') ||
+ (c < 'A' && c > '9') ||
+ (c > 'Z' && c < 'a' && c != '_') ||
+ (c > 'z')) {
+ result.Append ('%');
+ idx = ((int) c) >> 4;
+ result.Append (hexChars [idx]);
+ idx = ((int) c) & 0x0F;
+ result.Append (hexChars [idx]);
+ continue;
+ }
+
+ result.Append (c);
+ }
+
+ return result.ToString ();
+ }
+
+ public static byte [] UrlEncodeUnicodeToBytes (string str)
+ {
+ if (str == null)
+ return null;
+
+ if (str == "")
+ return new byte [0];
+
+ return Encoding.ASCII.GetBytes (UrlEncodeUnicode (str));
+ }
+
+ /// <summary>
+ /// Decodes an HTML-encoded string and returns the decoded string.
+ /// </summary>
+ /// <param name="s">The HTML string to decode. </param>
+ /// <returns>The decoded text.</returns>
+ public static string HtmlDecode (string s)
+ {
+ if (s == null)
+ throw new ArgumentNullException ("s");
+
+ if (s.IndexOf ('&') == -1)
+ return s;
+
+ bool insideEntity = false; // used to indicate that we are in a potential entity
+ string entity = String.Empty;
+ StringBuilder output = new StringBuilder ();
+ int len = s.Length;
+
+ for (int i = 0; i < len; i++) {
+ char c = s [i];
+ switch (c) {
+ case '&' :
+ output.Append (entity);
+ entity = "&";
+ insideEntity = true;
+ break;
+ case ';' :
+ if (!insideEntity) {
+ output.Append (c);
+ break;
+ }
+
+ entity += c;
+ int length = entity.Length;
+ if (length >= 2 && entity[1] == '#' && entity[2] != ';')
+ entity = ((char) Int32.Parse (entity.Substring (2, entity.Length - 3))).ToString();
+ else if (length > 1 && Entities.ContainsKey (entity.Substring (1, entity.Length - 2)))
+ entity = Entities [entity.Substring (1, entity.Length - 2)].ToString ();
+
+ output.Append (entity);
+ entity = String.Empty;
+ insideEntity = false;
+ break;
+ default :
+ if (insideEntity)
+ entity += c;
+ else
+ output.Append (c);
+ break;
+ }
+ }
+ output.Append (entity);
+ return output.ToString ();
+ }
+
+ /// <summary>
+ /// Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s">The HTML string to decode</param>
+ /// <param name="output">The TextWriter output stream containing the decoded string. </param>
+ public static void HtmlDecode(string s, TextWriter output)
+ {
+ if (s != null)
+ output.Write (HtmlDecode (s));
+ }
+
+ /// <summary>
+ /// HTML-encodes a string and returns the encoded string.
+ /// </summary>
+ /// <param name="s">The text string to encode. </param>
+ /// <returns>The HTML-encoded text.</returns>
+ public static string HtmlEncode (string s)
+ {
+ if (s == null)
+ return null;
+
+ StringBuilder output = new StringBuilder ();
+
+ foreach (char c in s)
+ switch (c) {
+ case '&' :
+ output.Append ("&amp;");
+ break;
+ case '>' :
+ output.Append ("&gt;");
+ break;
+ case '<' :
+ output.Append ("&lt;");
+ break;
+ case '"' :
+ output.Append ("&quot;");
+ break;
+ default:
+ if ((int) c > 128) {
+ output.Append ("&#");
+ output.Append (((int) c).ToString ());
+ output.Append (";");
+ }
+ else
+ output.Append (c);
+ break;
+ }
+ return output.ToString ();
+ }
+
+ /// <summary>
+ /// HTML-encodes a string and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s">The string to encode. </param>
+ /// <param name="output">The TextWriter output stream containing the encoded string. </param>
+ public static void HtmlEncode(string s, TextWriter output)
+ {
+ if (s != null)
+ output.Write (HtmlEncode (s));
+ }
+
+#if NET_1_1
+ public static string UrlPathEncode (string s)
+ {
+ if (s == null)
+ return null;
+
+ int idx = s.IndexOf ("?");
+ string s2 = null;
+ if (idx != -1) {
+ s2 = s.Substring (0, idx-1);
+ s2 = UrlEncode (s2) + s.Substring (idx);
+ } else {
+ s2 = UrlEncode (s);
+ }
+
+ return s2;
+ }
+#endif
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpValidationStatus.cs b/mcs/class/System.Web/System.Web/HttpValidationStatus.cs
new file mode 100644
index 00000000000..b8e873452f6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpValidationStatus.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.HttpValidationStatus.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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.
+//
+
+namespace System.Web {
+ [Serializable]
+ public enum HttpValidationStatus {
+ Invalid = 0x1,
+ IgnoreThisRequest,
+ Valid
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpValueCollection.cs b/mcs/class/System.Web/System.Web/HttpValueCollection.cs
new file mode 100644
index 00000000000..e8ba4e3a0db
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpValueCollection.cs
@@ -0,0 +1,220 @@
+//
+// System.Web.HttpValueCollection
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Gonzalo Paniagua (gonzalo@ximian.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;
+using System.Collections.Specialized;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Web.Util;
+
+namespace System.Web
+{
+ [Serializable]
+ class HttpValueCollection : NameValueCollection
+ {
+ bool _bHeaders;
+
+ internal HttpValueCollection ()
+ {
+ _bHeaders = false;
+ }
+
+ internal HttpValueCollection (string sData)
+ {
+ FillFromQueryString (sData, Encoding.UTF8);
+ IsReadOnly = true;
+ }
+
+ internal HttpValueCollection(string sData, bool ReadOnly, Encoding encoding)
+ {
+ FillFromQueryString (sData, encoding);
+ IsReadOnly = ReadOnly;
+ }
+
+ protected HttpValueCollection (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ // string = header1: value1\r\nheader2: value2
+ internal void FillFromHeaders (string sHeaders, Encoding encoding)
+ {
+ _bHeaders = true;
+ char [] arrSplitValue = new char [] {':'};
+ string sKey, sValue;
+
+ sKey = "";
+ sValue = "";
+
+ string [] arrValues = sHeaders.Split (new char [] {'\r', '\n'});
+ foreach (string sLine in arrValues) {
+ string [] arrKeyValue = sLine.Split (arrSplitValue);
+ if (arrKeyValue.Length == 1 && arrKeyValue [0].Length == 0) {
+ // Empty \r or \n is ignored
+ continue;
+ }
+
+ if (arrKeyValue[0] != sKey && sKey.Length > 0) {
+ Add (HttpUtility.UrlDecode (sKey, encoding),
+ HttpUtility.UrlDecode (sValue, encoding));
+ }
+
+ if (arrKeyValue.Length == 1) {
+ sValue += "\r\n" + arrKeyValue [0].Trim();
+ continue;
+ } else if (arrKeyValue.Length == 2) {
+ if (arrKeyValue[0].Length == 0) {
+ sValue += arrKeyValue [1].Trim();
+ continue;
+ }
+
+ sKey = arrKeyValue [0].Trim();
+ sValue = arrKeyValue [1].Trim();
+ }
+ }
+
+ if (sKey.Length > 0) {
+ Add (HttpUtility.UrlDecode (sKey, encoding),
+ HttpUtility.UrlDecode (sValue, encoding));
+ }
+ }
+
+ internal void FillFromHeaders (string sData)
+ {
+ FillFromHeaders (sData, Encoding.UTF8);
+ }
+
+ // String = test=aaa&kalle=nisse
+ internal void FillFromQueryString (string sData, Encoding encoding)
+ {
+ FillFromQueryString (sData, encoding, true);
+ }
+
+ void FillFromQueryString (string sData, Encoding encoding, bool decode)
+ {
+ _bHeaders = false;
+ if (sData == null || sData == "")
+ return;
+
+ string k, v;
+ int eq;
+ string [] arrValues = sData.Split (new char [] {'&'});
+ foreach (string sValue in arrValues) {
+ eq = sValue.IndexOf ('=');
+
+ if (eq == -1) {
+ k = sValue.Trim ();
+ if (decode)
+ k = HttpUtility.UrlDecode (k, encoding);
+
+ Add (k, String.Empty);
+ continue;
+ }
+
+ k = sValue.Substring (0, eq).Trim ();
+ v = String.Empty;
+ if (eq + 1 < sValue.Length) {
+ v = sValue.Substring (eq + 1).Trim ();
+ if (v.Length == 0)
+ v = String.Empty;
+ }
+
+ if (decode) {
+ k = HttpUtility.UrlDecode (k, encoding);
+ if (v.Length > 0)
+ v = HttpUtility.UrlDecode (v, encoding);
+ }
+
+ Add (k, v);
+ }
+ }
+
+ internal void FillFromQueryString (string sData)
+ {
+ FillFromQueryString (sData, Encoding.UTF8);
+ }
+
+ internal void FillFromCookieString (string sData)
+ {
+ FillFromQueryString (sData, Encoding.UTF8, false);
+ }
+
+ internal void MakeReadOnly ()
+ {
+ IsReadOnly = true;
+ }
+
+ internal void MakeReadWrite ()
+ {
+ IsReadOnly = false;
+ }
+
+ internal void Merge (NameValueCollection oData)
+ {
+ foreach (string sKey in oData)
+ Add (sKey, oData [sKey]);
+ }
+
+ internal void Reset ()
+ {
+ Clear ();
+ }
+
+ internal string ToString (bool UrlEncode)
+ {
+ StringBuilder result = new StringBuilder ();
+ string eq = (_bHeaders ? ":" : "=");
+ string separator = (_bHeaders ? "\r\n" : "&");
+
+ foreach (string strKey in AllKeys) {
+
+ if (result.Length > 0)
+ result.Append (separator);
+
+ if (UrlEncode) {
+ // use encoding
+ result.Append (HttpUtility.UrlEncode (strKey, Encoding.UTF8));
+ result.Append (eq);
+ result.Append (HttpUtility.UrlEncode (Get (strKey), Encoding.UTF8));
+ } else {
+ result.Append (strKey);
+ result.Append (eq);
+ result.Append (Get (strKey));
+ }
+ }
+
+ return result.ToString ();
+ }
+
+ public override string ToString ()
+ {
+ return ToString (false);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpWorkerRequest.cs b/mcs/class/System.Web/System.Web/HttpWorkerRequest.cs
new file mode 100644
index 00000000000..af6f9635e11
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpWorkerRequest.cs
@@ -0,0 +1,556 @@
+//
+// System.Web.HttpWorkerRequest
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// (constants from Bob Smith (bob@thestuff.net))
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) Patrik Torstensson
+// (c) 2002 Ximian, Inc. (http://www.ximian.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;
+using System.Collections;
+using System.Globalization;
+using System.Runtime.InteropServices;
+
+namespace System.Web
+{
+ [ComVisible (false)]
+ public abstract class HttpWorkerRequest : IHttpMapPath
+ {
+ public delegate void EndOfSendNotification (HttpWorkerRequest wr, object extraData);
+
+ public const int HeaderAccept = 20;
+ public const int HeaderAcceptCharset = 21;
+ public const int HeaderAcceptEncoding = 22;
+ public const int HeaderAcceptLanguage = 23;
+ public const int HeaderAcceptRanges = 20;
+ public const int HeaderAge = 21;
+ public const int HeaderAllow = 10;
+ public const int HeaderAuthorization = 24;
+ public const int HeaderCacheControl = 0;
+ public const int HeaderConnection = 1;
+ public const int HeaderContentEncoding = 13;
+ public const int HeaderContentLanguage = 14;
+ public const int HeaderContentLength = 11;
+ public const int HeaderContentLocation = 15;
+ public const int HeaderContentMd5 = 16;
+ public const int HeaderContentRange = 17;
+ public const int HeaderContentType = 12;
+ public const int HeaderCookie = 25;
+ public const int HeaderDate = 2;
+ public const int HeaderEtag = 22;
+ public const int HeaderExpect = 26;
+ public const int HeaderExpires = 18;
+ public const int HeaderFrom = 27;
+ public const int HeaderHost = 28;
+ public const int HeaderIfMatch = 29;
+ public const int HeaderIfModifiedSince = 30;
+ public const int HeaderIfNoneMatch = 31;
+ public const int HeaderIfRange = 32;
+ public const int HeaderIfUnmodifiedSince = 33;
+ public const int HeaderKeepAlive = 3;
+ public const int HeaderLastModified = 19;
+ public const int HeaderLocation = 23;
+ public const int HeaderMaxForwards = 34;
+ public const int HeaderPragma = 4;
+ public const int HeaderProxyAuthenticate = 24;
+ public const int HeaderProxyAuthorization = 35;
+ public const int HeaderRange = 37;
+ public const int HeaderReferer = 36;
+ public const int HeaderRetryAfter = 25;
+ public const int HeaderServer = 26;
+ public const int HeaderSetCookie = 27;
+ public const int HeaderTe = 38;
+ public const int HeaderTrailer = 5;
+ public const int HeaderTransferEncoding = 6;
+ public const int HeaderUpgrade = 7;
+ public const int HeaderUserAgent = 39;
+ public const int HeaderVary = 28;
+ public const int HeaderVia = 8;
+ public const int HeaderWarning = 9;
+ public const int HeaderWwwAuthenticate = 29;
+ public const int ReasonCachePolicy = 2;
+ public const int ReasonCacheSecurity = 3;
+ public const int ReasonClientDisconnect = 4;
+ public const int ReasonDefault = 0;
+ public const int ReasonFileHandleCacheMiss = 1;
+ public const int ReasonResponseCacheMiss = 0;
+ public const int RequestHeaderMaximum = 40;
+ public const int ResponseHeaderMaximum = 30;
+
+ static string [][] s_HttpStatusDescriptions;
+ static string [] s_HttpRequestHeaderNames;
+ static string [] s_HttpResponseHeaderNames;
+
+ static Hashtable s_HttpResponseHeadersTable;
+ static Hashtable s_HttpRequestHeaderTable;
+
+ static HttpWorkerRequest ()
+ {
+ string [] sSubCodes;
+
+ s_HttpStatusDescriptions = new string [6][];
+
+ sSubCodes = new String [3];
+ sSubCodes [0] = "Continue";
+ sSubCodes [1] = "Switching Protocols";
+ sSubCodes [2] = "Processing";
+ s_HttpStatusDescriptions [1] = sSubCodes;
+
+ sSubCodes = new String [8];
+ sSubCodes [0] = "OK";
+ sSubCodes [1] = "Created";
+ sSubCodes [2] = "Accepted";
+ sSubCodes [3] = "Non-Authoritative Information";
+ sSubCodes [4] = "No Content";
+ sSubCodes [5] = "Reset Content";
+ sSubCodes [6] = "Partial Content";
+ sSubCodes [7] = "Multi-Status";
+ s_HttpStatusDescriptions [2] = sSubCodes;
+
+ sSubCodes = new String [8];
+ sSubCodes [0] = "Multiple Choices";
+ sSubCodes [1] = "Moved Permanently";
+ sSubCodes [2] = "Found";
+ sSubCodes [3] = "See Other";
+ sSubCodes [4] = "Not Modified";
+ sSubCodes [5] = "Use Proxy";
+ sSubCodes [6] = String.Empty;
+ sSubCodes [7] = "Temporary Redirect";
+ s_HttpStatusDescriptions [3] = sSubCodes;
+
+ sSubCodes = new String [24];
+ sSubCodes [0] = "Bad Request";
+ sSubCodes [1] = "Unauthorized";
+ sSubCodes [2] = "Payment Required";
+ sSubCodes [3] = "Forbidden";
+ sSubCodes [4] = "Not Found";
+ sSubCodes [5] = "Method Not Allowed";
+ sSubCodes [6] = "Not Acceptable";
+ sSubCodes [7] = "Proxy Authentication Required";
+ sSubCodes [8] = "Request Timeout";
+ sSubCodes [9] = "Conflict";
+ sSubCodes [10] = "Gone";
+ sSubCodes [11] = "Length Required";
+ sSubCodes [12] = "Precondition Failed";
+ sSubCodes [13] = "Request Entity Too Large";
+ sSubCodes [14] = "Request-Uri Too Long";
+ sSubCodes [15] = "Unsupported Media Type";
+ sSubCodes [16] = "Requested Range Not Satisfiable";
+ sSubCodes [17] = "Expectation Failed";
+ sSubCodes [18] = String.Empty;
+ sSubCodes [19] = String.Empty;
+ sSubCodes [20] = String.Empty;
+ sSubCodes [21] = "Unprocessable Entity";
+ sSubCodes [22] = "Locked";
+ sSubCodes [23] = "Failed Dependency";
+ s_HttpStatusDescriptions [4] = sSubCodes;
+
+ sSubCodes = new String [8];
+ sSubCodes [0] = "Internal Server Error";
+ sSubCodes [1] = "Not Implemented";
+ sSubCodes [2] = "Bad Gateway";
+ sSubCodes [3] = "Service Unavailable";
+ sSubCodes [4] = "Gateway Timeout";
+ sSubCodes [5] = "Http Version Not Supported";
+ sSubCodes [6] = String.Empty;
+ sSubCodes [7] = "Insufficient Storage";
+ s_HttpStatusDescriptions [5] = sSubCodes;
+
+ InitLookupTables ();
+ }
+
+ public HttpWorkerRequest ()
+ {
+ }
+
+ static private void InitLookupTables ()
+ {
+ // Performance arrays
+ s_HttpRequestHeaderNames = new string [40];
+ s_HttpResponseHeaderNames = new string [30];
+
+ // Lookup tables (name -> id)
+ CaseInsensitiveHashCodeProvider hprovider;
+ hprovider = new CaseInsensitiveHashCodeProvider (CultureInfo.InvariantCulture);
+ CaseInsensitiveComparer hcomparer;
+ hcomparer = new CaseInsensitiveComparer (CultureInfo.InvariantCulture);
+ s_HttpRequestHeaderTable = new Hashtable (hprovider, hcomparer);
+ s_HttpResponseHeadersTable = new Hashtable (hprovider, hcomparer);
+
+ AddHeader (true, true, 0, "Cache-Control");
+ AddHeader (true, true, 1, "Connection");
+ AddHeader (true, true, 2, "Date");
+ AddHeader (true, true, 3, "Keep-Alive");
+ AddHeader (true, true, 4, "Pragma");
+ AddHeader (true, true, 5, "Trailer");
+ AddHeader (true, true, 6, "Transfer-Encoding");
+ AddHeader (true, true, 7, "Upgrade");
+ AddHeader (true, true, 8, "Via");
+ AddHeader (true, true, 9, "Warning");
+ AddHeader (true, true, 10, "Allow");
+ AddHeader (true, true, 11, "Content-Length");
+ AddHeader (true, true, 12, "Content-Type");
+ AddHeader (true, true, 13, "Content-Encoding");
+ AddHeader (true, true, 14, "Content-Language");
+ AddHeader (true, true, 15, "Content-Location");
+ AddHeader (true, true, 16, "Content-MD5");
+ AddHeader (true, true, 17, "Content-Range");
+ AddHeader (true, true, 18, "Expires");
+ AddHeader (true, true, 19, "Last-Modified");
+ AddHeader (true, false, 20, "Accept");
+ AddHeader (true, false, 21, "Accept-Charset");
+ AddHeader (true, false, 22, "Accept-Encoding");
+ AddHeader (true, false, 23, "Accept-Language");
+ AddHeader (true, false, 24, "Authorization");
+ AddHeader (true, false, 25, "Cookie");
+ AddHeader (true, false, 26, "Expect");
+ AddHeader (true, false, 27, "From");
+ AddHeader (true, false, 28, "Host");
+ AddHeader (true, false, 29, "If-Match");
+ AddHeader (true, false, 30, "If-Modified-Since");
+ AddHeader (true, false, 31, "If-None-Match");
+ AddHeader (true, false, 32, "If-Range");
+ AddHeader (true, false, 33, "If-Unmodified-Since");
+ AddHeader (true, false, 34, "Max-Forwards");
+ AddHeader (true, false, 35, "Proxy-Authorization");
+ AddHeader (true, false, 36, "Referer");
+ AddHeader (true, false, 37, "Range");
+ AddHeader (true, false, 38, "TE");
+ AddHeader (true, false, 39, "User-Agent");
+ AddHeader (false, true, 20, "Accept-Ranges");
+ AddHeader (false, true, 21, "Age");
+ AddHeader (false, true, 22, "ETag");
+ AddHeader (false, true, 23, "Location");
+ AddHeader (false, true, 24, "Proxy-Authenticate");
+ AddHeader (false, true, 25, "Retry-After");
+ AddHeader (false, true, 26, "Server");
+ AddHeader (false, true, 27, "Set-Cookie");
+ AddHeader (false, true, 28, "Vary");
+ AddHeader (false, true, 29, "WWW-Authenticate");
+ }
+
+ static private void AddHeader(bool bRequest, bool bResponse, int iID, string sHeader)
+ {
+ if (bResponse) {
+ s_HttpResponseHeaderNames [iID] = sHeader;
+ s_HttpResponseHeadersTable.Add (sHeader, iID);
+ }
+
+ if (bRequest) {
+ s_HttpRequestHeaderNames [iID] = sHeader;
+ s_HttpRequestHeaderTable.Add (sHeader, iID);
+ }
+ }
+
+ public virtual void CloseConnection ()
+ {
+ }
+
+ public abstract void EndOfRequest ();
+ public abstract void FlushResponse (bool finalFlush);
+
+ public virtual string GetAppPath ()
+ {
+ return null;
+ }
+
+ public virtual string GetAppPathTranslated ()
+ {
+ return null;
+ }
+
+ public virtual string GetAppPoolID ()
+ {
+ return null;
+ }
+
+ public virtual long GetBytesRead ()
+ {
+ return 0;
+ }
+
+ public virtual byte[] GetClientCertificate ()
+ {
+ return new byte[0];
+ }
+
+ public virtual byte[] GetClientCertificateBinaryIssuer ()
+ {
+ return new byte[0];
+ }
+
+ public virtual int GetClientCertificateEncoding ()
+ {
+ return 0;
+ }
+
+ public virtual byte[] GetClientCertificatePublicKey ()
+ {
+ return new byte[0];
+ }
+
+ public virtual DateTime GetClientCertificateValidFrom ()
+ {
+ return DateTime.Now;
+ }
+
+ public virtual DateTime GetClientCertificateValidUntil ()
+ {
+ return DateTime.Now;
+ }
+
+ public virtual long GetConnectionID ()
+ {
+ return 0;
+ }
+
+ public virtual string GetFilePath ()
+ {
+ return GetUriPath();
+ }
+
+ public virtual string GetFilePathTranslated ()
+ {
+ return null;
+ }
+
+ public abstract string GetHttpVerbName ();
+ public abstract string GetHttpVersion ();
+
+ public virtual string GetKnownRequestHeader (int index)
+ {
+ return null;
+ }
+
+ public static int GetKnownRequestHeaderIndex (string header)
+ {
+ object index;
+ index = s_HttpRequestHeaderTable [header];
+ if (null != index)
+ return (Int32) index;
+
+ return -1;
+ }
+
+ public static string GetKnownRequestHeaderName (int index)
+ {
+ return s_HttpRequestHeaderNames [index];
+ }
+
+ public static int GetKnownResponseHeaderIndex (string header)
+ {
+ object index;
+
+ index = s_HttpResponseHeadersTable [header];
+ if (null != index)
+ return (Int32) index;
+
+ return -1;
+ }
+
+ public static string GetKnownResponseHeaderName(int index)
+ {
+ return s_HttpResponseHeaderNames [index];
+ }
+
+ public abstract string GetLocalAddress ();
+ public abstract int GetLocalPort ();
+
+ public virtual string GetPathInfo ()
+ {
+ return String.Empty;
+ }
+
+ public virtual byte [] GetPreloadedEntityBody ()
+ {
+ return null;
+ }
+
+ public virtual string GetProtocol ()
+ {
+ return (IsSecure ()) ? "https" : "http";
+ }
+
+ public abstract string GetQueryString ();
+
+ public virtual byte[] GetQueryStringRawBytes ()
+ {
+ return null;
+ }
+
+ public abstract string GetRawUrl ();
+ public abstract string GetRemoteAddress ();
+
+ public virtual string GetRemoteName ()
+ {
+ return GetRemoteAddress();
+ }
+
+ public abstract int GetRemotePort ();
+
+ public virtual int GetRequestReason ()
+ {
+ return 0;
+ }
+
+ public virtual string GetServerName ()
+ {
+ return GetLocalAddress();
+ }
+
+ public virtual string GetServerVariable (string name)
+ {
+ return null;
+ }
+
+ public static string GetStatusDescription (int code)
+ {
+ if (code>= 100 && code < 600) {
+ int iMajor = code / 100;
+ int iMinor = code % 100;
+ if (iMinor < (int) s_HttpStatusDescriptions [iMajor].Length)
+ return s_HttpStatusDescriptions [iMajor][iMinor];
+ }
+
+ return String.Empty;
+ }
+
+ public virtual string GetUnknownRequestHeader (string name)
+ {
+ return null;
+ }
+
+ [CLSCompliant(false)]
+ public virtual string [][] GetUnknownRequestHeaders ()
+ {
+ return null;
+ }
+
+ public abstract string GetUriPath ();
+
+ public virtual long GetUrlContextID ()
+ {
+ return 0;
+ }
+
+ public virtual IntPtr GetUserToken ()
+ {
+ throw new NotSupportedException ();
+ }
+
+ public virtual IntPtr GetVirtualPathToken ()
+ {
+ throw new NotSupportedException ();
+ }
+
+ public bool HasEntityBody ()
+ {
+ string sContentLength = GetKnownRequestHeader (HeaderContentLength);
+ if (null != sContentLength && sContentLength != "0")
+ return true;
+
+ if (null != GetKnownRequestHeader (HeaderTransferEncoding))
+ return true;
+
+ if (null != GetPreloadedEntityBody () || IsEntireEntityBodyIsPreloaded ())
+ return true;
+
+ return false;
+ }
+
+ public virtual bool HeadersSent ()
+ {
+ return true;
+ }
+
+ public virtual bool IsClientConnected ()
+ {
+ return true;
+ }
+
+ public virtual bool IsEntireEntityBodyIsPreloaded ()
+ {
+ return false;
+ }
+
+ public virtual bool IsSecure ()
+ {
+ return false;
+ }
+
+ public virtual string MapPath (string virtualPath)
+ {
+ return null;
+ }
+
+ public virtual int ReadEntityBody (byte[] buffer, int size)
+ {
+ return 0;
+ }
+
+ public virtual void SendCalculatedContentLength (int contentLength)
+ {
+ }
+
+ public abstract void SendKnownResponseHeader (int index, string value);
+ public abstract void SendResponseFromFile (IntPtr handle, long offset, long length);
+ public abstract void SendResponseFromFile (string filename, long offset, long length);
+ public abstract void SendResponseFromMemory (byte [] data, int length);
+
+ public virtual void SendResponseFromMemory (IntPtr data, int length)
+ {
+ if (length <= 0)
+ return;
+
+ byte [] dataBytes = new byte [length];
+ Marshal.Copy (data, dataBytes, 0, length);
+ SendResponseFromMemory (dataBytes, length);
+ }
+
+ public abstract void SendStatus (int statusCode, string statusDescription);
+ public abstract void SendUnknownResponseHeader (string name, string value);
+
+ public virtual void SetEndOfSendNotification (EndOfSendNotification callback, object extraData)
+ {
+ }
+
+ public virtual string MachineConfigPath
+ {
+ get {
+ return null;
+ }
+ }
+
+ public virtual string MachineInstallDirectory
+ {
+ get {
+ return null;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpWriter.cs b/mcs/class/System.Web/System.Web/HttpWriter.cs
new file mode 100644
index 00000000000..30a2e80bdb9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpWriter.cs
@@ -0,0 +1,233 @@
+//
+// System.Web.HttpWriter
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.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;
+using System.IO;
+using System.Text;
+using System.Web.Util;
+
+namespace System.Web
+{
+ public sealed class HttpWriter : TextWriter
+ {
+ internal const int MaxBufferSize = 32768;
+
+ HttpResponse _Response;
+
+ HttpResponseStream _ResponseStream;
+
+ ReusableMemoryStream _OutputStream;
+ StreamWriter _OutputHelper;
+ Encoding _Encoding;
+
+ Stream _OutputFilter;
+ HttpResponseStreamProxy _OutputProxy;
+
+ internal HttpWriter (HttpResponse Response)
+ {
+ _Response = Response;
+
+ _Encoding = _Response.ContentEncoding;
+ _OutputStream = new ReusableMemoryStream (MaxBufferSize);
+ _OutputHelper = new StreamWriter (_OutputStream, _Response.ContentEncoding);
+ _ResponseStream = new HttpResponseStream (this);
+ }
+
+ internal void Dispose ()
+ {
+ _OutputHelper.Close ();
+ _OutputStream.Close ();
+ _OutputFilter.Close ();
+ }
+
+ internal Stream GetActiveFilter ()
+ {
+ if (null == _OutputFilter) {
+ // Create a filter proxy to allow us to know if we have a valid filter
+ if (null == _OutputProxy)
+ _OutputProxy = new HttpResponseStreamProxy (this);
+
+ return _OutputProxy;
+ }
+ return _OutputFilter;
+ }
+
+ internal void ActivateFilter (Stream OutputFilter)
+ {
+ if (null == _OutputProxy)
+ throw new HttpException ("Invalid filter usage");
+
+ _OutputFilter = OutputFilter;
+ }
+
+ internal void FilterData (bool CloseStream)
+ {
+ // Check if we have any filter at all
+ if (null == _OutputFilter)
+ return;
+
+ FlushBuffers ();
+
+ // Save our current data
+ byte [] arrData = _OutputStream.GetBuffer ();
+ int size = (int) _OutputStream.Length;
+
+ // Remove our internal data
+ Clear ();
+
+ // If we have a filter then we have a proxy
+ _OutputProxy.Active = true;
+
+ try {
+ // Call the filter (it does a callback into our HttpWriter again)
+ _OutputFilter.Write (arrData, 0, size);
+ _OutputFilter.Flush ();
+
+ if (CloseStream)
+ _OutputFilter.Close ();
+ } finally {
+ _OutputProxy.Active = false;
+ }
+ }
+
+ internal void Clear ()
+ {
+ _OutputHelper.Close ();
+ _OutputStream = new ReusableMemoryStream (_OutputStream.GetBuffer ());
+ _OutputHelper = new StreamWriter (_OutputStream, _Response.ContentEncoding);
+ }
+
+ internal void SendContent (HttpWorkerRequest Handler)
+ {
+ FlushBuffers();
+
+ int l = (int)_OutputStream.Length;
+ if (l > 0) {
+ byte [] arrContent = _OutputStream.GetBuffer ();
+ Handler.SendResponseFromMemory (arrContent, l);
+ }
+ }
+
+ internal void Update ()
+ {
+ _Encoding = _Response.ContentEncoding;
+ _OutputHelper.Flush ();
+ _OutputHelper = new StreamWriter (_OutputStream, _Encoding);
+ }
+
+ internal long BufferSize
+ {
+ get {
+ FlushBuffers ();
+ return _OutputStream.Length;
+ }
+ }
+
+ internal void FlushBuffers ()
+ {
+ _OutputHelper.Flush ();
+ _OutputStream.Flush ();
+ }
+
+ internal byte[] GetBuffer () {
+ return _OutputStream.GetBuffer ();
+ }
+
+ public override Encoding Encoding
+ {
+ get { return _Encoding; }
+ }
+
+ public Stream OutputStream
+ {
+ get { return _ResponseStream; }
+ }
+
+ public override void Close ()
+ {
+ _Response.Flush ();
+ _Response.Close ();
+ }
+
+ public override void Flush ()
+ {
+ }
+
+ private void CheckIfFlush ()
+ {
+ if (!_Response.BufferOutput) {
+ FlushBuffers ();
+ }
+ }
+
+ public override void Write (char ch)
+ {
+ _OutputHelper.Write (ch);
+ CheckIfFlush ();
+ }
+
+ public override void Write (object obj)
+ {
+ if (obj != null)
+ {
+ _OutputHelper.Write (obj.ToString ());
+ CheckIfFlush ();
+ }
+ }
+
+ public override void Write (string s)
+ {
+ _OutputHelper.Write (s);
+ CheckIfFlush ();
+ }
+
+ public override void Write (char [] buffer, int index, int count)
+ {
+ _OutputHelper.Write (buffer, index, count);
+ CheckIfFlush ();
+ }
+
+ public void WriteBytes (byte [] buffer, int index, int count)
+ {
+ _OutputStream.Write (buffer, index, count);
+ CheckIfFlush ();
+ }
+
+ public override void WriteLine ()
+ {
+ _OutputHelper.Write ("\r\n");
+ CheckIfFlush ();
+ }
+
+ public void WriteString (string s, int index, int count)
+ {
+ _OutputHelper.Write (s.Substring (index, count));
+ CheckIfFlush ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/IHttpAsyncHandler.cs b/mcs/class/System.Web/System.Web/IHttpAsyncHandler.cs
new file mode 100644
index 00000000000..a675dc400f2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/IHttpAsyncHandler.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.IHttpAsyncHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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.
+//
+namespace System.Web
+{
+ public interface IHttpAsyncHandler : IHttpHandler
+ {
+ IAsyncResult BeginProcessRequest(HttpContext context,
+ AsyncCallback cb,
+ object extraData);
+ void EndProcessRequest(IAsyncResult result);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/IHttpHandler.cs b/mcs/class/System.Web/System.Web/IHttpHandler.cs
new file mode 100644
index 00000000000..d0db44dc459
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/IHttpHandler.cs
@@ -0,0 +1,37 @@
+//
+// System.IHttpHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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.
+//
+namespace System.Web
+{
+ public interface IHttpHandler
+ {
+ bool IsReusable { get; }
+ void ProcessRequest(HttpContext context);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/IHttpHandlerFactory.cs b/mcs/class/System.Web/System.Web/IHttpHandlerFactory.cs
new file mode 100644
index 00000000000..23c1243c808
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/IHttpHandlerFactory.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.IHttpHandlerFactory.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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.
+//
+namespace System.Web
+{
+ public interface IHttpHandlerFactory
+ {
+ IHttpHandler GetHandler(HttpContext context,
+ string requestType,
+ string url,
+ string pathTranslated);
+ void ReleaseHandler(IHttpHandler handler);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/IHttpMapPath.cs b/mcs/class/System.Web/System.Web/IHttpMapPath.cs
new file mode 100644
index 00000000000..a935917b862
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/IHttpMapPath.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.IHttpMapPath
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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.
+//
+
+namespace System.Web
+{
+ interface IHttpMapPath
+ {
+ string MapPath (string path);
+ string MachineConfigPath { get; }
+ }
+
+}
+
diff --git a/mcs/class/System.Web/System.Web/IHttpModule.cs b/mcs/class/System.Web/System.Web/IHttpModule.cs
new file mode 100644
index 00000000000..7ca2a6b23ff
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/IHttpModule.cs
@@ -0,0 +1,35 @@
+//
+// System.Web.IHttpModule.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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.
+//
+namespace System.Web {
+ public interface IHttpModule {
+ void Dispose();
+ void Init(HttpApplication context);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/MimeTypes.cs b/mcs/class/System.Web/System.Web/MimeTypes.cs
new file mode 100644
index 00000000000..4a1e1a56eb9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/MimeTypes.cs
@@ -0,0 +1,493 @@
+//
+// System.Web.MimeTypes
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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;
+using System.Collections;
+
+namespace System.Web
+{
+ class MimeTypes
+ {
+ static Hashtable mimeTypes;
+
+ static MimeTypes ()
+ {
+ mimeTypes = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant,
+ CaseInsensitiveComparer.DefaultInvariant);
+
+ mimeTypes.Add ("3dm", "x-world/x-3dmf");
+ mimeTypes.Add ("3dmf", "x-world/x-3dmf");
+ mimeTypes.Add ("aab", "application/x-authorware-bin");
+ mimeTypes.Add ("aam", "application/x-authorware-map");
+ mimeTypes.Add ("aas", "application/x-authorware-seg");
+ mimeTypes.Add ("abc", "text/vnd.abc");
+ mimeTypes.Add ("acgi", "text/html");
+ mimeTypes.Add ("afl", "video/animaflex");
+ mimeTypes.Add ("ai", "application/postscript");
+ mimeTypes.Add ("aif", "audio/aiff");
+ mimeTypes.Add ("aifc", "audio/aiff");
+ mimeTypes.Add ("aiff", "audio/aiff");
+ mimeTypes.Add ("aim", "application/x-aim");
+ mimeTypes.Add ("aip", "text/x-audiosoft-intra");
+ mimeTypes.Add ("ani", "application/x-navi-animation");
+ mimeTypes.Add ("aos", "application/x-nokia-9000-communicator-add-on-software");
+ mimeTypes.Add ("aps", "application/mime");
+ mimeTypes.Add ("art", "image/x-jg");
+ mimeTypes.Add ("asf", "video/x-ms-asf");
+ mimeTypes.Add ("asm", "text/x-asm");
+ mimeTypes.Add ("asp", "text/asp");
+ mimeTypes.Add ("asx", "application/x-mplayer2");
+ mimeTypes.Add ("au", "audio/x-au");
+ mimeTypes.Add ("avi", "video/avi");
+ mimeTypes.Add ("avs", "video/avs-video");
+ mimeTypes.Add ("bcpio", "application/x-bcpio");
+ mimeTypes.Add ("bm", "image/bmp");
+ mimeTypes.Add ("bmp", "image/bmp");
+ mimeTypes.Add ("boo", "application/book");
+ mimeTypes.Add ("book", "application/book");
+ mimeTypes.Add ("boz", "application/x-bzip2");
+ mimeTypes.Add ("bsh", "application/x-bsh");
+ mimeTypes.Add ("bz", "application/x-bzip");
+ mimeTypes.Add ("bz2", "application/x-bzip2");
+ mimeTypes.Add ("c", "text/plain");
+ mimeTypes.Add ("c++", "text/plain");
+ mimeTypes.Add ("cat", "application/vnd.ms-pki.seccat");
+ mimeTypes.Add ("cc", "text/plain");
+ mimeTypes.Add ("ccad", "application/clariscad");
+ mimeTypes.Add ("cco", "application/x-cocoa");
+ mimeTypes.Add ("cdf", "application/cdf");
+ mimeTypes.Add ("cer", "application/pkix-cert");
+ mimeTypes.Add ("cha", "application/x-chat");
+ mimeTypes.Add ("chat", "application/x-chat");
+ mimeTypes.Add ("class", "application/java");
+ mimeTypes.Add ("conf", "text/plain");
+ mimeTypes.Add ("cpio", "application/x-cpio");
+ mimeTypes.Add ("cpp", "text/plain");
+ mimeTypes.Add ("cpt", "application/x-cpt");
+ mimeTypes.Add ("crl", "application/pkix-crl");
+ mimeTypes.Add ("crt", "application/pkix-cert");
+ mimeTypes.Add ("csh", "application/x-csh");
+ mimeTypes.Add ("css", "text/css");
+ mimeTypes.Add ("cxx", "text/plain");
+ mimeTypes.Add ("dcr", "application/x-director");
+ mimeTypes.Add ("deepv", "application/x-deepv");
+ mimeTypes.Add ("def", "text/plain");
+ mimeTypes.Add ("der", "application/x-x509-ca-cert");
+ mimeTypes.Add ("dif", "video/x-dv");
+ mimeTypes.Add ("dir", "application/x-director");
+ mimeTypes.Add ("dl", "video/dl");
+ mimeTypes.Add ("doc", "application/msword");
+ mimeTypes.Add ("dot", "application/msword");
+ mimeTypes.Add ("dp", "application/commonground");
+ mimeTypes.Add ("drw", "application/drafting");
+ mimeTypes.Add ("dv", "video/x-dv");
+ mimeTypes.Add ("dvi", "application/x-dvi");
+ mimeTypes.Add ("dwf", "drawing/x-dwf (old)");
+ mimeTypes.Add ("dwg", "application/acad");
+ mimeTypes.Add ("dxf", "application/dxf");
+ mimeTypes.Add ("dxr", "application/x-director");
+ mimeTypes.Add ("el", "text/x-script.elisp");
+ mimeTypes.Add ("elc", "application/x-elc");
+ mimeTypes.Add ("eps", "application/postscript");
+ mimeTypes.Add ("es", "application/x-esrehber");
+ mimeTypes.Add ("etx", "text/x-setext");
+ mimeTypes.Add ("evy", "application/envoy");
+ mimeTypes.Add ("f", "text/plain");
+ mimeTypes.Add ("f77", "text/plain");
+ mimeTypes.Add ("f90", "text/plain");
+ mimeTypes.Add ("fdf", "application/vnd.fdf");
+ mimeTypes.Add ("fif", "image/fif");
+ mimeTypes.Add ("fli", "video/fli");
+ mimeTypes.Add ("flo", "image/florian");
+ mimeTypes.Add ("flx", "text/vnd.fmi.flexstor");
+ mimeTypes.Add ("fmf", "video/x-atomic3d-feature");
+ mimeTypes.Add ("for", "text/plain");
+ mimeTypes.Add ("fpx", "image/vnd.fpx");
+ mimeTypes.Add ("frl", "application/freeloader");
+ mimeTypes.Add ("funk", "audio/make");
+ mimeTypes.Add ("g", "text/plain");
+ mimeTypes.Add ("g3", "image/g3fax");
+ mimeTypes.Add ("gif", "image/gif");
+ mimeTypes.Add ("gl", "video/gl");
+ mimeTypes.Add ("gsd", "audio/x-gsm");
+ mimeTypes.Add ("gsm", "audio/x-gsm");
+ mimeTypes.Add ("gsp", "application/x-gsp");
+ mimeTypes.Add ("gss", "application/x-gss");
+ mimeTypes.Add ("gtar", "application/x-gtar");
+ mimeTypes.Add ("gz", "application/x-gzip");
+ mimeTypes.Add ("gzip", "application/x-gzip");
+ mimeTypes.Add ("h", "text/plain");
+ mimeTypes.Add ("hdf", "application/x-hdf");
+ mimeTypes.Add ("help", "application/x-helpfile");
+ mimeTypes.Add ("hgl", "application/vnd.hp-HPGL");
+ mimeTypes.Add ("hh", "text/plain");
+ mimeTypes.Add ("hlb", "text/x-script");
+ mimeTypes.Add ("hlp", "application/x-helpfile");
+ mimeTypes.Add ("hpg", "application/vnd.hp-HPGL");
+ mimeTypes.Add ("hpgl", "application/vnd.hp-HPGL");
+ mimeTypes.Add ("hqx", "application/binhex");
+ mimeTypes.Add ("hta", "application/hta");
+ mimeTypes.Add ("htc", "text/x-component");
+ mimeTypes.Add ("htm", "text/html");
+ mimeTypes.Add ("html", "text/html");
+ mimeTypes.Add ("htmls", "text/html");
+ mimeTypes.Add ("htt", "text/webviewhtml");
+ mimeTypes.Add ("htx ", "text/html");
+ mimeTypes.Add ("ice ", "x-conference/x-cooltalk");
+ mimeTypes.Add ("ico", "image/x-icon");
+ mimeTypes.Add ("idc", "text/plain");
+ mimeTypes.Add ("ief", "image/ief");
+ mimeTypes.Add ("iefs", "image/ief");
+ mimeTypes.Add ("iges", "application/iges");
+ mimeTypes.Add ("igs", "application/iges");
+ mimeTypes.Add ("ima", "application/x-ima");
+ mimeTypes.Add ("imap", "application/x-httpd-imap");
+ mimeTypes.Add ("inf ", "application/inf");
+ mimeTypes.Add ("ins", "application/x-internett-signup");
+ mimeTypes.Add ("ip ", "application/x-ip2");
+ mimeTypes.Add ("isu", "video/x-isvideo");
+ mimeTypes.Add ("it", "audio/it");
+ mimeTypes.Add ("iv", "application/x-inventor");
+ mimeTypes.Add ("ivr", "i-world/i-vrml");
+ mimeTypes.Add ("ivy", "application/x-livescreen");
+ mimeTypes.Add ("jam ", "audio/x-jam");
+ mimeTypes.Add ("jav", "text/plain");
+ mimeTypes.Add ("java", "text/plain");
+ mimeTypes.Add ("jcm ", "application/x-java-commerce");
+ mimeTypes.Add ("jfif", "image/jpeg");
+ mimeTypes.Add ("jfif-tbnl", "image/jpeg");
+ mimeTypes.Add ("jpe", "image/jpeg");
+ mimeTypes.Add ("jpeg", "image/jpeg");
+ mimeTypes.Add ("jps", "image/x-jps");
+ mimeTypes.Add ("js ", "application/x-javascript");
+ mimeTypes.Add ("jut", "image/jutvision");
+ mimeTypes.Add ("kar", "audio/midi");
+ mimeTypes.Add ("ksh", "text/x-script.ksh");
+ mimeTypes.Add ("la ", "audio/nspaudio");
+ mimeTypes.Add ("lam", "audio/x-liveaudio");
+ mimeTypes.Add ("latex ", "application/x-latex");
+ mimeTypes.Add ("list", "text/plain");
+ mimeTypes.Add ("lma", "audio/nspaudio");
+ mimeTypes.Add ("log ", "text/plain");
+ mimeTypes.Add ("lsp ", "application/x-lisp");
+ mimeTypes.Add ("lst ", "text/plain");
+ mimeTypes.Add ("lsx", "text/x-la-asf");
+ mimeTypes.Add ("ltx", "application/x-latex");
+ mimeTypes.Add ("m", "text/plain");
+ mimeTypes.Add ("m1v", "video/mpeg");
+ mimeTypes.Add ("m2a", "audio/mpeg");
+ mimeTypes.Add ("m2v", "video/mpeg");
+ mimeTypes.Add ("m3u ", "audio/x-mpequrl");
+ mimeTypes.Add ("man", "application/x-troff-man");
+ mimeTypes.Add ("map", "application/x-navimap");
+ mimeTypes.Add ("mar", "text/plain");
+ mimeTypes.Add ("mbd", "application/mbedlet");
+ mimeTypes.Add ("mc$", "application/x-magic-cap-package-1.0");
+ mimeTypes.Add ("mcd", "application/mcad");
+ mimeTypes.Add ("mcf", "image/vasa");
+ mimeTypes.Add ("mcp", "application/netmc");
+ mimeTypes.Add ("me ", "application/x-troff-me");
+ mimeTypes.Add ("mht", "message/rfc822");
+ mimeTypes.Add ("mhtml", "message/rfc822");
+ mimeTypes.Add ("mid", "audio/midi");
+ mimeTypes.Add ("midi", "audio/midi");
+ mimeTypes.Add ("mif", "application/x-mif");
+ mimeTypes.Add ("mime ", "message/rfc822");
+ mimeTypes.Add ("mjf", "audio/x-vnd.AudioExplosion.MjuiceMediaFile");
+ mimeTypes.Add ("mjpg ", "video/x-motion-jpeg");
+ mimeTypes.Add ("mm", "application/base64");
+ mimeTypes.Add ("mme", "application/base64");
+ mimeTypes.Add ("mod", "audio/mod");
+ mimeTypes.Add ("moov", "video/quicktime");
+ mimeTypes.Add ("mov", "video/quicktime");
+ mimeTypes.Add ("movie", "video/x-sgi-movie");
+ mimeTypes.Add ("mp2", "video/mpeg");
+ mimeTypes.Add ("mp3", "audio/mpeg3");
+ mimeTypes.Add ("mpa", "audio/mpeg");
+ mimeTypes.Add ("mpc", "application/x-project");
+ mimeTypes.Add ("mpe", "video/mpeg");
+ mimeTypes.Add ("mpeg", "video/mpeg");
+ mimeTypes.Add ("mpg", "video/mpeg");
+ mimeTypes.Add ("mpga", "audio/mpeg");
+ mimeTypes.Add ("mpp", "application/vnd.ms-project");
+ mimeTypes.Add ("mpt", "application/x-project");
+ mimeTypes.Add ("mpv", "application/x-project");
+ mimeTypes.Add ("mpx", "application/x-project");
+ mimeTypes.Add ("mrc", "application/marc");
+ mimeTypes.Add ("ms", "application/x-troff-ms");
+ mimeTypes.Add ("mv", "video/x-sgi-movie");
+ mimeTypes.Add ("my", "audio/make");
+ mimeTypes.Add ("mzz", "application/x-vnd.AudioExplosion.mzz");
+ mimeTypes.Add ("nap", "image/naplps");
+ mimeTypes.Add ("naplps", "image/naplps");
+ mimeTypes.Add ("nc", "application/x-netcdf");
+ mimeTypes.Add ("ncm", "application/vnd.nokia.configuration-message");
+ mimeTypes.Add ("nif", "image/x-niff");
+ mimeTypes.Add ("niff", "image/x-niff");
+ mimeTypes.Add ("nix", "application/x-mix-transfer");
+ mimeTypes.Add ("nsc", "application/x-conference");
+ mimeTypes.Add ("nvd", "application/x-navidoc");
+ mimeTypes.Add ("oda", "application/oda");
+ mimeTypes.Add ("omc", "application/x-omc");
+ mimeTypes.Add ("omcd", "application/x-omcdatamaker");
+ mimeTypes.Add ("omcr", "application/x-omcregerator");
+ mimeTypes.Add ("p", "text/x-pascal");
+ mimeTypes.Add ("p10", "application/pkcs10");
+ mimeTypes.Add ("p12", "application/pkcs-12");
+ mimeTypes.Add ("p7a", "application/x-pkcs7-signature");
+ mimeTypes.Add ("p7c", "application/pkcs7-mime");
+ mimeTypes.Add ("p7m", "application/pkcs7-mime");
+ mimeTypes.Add ("p7r", "application/x-pkcs7-certreqresp");
+ mimeTypes.Add ("p7s", "application/pkcs7-signature");
+ mimeTypes.Add ("part ", "application/pro_eng");
+ mimeTypes.Add ("pas", "text/pascal");
+ mimeTypes.Add ("pbm ", "image/x-portable-bitmap");
+ mimeTypes.Add ("pcl", "application/x-pcl");
+ mimeTypes.Add ("pct", "image/x-pict");
+ mimeTypes.Add ("pcx", "image/x-pcx");
+ mimeTypes.Add ("pdb", "chemical/x-pdb");
+ mimeTypes.Add ("pdf", "application/pdf");
+ mimeTypes.Add ("pfunk", "audio/make");
+ mimeTypes.Add ("pgm", "image/x-portable-graymap");
+ mimeTypes.Add ("pic", "image/pict");
+ mimeTypes.Add ("pict", "image/pict");
+ mimeTypes.Add ("pkg", "application/x-newton-compatible-pkg");
+ mimeTypes.Add ("pko", "application/vnd.ms-pki.pko");
+ mimeTypes.Add ("pl", "text/plain");
+ mimeTypes.Add ("plx", "application/x-PiXCLscript");
+ mimeTypes.Add ("pm", "image/x-xpixmap");
+ mimeTypes.Add ("pm4 ", "application/x-pagemaker");
+ mimeTypes.Add ("pm5", "application/x-pagemaker");
+ mimeTypes.Add ("png", "image/png");
+ mimeTypes.Add ("pnm", "application/x-portable-anymap");
+ mimeTypes.Add ("pot", "application/mspowerpoint");
+ mimeTypes.Add ("pov", "model/x-pov");
+ mimeTypes.Add ("ppa", "application/vnd.ms-powerpoint");
+ mimeTypes.Add ("ppm", "image/x-portable-pixmap");
+ mimeTypes.Add ("pps", "application/mspowerpoint");
+ mimeTypes.Add ("ppt", "application/mspowerpoint");
+ mimeTypes.Add ("ppz", "application/mspowerpoint");
+ mimeTypes.Add ("pre", "application/x-freelance");
+ mimeTypes.Add ("prt", "application/pro_eng");
+ mimeTypes.Add ("ps", "application/postscript");
+ mimeTypes.Add ("pvu", "paleovu/x-pv");
+ mimeTypes.Add ("pwz ", "application/vnd.ms-powerpoint");
+ mimeTypes.Add ("py ", "text/x-script.phyton");
+ mimeTypes.Add ("pyc ", "applicaiton/x-bytecode.python");
+ mimeTypes.Add ("qcp ", "audio/vnd.qcelp");
+ mimeTypes.Add ("qd3 ", "x-world/x-3dmf");
+ mimeTypes.Add ("qd3d ", "x-world/x-3dmf");
+ mimeTypes.Add ("qif", "image/x-quicktime");
+ mimeTypes.Add ("qt", "video/quicktime");
+ mimeTypes.Add ("qtc", "video/x-qtc");
+ mimeTypes.Add ("qti", "image/x-quicktime");
+ mimeTypes.Add ("qtif", "image/x-quicktime");
+ mimeTypes.Add ("ra", "audio/x-pn-realaudio");
+ mimeTypes.Add ("ram", "audio/x-pn-realaudio");
+ mimeTypes.Add ("ras", "application/x-cmu-raster");
+ mimeTypes.Add ("rast", "image/cmu-raster");
+ mimeTypes.Add ("rexx ", "text/x-script.rexx");
+ mimeTypes.Add ("rf", "image/vnd.rn-realflash");
+ mimeTypes.Add ("rgb ", "image/x-rgb");
+ mimeTypes.Add ("rm", "application/vnd.rn-realmedia");
+ mimeTypes.Add ("rmi", "audio/mid");
+ mimeTypes.Add ("rmm ", "audio/x-pn-realaudio");
+ mimeTypes.Add ("rmp", "audio/x-pn-realaudio");
+ mimeTypes.Add ("rng", "application/ringing-tones");
+ mimeTypes.Add ("rnx ", "application/vnd.rn-realplayer");
+ mimeTypes.Add ("roff", "application/x-troff");
+ mimeTypes.Add ("rp ", "image/vnd.rn-realpix");
+ mimeTypes.Add ("rpm", "audio/x-pn-realaudio-plugin");
+ mimeTypes.Add ("rss", "text/xml");
+ mimeTypes.Add ("rt", "text/richtext");
+ mimeTypes.Add ("rtf", "text/richtext");
+ mimeTypes.Add ("rtx", "text/richtext");
+ mimeTypes.Add ("rv", "video/vnd.rn-realvideo");
+ mimeTypes.Add ("s", "text/x-asm");
+ mimeTypes.Add ("s3m ", "audio/s3m");
+ mimeTypes.Add ("sbk ", "application/x-tbook");
+ mimeTypes.Add ("scm", "application/x-lotusscreencam");
+ mimeTypes.Add ("sdml", "text/plain");
+ mimeTypes.Add ("sdp ", "application/sdp");
+ mimeTypes.Add ("sdr", "application/sounder");
+ mimeTypes.Add ("sea", "application/sea");
+ mimeTypes.Add ("set", "application/set");
+ mimeTypes.Add ("sgm ", "text/sgml");
+ mimeTypes.Add ("sgml", "text/sgml");
+ mimeTypes.Add ("sh", "text/x-script.sh");
+ mimeTypes.Add ("shar", "application/x-bsh");
+ mimeTypes.Add ("shtml ", "text/html");
+ mimeTypes.Add ("sid", "audio/x-psid");
+ mimeTypes.Add ("sit", "application/x-sit");
+ mimeTypes.Add ("skd", "application/x-koan");
+ mimeTypes.Add ("skm ", "application/x-koan");
+ mimeTypes.Add ("skp ", "application/x-koan");
+ mimeTypes.Add ("skt ", "application/x-koan");
+ mimeTypes.Add ("sl ", "application/x-seelogo");
+ mimeTypes.Add ("smi ", "application/smil");
+ mimeTypes.Add ("smil ", "application/smil");
+ mimeTypes.Add ("snd", "audio/basic");
+ mimeTypes.Add ("sol", "application/solids");
+ mimeTypes.Add ("spc ", "application/x-pkcs7-certificates");
+ mimeTypes.Add ("spl", "application/futuresplash");
+ mimeTypes.Add ("spr", "application/x-sprite");
+ mimeTypes.Add ("sprite ", "application/x-sprite");
+ mimeTypes.Add ("src", "application/x-wais-source");
+ mimeTypes.Add ("ssi", "text/x-server-parsed-html");
+ mimeTypes.Add ("ssm ", "application/streamingmedia");
+ mimeTypes.Add ("sst", "application/vnd.ms-pki.certstore");
+ mimeTypes.Add ("step", "application/step");
+ mimeTypes.Add ("stl", "application/sla");
+ mimeTypes.Add ("stp", "application/step");
+ mimeTypes.Add ("sv4cpio", "application/x-sv4cpio");
+ mimeTypes.Add ("sv4crc", "application/x-sv4crc");
+ mimeTypes.Add ("svf", "image/x-dwg");
+ mimeTypes.Add ("svr", "application/x-world");
+ mimeTypes.Add ("swf", "application/x-shockwave-flash");
+ mimeTypes.Add ("t", "application/x-troff");
+ mimeTypes.Add ("talk", "text/x-speech");
+ mimeTypes.Add ("tar", "application/x-tar");
+ mimeTypes.Add ("tbk", "application/toolbook");
+ mimeTypes.Add ("tcl", "text/x-script.tcl");
+ mimeTypes.Add ("tcsh", "text/x-script.tcsh");
+ mimeTypes.Add ("tex", "application/x-tex");
+ mimeTypes.Add ("texi", "application/x-texinfo");
+ mimeTypes.Add ("texinfo", "application/x-texinfo");
+ mimeTypes.Add ("text", "text/plain");
+ mimeTypes.Add ("tgz", "application/x-compressed");
+ mimeTypes.Add ("tif", "image/tiff");
+ mimeTypes.Add ("tiff", "image/tiff");
+ mimeTypes.Add ("tr", "application/x-troff");
+ mimeTypes.Add ("tsi", "audio/tsp-audio");
+ mimeTypes.Add ("tsp", "audio/tsplayer");
+ mimeTypes.Add ("tsv", "text/tab-separated-values");
+ mimeTypes.Add ("turbot", "image/florian");
+ mimeTypes.Add ("txt", "text/plain");
+ mimeTypes.Add ("uil", "text/x-uil");
+ mimeTypes.Add ("uni", "text/uri-list");
+ mimeTypes.Add ("unis", "text/uri-list");
+ mimeTypes.Add ("unv", "application/i-deas");
+ mimeTypes.Add ("uri", "text/uri-list");
+ mimeTypes.Add ("uris", "text/uri-list");
+ mimeTypes.Add ("ustar", "multipart/x-ustar");
+ mimeTypes.Add ("uu", "text/x-uuencode");
+ mimeTypes.Add ("uue", "text/x-uuencode");
+ mimeTypes.Add ("vcd", "application/x-cdlink");
+ mimeTypes.Add ("vcs", "text/x-vCalendar");
+ mimeTypes.Add ("vda", "application/vda");
+ mimeTypes.Add ("vdo", "video/vdo");
+ mimeTypes.Add ("vew ", "application/groupwise");
+ mimeTypes.Add ("viv", "video/vivo");
+ mimeTypes.Add ("vivo", "video/vivo");
+ mimeTypes.Add ("vmd ", "application/vocaltec-media-desc");
+ mimeTypes.Add ("vmf", "application/vocaltec-media-file");
+ mimeTypes.Add ("voc", "audio/voc");
+ mimeTypes.Add ("vos", "video/vosaic");
+ mimeTypes.Add ("vox", "audio/voxware");
+ mimeTypes.Add ("vqe", "audio/x-twinvq-plugin");
+ mimeTypes.Add ("vqf", "audio/x-twinvq");
+ mimeTypes.Add ("vql", "audio/x-twinvq-plugin");
+ mimeTypes.Add ("vrml", "application/x-vrml");
+ mimeTypes.Add ("vrt", "x-world/x-vrt");
+ mimeTypes.Add ("vsd", "application/x-visio");
+ mimeTypes.Add ("vst", "application/x-visio");
+ mimeTypes.Add ("vsw ", "application/x-visio");
+ mimeTypes.Add ("w60", "application/wordperfect6.0");
+ mimeTypes.Add ("w61", "application/wordperfect6.1");
+ mimeTypes.Add ("w6w", "application/msword");
+ mimeTypes.Add ("wav", "audio/wav");
+ mimeTypes.Add ("wb1", "application/x-qpro");
+ mimeTypes.Add ("wbmp", "image/vnd.wap.wbmp");
+ mimeTypes.Add ("web", "application/vnd.xara");
+ mimeTypes.Add ("wiz", "application/msword");
+ mimeTypes.Add ("wk1", "application/x-123");
+ mimeTypes.Add ("wmf", "windows/metafile");
+ mimeTypes.Add ("wml", "text/vnd.wap.wml");
+ mimeTypes.Add ("wmlc ", "application/vnd.wap.wmlc");
+ mimeTypes.Add ("wmls", "text/vnd.wap.wmlscript");
+ mimeTypes.Add ("wmlsc ", "application/vnd.wap.wmlscriptc");
+ mimeTypes.Add ("word ", "application/msword");
+ mimeTypes.Add ("wp", "application/wordperfect");
+ mimeTypes.Add ("wp5", "application/wordperfect");
+ mimeTypes.Add ("wp6 ", "application/wordperfect");
+ mimeTypes.Add ("wpd", "application/wordperfect");
+ mimeTypes.Add ("wq1", "application/x-lotus");
+ mimeTypes.Add ("wri", "application/mswrite");
+ mimeTypes.Add ("wrl", "application/x-world");
+ mimeTypes.Add ("wrz", "model/vrml");
+ mimeTypes.Add ("wsc", "text/scriplet");
+ mimeTypes.Add ("wsrc", "application/x-wais-source");
+ mimeTypes.Add ("wtk ", "application/x-wintalk");
+ mimeTypes.Add ("xbm", "image/x-xbitmap");
+ mimeTypes.Add ("xdr", "video/x-amt-demorun");
+ mimeTypes.Add ("xgz", "xgl/drawing");
+ mimeTypes.Add ("xif", "image/vnd.xiff");
+ mimeTypes.Add ("xl", "application/excel");
+ mimeTypes.Add ("xla", "application/excel");
+ mimeTypes.Add ("xlb", "application/excel");
+ mimeTypes.Add ("xlc", "application/excel");
+ mimeTypes.Add ("xld ", "application/excel");
+ mimeTypes.Add ("xlk", "application/excel");
+ mimeTypes.Add ("xll", "application/excel");
+ mimeTypes.Add ("xlm", "application/excel");
+ mimeTypes.Add ("xls", "application/excel");
+ mimeTypes.Add ("xlt", "application/excel");
+ mimeTypes.Add ("xlv", "application/excel");
+ mimeTypes.Add ("xlw", "application/excel");
+ mimeTypes.Add ("xm", "audio/xm");
+ mimeTypes.Add ("xml", "text/xml");
+ mimeTypes.Add ("xmz", "xgl/movie");
+ mimeTypes.Add ("xpix", "application/x-vnd.ls-xpix");
+ mimeTypes.Add ("xpm", "image/xpm");
+ mimeTypes.Add ("x-png", "image/png");
+ mimeTypes.Add ("xsr", "video/x-amt-showrun");
+ mimeTypes.Add ("xwd", "image/x-xwd");
+ mimeTypes.Add ("xyz", "chemical/x-pdb");
+ mimeTypes.Add ("z", "application/x-compressed");
+ mimeTypes.Add ("zip", "application/zip");
+ mimeTypes.Add ("zsh", "text/x-script.zsh");
+ }
+
+ public static string GetMimeType (string fileName)
+ {
+ string result = null;
+ int dot = fileName.LastIndexOf ('.');
+
+ if (dot != -1 && fileName.Length > dot + 1)
+ result = mimeTypes [fileName.Substring (dot + 1)] as string;
+
+ if (result == null)
+ result = "application/octet-stream";
+
+ return result;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/NoParamsInvoker.cs b/mcs/class/System.Web/System.Web/NoParamsInvoker.cs
new file mode 100644
index 00000000000..567071be101
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/NoParamsInvoker.cs
@@ -0,0 +1,57 @@
+//
+// System.Web.NoParamsInvoker - proxy used to invoke wired up events without parameters
+// as if they had parameters.
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2003 Ximian, Inc. (http://www.ximian.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.
+//
+
+namespace System.Web
+{
+ delegate void NoParamsDelegate ();
+ class NoParamsInvoker
+ {
+ EventHandler faked;
+ NoParamsDelegate real;
+
+ public NoParamsInvoker (object o, string method)
+ {
+ real = (NoParamsDelegate) Delegate.CreateDelegate (
+ typeof (NoParamsDelegate), o, method);
+ faked = new EventHandler (InvokeNoParams);
+ }
+
+ void InvokeNoParams (object o, EventArgs args)
+ {
+ real ();
+ }
+
+ public EventHandler FakeDelegate {
+ get { return faked; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/ParserError.cs b/mcs/class/System.Web/System.Web/ParserError.cs
new file mode 100644
index 00000000000..0fdd6763d1f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ParserError.cs
@@ -0,0 +1,69 @@
+//
+// System.Web.ParserError.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Runtime.Serialization;
+
+namespace System.Web {
+
+ [Serializable]
+ public sealed class ParserError
+ {
+ string _errorText;
+ string _virtualPath;
+ int _line;
+
+ public ParserError ()
+ {
+ }
+
+ public ParserError (string errorText, string virtualPath, int line)
+ {
+ _errorText = errorText;
+ _virtualPath = virtualPath;
+ _line = line;
+ }
+
+ public string ErrorText {
+ get { return _errorText; }
+ }
+
+ public string VirtualPath {
+ get { return _virtualPath; }
+ }
+
+ public int Line {
+ get { return _line; }
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web/ParserErrorCollection.cs b/mcs/class/System.Web/System.Web/ParserErrorCollection.cs
new file mode 100644
index 00000000000..563470986c4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ParserErrorCollection.cs
@@ -0,0 +1,97 @@
+//
+// System.Web.ParserErrorCollection.cs
+//
+// Authors:
+// Lluis Sanchez Gual (lluis@novell.com)
+//
+// (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using System.Collections;
+using System.Runtime.Serialization;
+
+namespace System.Web {
+
+ [Serializable]
+ public sealed class ParserErrorCollection: CollectionBase
+ {
+ public ParserErrorCollection ()
+ {
+ }
+
+ public ParserErrorCollection (ParserError[] errors)
+ {
+ InnerList.AddRange (errors);
+ }
+
+ public ParserError this [int index]
+ {
+ get { return (ParserError) InnerList [index]; }
+ }
+
+ public int Add (ParserError error)
+ {
+ return List.Add (error);
+ }
+
+ public void AddRange (ParserErrorCollection collection)
+ {
+ InnerList.AddRange (collection);
+ }
+
+ public void AddRange (ParserError[] errors)
+ {
+ InnerList.AddRange (errors);
+ }
+
+ public bool Contains (ParserError error)
+ {
+ return InnerList.Contains (error);
+ }
+
+ public void CopyTo (ParserError[] errors, int index)
+ {
+ List.CopyTo (errors, index);
+ }
+
+ public int IndexOf (ParserError error)
+ {
+ return InnerList.IndexOf (error);
+ }
+
+ public void Insert (int index, ParserError error)
+ {
+ InnerList.Insert (index, error);
+ }
+
+ public void Remove (ParserError error)
+ {
+ InnerList.Remove (error);
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Web/System.Web/ProcessInfo.cs b/mcs/class/System.Web/System.Web/ProcessInfo.cs
new file mode 100644
index 00000000000..6d424207cc6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ProcessInfo.cs
@@ -0,0 +1,111 @@
+//
+// System.Web.ProcessInfo
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+
+//
+// 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.
+//
+
+namespace System.Web {
+ public class ProcessInfo {
+
+ #region Fields
+
+ TimeSpan age;
+ int peakMemoryUsed;
+ int processID;
+ int requestCount;
+ ProcessShutdownReason shutdownReason;
+ DateTime startTime;
+ ProcessStatus status;
+
+ #endregion
+
+ #region Constructors
+
+ public ProcessInfo ()
+ {
+ }
+
+ public ProcessInfo (DateTime startTime, TimeSpan age, int processID, int requestCount, ProcessStatus status, ProcessShutdownReason shutdownReason, int peakMemoryUsed)
+ {
+ this.age = age;
+ this.peakMemoryUsed = peakMemoryUsed;
+ this.processID = processID;
+ this.requestCount = requestCount;
+ this.shutdownReason = shutdownReason;
+ this.startTime = startTime;
+ this.status = status;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public TimeSpan Age {
+ get { return age; }
+ }
+
+ public int PeakMemoryUsed {
+ get { return peakMemoryUsed; }
+ }
+
+ public int ProcessID {
+ get { return processID; }
+ }
+
+ public int RequestCount {
+ get { return requestCount; }
+ }
+
+ public ProcessShutdownReason ShutdownReason {
+ get { return shutdownReason; }
+ }
+
+ public DateTime StartTime {
+ get { return startTime; }
+ }
+
+ public ProcessStatus Status {
+ get { return status; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void SetAll (DateTime startTime, TimeSpan age, int processID, int requestCount, ProcessStatus status, ProcessShutdownReason shutdownReason, int peakMemoryUsed)
+ {
+ this.age = age;
+ this.peakMemoryUsed = peakMemoryUsed;
+ this.processID = processID;
+ this.requestCount = requestCount;
+ this.shutdownReason = shutdownReason;
+ this.startTime = startTime;
+ this.status = status;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/ProcessModelInfo.cs b/mcs/class/System.Web/System.Web/ProcessModelInfo.cs
new file mode 100644
index 00000000000..39c05b69598
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ProcessModelInfo.cs
@@ -0,0 +1,71 @@
+//
+// System.Web.ProcessModelInfo.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+
+//
+// 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;
+
+namespace System.Web {
+ public class ProcessModelInfo {
+
+ #region Fields
+
+ #endregion
+
+ #region Constructors
+
+ public ProcessModelInfo ()
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO ("Retrieve appropriate variables from worker")]
+ public static ProcessInfo GetCurrentProcessInfo ()
+ {
+ DateTime startTime = DateTime.Now;
+ TimeSpan age = TimeSpan.Zero;
+ int processID = 0;
+ int requestCount = 0;
+ ProcessStatus status = ProcessStatus.Terminated;
+ ProcessShutdownReason shutdownReason = ProcessShutdownReason.None;
+ int peakMemoryUsed = 0;
+
+ return new ProcessInfo (startTime, age, processID, requestCount, status, shutdownReason, peakMemoryUsed);
+ }
+
+ [MonoTODO ("Retrieve process information.")]
+ public static ProcessInfo[] GetHistory (int numRecords)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/ProcessShutdownReason.cs b/mcs/class/System.Web/System.Web/ProcessShutdownReason.cs
new file mode 100644
index 00000000000..b8cba9d6809
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ProcessShutdownReason.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.ProcessShutdownReason.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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.
+//
+
+namespace System.Web {
+ [Serializable]
+ public enum ProcessShutdownReason {
+ None,
+ Unexpected,
+ RequestsLimit,
+ RequestQueueLimit,
+ Timeout,
+ IdleTimeout,
+ MemoryLimitExceeded,
+ PingFailed,
+ DeadlockSuspected
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/ProcessStatus.cs b/mcs/class/System.Web/System.Web/ProcessStatus.cs
new file mode 100644
index 00000000000..90b379aeda6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ProcessStatus.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.ProcessStatus.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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.
+//
+
+namespace System.Web {
+ public enum ProcessStatus {
+ Alive = 0x1,
+ ShuttingDown,
+ ShutDown,
+ Terminated
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/QueueManager.cs b/mcs/class/System.Web/System.Web/QueueManager.cs
new file mode 100644
index 00000000000..dc28be7af95
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/QueueManager.cs
@@ -0,0 +1,125 @@
+//
+// System.Web.QueueManager
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003,2004 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
+// "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;
+using System.Collections;
+using System.Threading;
+using System.Web.Configuration;
+
+namespace System.Web
+{
+ class QueueManager
+ {
+ int minFree;
+ int minLocalFree;
+ int queueLimit;
+ Queue queue;
+ bool disposing;
+
+ public QueueManager ()
+ {
+ HttpRuntimeConfig config;
+ config = (HttpRuntimeConfig) HttpContext.GetAppConfig ("system.web/httpRuntime");
+ minFree = config.MinFreeThreads;
+ minLocalFree = config.MinLocalRequestFreeThreads;
+ queueLimit = config.AppRequestQueueLimit;
+ queue = new Queue (queueLimit);
+ }
+
+ bool CanExecuteRequest (HttpWorkerRequest req)
+ {
+ if (disposing)
+ return false;
+
+ int threads, cports;
+ ThreadPool.GetAvailableThreads (out threads, out cports);
+ bool local = (req != null && req.GetLocalAddress () == "127.0.0.1");
+ return (threads > minFree) || (local && threads > minLocalFree);
+ }
+
+ public HttpWorkerRequest GetNextRequest (HttpWorkerRequest req)
+ {
+ if (!CanExecuteRequest (req)) {
+ if (req != null) {
+ lock (queue) {
+ Queue (req);
+ }
+ }
+
+ return null;
+ }
+
+ HttpWorkerRequest result;
+ lock (queue) {
+ result = Dequeue ();
+ if (result != null) {
+ if (req != null)
+ Queue (req);
+ } else {
+ result = req;
+ }
+ }
+
+ return result;
+ }
+
+ void Queue (HttpWorkerRequest wr)
+ {
+ if (queue.Count < queueLimit) {
+ queue.Enqueue (wr);
+ return;
+ }
+
+ HttpRuntime.FinishUnavailable (wr);
+ }
+
+ HttpWorkerRequest Dequeue ()
+ {
+ if (queue.Count > 0)
+ return (HttpWorkerRequest) queue.Dequeue ();
+
+ return null;
+ }
+
+ public void Dispose ()
+ {
+ if (disposing)
+ return;
+
+ disposing = true;
+ HttpWorkerRequest wr;
+ while ((wr = GetNextRequest (null)) != null)
+ HttpRuntime.FinishUnavailable (wr);
+
+ queue = null;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/ReusableMemoryStream.cs b/mcs/class/System.Web/System.Web/ReusableMemoryStream.cs
new file mode 100644
index 00000000000..e52e96e13ac
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ReusableMemoryStream.cs
@@ -0,0 +1,277 @@
+//
+// System.Web.ReusableMemoryStream
+// Trimmed down copy of System.IO.MemoryStream used by HttpWriter.
+//
+// Authors: Marcin Szczepanski (marcins@zipworld.com.au)
+// Patrik Torstensson
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2001,2002 Marcin Szczepanski, Patrik Torstensson
+// (c) 2003 Ximian, Inc. (http://www.ximian.com)
+// Copyright (C) 2004 Novell (http://www.novell.com)
+//
+
+//
+// Copyright (C) 2004 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
+// "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.IO;
+using System.Runtime.InteropServices;
+
+namespace System.Web
+{
+ [Serializable]
+ class ReusableMemoryStream : Stream
+ {
+ int capacity;
+ int length;
+ byte [] internalBuffer;
+ bool streamClosed;
+ int position;
+
+ public ReusableMemoryStream (int capacity)
+ {
+ if (capacity < 0)
+ throw new ArgumentOutOfRangeException ("capacity");
+
+ this.capacity = capacity;
+ internalBuffer = new byte [capacity];
+ }
+
+ public ReusableMemoryStream (byte [] buffer)
+ {
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+
+ capacity = buffer.Length;
+ internalBuffer = buffer;
+ }
+
+ void CheckIfClosedThrowDisposed ()
+ {
+ if (streamClosed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+ }
+
+ public override bool CanRead {
+ get { return !streamClosed; }
+ }
+
+ public override bool CanSeek {
+ get { return !streamClosed; }
+ }
+
+ public override bool CanWrite {
+ get { return !streamClosed; }
+ }
+
+ int Capacity {
+ get {
+ CheckIfClosedThrowDisposed ();
+ return capacity;
+ }
+
+ set {
+ CheckIfClosedThrowDisposed ();
+ if (value == capacity)
+ return; // LAMENESS: see MemoryStreamTest.ConstructorFive
+
+ if (value < 0 || value < length)
+ throw new ArgumentOutOfRangeException ("value",
+ "New capacity cannot be negative or less than the current capacity " + value + " " + capacity);
+
+ byte [] newBuffer = null;
+ if (value != 0) {
+ newBuffer = new byte [value];
+ Buffer.BlockCopy (internalBuffer, 0, newBuffer, 0, length);
+ }
+
+ internalBuffer = newBuffer; // It's null when capacity is set to 0
+ capacity = value;
+ }
+ }
+
+ public override long Length {
+ get {
+ CheckIfClosedThrowDisposed ();
+ return length;
+ }
+ }
+
+ public override long Position {
+ get {
+ CheckIfClosedThrowDisposed ();
+ return position;
+ }
+
+ set {
+ CheckIfClosedThrowDisposed ();
+ if (value < 0)
+ throw new ArgumentOutOfRangeException ("value",
+ "Position cannot be negative" );
+
+ if (value > Int32.MaxValue)
+ throw new ArgumentOutOfRangeException ("value",
+ "Position must be non-negative and less than 2^31 - 1 - origin");
+
+ position = (int) value;
+ }
+ }
+
+ public override void Close ()
+ {
+ streamClosed = true;
+ }
+
+ public override void Flush ()
+ {
+ }
+
+ public byte [] GetBuffer ()
+ {
+ return internalBuffer;
+ }
+
+ public override int Read ([In,Out] byte [] buffer, int offset, int count)
+ {
+ CheckIfClosedThrowDisposed ();
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+
+ if (position >= length || count == 0)
+ return 0;
+
+ if (position > length - count)
+ count = length - position;
+
+ Buffer.BlockCopy (internalBuffer, position, buffer, offset, count);
+ position += count;
+ return count;
+ }
+
+ public override int ReadByte ()
+ {
+ CheckIfClosedThrowDisposed ();
+ if (position >= length)
+ return -1;
+
+ return internalBuffer [position++];
+ }
+
+ public override long Seek (long offset, SeekOrigin loc)
+ {
+ CheckIfClosedThrowDisposed ();
+
+ if (offset > (long) Int32.MaxValue)
+ throw new ArgumentOutOfRangeException ("Offset out of range. " + offset);
+
+ int refPoint;
+ switch (loc) {
+ case SeekOrigin.Begin:
+ if (offset < 0)
+ throw new IOException ("Attempted to seek before start of MemoryStream.");
+ refPoint = 0;
+ break;
+ case SeekOrigin.Current:
+ refPoint = position;
+ break;
+ case SeekOrigin.End:
+ refPoint = length;
+ break;
+ default:
+ throw new ArgumentException ("loc", "Invalid SeekOrigin");
+ }
+
+ refPoint += (int) offset;
+ if (refPoint < 0)
+ throw new IOException ("Attempted to seek before start of MemoryStream.");
+
+ position = refPoint;
+ return position;
+ }
+
+ int CalculateNewCapacity (int minimum)
+ {
+ if (minimum < 256)
+ minimum = 256;
+
+ if (minimum < capacity * 2)
+ minimum = capacity * 2;
+
+ return minimum;
+ }
+
+ public override void SetLength (long value)
+ {
+ CheckIfClosedThrowDisposed ();
+
+ if (value < 0 || value > (long) Int32.MaxValue)
+ throw new ArgumentOutOfRangeException ();
+
+ int newSize = (int) value;
+ if (newSize > capacity)
+ Capacity = CalculateNewCapacity (newSize);
+ else if (newSize < length)
+ Array.Clear (internalBuffer, newSize, length - newSize);
+
+ length = newSize;
+ if (position > length)
+ position = length;
+ }
+
+ public override void Write (byte [] buffer, int offset, int count)
+ {
+ CheckIfClosedThrowDisposed ();
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+
+ if (offset < 0 || count < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (buffer.Length - offset < count)
+ throw new ArgumentException ("offset+count",
+ "The size of the buffer is less than offset + count.");
+
+ // reordered to avoid possible integer overflow
+ if (position > capacity - count)
+ Capacity = CalculateNewCapacity (position + count);
+
+ Buffer.BlockCopy (buffer, offset, internalBuffer, position, count);
+ position += count;
+ if (position >= length)
+ length = position;
+ }
+
+ public override void WriteByte (byte value)
+ {
+ CheckIfClosedThrowDisposed ();
+ if (position >= capacity)
+ Capacity = CalculateNewCapacity (position + 1);
+
+ if (position >= length)
+ length = position + 1;
+
+ internalBuffer [position++] = value;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/ServerVariablesCollection.cs b/mcs/class/System.Web/System.Web/ServerVariablesCollection.cs
new file mode 100755
index 00000000000..281ad3acbce
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ServerVariablesCollection.cs
@@ -0,0 +1,238 @@
+//
+// System.Web.ServerVariablesCollection
+//
+// Authors:
+// Alon Gazit (along@mainsoft.com)
+//
+// (c) 2004 Mainsoft, Inc. (http://www.mainsoft.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;
+using System.Collections;
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System.Web
+{
+
+ internal class ServerVariablesCollection:HttpValueCollection
+ {
+ private HttpRequest _request;
+ private bool _loaded = false;
+
+ public ServerVariablesCollection(HttpRequest request)
+ {
+ _request = request;
+ }
+
+ private void loadServerVariablesCollection()
+ {
+ if (_loaded)
+ return;
+ MakeReadWrite();
+ Add("ALL_HTTP", _request.GetAllHeaders(false));
+ Add("ALL_RAW", _request.GetAllHeaders(true));
+ Add("APPL_MD_PATH", _request.WorkerRequest.GetServerVariable("APPL_MD_PATH"));
+ Add("APPL_PHYSICAL_PATH", _request.WorkerRequest.GetServerVariable("APPL_PHYSICAL_PATH"));
+
+ if (null != _request.Context.User && _request.Context.User.Identity.IsAuthenticated) {
+ Add ("AUTH_TYPE", _request.Context.User.Identity.AuthenticationType);
+ Add ("AUTH_USER", _request.Context.User.Identity.Name);
+ } else {
+ Add ("AUTH_TYPE", "");
+ Add ("AUTH_USER", "");
+ }
+
+ Add("AUTH_PASSWORD", _request.WorkerRequest.GetServerVariable("AUTH_PASSWORD"));
+ Add ("LOGON_USER", _request.WorkerRequest.GetServerVariable("LOGON_USER"));
+ Add ("REMOTE_USER", _request.WorkerRequest.GetServerVariable("REMOTE_USER"));
+ Add("CERT_COOKIE", _request.WorkerRequest.GetServerVariable("CERT_COOKIE"));
+ Add("CERT_FLAGS", _request.WorkerRequest.GetServerVariable("CERT_FLAGS"));
+ Add("CERT_ISSUER", _request.WorkerRequest.GetServerVariable("CERT_ISSUER"));
+ Add("CERT_KEYSIZE", _request.WorkerRequest.GetServerVariable("CERT_KEYSIZE"));
+ Add("CERT_SECRETKEYSIZE", _request.WorkerRequest.GetServerVariable("CERT_SECRETKEYSIZE"));
+ Add("CERT_SERIALNUMBER", _request.WorkerRequest.GetServerVariable("CERT_SERIALNUMBER"));
+ Add("CERT_SERVER_ISSUER", _request.WorkerRequest.GetServerVariable("CERT_SERVER_ISSUER"));
+ Add("CERT_SERVER_SUBJECT", _request.WorkerRequest.GetServerVariable("CERT_SERVER_SUBJECT"));
+ Add("CERT_SUBJECT", _request.WorkerRequest.GetServerVariable("CERT_SUBJECT"));
+
+ string sTmp = _request.WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderContentLength);
+ if (null != sTmp)
+ Add ("CONTENT_LENGTH", sTmp);
+ Add ("CONTENT_TYPE", _request.ContentType);
+
+ Add("GATEWAY_INTERFACE", _request.WorkerRequest.GetServerVariable("GATEWAY_INTERFACE"));
+ Add("HTTPS", _request.WorkerRequest.GetServerVariable("HTTPS"));
+ Add("HTTPS_KEYSIZE", _request.WorkerRequest.GetServerVariable("HTTPS_KEYSIZE"));
+ Add("HTTPS_SECRETKEYSIZE", _request.WorkerRequest.GetServerVariable("HTTPS_SECRETKEYSIZE"));
+ Add("HTTPS_SERVER_ISSUER", _request.WorkerRequest.GetServerVariable("HTTPS_SERVER_ISSUER"));
+ Add("HTTPS_SERVER_SUBJECT", _request.WorkerRequest.GetServerVariable("HTTPS_SERVER_SUBJECT"));
+ Add("INSTANCE_ID", _request.WorkerRequest.GetServerVariable("INSTANCE_ID"));
+ Add("INSTANCE_META_PATH", _request.WorkerRequest.GetServerVariable("INSTANCE_META_PATH"));
+ Add("LOCAL_ADDR", _request.WorkerRequest.GetLocalAddress());
+ Add("PATH_INFO", _request.PathInfo);
+ Add("PATH_TRANSLATED", _request.PhysicalPath);
+ Add("QUERY_STRING", _request.QueryStringRaw);
+ Add("REMOTE_ADDR", _request.UserHostAddress);
+ Add("REMOTE_HOST", _request.UserHostName);
+ Add("REMOTE_PORT", _request.WorkerRequest.GetRemotePort ().ToString ());
+ Add("REQUEST_METHOD", _request.HttpMethod);
+ Add("SCRIPT_NAME", _request.FilePath);
+ Add("SERVER_NAME", _request.WorkerRequest.GetServerName());
+ Add("SERVER_PORT", _request.WorkerRequest.GetLocalPort().ToString());
+ if (_request.WorkerRequest.IsSecure())
+ Add("SERVER_PORT_SECURE", "1");
+ else
+ Add("SERVER_PORT_SECURE", "0");
+ Add("SERVER_PROTOCOL", _request.WorkerRequest.GetHttpVersion());
+ Add("SERVER_SOFTWARE", _request.WorkerRequest.GetServerVariable("SERVER_SOFTWARE"));
+ Add ("URL", _request.Url.AbsolutePath);
+
+ _request.AddHeaderVariables (this);
+ MakeReadOnly();
+ _loaded = true;
+ }
+
+
+ public override string Get(int index)
+ {
+ loadServerVariablesCollection();
+ return base.Get(index);
+ }
+
+ public override string Get(string name)
+ {
+ string text1;
+ if (!_loaded)
+ {
+ text1 = GetServerVar(name);
+ if (text1 != null)
+ return text1;
+ loadServerVariablesCollection();
+ }
+ return base.Get(name);
+
+
+ }
+
+ private string GetServerVar(string name)
+ {
+ if (((name == null) || (name.Length <= 8)) || (this._request == null))
+ return null;
+ if (string.Compare(name, "AUTH_TYPE", true, CultureInfo.InvariantCulture) == 0)
+ {
+ if (null != _request.Context.User && _request.Context.User.Identity.IsAuthenticated)
+ return _request.Context.User.Identity.AuthenticationType;
+ else
+ return string.Empty;
+ }
+ else if (string.Compare(name, "AUTH_USER",true, CultureInfo.InvariantCulture) == 0)
+ {
+ if (null != _request.Context.User && _request.Context.User.Identity.IsAuthenticated)
+ return _request.Context.User.Identity.Name;
+ else
+ return string.Empty;
+ }
+ else if (string.Compare(name, "QUERY_STRING", true, CultureInfo.InvariantCulture) == 0)
+ return this._request.QueryStringRaw;
+ else if (string.Compare(name, "PATH_INFO", true, CultureInfo.InvariantCulture) == 0)
+ return this._request.PathInfo;
+ else if (string.Compare(name, "PATH_TRANSLATED", true, CultureInfo.InvariantCulture) == 0)
+ return this._request.PhysicalPath;
+ else if (string.Compare(name, "REQUEST_METHOD", true, CultureInfo.InvariantCulture) == 0)
+ return this._request.HttpMethod;
+ else if (string.Compare(name, "REMOTE_ADDR", true, CultureInfo.InvariantCulture) == 0)
+ return this._request.UserHostAddress;
+ else if (string.Compare(name, "REMOTE_HOST", true, CultureInfo.InvariantCulture) == 0)
+ return this._request.UserHostName;
+ else if (string.Compare(name, "REMOTE_ADDRESS", true, CultureInfo.InvariantCulture) == 0)
+ return this._request.UserHostAddress;
+ else if (string.Compare(name, "SCRIPT_NAME", true, CultureInfo.InvariantCulture) == 0)
+ return this._request.FilePath;
+ else if (string.Compare(name, "LOCAL_ADDR", true, CultureInfo.InvariantCulture) == 0)
+ return this._request.WorkerRequest.GetLocalAddress();
+ else if (string.Compare(name, "SERVER_PROTOCOL", true, CultureInfo.InvariantCulture) == 0)
+ return _request.WorkerRequest.GetHttpVersion();
+ else if (string.Compare(name, "SERVER_SOFTWARE", true, CultureInfo.InvariantCulture) == 0)
+ return _request.WorkerRequest.GetServerVariable("SERVER_SOFTWARE");
+ return null;
+ }
+
+ public override string GetKey(int index)
+ {
+ loadServerVariablesCollection();
+ return base.GetKey(index);
+ }
+
+ public override string[] GetValues(int index)
+ {
+ string text1;
+ string[] array1;
+ text1 = Get(index);
+ if (text1 == null)
+ {
+ return null;
+ }
+ array1 = new string[1];
+ array1[0] = text1;
+ return array1;
+ }
+
+ public override string[] GetValues(string name)
+ {
+ string text1;
+ string[] array1;
+ text1 = Get(name);
+ if (text1 == null)
+ {
+ return null;
+ }
+ array1 = new string[1];
+ array1[0] = text1;
+ return array1;
+ }
+
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ throw new SerializationException();
+ }
+
+ public override string[] AllKeys
+ {
+ get
+ {
+ loadServerVariablesCollection();
+ return base.AllKeys;
+ }
+ }
+
+ public override int Count
+ {
+ get
+ {
+ loadServerVariablesCollection();
+ return base.Count;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/SiteMap.cs b/mcs/class/System.Web/System.Web/SiteMap.cs
new file mode 100644
index 00000000000..c175ebaff1e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/SiteMap.cs
@@ -0,0 +1,87 @@
+//
+// System.Web.SiteMap
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Configuration.Provider;
+
+namespace System.Web {
+ public sealed class SiteMap {
+
+ internal SiteMap ()
+ {
+ }
+
+ [MonoTODO ("Get everything from the config")]
+ private static void Init ()
+ {
+ if (provider == null) {
+ lock (locker) {
+ if (provider == null) {
+ providers = new SiteMapProviderCollection ();
+ provider = new XmlSiteMapProvider ();
+ NameValueCollection attributes = new NameValueCollection ();
+ attributes.Add ("siteMapFile", "app.sitemap");
+ ((ProviderBase)provider).Initialize ("AspNetXmlSiteMapProvider", attributes);
+ providers.Add ((ProviderBase)provider);
+ }
+ }
+ }
+ }
+
+ public static SiteMapNode CurrentNode {
+ get { return Provider.CurrentNode; }
+ }
+ public static SiteMapNode RootNode {
+ get { return Provider.RootNode; }
+ }
+
+ public static SiteMapProvider Provider {
+ get {
+ Init ();
+ return provider;
+ }
+ }
+ public static SiteMapProviderCollection Providers {
+ get {
+ Init ();
+ return providers;
+ }
+ }
+
+ static SiteMapProvider provider;
+ static SiteMapProviderCollection providers;
+ static object locker = new object ();
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web/SiteMapNode.cs b/mcs/class/System.Web/System.Web/SiteMapNode.cs
new file mode 100644
index 00000000000..545fa2f9f1b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/SiteMapNode.cs
@@ -0,0 +1,352 @@
+//
+// System.Web.SiteMapNode
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.ComponentModel;
+
+namespace System.Web {
+ public class SiteMapNode : IHierarchyData, INavigateUIData, ICloneable {
+
+ private SiteMapNode () {}
+
+ public SiteMapNode (SiteMapProvider provider, string key) : this (provider, key, null, null, null, null, null, null) {}
+ public SiteMapNode (SiteMapProvider provider, string key, string url) : this (provider, key, url, null, null, null, null, null) {}
+ public SiteMapNode (SiteMapProvider provider, string key, string url, string title) : this (provider, key, url, title, null, null, null, null) {}
+ public SiteMapNode (SiteMapProvider provider, string key, string url, string title, string description) : this (provider, key, url, title, description, null, null, null) {}
+ public SiteMapNode (SiteMapProvider provider, string key, string url, string title, string description, IList roles, NameValueCollection attributes, NameValueCollection resourceKeys)
+ {
+ if (provider == null)
+ throw new ArgumentNullException ("provider");
+
+ this.provider = provider;
+ this.key = key;
+ this.url = url;
+ this.title = title;
+ this.description = description;
+ this.roles = roles;
+ this.attributes = attributes;
+ this.resourceKeys = resourceKeys;
+ }
+
+ public SiteMapDataSourceView GetDataSourceView (SiteMapDataSource owner, string viewName)
+ {
+ return new SiteMapDataSourceView (owner, viewName, this);
+ }
+
+ public SiteMapHierarchicalDataSourceView GetHierarchicalDataSourceView ()
+ {
+ return new SiteMapHierarchicalDataSourceView (this);
+ }
+
+ [MonoTODO]
+ public bool IsAccessibleToUser (System.Web.HttpContext ctx)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override string ToString()
+ {
+ return Title;
+ }
+
+ public virtual bool HasChildNodes { get { return ChildNodes != null && ChildNodes.Count != 0; } }
+
+ public SiteMapNodeCollection GetAllNodes ()
+ {
+ SiteMapNodeCollection ret;
+
+ ret = new SiteMapNodeCollection ();
+ GetAllNodesRecursive (ret);
+ return SiteMapNodeCollection.ReadOnly (ret);
+ }
+
+ void GetAllNodesRecursive(SiteMapNodeCollection c)
+ {
+ SiteMapNodeCollection childNodes = this.ChildNodes;
+
+ if (childNodes.Count > 0) {
+ childNodes.AddRange (childNodes);
+ foreach (SiteMapNode n in childNodes)
+ n.GetAllNodesRecursive (c);
+ }
+ }
+
+
+ public virtual bool IsDescendantOf (SiteMapNode node)
+ {
+ for (SiteMapNode n = ParentNode; n != null; n = n.ParentNode)
+ if (n == node) return true;
+
+ return false;
+ }
+
+ public virtual SiteMapNode NextSibling {
+ get {
+ IList siblings = this.SiblingNodes;
+ if (siblings == null)
+ return null;
+
+ int pos = siblings.IndexOf (this);
+ if (pos >= 0 && pos < siblings.Count - 1)
+ return (SiteMapNode) siblings [pos + 1];
+
+ return null;
+ }
+ }
+
+ public virtual SiteMapNode PreviousSibling {
+ get {
+ IList siblings = this.SiblingNodes;
+ if (siblings == null)
+ return null;
+
+ int pos = siblings.IndexOf (this);
+ if (pos > 0 && pos < siblings.Count)
+ return (SiteMapNode) siblings [pos - 1];
+
+ return null;
+ }
+ }
+
+ public virtual SiteMapNode ParentNode {
+ get {
+ if (parent != null) return parent;
+
+ SiteMapProvider provider = this.provider;
+
+ do {
+ parent = provider.GetParentNode (this);
+ if (parent != null)
+ return parent;
+
+ provider = provider.ParentProvider;
+ } while (provider != null);
+ return null;
+ }
+ set {
+ CheckWritable ();
+ parent = value;
+ }
+ }
+
+ [MonoTODO ("set")]
+ public virtual SiteMapNodeCollection ChildNodes {
+ get { return provider.GetChildNodes (this); }
+ set { CheckWritable (); }
+ }
+
+ public virtual SiteMapNode RootNode { get { return provider.RootProvider.RootNode; } }
+
+ SiteMapNodeCollection SiblingNodes {
+ get {
+ if (ParentNode != null)
+ return ParentNode.ChildNodes;
+
+ return null;
+ }
+ }
+
+ [MonoTODO]
+ protected string GetExplicitResourceString (string attributeName, bool b)
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ protected string GetImplicitResourceString (string attributeName)
+ {
+ return null;
+ }
+
+ [MonoTODO ("resource string?")]
+ public string this [string key]
+ {
+ get {
+ string val = null;
+ if (provider.EnableLocalization) {
+ val = GetExplicitResourceString (key, true);
+ if (val == null) val = GetImplicitResourceString (key);
+ }
+ if (val != null) return null;
+ if (attributes != null) return attributes [key];
+ return null;
+ }
+ }
+
+ object ICloneable.Clone ()
+ {
+ return Clone (false);
+ }
+
+ public virtual SiteMapNode Clone ()
+ {
+ return Clone (false);
+ }
+
+ public virtual SiteMapNode Clone (bool cloneParentNodes)
+ {
+ SiteMapNode node = new SiteMapNode ();
+ node.provider = provider;
+ node.key = key;
+ node.url = url;
+ node.title = title;
+ node.description = description;
+ node.roles = new ArrayList (roles);
+ node.attributes = new NameValueCollection (attributes);
+ if (cloneParentNodes && ParentNode != null)
+ node.parent = (SiteMapNode) ParentNode.Clone (true);
+ return node;
+ }
+
+ public override bool Equals (object ob)
+ {
+ SiteMapNode node = ob as SiteMapNode;
+ if (node == null) return false;
+
+ if (node.key != key ||
+ node.url != url ||
+ node.title != title ||
+ node.description != description) {
+ return false;
+ }
+
+ if ((roles == null || node.roles == null) && (roles != node.roles)) return false;
+ if (roles.Count != node.roles.Count) return false;
+
+ foreach (object role in roles)
+ if (!node.roles.Contains (role)) return false;
+
+ if ((attributes == null || node.attributes == null) && (attributes != node.attributes)) return false;
+ if (attributes.Count != node.attributes.Count) return false;
+
+ foreach (string k in attributes)
+ if (attributes [k] != node.attributes [k]) return false;
+
+ return true;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (key + url + title + description).GetHashCode ();
+ }
+
+ void CheckWritable ()
+ {
+ if (readOnly)
+ throw new InvalidOperationException ("Can't modify read-only node");
+ }
+
+ #region Field Accessors
+
+ public virtual NameValueCollection Attributes {
+ get { return attributes; }
+ set { CheckWritable (); attributes = value; }
+ }
+
+ public virtual string Description {
+ get { return description != null ? description : ""; }
+ set { CheckWritable (); description = value; }
+ }
+
+ [LocalizableAttribute (true)]
+ public virtual string Title {
+ get { return title != null ? title : ""; }
+ set { CheckWritable (); title = value; }
+ }
+
+ public virtual string Url {
+ get { return url != null ? url : ""; }
+ set { CheckWritable (); url = value; }
+ }
+
+ public virtual IList Roles {
+ get { return roles; }
+ set { CheckWritable (); roles = value; }
+ }
+
+ public bool ReadOnly {
+ get { return readOnly; }
+ set { readOnly = value; }
+ }
+
+ [MonoTODO ("Do somethig with this")]
+ public string ResourceKey {
+ get { return resourceKey; }
+ set { resourceKey = value; }
+ }
+
+ public string Key { get { return key; } }
+ public SiteMapProvider Provider { get { return provider; } }
+
+ #endregion
+
+ #region INavigateUIData
+ IHierarchicalEnumerable System.Web.UI.IHierarchyData.GetChildren () { return ChildNodes; }
+ IHierarchicalEnumerable System.Web.UI.IHierarchyData.GetParent ()
+ {
+ if (ParentNode == null) return null;
+ return SiteMapNodeCollection.ReadOnly (new SiteMapNodeCollection (ParentNode));
+ }
+
+ bool System.Web.UI.IHierarchyData.HasChildren { get { return HasChildNodes; } }
+ object System.Web.UI.IHierarchyData.Item { get { return this; } }
+ string System.Web.UI.IHierarchyData.Path { get { return Url; } }
+ string System.Web.UI.IHierarchyData.Type { get { return "SiteMapNode"; } }
+ #endregion
+
+ #region INavigateUIData
+ string INavigateUIData.Name { get { return Title; } }
+ string INavigateUIData.NavigateUrl { get { return Url; } }
+ string INavigateUIData.Value { get { return Title; } }
+ #endregion
+
+ #region Fields
+ SiteMapProvider provider;
+ string key;
+ string url;
+ string title;
+ string description;
+ IList roles;
+ NameValueCollection attributes;
+ NameValueCollection resourceKeys;
+ bool readOnly;
+ string resourceKey;
+ SiteMapNode parent;
+ #endregion
+
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web/SiteMapNodeCollection.cs b/mcs/class/System.Web/System.Web/SiteMapNodeCollection.cs
new file mode 100644
index 00000000000..79e685c1eb1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/SiteMapNodeCollection.cs
@@ -0,0 +1,148 @@
+//
+// System.Web.SiteMapNodeCollection
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Web.UI;
+
+namespace System.Web {
+ public class SiteMapNodeCollection : CollectionBase, IHierarchicalEnumerable {
+ public SiteMapNodeCollection () {}
+ public SiteMapNodeCollection (SiteMapNode value) { Add (value); }
+ public SiteMapNodeCollection (SiteMapNode[] values) { AddRangeInternal (values); }
+ public SiteMapNodeCollection (SiteMapNodeCollection values) { AddRangeInternal (values); }
+
+ public virtual int Add (SiteMapNode value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return this.List.Add (value);
+ }
+
+ public virtual void AddRange (System.Web.SiteMapNode[] value)
+ {
+ this.OnAddRange (value);
+ this.AddRangeInternal (value);
+ }
+
+ public virtual void AddRange (SiteMapNodeCollection value)
+ {
+ this.OnAddRange (value);
+ this.AddRangeInternal (value);
+ }
+
+ private void AddRangeInternal (IList value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ this.InnerList.AddRange (value);
+ }
+ public bool Contains (SiteMapNode value)
+ {
+ return this.List.Contains (value);
+ }
+
+ public void CopyTo (System.Web.SiteMapNode[] array, int index)
+ {
+ this.List.CopyTo (array, index);
+ }
+
+// public SiteMapDataSourceView GetDataSourceView ()
+// {
+// return new SiteMapDataSourceView (this);
+// }
+
+ public int IndexOf (SiteMapNode value)
+ {
+ return this.List.IndexOf (value);
+ }
+
+ public virtual void Insert (int index, SiteMapNode value)
+ {
+ this.List.Insert (index, value);
+ }
+
+ protected virtual void OnAddRange (IList value)
+ {
+ }
+
+ protected override void OnValidate (object value)
+ {
+ base.OnValidate (value);
+ if (value as SiteMapNode == null)
+ throw new ArgumentException ("Invalid type");
+ }
+
+ public static SiteMapNodeCollection ReadOnly (SiteMapNodeCollection collection)
+ {
+ return new ReadOnlySiteMapNodeCollection (collection);
+ }
+
+ public virtual void Remove (SiteMapNode value)
+ {
+ this.List.Remove (value);
+ }
+
+ IHierarchyData System.Web.UI.IHierarchicalEnumerable.GetHierarchyData (object enumeratedItem)
+ {
+ return enumeratedItem as IHierarchyData;
+ }
+
+ public virtual SiteMapNode this [int index] {
+ get { return (SiteMapNode) this.List [index]; }
+ set { this.List [index] = value; }
+ }
+
+ public virtual bool IsFixedSize {
+ get { return List.IsFixedSize; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return List.IsReadOnly; }
+ }
+
+ private class ReadOnlySiteMapNodeCollection : SiteMapNodeCollection {
+
+ internal ReadOnlySiteMapNodeCollection (SiteMapNodeCollection collection) : base (collection) {}
+
+ protected override void OnAddRange (IList value) { throw new NotSupportedException ("Readonly collection"); }
+ protected override void OnClear () { throw new NotSupportedException ("Readonly collection"); }
+ protected override void OnInsert (int index, object value) { throw new NotSupportedException ("Readonly collection"); }
+ protected override void OnRemove (int index, object value) { throw new NotSupportedException ("Readonly collection"); }
+ protected override void OnSet (int index, object oldValue, object newValue) { throw new NotSupportedException ("Readonly collection"); }
+ public override bool IsReadOnly { get { return true; } }
+ }
+
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web/SiteMapProvider.cs b/mcs/class/System.Web/System.Web/SiteMapProvider.cs
new file mode 100644
index 00000000000..f65a07687c0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/SiteMapProvider.cs
@@ -0,0 +1,254 @@
+//
+// System.Web.SiteMapProvider
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Configuration.Provider;
+using System.Web.Util;
+using System.Globalization;
+
+namespace System.Web {
+ public abstract class SiteMapProvider : ProviderBase {
+
+ bool enableLocalization;
+
+ public void AddNode (SiteMapNode node)
+ {
+ AddNode (node, null);
+ }
+
+ public void AddNode (SiteMapNode node, SiteMapNode parentNode)
+ {
+ if (node == null)
+ throw new ArgumentNullException ("node");
+
+ lock (this) {
+ string url = node.Url;
+ if (url != null && url.Length > 0) {
+
+
+ if (UrlUtils.IsRelativeUrl (url))
+ url = UrlUtils.Combine (HttpRuntime.AppDomainAppVirtualPath, url);
+ else
+ url = UrlUtils.ResolveVirtualPathFromAppAbsolute (url);
+
+ if (FindSiteMapNode (url) != null)
+ throw new InvalidOperationException ();
+
+ UrlToNode [url] = node;
+ }
+
+ if (parentNode != null) {
+ NodeToParent [node] = parentNode;
+ if (NodeToChildren [parentNode] == null)
+ NodeToChildren [parentNode] = new SiteMapNodeCollection ();
+
+ ((SiteMapNodeCollection) NodeToChildren [parentNode]).Add (node);
+ }
+ }
+ }
+
+ Hashtable nodeToParent;
+ Hashtable NodeToParent {
+ get {
+ if (nodeToParent == null) {
+ lock (this) {
+ if (nodeToParent == null)
+ nodeToParent = new Hashtable ();
+ }
+ }
+ return nodeToParent;
+ }
+ }
+
+ Hashtable nodeToChildren;
+ Hashtable NodeToChildren {
+ get {
+ if (nodeToChildren == null) {
+ lock (this) {
+ if (nodeToChildren == null)
+ nodeToChildren = new Hashtable ();
+ }
+ }
+ return nodeToChildren;
+ }
+ }
+
+ Hashtable urlToNode;
+ Hashtable UrlToNode {
+ get {
+ if (urlToNode == null) {
+ lock (this) {
+ if (urlToNode == null) {
+ urlToNode = new Hashtable (
+ CaseInsensitiveHashCodeProvider.DefaultInvariant,
+ CaseInsensitiveComparer.DefaultInvariant
+ );
+ }
+ }
+ }
+ return urlToNode;
+ }
+ }
+
+ protected virtual void Clear ()
+ {
+ lock (this) {
+ if (urlToNode != null)
+ urlToNode.Clear ();
+ if (nodeToChildren != null)
+ nodeToChildren.Clear ();
+ if (nodeToParent != null)
+ nodeToParent.Clear ();
+ }
+ }
+
+ public virtual SiteMapNode FindSiteMapNode (string rawUrl)
+ {
+ if (rawUrl == null)
+ throw new ArgumentNullException ("rawUrl");
+
+ if (rawUrl.Length > 0) {
+ this.BuildSiteMap();
+ rawUrl = UrlUtils.ResolveVirtualPathFromAppAbsolute (rawUrl);
+ return (SiteMapNode) UrlToNode [rawUrl];
+ }
+ return null;
+ }
+
+ public virtual SiteMapNodeCollection GetChildNodes (SiteMapNode node)
+ {
+ if (node == null)
+ throw new ArgumentNullException ("node");
+
+ this.BuildSiteMap();
+ SiteMapNodeCollection ret = (SiteMapNodeCollection) NodeToChildren [node];
+
+ if (ret != null)
+ return SiteMapNodeCollection.ReadOnly (ret);
+
+ return null;
+ }
+
+ public virtual SiteMapNode GetParentNode(SiteMapNode node) {
+ if (node == null)
+ throw new ArgumentNullException ("node");
+ this.BuildSiteMap();
+ return (SiteMapNode) NodeToParent [node];
+ }
+
+ public void RemoveNode (SiteMapNode node)
+ {
+
+ if (node == null)
+ throw new ArgumentNullException("node");
+
+ lock (this) {
+ SiteMapNode parent = (SiteMapNode) NodeToParent [node];
+ if (NodeToParent.Contains (node))
+ NodeToParent.Remove (node);
+
+ if (node.Url != null && node.Url.Length > 0 && UrlToNode.Contains (node.Url))
+ UrlToNode.Remove (node.Url);
+
+ if (parent != null) {
+ SiteMapNodeCollection siblings = (SiteMapNodeCollection) NodeToChildren [node];
+ if (siblings != null && siblings.Contains (node))
+ siblings.Remove (node);
+ }
+ }
+ }
+
+ public override void Initialize (string name, NameValueCollection attributes)
+ {
+ if (attributes != null)
+ description = attributes ["description"];
+
+ }
+
+ public virtual SiteMapNode CurrentNode {
+ get {
+ SiteMapNode ret;
+
+ if (HttpContext.Current != null) {
+ ret = this.FindSiteMapNode (HttpContext.Current.Request.RawUrl);
+ if (ret == null)
+ ret = this.FindSiteMapNode (HttpContext.Current.Request.Path);
+
+ return ret;
+ }
+
+ return null;
+ }
+ }
+
+ string description;
+ public virtual string Description {
+ get { return description != null ? description : "SiteMapProvider"; }
+ }
+
+ SiteMapProvider parentProvider;
+ public virtual SiteMapProvider ParentProvider {
+ get { return parentProvider; }
+ set { parentProvider = value; }
+ }
+
+ SiteMapProvider rootProviderCache;
+ public virtual SiteMapProvider RootProvider {
+ get {
+ if (rootProviderCache == null) {
+ lock (this) {
+ if (rootProviderCache == null) {
+ SiteMapProvider current = this;
+ while (current.ParentProvider != null)
+ current = current.ParentProvider;
+
+ rootProviderCache = current;
+ }
+ }
+ }
+ return rootProviderCache;
+ }
+ }
+
+ public bool EnableLocalization {
+ get { return enableLocalization; }
+ set { enableLocalization = value; }
+ }
+
+ public abstract SiteMapNode BuildSiteMap ();
+ public abstract SiteMapNode RootNode { get; }
+
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web/SiteMapProviderCollection.cs b/mcs/class/System.Web/System.Web/SiteMapProviderCollection.cs
new file mode 100644
index 00000000000..a081829c9f9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/SiteMapProviderCollection.cs
@@ -0,0 +1,66 @@
+//
+// System.Web.SiteMapProviderCollection
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+using System.Configuration.Provider;
+using System.Web.UI;
+
+namespace System.Web {
+ public class SiteMapProviderCollection : ProviderCollection
+ {
+ public SiteMapProviderCollection () {}
+
+ public override void Add (ProviderBase provider)
+ {
+ if (provider == null)
+ throw new ArgumentNullException ("provider");
+ if ((provider as SiteMapProvider) == null)
+ throw new InvalidOperationException(String.Format ("{0} must implement {1} to act as a site map provider", provider.GetType (), typeof (SiteMapProvider)));
+
+ base.Add (provider);
+ }
+
+ public virtual void AddArray (ProviderBase[] providerArray)
+ {
+ foreach (ProviderBase p in providerArray) {
+ if (this [p.Name] != null)
+ throw new ArgumentException ("Duplicate site map providers");
+ Add (p);
+ }
+ }
+
+ public new SiteMapProvider this [string name] { get { return (SiteMapProvider) base [name]; } }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web/SiteMapResolveEventArgs.cs b/mcs/class/System.Web/System.Web/SiteMapResolveEventArgs.cs
new file mode 100644
index 00000000000..b7b5a360ae2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/SiteMapResolveEventArgs.cs
@@ -0,0 +1,60 @@
+//
+// System.Web.SiteMapProvider
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace System.Web
+{
+ public delegate SiteMapNode SiteMapResolveEventHandler (object sender, SiteMapResolveEventArgs e);
+
+ public class SiteMapResolveEventArgs : EventArgs
+ {
+ HttpContext _context;
+ SiteMapProvider _provider;
+
+ public SiteMapResolveEventArgs (HttpContext context, SiteMapProvider provider)
+ {
+ _context = context;
+ _provider = provider;
+ }
+
+ public HttpContext Context {
+ get { return _context; }
+ }
+
+ public SiteMapProvider Provider {
+ get { return _provider; }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web/StaticFileHandler.cs b/mcs/class/System.Web/System.Web/StaticFileHandler.cs
new file mode 100644
index 00000000000..61a37cd224a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/StaticFileHandler.cs
@@ -0,0 +1,83 @@
+//
+// System.Web.StaticFileHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.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;
+using System.IO;
+
+namespace System.Web
+{
+ class StaticFileHandler : IHttpHandler
+ {
+ public void ProcessRequest (HttpContext context)
+ {
+ HttpRequest request = context.Request;
+ HttpResponse response = context.Response;
+ string fileName = request.PhysicalPath;
+ FileInfo fi = new FileInfo (fileName);
+ if (!fi.Exists)
+ throw new HttpException (404, "File '" + request.FilePath + "' not found.");
+
+ if ((fi.Attributes & FileAttributes.Directory) != 0) {
+ response.Redirect (request.Path + '/');
+ return;
+ }
+
+ string strHeader = request.Headers ["If-Modified-Since"];
+ try {
+ if (strHeader != null) {
+ DateTime dtIfModifiedSince = DateTime.ParseExact (strHeader, "r", null);
+ DateTime ftime = fi.LastWriteTime.ToUniversalTime ();
+ if (ftime <= dtIfModifiedSince) {
+ response.StatusCode = 304;
+ return;
+ }
+ }
+ } catch { }
+
+ try {
+ DateTime lastWT = fi.LastWriteTime.ToUniversalTime ();
+ response.AddHeader ("Last-Modified", lastWT.ToString ("r"));
+
+ response.WriteFile (fileName);
+ response.ContentType = MimeTypes.GetMimeType (fileName);
+ } catch (Exception) {
+ throw new HttpException (403, "Forbidden.");
+ }
+ }
+
+ public bool IsReusable
+ {
+ get {
+ return true;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/TODOAttribute.cs b/mcs/class/System.Web/System.Web/TODOAttribute.cs
new file mode 100644
index 00000000000..0c76f9c04e3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/TODOAttribute.cs
@@ -0,0 +1,58 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.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;
+
+namespace System.Web {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+
+ public string Comment {
+ get { return comment; }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/TimeoutManager.cs b/mcs/class/System.Web/System.Web/TimeoutManager.cs
new file mode 100644
index 00000000000..2fbdd35e3f6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/TimeoutManager.cs
@@ -0,0 +1,127 @@
+//
+// System.Web.TimeoutManager
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 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
+// "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;
+using System.Collections;
+using System.Threading;
+using System.Web.Configuration;
+
+namespace System.Web
+{
+ class StepTimeout
+ {
+ }
+
+ class TimeoutManager
+ {
+ Timer timer;
+ Hashtable contexts;
+
+ public TimeoutManager ()
+ {
+ contexts = Hashtable.Synchronized (new Hashtable ());
+ timer = new Timer (new TimerCallback (CheckTimeouts), null, 0, 15000);
+ }
+
+ public void Add (HttpContext context)
+ {
+ object value = contexts [context];
+ if (value == null) {
+ value = Thread.CurrentThread;
+ } else if (value is Thread) {
+ ArrayList list = new ArrayList ();
+ list.Add (value);
+ list.Add (Thread.CurrentThread);
+ value = list;
+ } else {
+ ArrayList list = (ArrayList) value;
+ list.Add (Thread.CurrentThread);
+ value = list;
+ }
+
+ lock (this) {
+ contexts [context] = value;
+ }
+ }
+
+ public Thread Remove (HttpContext context)
+ {
+ object value = contexts [context];
+ if (value == null)
+ return null;
+
+ if (value is Thread) {
+ lock (this) {
+ contexts.Remove (context);
+ }
+ return (Thread) value;
+ }
+
+ ArrayList list = (ArrayList) value;
+ Thread result = null;
+ if (list.Count > 0) {
+ result = (Thread) list [list.Count - 1];
+ list.RemoveAt (list.Count - 1);
+ }
+
+ if (list.Count == 0) {
+ lock (this) {
+ contexts.Remove (context);
+ }
+ }
+
+ return result;
+ }
+
+ void CheckTimeouts (object state)
+ {
+ if (contexts.Count == 0) {
+ return;
+ }
+
+ DateTime now = DateTime.UtcNow;
+ ArrayList clist = new ArrayList ();
+
+ lock (this) { // The lock prevents Keys enumerator from being out of synch
+ clist.AddRange (contexts.Keys);
+ }
+
+ foreach (HttpContext context in clist) {
+ if (!context.CheckIfTimeout (now))
+ continue;
+
+ Thread thread = Remove (context);
+ if (thread != null) // Only if context is removed right after the lock
+ thread.Abort (new StepTimeout ());
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/TraceContext.cs b/mcs/class/System.Web/System.Web/TraceContext.cs
new file mode 100644
index 00000000000..5777ab4141f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/TraceContext.cs
@@ -0,0 +1,167 @@
+//
+// System.Web.TraceContext
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2002 2003, Patrik Torstensson
+// (C) 2003 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
+// "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;
+using System.Data;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace System.Web {
+ public sealed class TraceContext {
+ private HttpContext _Context;
+ private bool _Enabled;
+ private TraceMode _Mode;
+ private TraceData data;
+ private bool data_saved;
+ private bool _haveTrace;
+
+ public TraceContext(HttpContext Context) {
+ _Context = Context;
+ _Enabled = false;
+ }
+
+
+ internal bool HaveTrace {
+ get {
+ return _haveTrace;
+ }
+ }
+
+ public bool IsEnabled {
+ get {
+ if (!_haveTrace)
+ return HttpRuntime.TraceManager.Enabled;
+ return _Enabled;
+ }
+
+ set {
+ if (value && data == null)
+ data = new TraceData ();
+ _haveTrace = true;
+ _Enabled = value;
+ }
+ }
+
+ public TraceMode TraceMode {
+ get {
+ return _Mode;
+ }
+
+ set {
+ _Mode = value;
+ }
+ }
+
+ public void Warn(string msg) {
+ Write(String.Empty, msg, null, true);
+ }
+
+ public void Warn(string category, string msg) {
+ Write(category, msg, null, true);
+ }
+
+ public void Warn(string category, string msg, Exception error) {
+ Write(category, msg, error, true);
+ }
+
+ public void Write(string msg) {
+ Write(String.Empty, msg, null, false);
+ }
+
+ public void Write(string category, string msg) {
+ Write(category, msg, null, false);
+ }
+
+ public void Write(string category, string msg, Exception error) {
+ Write(category, msg, error, false);
+ }
+
+ private void Write(string category, string msg, Exception error, bool Warning) {
+ if (!IsEnabled)
+ return;
+ if (data == null)
+ data = new TraceData ();
+ data.Write (category, msg, error, Warning);
+ }
+
+ internal void SaveData ()
+ {
+ if (data == null)
+ data = new TraceData ();
+ SetRequestDetails ();
+ if (_Context.Handler is Page)
+ data.AddControlTree ((Page) _Context.Handler);
+
+ AddCookies ();
+ AddHeaders ();
+ AddServerVars ();
+ HttpRuntime.TraceManager.AddTraceData (data);
+ data_saved = true;
+ }
+
+ internal void Render (HtmlTextWriter output)
+ {
+ if (!data_saved)
+ SaveData ();
+ data.Render (output);
+ }
+
+ private void SetRequestDetails ()
+ {
+ data.RequestPath = _Context.Request.FilePath;
+ data.SessionID = (_Context.Session != null ? _Context.Session.SessionID : String.Empty);
+ data.RequestType = _Context.Request.RequestType;
+ data.RequestTime = _Context.Timestamp;
+ data.StatusCode = _Context.Response.StatusCode;
+ data.RequestEncoding = _Context.Request.ContentEncoding;
+ data.ResponseEncoding = _Context.Response.ContentEncoding;
+ }
+
+ private void AddCookies ()
+ {
+ foreach (string key in _Context.Request.Cookies.Keys)
+ data.AddCookie (key, _Context.Request.Cookies [key].Value);
+ }
+
+ private void AddHeaders ()
+ {
+ foreach (string key in _Context.Request.Headers.Keys)
+ data.AddHeader (key, _Context.Request.Headers [key]);
+ }
+
+ private void AddServerVars ()
+ {
+ foreach (string key in _Context.Request.ServerVariables)
+ data.AddServerVar (key, _Context.Request.ServerVariables [key]);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/TraceData.cs b/mcs/class/System.Web/System.Web/TraceData.cs
new file mode 100644
index 00000000000..af69a581438
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/TraceData.cs
@@ -0,0 +1,458 @@
+//
+// System.Web.TraceData
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2004 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
+// "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;
+using System.Text;
+using System.Data;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace System.Web {
+
+ internal class TraceData {
+
+ private bool is_first_time;
+ private DateTime first_time;
+ private double prev_time;
+
+ private DataTable info;
+ private DataTable control_data;
+ private DataTable cookie_data;
+ private DataTable header_data;
+ private DataTable servervar_data;
+
+ private string request_path;
+ private string session_id;
+ private DateTime request_time;
+ private Encoding request_encoding;
+ private Encoding response_encoding;
+ private string request_type;
+ private int status_code;
+
+ public TraceData ()
+ {
+ info = new DataTable ();
+ info.Columns.Add (new DataColumn ("Category", typeof (string)));
+ info.Columns.Add (new DataColumn ("Message", typeof (string)));
+ info.Columns.Add (new DataColumn ("Exception", typeof (string)));
+ info.Columns.Add (new DataColumn ("TimeSinceFirst", typeof (double)));
+ info.Columns.Add (new DataColumn ("IsWarning", typeof (bool)));
+
+ control_data = new DataTable ();
+ control_data.Columns.Add (new DataColumn ("ControlId", typeof (string)));
+ control_data.Columns.Add (new DataColumn ("Type", typeof (System.Type)));
+ control_data.Columns.Add (new DataColumn ("RenderSize", typeof (int)));
+ control_data.Columns.Add (new DataColumn ("ViewstateSize", typeof (int)));
+ control_data.Columns.Add (new DataColumn ("Depth", typeof (int)));
+
+ cookie_data = new DataTable ();
+ cookie_data.Columns.Add (new DataColumn ("Name", typeof (string)));
+ cookie_data.Columns.Add (new DataColumn ("Value", typeof (string)));
+
+ header_data = new DataTable ();
+ header_data.Columns.Add (new DataColumn ("Name", typeof (string)));
+ header_data.Columns.Add (new DataColumn ("Value", typeof (string)));
+
+ servervar_data = new DataTable ();
+ servervar_data.Columns.Add (new DataColumn ("Name", typeof (string)));
+ servervar_data.Columns.Add (new DataColumn ("Value", typeof (string)));
+
+ is_first_time = true;
+ }
+
+ public string RequestPath {
+ get { return request_path; }
+ set { request_path = value; }
+ }
+
+ public string SessionID {
+ get { return session_id; }
+ set { session_id = value; }
+ }
+
+ public DateTime RequestTime {
+ get { return request_time; }
+ set { request_time = value; }
+ }
+
+ public Encoding RequestEncoding {
+ get { return request_encoding; }
+ set { request_encoding = value; }
+ }
+
+ public Encoding ResponseEncoding {
+ get { return response_encoding; }
+ set { response_encoding = value; }
+ }
+
+ public string RequestType {
+ get { return request_type; }
+ set { request_type = value; }
+ }
+
+ public int StatusCode {
+ get { return status_code; }
+ set { status_code = value; }
+ }
+
+ public void Write (string category, string msg, Exception error, bool Warning)
+ {
+ double time;
+ if (is_first_time) {
+ time = 0;
+ is_first_time = false;
+ first_time = DateTime.Now;
+ } else
+ time = (DateTime.Now - first_time).TotalSeconds;
+
+ DataRow r = info.NewRow ();
+ r ["Category"] = category;
+ r ["Message"] = HtmlEncode (msg);
+ r ["Exception"] = (error != null ? error.ToString () : null);
+ r ["TimeSinceFirst"] = time;
+ r ["IsWarning"] = Warning;
+
+ info.Rows.Add (r);
+ }
+
+ static string HtmlEncode (string s)
+ {
+ if (s == null)
+ return "";
+
+ string res = HttpUtility.HtmlEncode (s);
+ res = res.Replace ("\n", "<br>");
+ return res.Replace (" ", "&nbsp;");
+ }
+
+ public void AddControlTree (Page page)
+ {
+ AddControl (page, 0);
+ }
+
+ private void AddControl (Control c, int control_pos)
+ {
+ DataRow r = control_data.NewRow ();
+ r ["ControlId"] = c.UniqueID;
+ r ["Type"] = c.GetType ();
+ r ["Depth"] = control_pos;
+
+ control_data.Rows.Add (r);
+
+ foreach (Control child in c.Controls)
+ AddControl (child, control_pos + 1);
+ }
+
+ public void AddCookie (string name, string value)
+ {
+ DataRow r = cookie_data.NewRow ();
+
+ r ["Name"] = name;
+ r ["Value"] = value;
+
+ cookie_data.Rows.Add (r);
+ }
+
+ public void AddHeader (string name, string value)
+ {
+ DataRow r = header_data.NewRow ();
+
+ r ["Name"] = name;
+ r ["Value"] = value;
+
+ header_data.Rows.Add (r);
+ }
+
+ public void AddServerVar (string name, string value)
+ {
+ DataRow r = servervar_data.NewRow ();
+
+ r ["Name"] = name;
+ r ["Value"] = value;
+
+ servervar_data.Rows.Add (r);
+ }
+
+ public void Render (HtmlTextWriter output)
+ {
+ output.AddAttribute ("id", "__asptrace");
+ output.RenderBeginTag (HtmlTextWriterTag.Div);
+
+ RenderStyleSheet (output);
+
+ output.AddAttribute ("class", "tracecontent");
+ output.RenderBeginTag (HtmlTextWriterTag.Span);
+
+ RenderRequestDetails (output);
+ RenderTraceInfo (output);
+ RenderControlTree (output);
+ RenderCookies (output);
+ RenderHeaders (output);
+ RenderServerVars (output);
+
+ output.RenderEndTag ();
+ output.RenderEndTag ();
+ }
+
+ private void RenderRequestDetails (HtmlTextWriter output)
+ {
+ Table table = CreateTable ();
+
+ table.Rows.Add (AltRow ("Request Details:"));
+ table.Rows.Add (InfoRow2 ("Session Id:", session_id,
+ "Request Type", request_type));
+ table.Rows.Add (InfoRow2 ("Time of Request:", request_time.ToString (),
+ "State Code:", status_code.ToString ()));
+ table.Rows.Add (InfoRow2 ("Request Encoding:", request_encoding.EncodingName,
+ "Response Encoding:", response_encoding.EncodingName));
+ table.RenderControl (output);
+ }
+
+ private void RenderTraceInfo (HtmlTextWriter output)
+ {
+ Table table = CreateTable ();
+
+ table.Rows.Add (AltRow ("Trace Information"));
+ table.Rows.Add (SubHeadRow ("Category", "Message", "From First(s)", "From Lasts(s)"));
+
+ int pos = 0;
+ foreach (DataRow r in info.Rows)
+ RenderTraceInfoRow (table, r, pos++);
+
+ table.RenderControl (output);
+ }
+
+ private void RenderControlTree (HtmlTextWriter output)
+ {
+ Table table = CreateTable ();
+
+ table.Rows.Add (AltRow ("Control Tree"));
+ table.Rows.Add (SubHeadRow ("Control Id", "Type",
+ "Render Size Bytes (including children)",
+ "View state Size Bytes (excluding children)"));
+
+ int pos = 0;
+ foreach (DataRow r in control_data.Rows) {
+ int depth = (int) r ["Depth"];
+ string prefix = String.Empty;
+ for (int i=0; i<depth; i++)
+ prefix += "&nbsp;&nbsp;&nbsp;&nbsp;";
+ RenderAltRow (table, pos++, prefix + r ["ControlId"],
+ r ["Type"].ToString (), "&nbsp;", "&nbsp;");
+ }
+
+ table.RenderControl (output);
+ }
+
+ private void RenderCookies (HtmlTextWriter output)
+ {
+ Table table = CreateTable ();
+
+ table.Rows.Add (AltRow ("Cookies Collection"));
+ table.Rows.Add (SubHeadRow ("Name", "Value", "Size"));
+
+ int pos = 0;
+ foreach (DataRow r in cookie_data.Rows) {
+ string name = r ["Name"].ToString ();
+ string value = r ["Value"].ToString ();
+ int length = name.Length + (value == null ? 0 : value.Length);
+ RenderAltRow (table, pos++, name, value, length.ToString ());
+ }
+
+ table.RenderControl (output);
+ }
+
+ private void RenderHeaders (HtmlTextWriter output)
+ {
+ Table table = CreateTable ();
+
+ table.Rows.Add (AltRow ("Headers Collection"));
+ table.Rows.Add (SubHeadRow ("Name", "Value"));
+
+ int pos = 0;
+ foreach (DataRow r in header_data.Rows)
+ RenderAltRow (table, pos++, r ["Name"].ToString (), r ["Value"].ToString ());
+
+ table.RenderControl (output);
+ }
+
+ private void RenderServerVars (HtmlTextWriter output)
+ {
+ Table table = CreateTable ();
+
+ table.Rows.Add (AltRow ("Server Variables"));
+ table.Rows.Add (SubHeadRow ("Name", "Value"));
+
+ int pos = 0;
+ foreach (DataRow r in servervar_data.Rows)
+ RenderAltRow (table, pos++, r ["Name"].ToString (), r ["Value"].ToString ());
+
+ table.RenderControl (output);
+ }
+
+ internal static TableRow AltRow (string title)
+ {
+ TableRow row = new TableRow ();
+ TableHeaderCell header = new TableHeaderCell ();
+ header.CssClass = "alt";
+ header.HorizontalAlign = HorizontalAlign.Left;
+ header.Attributes [" colspan"] = "10";
+ header.Text = "<h3><b>" + title + "</b></h3>";
+
+ row.Cells.Add (header);
+ return row;
+ }
+
+ private TableRow RenderTraceInfoRow (Table table, DataRow r, int pos)
+ {
+ string open, close;
+ open = close = String.Empty;
+ if ((bool) r ["IsWarning"]) {
+ open = "<font color=\"Red\">";
+ close = "</font>";
+ }
+
+ double t = (double) r ["TimeSinceFirst"];
+ string t1, t2;
+ if (t == 0) {
+ t1 = t2 = String.Empty;
+ prev_time = 0;
+ } else {
+ t1 = t.ToString ("0.000000");
+ t2 = (t - prev_time).ToString ("0.000000");
+ prev_time = t;
+ }
+
+ return RenderAltRow (table, pos, open + (string) r ["Category"] + close,
+ open + (string) r ["Message"] + close, t1, t2);
+ }
+
+ internal static TableRow SubHeadRow (params string[] cells)
+ {
+ TableRow row = new TableRow ();
+ foreach (string s in cells) {
+ TableHeaderCell cell = new TableHeaderCell ();
+ cell.Text = s;
+ row.Cells.Add (cell);
+ }
+
+ row.CssClass = "subhead";
+ row.HorizontalAlign = HorizontalAlign.Left;
+
+ return row;
+ }
+
+ internal static TableRow RenderAltRow (Table table, int pos, params string[] cells)
+ {
+ TableRow row = new TableRow ();
+ foreach (string s in cells) {
+ TableCell cell = new TableCell ();
+ cell.Text = s;
+ row.Cells.Add (cell);
+ }
+
+ if ((pos % 2) != 0)
+ row.CssClass = "alt";
+
+ table.Rows.Add (row);
+ return row;
+ }
+
+ private TableRow InfoRow2 (string title1, string info1, string title2, string info2)
+ {
+ TableRow row = new TableRow ();
+ TableHeaderCell header1 = new TableHeaderCell ();
+ TableHeaderCell header2 = new TableHeaderCell ();
+ TableCell cell1 = new TableCell ();
+ TableCell cell2 = new TableCell ();
+
+ header1.Text = title1;
+ header2.Text = title2;
+ cell1.Text = info1;
+ cell2.Text = info2;
+
+ row.Cells.Add (header1);
+ row.Cells.Add (cell1);
+ row.Cells.Add (header2);
+ row.Cells.Add (cell2);
+
+ row.HorizontalAlign = HorizontalAlign.Left;
+
+ return row;
+ }
+
+ internal static Table CreateTable ()
+ {
+ Table table = new Table ();
+
+ table.Width = Unit.Percentage (100);
+ table.CellSpacing = 0;
+ table.CellPadding = 0;
+
+ return table;
+ }
+
+ internal static void RenderStyleSheet (HtmlTextWriter o)
+ {
+ o.WriteLine ("<style type=\"text/css\">");
+ o.Write ("span.tracecontent { background-color:white; ");
+ o.WriteLine ("color:black;font: 10pt verdana, arial; }");
+ o.Write ("span.tracecontent table { font: 10pt verdana, ");
+ o.WriteLine ("arial; cellspacing:0; cellpadding:0; margin-bottom:25}");
+ o.WriteLine ("span.tracecontent tr.subhead { background-color:cccccc;}");
+ o.WriteLine ("span.tracecontent th { padding:0,3,0,3 }");
+ o.WriteLine ("span.tracecontent th.alt { background-color:black; color:white; padding:3,3,2,3; }");
+ o.WriteLine ("span.tracecontent td { padding:0,3,0,3 }");
+ o.WriteLine ("span.tracecontent tr.alt { background-color:eeeeee }");
+ o.WriteLine ("span.tracecontent h1 { font: 24pt verdana, arial; margin:0,0,0,0}");
+ o.WriteLine ("span.tracecontent h2 { font: 18pt verdana, arial; margin:0,0,0,0}");
+ o.WriteLine ("span.tracecontent h3 { font: 12pt verdana, arial; margin:0,0,0,0}");
+ o.WriteLine ("span.tracecontent th a { color:darkblue; font: 8pt verdana, arial; }");
+ o.WriteLine ("span.tracecontent a { color:darkblue;text-decoration:none }");
+ o.WriteLine ("span.tracecontent a:hover { color:darkblue;text-decoration:underline; }");
+ o.WriteLine ("span.tracecontent div.outer { width:90%; margin:15,15,15,15}");
+ o.Write ("span.tracecontent table.viewmenu td { background-color:006699; ");
+ o.WriteLine ("color:white; padding:0,5,0,5; }");
+ o.WriteLine ("span.tracecontent table.viewmenu td.end { padding:0,0,0,0; }");
+ o.WriteLine ("span.tracecontent table.viewmenu a {color:white; font: 8pt verdana, arial; }");
+ o.WriteLine ("span.tracecontent table.viewmenu a:hover {color:white; font: 8pt verdana, arial; }");
+ o.WriteLine ("span.tracecontent a.tinylink {color:darkblue; font: 8pt verdana, ");
+ o.WriteLine ("arial;text-decoration:underline;}");
+ o.WriteLine ("span.tracecontent a.link {color:darkblue; text-decoration:underline;}");
+ o.WriteLine ("span.tracecontent div.buffer {padding-top:7; padding-bottom:17;}");
+ o.WriteLine ("span.tracecontent .small { font: 8pt verdana, arial }");
+ o.WriteLine ("span.tracecontent table td { padding-right:20 }");
+ o.WriteLine ("span.tracecontent table td.nopad { padding-right:5 }");
+ o.WriteLine ("</style>");
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/TraceManager.cs b/mcs/class/System.Web/System.Web/TraceManager.cs
new file mode 100644
index 00000000000..c8cf73b7481
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/TraceManager.cs
@@ -0,0 +1,124 @@
+//
+// System.Web.TraceManager
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2004 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
+// "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;
+using System.Collections;
+using System.Web.Configuration;
+
+namespace System.Web {
+
+ internal class TraceManager {
+
+ private static string traceConfigPath = "system.web/trace";
+ private bool enabled = false;
+ private bool local_only = true;
+ private bool page_output = false;
+ private TraceMode mode;
+ private int request_limit = 10;
+
+ private int cur_item;
+ private TraceData[] data;
+
+ public TraceManager ()
+ {
+ TraceConfig config = (TraceConfig) HttpContext.GetAppConfig (traceConfigPath);
+
+ if (config == null)
+ return;
+
+ enabled = config.Enabled;
+ local_only = config.LocalOnly;
+ page_output = config.PageOutput;
+ mode = config.TraceMode;
+ request_limit = config.RequestLimit;
+ }
+
+ public bool Enabled {
+ get { return enabled; }
+ set { enabled = value; }
+ }
+
+ public bool LocalOnly {
+ get { return local_only; }
+ set { local_only = value; }
+ }
+
+ public bool PageOutput {
+ get { return page_output; }
+ set { page_output = value; }
+ }
+
+ public int RequestLimit {
+ get { return request_limit; }
+ set {
+ if (request_limit == value)
+ return;
+ TraceData[] swap = new TraceData [value];
+ Array.Copy (data, swap, (cur_item > value ? value : cur_item));
+ if (cur_item > value)
+ cur_item = value;
+ request_limit = value;
+ }
+ }
+
+ public TraceMode TraceMode {
+ get { return mode; }
+ set { mode = value; }
+ }
+
+ public TraceData[] TraceData {
+ get { return data; }
+ }
+
+ public void AddTraceData (TraceData item)
+ {
+ if (data == null)
+ data = new TraceData [request_limit];
+ if (cur_item == request_limit)
+ return;
+ data [cur_item++] = item;
+ }
+
+ public void Clear ()
+ {
+ if (data == null)
+ return;
+
+ Array.Clear (data, 0, data.Length);
+ cur_item = 0;
+ }
+
+ public int ItemCount {
+ get { return cur_item; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/TraceMode.cs b/mcs/class/System.Web/System.Web/TraceMode.cs
new file mode 100644
index 00000000000..635081c97a9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/TraceMode.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.TraceMode.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+//
+// 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.
+//
+
+namespace System.Web {
+ public enum TraceMode {
+ SortByTime,
+ SortByCategory,
+ Default
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/WebCategoryAttribute.cs b/mcs/class/System.Web/System.Web/WebCategoryAttribute.cs
new file mode 100644
index 00000000000..964a82736ba
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/WebCategoryAttribute.cs
@@ -0,0 +1,51 @@
+//
+// System.Web.WebCategoryAttribute.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+
+namespace System.Web
+{
+ [AttributeUsage(AttributeTargets.All)]
+ internal sealed class WebCategoryAttribute : CategoryAttribute
+ {
+ public WebCategoryAttribute (string category)
+ : base (category)
+ {
+ }
+
+ protected override string GetLocalizedString (string value)
+ {
+ return Locale.GetText (value);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/WebSysDescriptionAttribute.cs b/mcs/class/System.Web/System.Web/WebSysDescriptionAttribute.cs
new file mode 100644
index 00000000000..da882c2974a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/WebSysDescriptionAttribute.cs
@@ -0,0 +1,58 @@
+//
+// System.Web.WebSysDescriptionAttribute.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// 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;
+using System.ComponentModel;
+
+namespace System.Web
+{
+ [AttributeUsage(AttributeTargets.All)]
+ internal class WebSysDescriptionAttribute : DescriptionAttribute
+ {
+ private bool isReplaced = false;
+
+ public WebSysDescriptionAttribute (string description)
+ : base (description)
+ {
+ }
+
+ public override string Description {
+ get {
+ if (!isReplaced) {
+ isReplaced = true;
+ DescriptionValue = Locale.GetText (DescriptionValue);
+ }
+ return DescriptionValue;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/XmlSiteMapProvider.cs b/mcs/class/System.Web/System.Web/XmlSiteMapProvider.cs
new file mode 100644
index 00000000000..6e0f8d54a27
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/XmlSiteMapProvider.cs
@@ -0,0 +1,178 @@
+//
+// System.Web.XmlSiteMapProvider
+//
+// Authors:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+//
+
+//
+// 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.
+//
+
+#if NET_2_0
+using System.Collections;
+using System.Collections.Specialized;
+using System.Configuration;
+using System.Text;
+using System.Xml;
+using System.Web.Util;
+using System.IO;
+
+namespace System.Web {
+ public class XmlSiteMapProvider : SiteMapProvider, IDisposable {
+ static readonly char [] seperators = { ';', ',' };
+ bool building;
+
+ public override SiteMapNode BuildSiteMap ()
+ {
+ if (root != null)
+ return root;
+ // Whenever you call AddNode, it tries to find dups, and will call this method
+ // Is this a bug in MS??
+ if (building)
+ return null;
+
+ lock (this) {
+ building = true;
+ if (root != null)
+ return root;
+ XmlDocument d = new XmlDocument ();
+ d.Load (file);
+
+ root = BuildSiteMapRecursive (d.SelectSingleNode ("/siteMap/siteMapNode"));
+ AddNode (root);
+ building = false;
+ return root;
+ }
+ }
+
+ string GetNonEmptyOptionalAttribute (XmlNode n, string name)
+ {
+ return System.Web.Configuration.HandlersUtil.ExtractAttributeValue (name, n, true);
+ }
+
+ string GetOptionalAttribute (XmlNode n, string name)
+ {
+ return System.Web.Configuration.HandlersUtil.ExtractAttributeValue (name, n, true, true);
+ }
+
+ [MonoTODO]
+ SiteMapNode BuildSiteMapRecursive (XmlNode xmlNode)
+ {
+
+ if (xmlNode.Name != "siteMapNode")
+ throw new ConfigurationException ("incorrect element name", xmlNode);
+
+ string provider = GetNonEmptyOptionalAttribute (xmlNode, "provider");
+ string siteMapFile = GetNonEmptyOptionalAttribute (xmlNode, "siteMapFile");
+
+ if (provider != null) {
+ throw new NotImplementedException ();
+ } else if (siteMapFile != null) {
+ throw new NotImplementedException ();
+ } else {
+
+ string url = GetOptionalAttribute (xmlNode, "url");
+ string title = GetOptionalAttribute (xmlNode, "title");
+ string description = GetOptionalAttribute (xmlNode, "description");
+ string keywords = GetOptionalAttribute (xmlNode, "keywords");
+ string roles = GetOptionalAttribute (xmlNode, "roles");
+
+ ArrayList keywordsList = new ArrayList ();
+ if (keywords != null) {
+ foreach (string s in keywords.Split (seperators)) {
+ string ss = s.Trim ();
+ if (ss.Length > 0)
+ keywordsList.Add (ss);
+ }
+ }
+
+ ArrayList rolesList = new ArrayList ();
+ if (roles != null) {
+ foreach (string s in roles.Split (seperators)) {
+ string ss = s.Trim ();
+ if (ss.Length > 0)
+ rolesList.Add (ss);
+ }
+ }
+
+ SiteMapNode node = new SiteMapNode (this, null, url, title, description,
+ /*ArrayList.ReadOnly (keywordsList), */ArrayList.ReadOnly (rolesList), null,
+ null); // TODO what do they want for attributes
+
+ foreach (XmlNode child in xmlNode.ChildNodes) {
+ if (child.NodeType != XmlNodeType.Element)
+ continue;
+ AddNode (BuildSiteMapRecursive (child), node);
+ }
+
+ return node;
+ }
+ }
+
+ protected override void Clear ()
+ {
+ base.Clear ();
+ root = null;
+ }
+
+ [MonoTODO]
+ public void Dispose ()
+ {
+ // what do i do?
+ }
+
+ [MonoTODO]
+ public override SiteMapNode FindSiteMapNode (string rawUrl)
+ {
+ return base.FindSiteMapNode (rawUrl); // why did they override this method!?
+ }
+
+ public override void Initialize (string name, NameValueCollection attributes)
+ {
+
+ base.Initialize (name, attributes);
+ file = attributes ["siteMapFile"];
+
+ if (file == null && file.Length == 0)
+ throw new ArgumentException ("you must provide a file");
+
+ if (UrlUtils.IsRelativeUrl (file))
+ file = Path.Combine(HttpRuntime.AppDomainAppPath, file);
+ else
+ file = UrlUtils.ResolvePhysicalPathFromAppAbsolute (file);
+ }
+
+ public override SiteMapNode RootNode {
+ get {
+ BuildSiteMap ();
+ return root;
+ }
+ }
+
+ string file;
+ SiteMapNode root = null;
+ }
+
+}
+#endif
+
diff --git a/mcs/class/System.Web/System.Web_test.dll.sources b/mcs/class/System.Web/System.Web_test.dll.sources
new file mode 100644
index 00000000000..5d78bf30ceb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web_test.dll.sources
@@ -0,0 +1,5 @@
+System.Web/HttpRequestTest.cs
+System.Web/HttpServerUtilityTest.cs
+System.Web/HttpUtilityTest.cs
+System.Web.UI/TestUrlPropertyAttribute.cs
+System.Web.UI.WebControls/TestControlIDConverter.cs
diff --git a/mcs/class/System.Web/Test/DataBinderTests.cs b/mcs/class/System.Web/Test/DataBinderTests.cs
new file mode 100644
index 00000000000..b965660dfd9
--- /dev/null
+++ b/mcs/class/System.Web/Test/DataBinderTests.cs
@@ -0,0 +1,206 @@
+//
+// System.Web.UI.DataBinderTests
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+//#define NUNIT // Comment out this one if you wanna play with the test without using NUnit
+
+#if NUNIT
+using NUnit.Framework;
+#else
+using System.Reflection;
+#endif
+
+using System.IO;
+using System;
+using System.Text;
+using System.Web;
+using System.Web.UI;
+using System.Runtime.CompilerServices;
+
+namespace MonoTests.System.Web.UI
+{
+#if NUNIT
+ public class DataBinderTests : TestCase
+ {
+#else
+ public class DataBinderTests
+ {
+#endif
+#if NUNIT
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (PathTest));
+ }
+ }
+
+ public DataBinderTests () : base ("MonoTests.System.Web.UI.DataBinderTests testcase") { }
+ public DataBinderTests (string name) : base (name) { }
+
+ protected override void SetUp ()
+ {
+#else
+ static DataBinderTests ()
+ {
+#endif
+ instance = new ClassInstance ("instance");
+ instance.another = new ClassInstance ("another");
+ echo = new StringEcho();
+ }
+
+ static ClassInstance instance;
+ static StringEcho echo;
+
+ public void TestEval1 ()
+ {
+ try {
+ DataBinder.Eval (instance, "hello");
+ Fail ("Eval1 #1 didn't throw exception");
+ } catch (HttpException) {
+ }
+
+ object o = instance.Prop1;
+ AssertEquals ("Eval1 #2", DataBinder.Eval (instance, "Prop1"), o);
+ o = instance.Prop2;
+ AssertEquals ("Eval1 #3", DataBinder.Eval (instance, "Prop2"), o);
+ o = instance [0];
+ AssertEquals ("Eval1 #4", DataBinder.Eval (instance, "[0]"), o);
+ o = instance ["hi there!"];
+ AssertEquals ("Eval1 #4", DataBinder.Eval (instance, "[\"hi there!\"]"), o);
+ }
+
+ public void TestEval2 ()
+ {
+ try {
+ DataBinder.Eval (instance, "Another.hello");
+ Fail ("Eval2 #1 didn't throw exception");
+ } catch (HttpException) {
+ }
+
+ object o = instance.Another.Prop1;
+ AssertEquals ("Eval2 #2", DataBinder.Eval (instance, "Another.Prop1"), o);
+ o = instance.Another.Prop2;
+ AssertEquals ("Eval2 #3", DataBinder.Eval (instance, "Another.Prop2"), o);
+ o = instance.Another [0];
+ AssertEquals ("Eval2 #4", DataBinder.Eval (instance, "Another[0]"), o);
+ o = instance.Another ["hi there!"];
+ AssertEquals ("Eval2 #4", DataBinder.Eval (instance, "Another[\"hi there!\"]"), o);
+ AssertEquals ("Eval2 #5", DataBinder.Eval (instance,
+ "Another[\"hi there!\"] MS ignores this]"), o);
+
+ // MS gets fooled with this!!!
+ //AssertEquals ("Eval2 #4", DataBinder.Eval (instance, "Another[\"hi] there!\"]"), o);
+ }
+
+ public void TestEval3 ()
+ {
+ try {
+ DataBinder.Eval (echo, "[0]");
+ Fail ("Eval3 #1 didn't throw exception");
+ } catch (ArgumentException) {
+ }
+
+ AssertEquals ("Eval3 #2", DataBinder.Eval (echo, "[test]"), "test");
+ AssertEquals ("Eval3 #3", DataBinder.Eval (echo, "[\"test\"]"), "test");
+ AssertEquals ("Eval3 #4", DataBinder.Eval (echo, "['test']"), "test");
+ AssertEquals ("Eval3 #5", DataBinder.Eval (echo, "['test\"]"), "'test\"");
+ AssertEquals ("Eval3 #6", DataBinder.Eval (echo, "[\"test']"), "\"test'");
+ }
+
+
+#if !NUNIT
+ void Assert (string msg, bool result)
+ {
+ if (!result)
+ Console.WriteLine (msg);
+ }
+
+ void AssertEquals (string msg, object expected, object real)
+ {
+ if (expected == null && real == null)
+ return;
+
+ if (expected != null && expected.Equals (real))
+ return;
+
+ Console.WriteLine ("{0}: expected: '{1}', got: '{2}'", msg, expected, real);
+ }
+
+ void Fail (string msg)
+ {
+ Console.WriteLine ("Failed: {0}", msg);
+ }
+
+ static void Main ()
+ {
+ DataBinderTests dbt = new DataBinderTests ();
+ Type t = typeof (DataBinderTests);
+ MethodInfo [] methods = t.GetMethods ();
+ foreach (MethodInfo m in methods) {
+ if (m.Name.Substring (0, 4) == "Test")
+ m.Invoke (dbt, null);
+ }
+ }
+#endif
+ }
+
+ class ClassInstance
+ {
+ public string hello = "Hello";
+ public ClassInstance another;
+ string prefix;
+
+ public ClassInstance (string prefix)
+ {
+ this.prefix = prefix;
+ }
+
+ public object Prop1
+ {
+ get {
+ return prefix + "This is Prop1";
+ }
+ }
+
+ public object Prop2
+ {
+ get {
+ return prefix + "This is Prop2";
+ }
+ }
+
+ public object this [int index]
+ {
+ get {
+ return prefix + "This is the indexer for int. Index: " + index;
+ }
+ }
+
+ public object this [string index]
+ {
+ get {
+ return prefix + "This is the indexer for string. Index: " + index;
+ }
+ }
+
+ public ClassInstance Another
+ {
+ get {
+ return another;
+ }
+ }
+ }
+
+ class StringEcho
+ {
+ public object this [string msg] {
+ get { return msg; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/Test/Makefile b/mcs/class/System.Web/Test/Makefile
new file mode 100644
index 00000000000..6899e30bfe4
--- /dev/null
+++ b/mcs/class/System.Web/Test/Makefile
@@ -0,0 +1,9 @@
+thisdir = class/System.Web/Test
+SUBDIRS = TestMonoWeb
+include ../../../build/rules.make
+
+all-local install-local clean-local test-local run-test-local run-test-ondotnet-local uninstall-local:
+
+DISTFILES = DataBinderTests.cs $(wildcard *.aspx)
+
+dist-local: dist-default
diff --git a/mcs/class/System.Web/Test/System.Web.Caching/CacheStress.cs b/mcs/class/System.Web/Test/System.Web.Caching/CacheStress.cs
new file mode 100644
index 00000000000..782bb2f8a58
--- /dev/null
+++ b/mcs/class/System.Web/Test/System.Web.Caching/CacheStress.cs
@@ -0,0 +1,109 @@
+//
+// CacheStress
+//
+// Authors:
+// Eyal Alayuf (Mainsoft)
+//
+// (c) 2005 Mainsoft, Inc. (http://www.mainsoft.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;
+using System.Web.Caching;
+using System.Threading;
+
+public class CacheStress
+{
+ static int threads = 0;
+ static int KeyStart = 0;
+ static long SlidingWindow = 0;
+ static bool UseAbsoluteTime = false;
+ static int Modulo = 71;
+ static Cache c;
+ static SafeSum Sum = new SafeSum();
+
+ static void Main(string[] args)
+ {
+ if (args.Length < 2) {
+ Console.WriteLine("Usage: CacheStress <#threads> <#millis> [UseAbsoluteTime]");
+ return;
+ }
+ c = new Cache();
+ threads = System.Int32.Parse(args[0]);
+ SlidingWindow = System.Int64.Parse(args[1]);
+ UseAbsoluteTime = (args.Length > 2);
+ for (int i = 0; i < threads; i++)
+ {
+ Thread th = new Thread(new ThreadStart(RunCycle));
+ th.Start();
+ }
+ int secs = 10;
+ for (int j = secs; ;j += secs)
+ {
+ Thread.Sleep(1000 * secs);
+ Console.WriteLine("Executed {0} transactions in {1} seconds", Sum.Value, j);
+ }
+ }
+
+ static void RunCycle()
+ {
+ int n = Interlocked.Increment(ref KeyStart);
+ for (int i = 1; ; i++) {
+ try
+ {
+ string key = "stam" + n;
+ object o2 = c.Get(key);
+ if (o2 == null)
+ {
+ if (UseAbsoluteTime)
+ c.Insert(key, 1, null, DateTime.Now.AddTicks(SlidingWindow), Cache.NoSlidingExpiration);
+ else
+ c.Insert(key, 1, null, Cache.NoAbsoluteExpiration, new TimeSpan(SlidingWindow));
+ }
+ n = (n * 2 + i) % Modulo;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught exception " + e.GetType().ToString() + ": " + e.Message + e.StackTrace);
+ }
+ if (i == 100)
+ {
+ Sum.Add(i);
+ i = 0;
+ }
+ }
+ }
+
+ class SafeSum
+ {
+ public SafeSum()
+ {
+ _value = 0;
+ }
+
+ public int Value { get { lock(this) { return _value; } } }
+ public void Add(int i) { lock(this) { _value += i; } }
+
+ private int _value;
+ }
+}
diff --git a/mcs/class/System.Web/Test/System.Web.Caching/Makefile b/mcs/class/System.Web/Test/System.Web.Caching/Makefile
new file mode 100644
index 00000000000..3d66c96bdb6
--- /dev/null
+++ b/mcs/class/System.Web/Test/System.Web.Caching/Makefile
@@ -0,0 +1,8 @@
+thisdir = class/System.Web/Test/System.Web.Caching
+SUBDIRS =
+include ../../../../build/rules.make
+
+all-local install-local clean-local test-local run-test-local run-test-ondotnet-local uninstall-local:
+
+DISTFILES = CacheStress.cs
+
diff --git a/mcs/class/System.Web/Test/System.Web.Caching/README b/mcs/class/System.Web/Test/System.Web.Caching/README
new file mode 100644
index 00000000000..9e38766e29d
--- /dev/null
+++ b/mcs/class/System.Web/Test/System.Web.Caching/README
@@ -0,0 +1,10 @@
+The CacheStress.cs test is a standalone test that should be compiled and run
+as a console application.
+In normal mode the test prints every 10 seconds the number of transactions it
+committed.
+In case of an exception the test prints the exception and continues. In case
+of a deadlock the transaction count will remain constant.
+Note that the test does not run in .Net on Windows since the System.Web.Caching
+of .Net cannot be used from a console application. Mono's implementation does
+not currently have this dependency. When (and if) it does this test should
+be made into a Web application.
diff --git a/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog b/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
new file mode 100644
index 00000000000..24cfa8e707b
--- /dev/null
+++ b/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
@@ -0,0 +1,4 @@
+2004-10-08 Sanjay Gupta <gsanjay@novell.com>
+
+ * TestControlIDConverter.cs: Added new test file for ControlIDConverter.
+
diff --git a/mcs/class/System.Web/Test/System.Web.UI.WebControls/TestControlIDConverter.cs b/mcs/class/System.Web/Test/System.Web.UI.WebControls/TestControlIDConverter.cs
new file mode 100644
index 00000000000..f674e12f225
--- /dev/null
+++ b/mcs/class/System.Web/Test/System.Web.UI.WebControls/TestControlIDConverter.cs
@@ -0,0 +1,85 @@
+//
+// Tests for System.Web.UI.WebControls.ControlIDConverter.cs
+//
+// Author:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Web;
+using System.Web.UI.WebControls;
+using System.Collections;
+using System.ComponentModel;
+using System.IO;
+
+namespace MonoTests.System.Web.UI.WebControls
+{
+ [TestFixture]
+ public class ControlIDConverterTest
+ {
+ ControlIDConverter ctrlConv;
+
+ [TearDown]
+ public void TearDown () {}
+
+ [SetUp]
+ public void SetUp ()
+ {
+ ctrlConv = new ControlIDConverter ();
+ }
+
+ [Test]
+ public void TestGetStandardValues ()
+ {
+ Assert.IsNull (ctrlConv.GetStandardValues (), "GSV#1");
+
+ Assert.IsNull (ctrlConv.GetStandardValues (null), "GSV#2");
+ }
+
+ [Test]
+ public void TestGetStandardValuesExclusive ()
+ {
+ Assert.IsFalse (ctrlConv.GetStandardValuesExclusive (), "GSVE#1");
+
+ Assert.IsFalse (ctrlConv.GetStandardValuesExclusive (null), "GSVE#2");
+ }
+
+ [Test]
+ public void TestGetStandardValuesSupported ()
+ {
+ Assert.IsFalse (ctrlConv.GetStandardValuesSupported (), "GSVS#1");
+
+ Assert.IsFalse (ctrlConv.GetStandardValuesSupported (null), "GSVS#2");
+ }
+
+ }
+}
+
+#endif
+
diff --git a/mcs/class/System.Web/Test/System.Web.UI/ChangeLog b/mcs/class/System.Web/Test/System.Web.UI/ChangeLog
new file mode 100644
index 00000000000..fa8d41d9c85
--- /dev/null
+++ b/mcs/class/System.Web/Test/System.Web.UI/ChangeLog
@@ -0,0 +1,3 @@
+2004-10-12 Sanjay Gupta <gsanjay@novell.com>
+
+ * TestUrlPropertyAttribute.cs: Added UrlPropertyAttribute test cases.
diff --git a/mcs/class/System.Web/Test/System.Web.UI/TestUrlPropertyAttribute.cs b/mcs/class/System.Web/Test/System.Web.UI/TestUrlPropertyAttribute.cs
new file mode 100644
index 00000000000..459bdb26716
--- /dev/null
+++ b/mcs/class/System.Web/Test/System.Web.UI/TestUrlPropertyAttribute.cs
@@ -0,0 +1,115 @@
+//
+// Tests for System.Web.UI.UrlPropertyAttribute.cs
+//
+// Author:
+// Sanjay Gupta (gsanjay@novell.com)
+//
+
+//
+// Copyright (C) 2004 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
+// "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.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Collections;
+using System.ComponentModel;
+using System.IO;
+
+namespace MonoTests.System.Web.UI
+{
+ [TestFixture]
+ public class UrlPropertyAttributeTest
+ {
+ UrlPropertyAttribute upa;
+ UrlPropertyAttribute upa1;
+ UrlPropertyAttribute upa2;
+ string filter;
+ UrlTypes urlTypes;
+
+ [TearDown]
+ public void TearDown () {}
+
+ [SetUp]
+ public void SetUp ()
+ {
+ filter = "filter";
+ urlTypes = UrlTypes.DocRelative;
+ upa = new UrlPropertyAttribute ();
+ upa1 = new UrlPropertyAttribute (filter);
+ upa2 = new UrlPropertyAttribute (filter, urlTypes);
+ }
+
+ [Test]
+ public void TestFilter ()
+ {
+ Assert.AreEqual (upa.Filter, "*.*", "Filter#1");
+ Assert.AreEqual (upa1.Filter, filter, "Filter#2");
+ Assert.AreEqual (upa2.Filter, filter, "Filter#3");
+ }
+
+ [Test]
+ public void TestAllowedTypes ()
+ {
+ UrlTypes types = UrlTypes.Absolute |
+ UrlTypes.AppRelative |
+ UrlTypes.DocRelative |
+ UrlTypes.RootRelative;
+
+ Assert.AreEqual (upa.AllowedTypes, types, "Types#1");
+ Assert.AreEqual (upa1.AllowedTypes, types, "Types#2");
+ Assert.AreEqual (upa2.AllowedTypes, urlTypes, "Types#3");
+ }
+
+ [Test]
+ public void TestGetHashCode ()
+ {
+ string filter1 = "*.*";
+ Assert.AreEqual (upa.GetHashCode (), filter1.GetHashCode (), "GHC#1");
+ Assert.AreEqual (upa1.GetHashCode (), filter.GetHashCode (), "GHC#2");
+ }
+
+ [Test]
+ public void TestEquals ()
+ {
+ upa = new UrlPropertyAttribute ("sanjay");
+
+ Assert.IsFalse (upa.Equals (upa2), "Equals#1");
+ //Assert.IsTrue (upa.Equals (upa1), "Equals#2");
+
+ Assert.IsFalse (upa1.Equals (upa2), "Equals#3");
+
+ upa1 = new UrlPropertyAttribute ("sanjay", UrlTypes.Absolute);
+ Assert.IsFalse (upa2.Equals (upa1), "Equals#4");
+ upa1 = new UrlPropertyAttribute ("sanjay", UrlTypes.DocRelative);
+ //Assert.IsTrue (upa2.Equals (upa1), "Equals#5");
+
+ }
+
+ }
+}
+
+#endif
+
diff --git a/mcs/class/System.Web/Test/System.Web/ChangeLog b/mcs/class/System.Web/Test/System.Web/ChangeLog
new file mode 100644
index 00000000000..e63301513cc
--- /dev/null
+++ b/mcs/class/System.Web/Test/System.Web/ChangeLog
@@ -0,0 +1,13 @@
+2005-02-23 Sebastien Pouliot <sebastien@ximian.com>
+
+ * HttpRequestTest.cs: Added another XSS case that was found on ASP.NET
+ (fixed now) but didn't affect Mono.
+
+2005-02-23 Sebastien Pouliot <sebastien@ximian.com>
+
+ * HttpRequestTest.cs: New. Test that ValidateInput throw exceptions
+ when expected.
+ * HttpServerUtilityTest.cs: New. Test for possible XSS when using
+ HtmlEncode.
+ * HttpUtilityTest.cs: New. Test for possible XSS when using
+ HtmlEncode.
diff --git a/mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs b/mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs
new file mode 100644
index 00000000000..a5ad49940c6
--- /dev/null
+++ b/mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs
@@ -0,0 +1,91 @@
+//
+// System.Web.HttpRequestTest.cs - Unit tests for System.Web.HttpRequest
+//
+// Author:
+// Sebastien Pouliot <sebastien@ximian.com>
+//
+// Copyright (C) 2005 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
+// "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.Text;
+using System.Web;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Web {
+
+ [TestFixture]
+ public class HttpRequestTest {
+
+#if NET_1_1
+ [Test]
+ [ExpectedException (typeof (HttpRequestValidationException))]
+ public void ValidateInput_XSS ()
+ {
+ string problem = "http://server.com/attack2.aspx?test=<script>alert('vulnerability')</script>";
+ string decoded = HttpUtility.UrlDecode (problem);
+ int n = decoded.IndexOf ('?');
+ HttpRequest request = new HttpRequest (null, decoded.Substring (0,n), decoded.Substring (n+1));
+ request.ValidateInput ();
+ // the next statement throws
+ Assert.AreEqual ("<script>alert('vulnerability')</script>", request.QueryString ["test"], "QueryString");
+ }
+
+ // Notes:
+ // * this is to avoid a regression that would cause Mono to
+ // fail again on item #2 of the XSS vulnerabilities listed at:
+ // http://it-project.ru/andir/docs/aspxvuln/aspxvuln.en.xml
+ // * The author notes that Microsoft has decided not to fix
+ // this issue (hence the NotDotNet category).
+
+ [Test]
+ [Category ("NotDotNet")]
+ [ExpectedException (typeof (HttpRequestValidationException))]
+ public void ValidateInput_XSS_Unicode ()
+ {
+ string problem = "http://server.com/attack2.aspx?test=%uff1cscript%uff1ealert('vulnerability')%uff1c/script%uff1e";
+ string decoded = HttpUtility.UrlDecode (problem);
+ int n = decoded.IndexOf ('?');
+ HttpRequest request = new HttpRequest (null, decoded.Substring (0,n), decoded.Substring (n+1));
+ request.ValidateInput ();
+ // the next statement throws
+ Assert.AreEqual ("\xff1cscript\xff1ealert('vulnerability')\xff1c/script\xff1e", request.QueryString ["test"], "QueryString");
+ }
+
+ // This has affected ASP.NET 1.1 but it seems fixed now
+ // http://secunia.com/advisories/9716/
+ // http://weblogs.asp.net/kaevans/archive/2003/11/12/37169.aspx
+ [Test]
+ [ExpectedException (typeof (HttpRequestValidationException))]
+ public void ValidateInput_XSS_Null ()
+ {
+ string problem = "http://secunia.com/?test=<%00SCRIPT>alert(document.cookie)</SCRIPT>";
+ string decoded = HttpUtility.UrlDecode (problem);
+ int n = decoded.IndexOf ('?');
+ HttpRequest request = new HttpRequest (null, decoded.Substring (0,n), decoded.Substring (n+1));
+ request.ValidateInput ();
+ // the next statement throws
+ Assert.AreEqual ("<SCRIPT>alert(document.cookie)</SCRIPT>", request.QueryString ["test"], "QueryString");
+ }
+#endif
+ }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpServerUtilityTest.cs b/mcs/class/System.Web/Test/System.Web/HttpServerUtilityTest.cs
new file mode 100644
index 00000000000..4f98deb9e4b
--- /dev/null
+++ b/mcs/class/System.Web/Test/System.Web/HttpServerUtilityTest.cs
@@ -0,0 +1,85 @@
+//
+// System.Web.HttpServerUtilityTest.cs
+// - Unit tests for System.Web.HttpServerUtility
+//
+// Author:
+// Sebastien Pouliot <sebastien@ximian.com>
+//
+// Copyright (C) 2005 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
+// "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.Text;
+using System.Web;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Web {
+
+ [TestFixture]
+ public class HttpServerUtilityTest {
+
+ private HttpApplication _app;
+
+ [TestFixtureSetUp]
+ public void FixtureSetUp ()
+ {
+ _app = new HttpApplication ();
+ }
+
+ public HttpServerUtility Server {
+ get { return _app.Server; }
+ }
+
+ [Test]
+ public void HtmlEncode_LtGt ()
+ {
+ Assert.AreEqual ("&lt;script&gt;", Server.HtmlEncode ("<script>"));
+ }
+
+ // Notes:
+ // * this is to avoid a regression that would cause Mono to
+ // fail item #3 of the XSS vulnerabilities listed at:
+ // http://it-project.ru/andir/docs/aspxvuln/aspxvuln.en.xml
+ // we didn't fall the first time so let's ensure we never will
+ // * The author notes that Microsoft has decided not to fix
+ // this issue (hence the NotDotNet category).
+
+ [Test]
+ [Category ("NotDotNet")]
+ public void HtmlEncode_XSS ()
+ {
+ string problem = "\xff1cscript\xff1e"; // unicode looks alike <script>
+ byte[] utf8data = Encoding.UTF8.GetBytes (problem);
+ Encoding win1251 = Encoding.GetEncoding ("windows-1251");
+ byte[] windata = Encoding.Convert (Encoding.UTF8, win1251, utf8data);
+ // now it's a real problem
+ Assert.AreEqual ("<script>", Encoding.ASCII.GetString (windata), "<script>");
+
+ string encoded = Server.HtmlEncode (problem);
+ Assert.AreEqual ("&#65308;script&#65310;", encoded, "&#65308;script&#65310;");
+
+ utf8data = Encoding.UTF8.GetBytes (encoded);
+ windata = Encoding.Convert (Encoding.UTF8, win1251, utf8data);
+ Assert.AreEqual ("&#65308;script&#65310;", Encoding.ASCII.GetString (windata), "ok");
+ }
+ }
+}
diff --git a/mcs/class/System.Web/Test/System.Web/HttpUtilityTest.cs b/mcs/class/System.Web/Test/System.Web/HttpUtilityTest.cs
new file mode 100644
index 00000000000..0cbb07bcd7a
--- /dev/null
+++ b/mcs/class/System.Web/Test/System.Web/HttpUtilityTest.cs
@@ -0,0 +1,72 @@
+//
+// System.Web.HttpUtilityTest.cs - Unit tests for System.Web.HttpUtility
+//
+// Author:
+// Sebastien Pouliot <sebastien@ximian.com>
+//
+// Copyright (C) 2005 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
+// "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.Text;
+using System.Web;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Web {
+
+ [TestFixture]
+ public class HttpUtilityTest {
+
+ [Test]
+ public void HtmlEncode_LtGt ()
+ {
+ Assert.AreEqual ("&lt;script&gt;", HttpUtility.HtmlEncode ("<script>"));
+ }
+
+ // Notes:
+ // * this is to avoid a regression that would cause Mono to
+ // fail item #3 of the XSS vulnerabilities listed at:
+ // http://it-project.ru/andir/docs/aspxvuln/aspxvuln.en.xml
+ // we didn't fall the first time so let's ensure we never will
+ // * The author notes that Microsoft has decided not to fix
+ // this issue (hence the NotDotNet category).
+
+ [Test]
+ [Category ("NotDotNet")]
+ public void HtmlEncode_XSS ()
+ {
+ string problem = "\xff1cscript\xff1e"; // unicode looks alike <script>
+ byte[] utf8data = Encoding.UTF8.GetBytes (problem);
+ Encoding win1251 = Encoding.GetEncoding ("windows-1251");
+ byte[] windata = Encoding.Convert (Encoding.UTF8, win1251, utf8data);
+ // now it's a real problem
+ Assert.AreEqual ("<script>", Encoding.ASCII.GetString (windata), "<script>");
+
+ string encoded = HttpUtility.HtmlEncode (problem);
+ Assert.AreEqual ("&#65308;script&#65310;", encoded, "&#65308;script&#65310;");
+
+ utf8data = Encoding.UTF8.GetBytes (encoded);
+ windata = Encoding.Convert (Encoding.UTF8, win1251, utf8data);
+ Assert.AreEqual ("&#65308;script&#65310;", Encoding.ASCII.GetString (windata), "ok");
+ }
+ }
+}
diff --git a/mcs/class/System.Web/Test/TestMonoWeb/AsyncHandler.cs b/mcs/class/System.Web/Test/TestMonoWeb/AsyncHandler.cs
new file mode 100644
index 00000000000..cab2351e1ed
--- /dev/null
+++ b/mcs/class/System.Web/Test/TestMonoWeb/AsyncHandler.cs
@@ -0,0 +1,103 @@
+using System;
+using System.Threading;
+using System.Web;
+
+namespace TestMonoWeb {
+ /// <summary>
+ /// Summary description for AsyncHandler.
+ /// </summary>
+ public class AsyncHandler : IHttpAsyncHandler {
+ private HttpContext _context;
+ public bool IsReusable {
+ get {
+ //To enable pooling, return true here.
+ //This keeps the handler in memory.
+ return false;
+ }
+ }
+
+ public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) {
+ AsynchOperation asynch = new AsynchOperation(cb, context, null);
+ asynch.StartAsyncWork();
+
+ context.Response.Write("AsyncHandler.BeginProcessRequest<br>\n");
+ context.Response.Flush();
+
+ //Signal the application that asynchronous
+ //processing is being performed.
+ SomeResult asynchForBegin = new SomeResult();
+
+ //Processing is not synchronous.
+ asynchForBegin.SetSynch(false);
+
+ //Processing is not complete.
+ asynchForBegin.SetCompleted(false);
+
+ _context = context;
+
+ return new SomeResult();
+ }
+
+ public void EndProcessRequest(IAsyncResult result) {
+ _context.Response.Write("AsyncHandler.EndProcessRequest<br>\n");
+ }
+
+ //This method is required but is not called.
+ public void ProcessRequest(HttpContext context) {
+ }
+
+ }//end class
+
+ public class SomeResult : IAsyncResult {
+
+ /*
+ An instance of this class is returned to the application.
+ This class lets the application know how the BeginEventHandler method has been handled. The application checks the CompletedSynchronously method.
+ */
+
+ private bool _blnIsCompleted = false;
+ private Mutex myMutex = null;
+ private Object myAsynchStateObject = null;
+ private bool _blnCompletedSynchronously = false;
+
+ public void SetCompleted(bool blnTrueOrFalse) {
+ _blnIsCompleted = blnTrueOrFalse;
+ }
+
+ public void SetSynch(bool blnTrueOrFalse) {
+ _blnCompletedSynchronously = blnTrueOrFalse;
+ }
+
+ public bool IsCompleted {
+ /*
+ This is not called by the application. However, set it to true.
+ */
+ get {
+ return _blnIsCompleted;
+ }
+ }
+
+ public WaitHandle AsyncWaitHandle {
+ //The application does not call this method.
+ get {
+ return myMutex;
+ }
+ }
+
+ public Object AsyncState {
+ //The application does not call this method because
+ //null is passed in as the last parameter to BeginEventHandler.
+ get {
+ return myAsynchStateObject;
+ }
+ }
+
+ public bool CompletedSynchronously {
+ //The application wants to know if this is synchronous.
+ //Return true if the Begin method was called synchronously.
+ get {
+ return _blnCompletedSynchronously;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/Test/TestMonoWeb/AsyncModule.cs b/mcs/class/System.Web/Test/TestMonoWeb/AsyncModule.cs
new file mode 100644
index 00000000000..839297b1c9e
--- /dev/null
+++ b/mcs/class/System.Web/Test/TestMonoWeb/AsyncModule.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Web;
+
+namespace TestMonoWeb
+{
+ /// <summary>
+ /// Summary description for AsyncModule.
+ /// </summary>
+ public class AsyncModule : IHttpModule
+ {
+ HttpApplication _app;
+
+ public void Init(HttpApplication app) {
+ app.AddOnPreRequestHandlerExecuteAsync(
+ new BeginEventHandler(this.BeginPreHandlerExecute),
+ new EndEventHandler(this.EndPreHandlerExecute));
+
+ _app = app;
+ }
+
+ IAsyncResult BeginPreHandlerExecute(Object source, EventArgs e, AsyncCallback cb, Object extraData) {
+ ((HttpApplication) source).Context.Response.Write("AsyncModule.BeginPreHandlerExecute()<br>\n");
+
+ AsynchOperation asynch = new AsynchOperation(cb, _app.Context, extraData);
+ asynch.StartAsyncWork();
+ return asynch;
+ }
+
+ void EndPreHandlerExecute(IAsyncResult ar) {
+ ((AsynchOperation) ar).Context.Response.Write("AsyncModule.EndPreHandlerExecute()<br>\n");
+ }
+
+ public void Dispose() {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/Test/TestMonoWeb/AsyncOperation.cs b/mcs/class/System.Web/Test/TestMonoWeb/AsyncOperation.cs
new file mode 100644
index 00000000000..46b0ff1f722
--- /dev/null
+++ b/mcs/class/System.Web/Test/TestMonoWeb/AsyncOperation.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Threading;
+using System.Web;
+
+namespace TestMonoWeb
+{
+ class AsynchOperation : IAsyncResult {
+ private bool _completed;
+ private Object _state;
+ private AsyncCallback _callback;
+ private HttpContext _context;
+
+ bool IAsyncResult.IsCompleted { get { return _completed; } }
+ WaitHandle IAsyncResult.AsyncWaitHandle { get { return null; } }
+ Object IAsyncResult.AsyncState { get { return _state; } }
+ bool IAsyncResult.CompletedSynchronously { get { return false; } }
+
+ public HttpContext Context {
+ get {
+ return _context;
+ }
+ }
+
+ public AsynchOperation(AsyncCallback callback, HttpContext context, Object state) {
+ _callback = callback;
+ _context = context;
+ _state = state;
+ _completed = false;
+ }
+
+ public void StartAsyncWork() {
+ ThreadPool.QueueUserWorkItem(new WaitCallback(DoSomething), null /*workItemState*/);
+ }
+
+ private void DoSomething(Object workItemState) {
+ // Just for testing..
+ Thread.Sleep(100);
+ _completed = true;
+ _callback(this);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/Test/TestMonoWeb/Makefile b/mcs/class/System.Web/Test/TestMonoWeb/Makefile
new file mode 100644
index 00000000000..8c6dae82c5f
--- /dev/null
+++ b/mcs/class/System.Web/Test/TestMonoWeb/Makefile
@@ -0,0 +1,38 @@
+thisdir = class/System.Web/Test/TestMonoWeb
+SUBDIRS =
+include ../../../../build/rules.make
+
+LOCAL_MCS_FLAGS = /nowarn:0168 /nowarn:0162 /unsafe \
+ /noconfig /r:System.dll /r:System.Web.dll \
+ /r:System.Drawing.dll /r:System.Xml.dll
+
+all-local install-local uninstall-local:
+
+# it doesn't compile for me.
+# test-local: TestMonoWeb.exe
+
+test-local:
+
+# ??? What do we run here?
+
+run-test-local run-test-ondotnet-local:
+
+clean-local:
+ rm -f *.exe
+
+sources = \
+ AsyncHandler.cs \
+ AsyncModule.cs \
+ AsyncOperation.cs \
+ SyncHandler.cs \
+ SyncModule.cs \
+ Test1.cs
+
+DISTFILES = $(sources) README
+
+dist-local: dist-default
+
+# The thingie
+
+TestMonoWeb.exe: $(sources)
+ $(CSCOMPILE) /target:exe /out:$@ $(sources)
diff --git a/mcs/class/System.Web/Test/TestMonoWeb/README b/mcs/class/System.Web/Test/TestMonoWeb/README
new file mode 100644
index 00000000000..1d4950d8036
--- /dev/null
+++ b/mcs/class/System.Web/Test/TestMonoWeb/README
@@ -0,0 +1,5 @@
+This small test program tests HttpModule and HttpHandler. The test program can both handle async and sync tests.
+
+This program uses the temporary configuration for modules and handlers.
+
+- Patrik Torstensson \ No newline at end of file
diff --git a/mcs/class/System.Web/Test/TestMonoWeb/SyncHandler.cs b/mcs/class/System.Web/Test/TestMonoWeb/SyncHandler.cs
new file mode 100644
index 00000000000..7dd01bb65ab
--- /dev/null
+++ b/mcs/class/System.Web/Test/TestMonoWeb/SyncHandler.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Web;
+
+namespace TestMonoWeb
+{
+ public class SyncHandler : IHttpHandler {
+
+ public void ProcessRequest(HttpContext context) {
+ context.Response.Write("SyncHandler.ProcessRequest<br>\n");
+ }
+
+ public bool IsReusable {
+ get { return false; }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/Test/TestMonoWeb/SyncModule.cs b/mcs/class/System.Web/Test/TestMonoWeb/SyncModule.cs
new file mode 100644
index 00000000000..7fddb06a8bf
--- /dev/null
+++ b/mcs/class/System.Web/Test/TestMonoWeb/SyncModule.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections;
+using System.Web;
+
+namespace TestMonoWeb
+{
+ public class SyncModule : IHttpModule {
+ public String ModuleName {
+ get { return "HelloWorldModule"; }
+ }
+ //In the Init function, register for HttpApplication
+ //events by adding your handlers.
+ public void Init(HttpApplication application) {
+ application.BeginRequest += (new EventHandler(this.Application_BeginRequest));
+ application.EndRequest += (new EventHandler(this.Application_EndRequest));
+ }
+
+ //Your BeginRequest event handler.
+ private void Application_BeginRequest(Object source, EventArgs e) {
+ HttpApplication application = (HttpApplication)source;
+ HttpContext context = application.Context;
+
+ context.Response.Write("SyncModule.Application_BeginRequest()<br>\n");
+ }
+
+ //Your EndRequest event handler.
+ private void Application_EndRequest(Object source, EventArgs e) {
+ HttpApplication application = (HttpApplication)source;
+ HttpContext context = application.Context;
+
+ context.Response.Write("SyncModule.Application_EndRequest()<br>\n");
+ }
+
+ public void Dispose() {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/Test/TestMonoWeb/Test1.cs b/mcs/class/System.Web/Test/TestMonoWeb/Test1.cs
new file mode 100644
index 00000000000..b453cd8b170
--- /dev/null
+++ b/mcs/class/System.Web/Test/TestMonoWeb/Test1.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Web;
+using System.Web.Hosting;
+using System.Web.Configuration;
+
+namespace TestMonoWeb
+{
+ public class MyHost : MarshalByRefObject {
+ public MyHost() {
+ }
+ }
+ /// <summary>
+ /// Summary description for Test1.
+ /// </summary>
+ public class Test1
+ {
+ static void Main(string[] args) {
+ // Create the application host
+ object host = ApplicationHost.CreateApplicationHost(typeof(MyHost), "/", "c:\\");
+
+ int request_count = 10;
+ SimpleWorkerRequest [] requests = new SimpleWorkerRequest[request_count];
+
+ int pos;
+ for (pos = 0; pos != request_count; pos++) {
+ requests[pos] = new SimpleWorkerRequest("test.aspx", "", Console.Out);
+ }
+
+ ModulesConfiguration.Add("syncmodule", typeof(SyncModule).AssemblyQualifiedName);
+ ModulesConfiguration.Add("asyncmodule", typeof(AsyncModule).AssemblyQualifiedName);
+
+ HandlerFactoryConfiguration.Add("get", "/", typeof(AsyncHandler).AssemblyQualifiedName);
+ //HandlerFactoryConfiguration.Add("get", "/", typeof(SyncHandler).AssemblyQualifiedName);
+
+ for (pos = 0; pos != request_count; pos++)
+ HttpRuntime.ProcessRequest(requests[pos]);
+
+ HttpRuntime.Close();
+/*
+ Console.Write("Press Enter to quit.");
+ Console.WriteLine();
+ Console.ReadLine();
+*/
+ }
+ }
+}
diff --git a/mcs/class/System.Web/Test/test.aspx b/mcs/class/System.Web/Test/test.aspx
new file mode 100644
index 00000000000..363fab9697f
--- /dev/null
+++ b/mcs/class/System.Web/Test/test.aspx
@@ -0,0 +1,29 @@
+<%@ page language="c#"%>
+<html>
+<head>
+<title>Test</title>
+<%Response.Write("Test");%>
+
+<script runat="server" language="c#">
+ void SubmitBtn_Click(Object sender, EventArgs e) {
+ Response.Write("Hi");
+ }
+</script>
+
+<form action="test.aspx" method="post" runat="server">
+<asp:button text="Click Me" OnClick="SubmitBtn_Click" runat="server"/>
+</form>
+
+<!-- output
+
+<html>
+<head>
+<title>Test</title>
+Test<form name="ctrl0" method="post" action="test.aspx" id="ctrl0">
+<input type="hidden" name="__VIEWSTATE" value="dDwtMTc0MDc5ODg1Mzs7Pg==" />
+
+<input type="submit" name="ctrl1" value="Click Me" />
+</form>
+
+
+--> \ No newline at end of file
diff --git a/mcs/class/System.Web/Test/test2.aspx b/mcs/class/System.Web/Test/test2.aspx
new file mode 100644
index 00000000000..168aa05cb58
--- /dev/null
+++ b/mcs/class/System.Web/Test/test2.aspx
@@ -0,0 +1,101 @@
+<%@ Page Language="C#" %>
+<html>
+<head>
+<script language="C#" runat="server">
+void Page_Load(Object Sender, EventArgs e) {
+ if (!IsPostBack) {
+ ArrayList values = new ArrayList();
+
+ values.Add(new PositionData("Microsoft", "Msft"));
+ values.Add(new PositionData("Intel", "Intc"));
+ values.Add(new PositionData("Dell", "Dell"));
+
+ Repeater1.DataSource = values;
+ Repeater1.DataBind();
+
+ Repeater2.DataSource = values;
+ Repeater2.DataBind();
+ Response.Write(Repeater1.Controls[0].ClientID);
+ Response.Write("<br>");
+ Response.Write(Repeater1.Controls[0].UniqueID);
+ Response.Write("<br>");
+ }
+ }
+
+ public class PositionData {
+
+ private string name;
+ private string ticker;
+
+ public PositionData(string name, string ticker) {
+ this.name = name;
+ this.ticker = ticker;
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ }
+
+ public string Ticker {
+ get {
+ return ticker;
+ }
+ }
+ }
+
+ </script>
+
+</head>
+<body>
+
+<h3><font face="Verdana">Repeater Example</font></h3>
+
+<form runat=server>
+
+<b>Repeater1:</b>
+
+<p>
+
+<asp:Repeater id=Repeater1 runat="server">
+<HeaderTemplate>
+<table border=1>
+<tr>
+<td><b>Company</b></td>
+<td><b>Symbol</b></td>
+</tr>
+</HeaderTemplate>
+
+<ItemTemplate>
+<tr>
+<td> <%# DataBinder.Eval(Container.DataItem, "Name") %> <asp:label id="test"></td>
+<td> <%# DataBinder.Eval(Container.DataItem, "Ticker") %> </td>
+</tr>
+</ItemTemplate>
+
+<FooterTemplate>
+</table>
+</FooterTemplate>
+
+</asp:Repeater>
+<p>
+
+<b>Repeater2:</b>
+<p>
+<asp:Repeater id=Repeater2 runat="server">
+
+<HeaderTemplate>
+Company data:
+ </HeaderTemplate>
+
+<ItemTemplate>
+<%# DataBinder.Eval(Container.DataItem, "Name") %> (<%# DataBinder.Eval(Container.DataItem, "Ticker") %>)
+ </ItemTemplate>
+
+<SeparatorTemplate>, </SeparatorTemplate>
+</asp:Repeater>
+</form>
+</body>
+</html>
+
diff --git a/mcs/class/System.Web/Test/test3.aspx b/mcs/class/System.Web/Test/test3.aspx
new file mode 100644
index 00000000000..d8776e45f48
--- /dev/null
+++ b/mcs/class/System.Web/Test/test3.aspx
@@ -0,0 +1,23 @@
+<%@ Page Debug="true" %>
+<html>
+<script runat=server language="vb">
+
+Sub AnchorBtn_Click(Source As Object, E as EventArgs)
+ Message.InnerText = Message.InnerHtml
+ End Sub
+
+ </script>
+
+<body>
+<form method=post runat=server>
+
+<a OnServerClick="AnchorBtn_Click" runat=server> Click here at your peril.</a>
+
+<h1>
+<span id="Message" runat=server><span id="Message2" runat=server>narf</span></span>
+</h1>
+
+</form>
+</body>
+</html>
+
diff --git a/mcs/class/System.Web/Test/test4.aspx b/mcs/class/System.Web/Test/test4.aspx
new file mode 100644
index 00000000000..f9c020c1d85
--- /dev/null
+++ b/mcs/class/System.Web/Test/test4.aspx
@@ -0,0 +1,119 @@
+<%@ Page Language="C#" Debug="true" %>
+<html>
+<head>
+<script language="C#" runat="server">
+// protected override void OnInit(EventArgs e){
+// throw new Exception();
+// }
+ protected override void LoadViewState(object savedState){
+ throw new Exception();
+ }
+ protected override object SaveViewState(){
+ throw new Exception();
+ }
+ void Page_Kill(Object Sender, EventArgs e) {
+ throw new Exception();
+ }
+ protected override void OnInit(EventArgs e){
+ EnableViewState = true;
+ TrackViewState();
+ ViewState["test"] = "DIE!";
+ }
+ void Page_Load(Object Sender, EventArgs e) {
+// ((Control)Sender).PreRender += new EventHandler(Page_Kill);
+ if (!IsPostBack) {
+ ArrayList values = new ArrayList();
+
+ values.Add(new PositionData("Microsoft", "Msft"));
+ values.Add(new PositionData("Intel", "Intc"));
+ values.Add(new PositionData("Dell", "Dell"));
+
+ Repeater1.DataSource = values;
+ Repeater1.DataBind();
+
+ Repeater2.DataSource = values;
+ Repeater2.DataBind();
+ Response.Write(Repeater1.Controls[0].ClientID);
+ Response.Write("<br>");
+ Response.Write(Repeater1.Controls[0].UniqueID);
+ Response.Write("<br>");
+ }
+ }
+
+ public class PositionData {
+
+ private string name;
+ private string ticker;
+
+ public PositionData(string name, string ticker) {
+ this.name = name;
+ this.ticker = ticker;
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ }
+
+ public string Ticker {
+ get {
+ return ticker;
+ }
+ }
+ }
+
+ </script>
+
+</head>
+<body>
+
+<h3><font face="Verdana">Repeater Example</font></h3>
+
+<form runat=server>
+
+<b>Repeater1:</b>
+
+<p>
+
+<asp:Repeater id=Repeater1 runat="server">
+<HeaderTemplate>
+<table border=1>
+<tr>
+<td><b>Company</b></td>
+<td><b>Symbol</b></td>
+</tr>
+</HeaderTemplate>
+
+<ItemTemplate>
+<tr>
+<td> <%# DataBinder.Eval(Container.DataItem, "Name") %> <asp:label id="test"></td>
+<td> <%# DataBinder.Eval(Container.DataItem, "Ticker") %> </td>
+</tr>
+</ItemTemplate>
+
+<FooterTemplate>
+</table>
+</FooterTemplate>
+
+</asp:Repeater>
+<p>
+
+<b>Repeater2:</b>
+<p>
+<asp:Repeater id=Repeater2 runat="server">
+
+<HeaderTemplate>
+Company data:
+ </HeaderTemplate>
+
+<ItemTemplate>
+<%# DataBinder.Eval(Container.DataItem, "Name") %> (<%# DataBinder.Eval(Container.DataItem, "Ticker") %>)
+ </ItemTemplate>
+
+<SeparatorTemplate>, </SeparatorTemplate>
+</asp:Repeater>
+</form>
+</body>
+</html>
+
diff --git a/mcs/class/System.Web/Test/test5.aspx b/mcs/class/System.Web/Test/test5.aspx
new file mode 100644
index 00000000000..2aaf4bf06c2
--- /dev/null
+++ b/mcs/class/System.Web/Test/test5.aspx
@@ -0,0 +1,121 @@
+<%@ Page Language="C#" Debug="true" %>
+<html>
+<head>
+<%
+Response.Write(HttpWorkerRequest.HeaderAccept);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAcceptCharset);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAcceptEncoding);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAcceptLanguage);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAcceptRanges);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAge);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAllow);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAuthorization);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderCacheControl);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderConnection);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentEncoding);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentLanguage);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentLength);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentLocation);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentMd5);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentRange);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentType);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderCookie);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderDate);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderEtag);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderExpect);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderExpires);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderFrom);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderHost);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderIfMatch);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderIfModifiedSince);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderIfNoneMatch);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderIfRange);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderIfUnmodifiedSince);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderKeepAlive);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderLastModified);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderLocation);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderMaxForwards);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderPragma);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderProxyAuthenticate);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderProxyAuthorization);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderRange);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderReferer);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderRetryAfter);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderServer);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderSetCookie);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderTe);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderTrailer);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderTransferEncoding);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderUpgrade);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderUserAgent);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderVary);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderVia);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderWarning);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderWwwAuthenticate);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonCachePolicy);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonCacheSecurity);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonClientDisconnect);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonDefault);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonFileHandleCacheMiss);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonResponseCacheMiss);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.RequestHeaderMaximum);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ResponseHeaderMaximum);
+Response.Write("<br>");
+%> \ No newline at end of file
diff --git a/mcs/class/System.Web/Test/test6.aspx b/mcs/class/System.Web/Test/test6.aspx
new file mode 100644
index 00000000000..594c4bc7bbb
--- /dev/null
+++ b/mcs/class/System.Web/Test/test6.aspx
@@ -0,0 +1,83 @@
+<html>
+<head>
+<!--
+ Author: Gaurav Vaish
+ Original Source: http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIWebControlsCalendarClassSelectedDateTopic.asp
+ Copyright: (C) Gaurav Vaish, 2001
+-->
+ <script language="C#" runat="server">
+
+ void Selection_Change(Object sender, EventArgs e)
+ {
+ Label1.Text = "The selected date is " + Calendar1.SelectedDate.ToShortDateString();
+ }
+
+ void Selection_Change_Month(Object sender, EventArgs e)
+ {
+ Label2.Text = "The selected date is " + Calendar2.SelectedDate.ToShortDateString();
+ }
+
+ void Selection_Change_DWM(Object sender, EventArgs e)
+ {
+ Label3.Text = "The selected date is " + Calendar3.SelectedDate.ToShortDateString();
+ }
+
+ </script>
+
+</head>
+<body>
+
+ <form runat="server">
+
+ <h3><font face="Verdana">Calendar Example</font></h3>
+
+ Select a date on the Calendar control.<br><br>
+
+ <asp:Calendar ID="Calendar1" runat="server"
+ SelectionMode="Day"
+ ShowGridLines="True"
+ OnSelectionChanged="Selection_Change">
+
+ <SelectedDayStyle BackColor="Yellow"
+ ForeColor="Red">
+ </SelectedDayStyle>
+
+ </asp:Calendar>
+
+ <asp:Label id="Label1" runat=server />
+
+ <hr><br>
+
+ <asp:Calendar ID="Calendar2" runat="server"
+ SelectionMode="DayWeek"
+ ShowGridLines="True"
+ OnSelectionChanged="Selection_Change_Month">
+
+ <SelectedDayStyle BackColor="Yellow"
+ ForeColor="Red">
+ </SelectedDayStyle>
+
+ </asp:Calendar>
+
+ <asp:Label id="Label2" runat=server />
+
+ <hr><br>
+
+ <asp:Calendar ID="Calendar3" runat="server"
+ SelectionMode="DayWeekMonth"
+ ShowGridLines="True"
+ OnSelectionChanged="Selection_Change_DWM">
+
+ <SelectedDayStyle BackColor="Yellow"
+ ForeColor="Red">
+ </SelectedDayStyle>
+
+ </asp:Calendar>
+
+ <asp:Label id="Label3" runat=server />
+
+ <hr><br>
+
+ </form>
+</body>
+</html> \ No newline at end of file
diff --git a/mcs/class/System.Web/makefile.trace b/mcs/class/System.Web/makefile.trace
new file mode 100644
index 00000000000..789f5a5f5a4
--- /dev/null
+++ b/mcs/class/System.Web/makefile.trace
@@ -0,0 +1,12 @@
+# Used to build System.Web with trace support
+NANT=$(RUNTIME) ../../nant/NAnt.exe
+MAKE_GNU=$(MAKE) -f makefile.gnu -C .
+PLATFORM=uname | grep CYGWIN 2> /dev/null
+all:
+ @echo "Building System.Web.dll with Trace enabled."
+ ($(PLATFORM) && $(NANT) trace) || \
+ $(MAKE_GNU) LIB_FLAGS="/d:TRACE /d:WEBTRACE -r corlib -r System -r System.Drawing -r System.Xml"
+
+clean:
+ ($(PLATFORM) && $(NANT) clean) || $(MAKE_GNU) clean
+
diff --git a/mcs/class/System.Web/resources/ChangeLog b/mcs/class/System.Web/resources/ChangeLog
new file mode 100644
index 00000000000..ee126394de8
--- /dev/null
+++ b/mcs/class/System.Web/resources/ChangeLog
@@ -0,0 +1,31 @@
+2005-03-11 Lluis Sanchez Gual <lluis@novell.com>
+
+ * webform.js: ClientSubmit option set to true means submit
+ performed by asp.net, not by the browser.
+
+2005-02-04 Lluis Sanchez Gual <lluis@novell.com>
+
+ * webform.js: Added webform script.
+
+2005-01-10 Lluis Sanchez Gual <lluis@novell.com>
+
+ * arrow_up.gif, arrow_down.gif: Added menu resources.
+
+2004-12-02 Lluis Sanchez Gual <lluis@novell.com>
+
+ * callback.js: Added callback script.
+
+2004-11-26 Lluis Sanchez Gual <lluis@novell.com>
+
+ * arrow_minus.gif, arrow_noexpand.gif, arrow_plus.gif, box_full.gif,
+ box_empty.gif, box_minus.gif, box_noexpand.gif, box_plus.gif,
+ contact.gif, dot_empty.gif, dot_full.gif, dots.gif,
+ inbox.gif, star_empty.gif, star_full.gif, warning.gif,
+ TreeView_noexpand.gif, TreeView_dash.gif, TreeView_dashminus.gif,
+ TreeView_dashplus.gif, TreeView_i.gif, TreeView_l.gif,
+ TreeView_lminus.gif, TreeView_lplus.gif, TreeView_minus.gif,
+ TreeView_plus.gif, TreeView_r.gif, TreeView_rminus.gif,
+ TreeView_rplus.gif, TreeView_t.gif, TreeView_tminus.gif,
+ TreeView_tplus.gif, System.Web.UI.WebControls/TreeView.js
+
+ New files.
diff --git a/mcs/class/System.Web/resources/TreeView_dash.gif b/mcs/class/System.Web/resources/TreeView_dash.gif
new file mode 100644
index 00000000000..752195d4000
--- /dev/null
+++ b/mcs/class/System.Web/resources/TreeView_dash.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/TreeView_dashminus.gif b/mcs/class/System.Web/resources/TreeView_dashminus.gif
new file mode 100644
index 00000000000..18464a4ce3c
--- /dev/null
+++ b/mcs/class/System.Web/resources/TreeView_dashminus.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/TreeView_dashplus.gif b/mcs/class/System.Web/resources/TreeView_dashplus.gif
new file mode 100644
index 00000000000..f5894b8674e
--- /dev/null
+++ b/mcs/class/System.Web/resources/TreeView_dashplus.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/TreeView_i.gif b/mcs/class/System.Web/resources/TreeView_i.gif
new file mode 100644
index 00000000000..f8445bed5ce
--- /dev/null
+++ b/mcs/class/System.Web/resources/TreeView_i.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/TreeView_l.gif b/mcs/class/System.Web/resources/TreeView_l.gif
new file mode 100644
index 00000000000..0c696d31c61
--- /dev/null
+++ b/mcs/class/System.Web/resources/TreeView_l.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/TreeView_lminus.gif b/mcs/class/System.Web/resources/TreeView_lminus.gif
new file mode 100644
index 00000000000..c2f9822e977
--- /dev/null
+++ b/mcs/class/System.Web/resources/TreeView_lminus.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/TreeView_lplus.gif b/mcs/class/System.Web/resources/TreeView_lplus.gif
new file mode 100644
index 00000000000..ddce8ea455e
--- /dev/null
+++ b/mcs/class/System.Web/resources/TreeView_lplus.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/TreeView_minus.gif b/mcs/class/System.Web/resources/TreeView_minus.gif
new file mode 100644
index 00000000000..ab64ec7143d
--- /dev/null
+++ b/mcs/class/System.Web/resources/TreeView_minus.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/TreeView_noexpand.gif b/mcs/class/System.Web/resources/TreeView_noexpand.gif
new file mode 100755
index 00000000000..103e5f9267e
--- /dev/null
+++ b/mcs/class/System.Web/resources/TreeView_noexpand.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/TreeView_plus.gif b/mcs/class/System.Web/resources/TreeView_plus.gif
new file mode 100644
index 00000000000..84efd99c201
--- /dev/null
+++ b/mcs/class/System.Web/resources/TreeView_plus.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/TreeView_r.gif b/mcs/class/System.Web/resources/TreeView_r.gif
new file mode 100644
index 00000000000..4868b9c532c
--- /dev/null
+++ b/mcs/class/System.Web/resources/TreeView_r.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/TreeView_rminus.gif b/mcs/class/System.Web/resources/TreeView_rminus.gif
new file mode 100644
index 00000000000..fa8ba4b8382
--- /dev/null
+++ b/mcs/class/System.Web/resources/TreeView_rminus.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/TreeView_rplus.gif b/mcs/class/System.Web/resources/TreeView_rplus.gif
new file mode 100644
index 00000000000..6a3e674cbf8
--- /dev/null
+++ b/mcs/class/System.Web/resources/TreeView_rplus.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/TreeView_t.gif b/mcs/class/System.Web/resources/TreeView_t.gif
new file mode 100644
index 00000000000..0d4896702c6
--- /dev/null
+++ b/mcs/class/System.Web/resources/TreeView_t.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/TreeView_tminus.gif b/mcs/class/System.Web/resources/TreeView_tminus.gif
new file mode 100644
index 00000000000..9a55ac3b300
--- /dev/null
+++ b/mcs/class/System.Web/resources/TreeView_tminus.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/TreeView_tplus.gif b/mcs/class/System.Web/resources/TreeView_tplus.gif
new file mode 100644
index 00000000000..888a40459df
--- /dev/null
+++ b/mcs/class/System.Web/resources/TreeView_tplus.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/arrow_down.gif b/mcs/class/System.Web/resources/arrow_down.gif
new file mode 100644
index 00000000000..8aa51fca9b8
--- /dev/null
+++ b/mcs/class/System.Web/resources/arrow_down.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/arrow_minus.gif b/mcs/class/System.Web/resources/arrow_minus.gif
new file mode 100644
index 00000000000..8aa51fca9b8
--- /dev/null
+++ b/mcs/class/System.Web/resources/arrow_minus.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/arrow_noexpand.gif b/mcs/class/System.Web/resources/arrow_noexpand.gif
new file mode 100644
index 00000000000..84a07a80a10
--- /dev/null
+++ b/mcs/class/System.Web/resources/arrow_noexpand.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/arrow_plus.gif b/mcs/class/System.Web/resources/arrow_plus.gif
new file mode 100644
index 00000000000..16f029d15c3
--- /dev/null
+++ b/mcs/class/System.Web/resources/arrow_plus.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/arrow_up.gif b/mcs/class/System.Web/resources/arrow_up.gif
new file mode 100644
index 00000000000..0eb464ac7ae
--- /dev/null
+++ b/mcs/class/System.Web/resources/arrow_up.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/box_empty.gif b/mcs/class/System.Web/resources/box_empty.gif
new file mode 100644
index 00000000000..34b662bebec
--- /dev/null
+++ b/mcs/class/System.Web/resources/box_empty.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/box_full.gif b/mcs/class/System.Web/resources/box_full.gif
new file mode 100644
index 00000000000..043b3fb6a98
--- /dev/null
+++ b/mcs/class/System.Web/resources/box_full.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/box_minus.gif b/mcs/class/System.Web/resources/box_minus.gif
new file mode 100644
index 00000000000..e23fd13d094
--- /dev/null
+++ b/mcs/class/System.Web/resources/box_minus.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/box_noexpand.gif b/mcs/class/System.Web/resources/box_noexpand.gif
new file mode 100644
index 00000000000..4fa7892dfe2
--- /dev/null
+++ b/mcs/class/System.Web/resources/box_noexpand.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/box_plus.gif b/mcs/class/System.Web/resources/box_plus.gif
new file mode 100644
index 00000000000..16862b0f636
--- /dev/null
+++ b/mcs/class/System.Web/resources/box_plus.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/callback.js b/mcs/class/System.Web/resources/callback.js
new file mode 100644
index 00000000000..bdab5971b35
--- /dev/null
+++ b/mcs/class/System.Web/resources/callback.js
@@ -0,0 +1,60 @@
+
+function WebForm_DoCallback (id, arg, callback, ctx, errorCallback)
+{
+ var qs = WebForm_getFormData () + "&__CALLBACKTARGET=" + id + "&&__CALLBACKARGUMENT=" + escape(arg);
+ WebForm_httpPost (document.URL, qs, function (httpPost) { WebForm_ClientCallback (httpPost, ctx, callback, errorCallback); });
+}
+
+function WebForm_ClientCallback (httpPost, ctx, callback, errorCallback)
+{
+ try {
+ var doc = httpPost.responseText;
+ } catch (e) {
+ if (errorCallback != null)
+ errorCallback (httpPost.responseText, ctx);
+ return;
+ }
+ callback (doc, ctx);
+}
+
+function WebForm_getFormData ()
+{
+ var qs = "";
+ var len = theForm.elements.length;
+ for (n=0; n<len; n++) {
+ var elem = theForm.elements [n];
+ if (qs.length > 0) qs += "&";
+ qs += elem.name + "=" + escape (elem.value);
+ }
+ return qs;
+}
+
+var axName = null;
+function WebForm_httpPost (url, data, callback)
+{
+ var httpPost = null;
+
+ if (typeof XMLHttpRequest != "undefined") {
+ httpPost = new XMLHttpRequest ();
+ httpPost.addEventListener ("load", function () { callback (httpPost);}, false );
+ } else {
+ if (axName != null)
+ httpPost = new ActiveXObject (axName);
+ else {
+ var clsnames = new Array ("MSXML", "MSXML2", "MSXML3", "Microsoft");
+ for (n = 0; n < clsnames.length && httpPost == null; n++) {
+ axName = clsnames [n] + ".XMLHTTP";
+ try {
+ httpPost = new ActiveXObject (axName);
+ } catch (e) { axName = null; }
+ }
+ if (httpPost == null)
+ throw new Error ("XMLHTTP object could not be created.");
+ }
+ httpPost.onreadystatechange = function () { if (httpPost.readyState == 4) callback (httpPost); };
+ }
+
+ httpPost.open ("POST", url, true); // async
+ httpPost.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded");
+ setTimeout (function () { httpPost.send (data); }, 10);
+}
diff --git a/mcs/class/System.Web/resources/contact.gif b/mcs/class/System.Web/resources/contact.gif
new file mode 100644
index 00000000000..34b91d14f04
--- /dev/null
+++ b/mcs/class/System.Web/resources/contact.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/dot_empty.gif b/mcs/class/System.Web/resources/dot_empty.gif
new file mode 100644
index 00000000000..396a3ef4a88
--- /dev/null
+++ b/mcs/class/System.Web/resources/dot_empty.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/dot_full.gif b/mcs/class/System.Web/resources/dot_full.gif
new file mode 100644
index 00000000000..37a49abc9fd
--- /dev/null
+++ b/mcs/class/System.Web/resources/dot_full.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/dots.gif b/mcs/class/System.Web/resources/dots.gif
new file mode 100644
index 00000000000..ceebff5b49f
--- /dev/null
+++ b/mcs/class/System.Web/resources/dots.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/inbox.gif b/mcs/class/System.Web/resources/inbox.gif
new file mode 100644
index 00000000000..2ef1144ac03
--- /dev/null
+++ b/mcs/class/System.Web/resources/inbox.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/star_empty.gif b/mcs/class/System.Web/resources/star_empty.gif
new file mode 100644
index 00000000000..dc9173f4bc4
--- /dev/null
+++ b/mcs/class/System.Web/resources/star_empty.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/star_full.gif b/mcs/class/System.Web/resources/star_full.gif
new file mode 100644
index 00000000000..fa55b9e07d6
--- /dev/null
+++ b/mcs/class/System.Web/resources/star_full.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/warning.gif b/mcs/class/System.Web/resources/warning.gif
new file mode 100644
index 00000000000..0e528fcceb3
--- /dev/null
+++ b/mcs/class/System.Web/resources/warning.gif
Binary files differ
diff --git a/mcs/class/System.Web/resources/webform.js b/mcs/class/System.Web/resources/webform.js
new file mode 100644
index 00000000000..b289cf2714e
--- /dev/null
+++ b/mcs/class/System.Web/resources/webform.js
@@ -0,0 +1,13 @@
+
+function WebForm_DoPostback (ctrl, par, url, apb, pval, tf, csubm, vg)
+{
+ if (pval && typeof(Page_ClientValidate) == "function" && !Page_ClientValidate())
+ return;
+
+ if (url != null)
+ theForm.action = url;
+
+ if (csubm)
+ __doPostBack (ctrl, par);
+}
+