2005-08-17 Chris Toshok <toshok@ximian.com>
authorChris Toshok <toshok@novell.com>
Fri, 26 Aug 2005 22:24:32 +0000 (22:24 -0000)
committerChris Toshok <toshok@novell.com>
Fri, 26 Aug 2005 22:24:32 +0000 (22:24 -0000)
* WebPartTest.cs: new test.
2005-08-26  Chris Toshok  <toshok@ximian.com>

* HtmlButtonTest.cs: add view state tests (to make sure
ValidationGroup and CausesValidation are there.)

2005-08-22  Chris Toshok  <toshok@ximian.com>

* HtmlInputCheckBoxTest.cs: 2.0-ify these tests.

* HtmlInputButtonTest.cs: same.

2005-08-22  Chris Toshok  <toshok@ximian.com>

* SimpleWorkerRequestTest.cs (Host): make cwd =
"Environment.CurrentDirectory + Path.DirectorySeparatorChar" so we
pass on MS.

2005-08-11  Chris Toshok  <toshok@ximian.com>

* jsunit.js (Assert): no reason to have a prototype for
this.. just define a variable named Assert and add it to the
script's context.

2005-08-11  Chris Toshok  <toshok@ximian.com>

* jsunit.js (jsunit_RunTestForPage): set the failure_span
innerHTML explicitly to "0 tests" to initialize it.
(jsunit_RunTestForPageStep): use update_failures_span here to set
the innerhtml to whatever our results currently are.
(update_failures_span): new function, basically just set the text
and background of the span.

2005-08-04  Chris Toshok  <toshok@ximian.com>

* jsunit.js: add expected failure output.  add some (for now)
disabled netscape.security handling for UniversalBrowserRead (so
we can do testing of remote pages.)

2005-08-03  Chris Toshok  <toshok@ximian.com>

* jsunit.js: Mucho improvements.

2005-08-02  Chris Toshok  <toshok@ximian.com>

* jsunit.js (JSUnit_Click): fix typo.
(checkReadyState): fix c&p error.
(jsunit_RunTestPageStep): initialize both test_scripts.waiting and
test_run.waiting before we fire off the load(s).
(jsunit_FindTestFixture): new function to locate the test fixture
on either page, and set top.test_fixture and
top.test_fixture_context accordingly.
(jsunit_RunTestsForPage): use jsunit_FindTestFixture.
(jsunit_RunTestsForPageStep): same.
(test_run_onload): remove the extraneous if-check
(test_scripts_onload): same.

2005-08-01  Chris Toshok  <toshok@ximian.com>

* jsunit.js (jsunit_RunTestForPageStep): add the public api to
whatever script context we're using for TestFixture.  We need this
here because pages that do postbacks but include the testfixture
in the main page will get their context reset on the page load.

2005-08-01  Chris Toshok  <toshok@ximian.com>

* jsunit.js: make the script: property on JSUnit_TestPages
optional, and look for the TestFixture in the test_run page (so
you can write html + tests all in one file).
(JSUnit_Click): fix an "uh oh" alert.

2005-07-27  Chris Toshok  <toshok@ximian.com>

* jsunit.js (Assert): when we fail due to an exception, use
e.message which works on both ff and IE.

2005-07-27  Chris Toshok  <toshok@ximian.com>

* jsunit.js: add a Trace object/window so we can get debug spew
without window.alert.  Also, implement the readyState polling page
loading hack for IE so we can remove all the onload handlers from
.aspx/-script.html files in jsunit-tests (hurray).

2005-07-26  Chris Toshok  <toshok@ximian.com>

* jsunit.js: add some better status messages.

2005-07-25  Chris Toshok  <toshok@ximian.com>

* jsunit.js (JSUnit_Click): if el == null return early.
(jsunit_RunTestForPageStep): wrap the call to testfunc() in a try
block so we can add some failure text instead of making the user
look at the JS console.

2005-07-25  Chris Toshok  <toshok@ximian.com>

* jsunit-results.html: change the status span's id to status_text.

* jsunit.js (encode): new function, to replace < with &lt;, > with
&gt;, \n with \\n, etc, so when we output error strings we can see
the actual html.
(string_charcode_diff): return a string detailing the first index
at which two strings differ.
(Assert): encode all the strings we pass to test_failed.  Also on
AreEqual and AreEqualCase, replace \r\n with \n (since mozilla
seems to do this automatically, while IE doesn't), and also call
string_charcode_diff.
(JSUnit_*) change the state span's id to status_text so it works
on IE, and widen the testcase tables.

2005-07-24  Chris Toshok  <toshok@ximian.com>

* jsunit.js (JSUnit_GetAttribute): add optional id argument.
defaults to using the bound element.

* README: more docs, list out the convenience functions and some
info about how to handle page loading.2005-08-26  Chris Toshok  <toshok@ximian.com>

* TextBoxTest.cs: add tests for the 2.0 validation properties, and
to make sure they're getting saved to the viewstate.

2005-08-26  Chris Toshok  <toshok@ximian.com>

* FontUnitTest.cs: Add tests for the two 2.0 constructors, and the
2.0 ToString(IFormatProvider) method.

* UnitTest.cs: Add tests for the 2.0 ToString(IFormatProvider)
method.

2005-08-25  Chris Toshok  <toshok@ximian.com>

* CalendarTest.cs: add viewstate tests for Caption/CaptionAlign
(2.0).

2005-08-24  Chris Toshok  <toshok@ximian.com>

* ValidationSummaryTest.cs (ValidationSummary_ValidationGroup):
add tests for ValidationGroup, making sure it's stored in the
ViewState.

2005-08-23  Chris Toshok  <toshok@ximian.com>

* RepeatInfoTest.cs (RenderRepeater_BaseControl): the 2.0 ReatInfo
class does things a little differently.

2005-08-22  Chris Toshok  <toshok@ximian.com>

* ListControlTest.cs: #if NET_2_0 some of the asserts whose values
are different in 2.0.

* ValidationSummaryTest.cs: same.

* XmlTest.cs: same.

* ListBoxTest.cs: same.

* CheckBoxTest.cs: same.

* UnitTest.cs: same.

* TextBoxTest.cs: same.

* CustomValidatorTest.cs: same.

* DataGridTest.cs: same.

* BaseCompareValidatorTest.cs: remove ko-KR, since my laptop
presently can't find it, and we already have another ymd date
element order.

2005-08-22  Chris Toshok  <toshok@ximian.com>

* RepeatInfoTest.auto.cs: regenerate.

* RepeatInfoTest.auto.2.0.cs: generate using .Net 2.0.

* RepeatInfoTest.gen.cs: add wrapper #ifdefs for the 1.x/2.0 cases
- we need both.

2005-08-22  Chris Toshok  <toshok@ximian.com>

* BaseCompareValidatorTest.cs: fix the tests that change behavior
between 1.x and 2.0.

2005-08-22  Chris Toshok  <toshok@ximian.com>

* LinkButtonTest.cs: add validation group tests.

2005-08-22  Chris Toshok  <toshok@ximian.com>

* ImageButtonTest.cs: add NET_2_0 validation tests.

2005-08-22  Chris Toshok  <toshok@ximian.com>

* CheckBoxTest.cs: add NET_2_0 validation tests.

2005-08-22  Chris Toshok  <toshok@ximian.com>

* ButtonTest.cs (Button_DefaultValues): add NET_2_0 test for
ValidationGroup.
(Button_ViewState): same.

2005-08-17  Chris Toshok  <toshok@ximian.com>

* CompositeControlTest.cs: put it in the MonoTests. namespace so
it shows up in the right place in the nunit gui.

2005-08-12  Chris Toshok  <toshok@ximian.com>

* CompositeControlTest.cs: a couple of tests for CompositeControl.

2005-07-30  Chris Toshok  <toshok@ximian.com>

* HyperLinkColumnTest.cs: add some tests for how the column
initializes a TableCell.

2005-07-29  Chris Toshok  <toshok@ximian.com>

* BaseCompareValidatorTest.cs (CanConvert): disable B9, until we
figure out a culture independent way to do it.
(Convert): same with C17/C18.
(MiscPropertiesAndMethods): test CutoffYear, GetFullYear, and
GetDateElementOrder.

2005-07-29  Chris Toshok  <toshok@ximian.com>

* BaseCompareValidatorTest.cs: use DateTime to generate the
strings for our date tests, since they're culture specific.

2005-07-19  Chris Toshok  <toshok@ximian.com>

* BaseValidatorTest.cs: use the right call (SetValidationTextBox)
in ValidatorTest.

2005-07-19  Chris Toshok  <toshok@ximian.com>

* BaseCompareValidatorTest.cs: add date tests.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* BaseCompareValidatorTest.cs: note the lack of Date tests, and
add null tests.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* BaseCompareValidatorTest.cs: new tests.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* CompareValidatorTest.cs (CompareValidator_ValueToCompareTest,
CompareValidator_ControlToCompareTest): new methods.

* ValidatorTest.cs: add AddTextBox method.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* RegularExpressionValidatorTest.cs: add a simple validation test.

* ValidatorTest.cs: add a base class for validator tests, that
enables a little scaffolding for faking out the test.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* CompareValidatorTest.cs: new tests.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* RegularExpressionValidatorTest.cs: new test.

2005-08-19  Chris Toshok  <toshok@ximian.com>

* ProfileInfo.cs: I was bored.  implement this.

2005-08-25  Chris Toshok  <toshok@ximian.com>

* HttpApplication.cs (IsReusable): return true.
(InitOnce): remove the initialization of handler_factory from
here.
(GetHandler) and move it here, so we make sure to load handlers
from all needed web.config files.

2005-08-25  Chris Toshok  <toshok@ximian.com>

* HttpApplication.cs (InitOnce): move the initialization of
modules above the call to HttpApplicationFactory.AttachEvents,
since that method accesses HttpApplication.Modules.  Fixes
nGallery.
(IsReusable): mark TODO.

2005-08-18  Chris Toshok  <toshok@ximian.com>

* HttpRequest.cs (get_Params): implement.

2005-08-17  Chris Toshok  <toshok@ximian.com>

* HttpResponse.cs: HttpResponse's Cookie's collection acts
differently than HttpRequests in that it never returns null from
the "this [string]" accessor.

2005-07-27  Chris Toshok  <toshok@ximian.com>

* HttpResponseHeader.cs: remove spew.

2005-07-27  Chris Toshok  <toshok@ximian.com>

* HttpResponseHeader.cs (HttpResponseHandler..ctor): use
HttpWorkerRequest.GetKnownResponseHeaderName instead of
GetKnownRequestHeaderName.  Fixes Response.Redirect until miguel's
new HttpReponse is online.

2005-07-21  Chris Toshok  <toshok@ximian.com>

* HttpBrowserCapabilities.cs: enable support for the W3CDomVersion
and EcmaScriptVersion properties.

2005-07-21  Chris Toshok  <toshok@ximian.com>

* HttpResponseHeader.cs: hi, i'm stupid and missed String.Replace.

2005-07-21  Chris Toshok  <toshok@ximian.com>

* HttpResponseHeader.cs: url encode just \r and \n if they're
present in the value.

2005-07-20  Chris Toshok  <toshok@ximian.com>

* HttpPostedFile.cs: add missing ContentLength property.

2005-07-20  Chris Toshok  <toshok@ximian.com>

* HttpCookieCollection.cs: add a new ctor that takes a string (the
contents of the Cookies: header).

2005-07-20  Chris Toshok  <toshok@ximian.com>

* HttpCookieCollection.cs: add another ctor (internal, but not
obsolete, so we aren't passing a stupid HttpResponse in in order
to change the behavior of the collection.)

* HttpCookie.cs: init this.values in the internal ctor.

2005-07-20  Chris Toshok  <toshok@ximian.com>

* HttpCookieCollection.cs: use "auto-fill mode" when we're dealing
with an HttpResponse's cookie collection.  That is, create the
cookie if the consumer looks it up.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* HttpResponseHeader.cs: initial implementation.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* HttpModuleCollection.cs (HttpModuleCollection.GetKey): add
missing method.

* HttpFileCollection.cs: initial implementation.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* HttpModuleCollection.cs (HttpModuleCollection.CopyTo): implement
missing method.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* HttpModuleCollection.cs: initial implementation.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* HttpCacheVaryByHeaders.cs: only add the header if it's not
already in the hash.

* HttpCacheVaryByParams.cs: only add the param if it's not already
in the hash.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* HttpCookie.cs (HttpCookie+CookieNVC.Set): new override to fix an
MS quirk.

2005-07-16  Chris Toshok  <toshok@ximian.com>

* HttpCacheVaryByHeaders.cs: make sure we set vary_by_unspecified
= false in the custom setter.

2005-07-16  Chris Toshok  <toshok@ximian.com>

* HttpCacheVaryByParams.cs: initial implementation.

2005-07-16  Chris Toshok  <toshok@ximian.com>

* HttpCacheVaryByHeaders.cs: initial implementation.

2005-07-15  Chris Toshok  <toshok@ximian.com>

* HttpCookie.cs: one more time.

2005-07-15  Chris Toshok  <toshok@ximian.com>

* HttpCookie.cs (HttpCookie.GetCookieHeader): use
expires.ToString().

2005-07-15  Chris Toshok  <toshok@ximian.com>

* HttpCookie.cs (HttpCookie.GetCookieHeader): implement to fix
ben's bug.

2005-07-15  Chris Toshok  <toshok@ximian.com>

* HttpCookieCollection.cs: initial implementation (with a couple
of labeled inefficiencies.)

2005-07-15  Chris Toshok  <toshok@ximian.com>

* HttpCookie.cs (HttpCookie.get_HasKeys): use values.HasKeys()
instead of trying to be smart about it ourselves.

2005-07-15  Chris Toshok  <toshok@ximian.com>

* HttpCookie.cs: initial implementation.  we fail one unit test,
but it might be due to a bug in NameValueCollection.

2005-08-26  Chris Toshok  <toshok@ximian.com>

* HtmlButton.cs (ValidationGroup): implement.
(RaisePostBackEvent): gross #ifdef-iry to make sure we only have
one body of the actual RaisePostBackEvent code.  Also, call
Page.Validate(ValidationGroup) in the 2.0 case.

2005-08-25  Chris Toshok  <toshok@ximian.com>

* HtmlForm.cs (CreateControlCollection, OnPreRender,
RenderControl): implement naively, just calling base.Method.

2005-08-25  Chris Toshok  <toshok@ximian.com>

* HtmlForm.cs (RenderAttributes): don't strip off the stuff after
the last '/' when rendering the action.  Fixes comments in
nGallery.

2005-08-24  Chris Toshok  <toshok@ximian.com>

* HtmlInputButton.cs, HtmlInputFile.cs, HtmlHead.cs,
HtmlInputImage.cs, HtmlForm.cs, HtmlInputCheckBox.cs,
HtmlInputHidden.cs, HtmlButton.cs, HtmlSelect.cs, HtmlControl.cs:
Add MonoTODO's for all NotImplementedException's.

2005-07-20  Chris Toshok  <toshok@ximian.com>

* HtmlForm.cs (RenderAttributes): if there are submit statements,
we need to render those.

* HtmlInputImage.cs: same.

* HtmlInputButton.cs: hook up the client validation stuff.

* HtmlButton.cs: same, except a lot more complicated due to
postback handling.

2005-08-24  Chris Toshok  <toshok@ximian.com>

* Control.cs (get_Adapter): Instead of throwing an exception, just
return null, so we can write the rest of the Control specific
Adapter code and just not enable any of those code paths until we
have actual adapters.  Also flag TODO.
(EnsureChildControls): Call out to Adapter.CreateChildControls if
we have an adapter.
(RenderChildren): call "RenderControl (writer, adapter)" if we
have an adapter.
(RenderControl): implement the adapter case naively.
(LoadRecursive): call out to Adapter.OnLoad if we have one.
(PreRenderRecursiveInternal): call out to Adapter.OnPrerender if
we have one.
(InitRecursive): call out to Adapter.OnInit if we have one.

2005-08-24  Chris Toshok  <toshok@ximian.com>

* Page.cs (GetPostBackEventReference): track change to
ClientScriptManager and don't call a removed method.

* ClientScriptManager.cs: track more recent docs and corcompare
output.

2005-07-30  Chris Toshok  <toshok@ximian.com>

* Page.cs (VerifyRenderingInServerForm): copy MS's error message
since our form-errors jsunit tests depend on it.

2005-07-30  Chris Toshok  <toshok@ximian.com>

* DataBinder.cs (FormatResult): make internal, not private.

2005-07-20  Chris Toshok  <toshok@ximian.com>

* ClientScriptManager.cs (GetClientValidationEvent): the JS we
stick in onclick handlers for buttons/links/etc.

* Page.cs (GetSubmitStatements): new function to return
scriptManager.WriteSubmitStatements.  Used by HtmlForm.
(AreValidatorsUplevel): used by many of the button/linkbutton
controls (the ones that can CauseValidation) to tell whether or
not to emit client side validation calls.

2005-07-20  Chris Toshok  <toshok@ximian.com>

* WebResourceAttribute.cs: make internal (and available) in
!NET_2_0.

2005-07-20  Chris Toshok  <toshok@ximian.com>

* ClientScriptManager.cs (GetWebResourceUrl): make internal (but
available) in !NET_2_0.

2005-08-24  Chris Toshok  <toshok@ximian.com>

* PageAdapter.cs, ControlAdapter: add MonoTODO's.

2005-07-20  Chris Toshok  <toshok@ximian.com>

* AssemblyInfo.cs: add WebUIValidation.js attribute.

2005-08-17  Chris Toshok  <toshok@ximian.com>

* WebPart.cs: add basic stubbed out (and mostly NYI)
methods/properties.

* Part.cs: same.

2005-08-25  Chris Toshok  <toshok@ximian.com>

* HandlerFactoryConfiguration.cs: implement the slow path for
PathMatches using Regex.  Also, make the fast path for exact
matches faster (and more correct).

2005-08-25  Chris Toshok  <toshok@ximian.com>

* HandlerFactoryConfiguration.cs: chain up to the parent
Configuration if we don't have a match, instead of adding the
parent's handlers to our list (and thereby overriding ours).

2005-08-04  Chris Toshok  <toshok@ximian.com>

* WebUIValidation.js (CustomValidatorEvaluateIsValid): correct the
args.IsValid check.

2005-08-04  Chris Toshok  <toshok@ximian.com>

* WebUIValidation.js (ValidatorOnLoad): set "enabled" == "true" if
there's no attribute present.
(Page_ClientValidate): a validator succeeds if it's disabled.

2005-07-27  Chris Toshok  <toshok@ximian.com>

* WebUIValidation.js (ValidatorCommonOnSubmit): fix formatting of
List and SingleParagraph mode ValidationSummaries.
(ValidatorTrim): use two regexps instead of two while loops.
(CustomValidatorEvaluateIsValid): new function.

2005-07-26  Chris Toshok  <toshok@ximian.com>

* WebUIValidation.js: fix the summary mode for
ValidationSummaries.

2005-07-25  Chris Toshok  <toshok@ximian.com>

* WebUIValidation.js (RangeValidatorEvaluateIsValid): fix this -
GetAttribute is dead, long live validator.getAttribute.

2005-07-24  Chris Toshok  <toshok@ximian.com>

* WebUIValidation.js: add support for validation summaries, both
in summary and messagebox mode.

2005-07-22  Chris Toshok  <toshok@ximian.com>

* WebUIValidation.js: the JSUnit tests pointed out that
validator.evaluationfunction is not a string after OnLoad.  do
this as well so the tests pass, and deal with the difference
between o[attr], o.getAttribute(attr), and o.attr. Ugh.

2005-07-21  Chris Toshok  <toshok@ximian.com>

* WebUIValidation.js (RequiredFieldValidatorEvaluateIsValid): trim
both the initial value and the control's value.

2005-07-21  Chris Toshok  <toshok@ximian.com>

* WebUIValidation.js: handle validators that use
Display="Dynamic".

2005-07-20  Chris Toshok  <toshok@ximian.com>

* WebUIValidation.js (ValidatorTrim): new function.
(RangeValidatorEvaluateIsValid): use ValidatorGetValue and
ValidatorTrim.
(RegularExpressionValidatorEvaluateIsValid): same.
(RequiredFieldValidatorEvaluateIsValid): same.

2005-07-20  Chris Toshok  <toshok@ximian.com>

* WebUIValidation.js: new file.

2005-08-26  Chris Toshok  <toshok@ximian.com>

* TextBox.cs: implement ValidationGroup and CausesValidation
properties.

2005-08-26  Chris Toshok  <toshok@ximian.com>

* Unit.cs: implement the 2.0 ToString(IFormatProvider) method.

* FontUnit.cs: add two 2.0 ctors, and the 2.0
ToString(IFormatProvider) method.

2005-08-26  Chris Toshok  <toshok@ximian.com>

* Calendar.cs (UseAccessibleHeader): implement.
(RaisePostBackEvent): some #ifdef ugliness to get this all working
propertly between 1.x and 2.0
(WriteDayHeader): if UseAccessibleHeader == true, render header
cells as th's, not td's, and add abbr and scope attributes.

2005-08-25  Chris Toshok  <toshok@ximian.com>

* Calendar.cs (Caption, CaptionAlign): implement these properties.
(Render): if we have a non-empty caption, show it.
(WriteCaption): new method, output the caption.

2005-08-25  Chris Toshok  <toshok@ximian.com>

* Calendar.cs (Render): Copy the entire style from the Calendar to
the Table, not just the font.
(WriteDay): don't just write the link/text/etc.  Create a
LiteralControl as a child of the cell, before the call to
OnDayRender, with its text set to the day number.  After
OnDayRender, set the literal's text to either the number again (if
it's not selectable) or the full text of the js __doPostBack
hyperlink (if it is.)  Also, use cell.RenderControl here so we can
render child controls with the id's listed properly (and arguably
incorrectly).
(ApplyTitleStyleCell): remove.
(WriteTitle): apply the titleStyle to the enclosing table, not the
table cell containing the month name.  Also, copy from the
Calendar's ControlStyle to populate tableTitle's style initially.
We end up with more (superfluous) style attributes than MS, but
it's better than having less.

2005-08-25  Chris Toshok  <toshok@ximian.com>

* LinkButton.cs (PostBackUrl): correct the UrlProperty attribute.

* Unit.cs: add [Serializable] and the 2.0 specific ToString(), not
yet implemented.

* HiddenField.cs: stub out this class and label everything
MonoTODO.

2005-08-25  Chris Toshok  <toshok@ximian.com>

* SqlDataSourceFilteringEventArgs.cs: add some usings, and fix a
typo.

* SqlDataSourceSelectingEventArgs.cs: IDbCommand -> DbCommand, and
add a using statement.

2005-08-25  Chris Toshok  <toshok@ximian.com>

* SqlDataSourceFilteringEventArgs.cs: new 2.0 class, as per
corcompare.

* SqlDataSourceFilteringEventHandler.cs: new 2.0 delegate, as per
corcompare.

2005-08-25  Chris Toshok  <toshok@ximian.com>

* SqlDataSourceCommandType.cs: new 2.0 enum, as per corcompare.

2005-08-25  Chris Toshok  <toshok@ximian.com>

* AdRotator.cs: stub out enough of the 2.0 methods/properties by
calling base.Foo to get the standalone adrotator (1.0) tests to
run without throwing exceptions.

2005-08-25  Chris Toshok  <toshok@ximian.com>

* ValidationSummary.cs (ValidationGroup): implement.
(Render): use Page.GetValidators in .net 2.0, so we can support
ValidationGroups.  Also, <br>'s get rendered as <br /> in .net
2.0.

2005-08-25  Chris Toshok  <toshok@ximian.com>

* ImageButton.cs (TagKey): disable (but flag) the "virtual new"
2.0 attribute modifiers, and revert back to "override".

* ListBox.cs (BorderColor): disable (but flag) the "virtual new"
2.0 attribute modifiers, and revert back to "override".
(BorderStyle): same.
(BorderWidth): same.

* TextBox.cs (SaveViewState): implement naively, calling
base.SaveViewState.
(TagKey): disable (but flag) the "virtual new" 2.0 attribute
modifiers, and revert back to "override".

2005-08-24  Chris Toshok  <toshok@ximian.com>

* Button.cs, DetailsView.cs, FontInfo.cs, Style.cs, Xml.cs,
Menu.cs, ObjectDataSource.cs, CheckBox.cs, RadioButton.cs,
ListControl.cs, SiteMapPath.cs, BulletedList.cs,
DataBoundControl.cs, ListItemCollection.cs, GridView.cs,
Wizard.cs, TextBox.cs, CheckBoxList.cs, RadioButtonList.cs,
PagedDataSource.cs, FormView.cs, AdRotator.cs, Repeater.cs,
DropDownList.cs, MultiView.cs, HierarchicalDataBoundControl.cs,
Calendar.cs, ListBox.cs, WebControl.cs, Literal.cs,
ValidationSummary.cs, ImageButton.cs, LinkButton.cs, TreeView.cs:
Add MonoTODO's for all things that throw NotImplementException.

2005-08-23  Chris Toshok  <toshok@ximian.com>

* BaseCompareValidator.cs (GetFullYear): it turns out the docs up
on msdn.microsoft.com tell exactly how the .net 2.0 stuff works,
even though they were written for the 1.0 stuff.

2005-08-23  Chris Toshok  <toshok@ximian.com>

* RepeatInfo.cs: some massaging to support both the 1.x and 2.0
output.  Our tests now pass on both mono and ms, with both 1.x and
2.0 profiles.

2005-08-22  Chris Toshok  <toshok@ximian.com>

* LinkButton.cs (ValidationGroup): implement.
(IPostBackEventHandler.RaisePostBackEvent): in the 2.0 profile,
pass ValidationGroup to Page.Validate.

2005-08-22  Chris Toshok  <toshok@ximian.com>

* ImageButton.cs (ValidationGroup): implement.
(IPostBackEventHandler.RaisePostBackEvent): if we cause
validation, call Page.Validate properly (in both profiles).

2005-08-22  Chris Toshok  <toshok@ximian.com>

* Button.cs (IPostBackEventHandler.RaisePostBackEvent): in the 2.0
case, pass ValidationGroup to Page.Validate.
(ValidationGroup): implement using ViewState.

2005-08-22  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs (Text): 2.0 only.  implement naively, just
get/set base.Text.
(OnInit): add 2.0 support for validation groups.
(OnUnload): same.

2005-08-19  Chris Toshok  <toshok@ximian.com>

* LinkButton.cs (ValidationGroup): implement getter/setter.
(RaisePostBackEvent): implement naively, by c&p'ing the old
implementation of IPostBackEventHandler.RaisePostBackEvent, but
making use of the ValidationGroup in the call to Page.Validate.

* Button.cs: same.

* Style.cs (LoadViewState): set our style flags for all the things
we have flags for.  Seems like the subclass flags should be
handled in overridden LoadViewState methods, but none of the Style
subclasses seem to override this method.

2005-08-19  Chris Toshok  <toshok@ximian.com>

* TableStyle.cs (Merge, MergeWith): make these look a bit more
like Copy/CopyFrom, with the styles checks instead of just
ViewState checks.

* TableItemStyle.cs: same, only also make Copy/CopyFrom work as in
TableStyle.cs.

2005-08-19  Chris Toshok  <toshok@ximian.com>

* DataGrid.cs (InitializePager): don't unconditionally set
pager_cell to the numeric pager (especially after setting it
conditionally to the nextprev pager.)
(InitializeNumericPager): the link buttons don't participate in
validation.
(InitializeNextPrevPager): same.
(CreateControlHierarchy): create the top/bottom pagers only if the
PagerStyle says too.

2005-08-18  Chris Toshok  <toshok@ximian.com>

* DataList.cs (CreateControlHierarchy): Call Controls.Clear() at
the start of this method so templates are created properly.

2005-08-17  Chris Toshok  <toshok@ximian.com>

* CompositeControl.cs (RecreateChildControls): implement naively -
just call CreateChildControls.  We might need to call
Controls.Clear() as well, but for the time being, this is ok.

2005-08-12  Chris Toshok  <toshok@ximian.com>

* CompositeControl.cs (DataBind, Render, get_Controls): the MSDN
docs says these methods/properties "ensure the child controls are
created" -- so call EnsureChildControls() before invoking the base
class's code.

2005-08-10  Chris Toshok  <toshok@ximian.com>

* Label.cs (LoadViewState): set the Text attribute from our
ViewState (if it exists) to clear out any child controls.  Fixes
jsunit test label/label-child-control-postback.aspx.

2005-08-05  Chris Toshok  <toshok@ximian.com>

* HyperLinkColumn.cs (FormatDataNavigateUrlValue): treat "" as
null when it comes to the format string.
(FormatDataTextValue): same.

2005-08-04  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs (Validate): only test a validator if it's both
enabled and visible.

2005-08-04  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs (AddAttributesToRender): add "enabled" if
!Enabled.

2005-08-01  Chris Toshok  <toshok@ximian.com>

* HyperLinkColumn.cs (ItemDataBinding): remove incorrect comment.

2005-07-30  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs: initial version of 2.0 properties
ValidationGroup and SetFocusOnError.

2005-07-30  Chris Toshok  <toshok@ximian.com>

* HyperLinkColumn.cs (InitializeCell): clean this up.

2005-07-30  Chris Toshok  <toshok@ximian.com>

* HyperLinkColumn.cs (FormatDataNavigateUrlValue): just use
DataBinder.FormatResult.
(FormatDataTextValue): same.
(Initialize): call base.Initialize.
(ItemDataBinding): new function, get the text/navigateurl and set
them on our HyperLink control.
(InitializeCell): create a hyperlink control in the
Item/EditItem/AlternatingItem case.

2005-07-29  Chris Toshok  <toshok@ximian.com>

* BaseCompareValidator.cs (GetDateElementOrder): implement.

2005-07-29  Chris Toshok  <toshok@ximian.com>

* BaseCompareValidator.cs (GetFullYear): implement two ways.  The
#if'ed out version follows microsoft's docs on msdn, but doesn't
match ms's behavior.  The other matches their behavior but not
their docs.  we use the latter.  go figure.
(get_CutoffYear): implement using
CultureInfo.CurrentCulture.Calendar.TwoDigitYearMax.

2005-07-29  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs (Validatate): not sure if this is entirely
correct (some fairly deep testing required), but setting Enabled =
false has the effect of setting IsValid = true.

2005-07-27  Chris Toshok  <toshok@ximian.com>

* RegularExpressionValidator.cs (EvaluateIsValid): "" is valid.

2005-07-26  Chris Toshok  <toshok@ximian.com>

* LinkButton.cs (AddParsedSubObject): reversed the order of
Controls.Add() and Text = null
(set_Text): call Controls.Clear()
(RenderContents): use HasControls() for the if test instead of
Text != "".

* HyperLink.cs (AddParsedSubObject): reversed the order of
Controls.Add () and Text = null;

2005-07-26  Chris Toshok  <toshok@ximian.com>

* LinkButton.cs (AddParsedSubObject): copy implementation from
HyperLink.
(RenderContents): only call writer.Write(Text) if Text != "".
Otherwise default to base.RenderContents.

2005-07-26  Chris Toshok  <toshok@ximian.com>

* Button.cs, CheckBox.cs, TextBox.cs, DropDownList.cs, ListBox.cs,
ImageButton.cs, LinkButton.cs (AddAttributesToRender): add if
(Page != null) around my last commit.

2005-07-26  Chris Toshok  <toshok@ximian.com>

* Button.cs, CheckBox.cs, TextBox.cs, DropDownList.cs, ListBox.cs,
ImageButton.cs, LinkButton.cs (AddAttributesToRender): call
Page.VerifyRenderingInServerFormHere.

2005-07-26  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs: remove some MonoTODO's about the client side
validator stuff.

2005-07-25  Chris Toshok  <toshok@ximian.com>

* ValidationSummary.cs (AddAttributesToRender): add client side
support.
(OnPreRender): set the "been here" flag.
(Render): add client side support.

2005-07-23  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs (GetControlValidateValue): handle ListItems as
prop.GetValue results.
(Render): fix the static non-uplevel case, so that we display text
when there's an error.

2005-07-22  Chris Toshok  <toshok@ximian.com>

* RegularExpressionValidator.cs (AddAttributesToRender): only
output ValidationExpression if it's != null.

2005-07-22  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs (AddAttributesToRender): fix up the Display
rendering such it matches MS's output.
(Render): stop using the huge complicated if's for each output
stage and move to boolean flags, and fix the static-nonuplevel
case, where a validator outputs as nothing but &nbsp;

2005-07-21  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs (RegisterValidatorCommonScript): remove the NS4
stuff that I c&p'ed from elsewhere - NS4 doesn't support the DOM1
stuff WebUIValidation.js uses, so we don't support it for uplevel
rendering.

2005-07-21  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs (DetermineRenderUplevel): include checks for
the EcmaScriptVersion and W3CDomVersion.

2005-07-21  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs (OnPreRender): call DetermineRenderUplevel and
cache the results.

2005-07-21  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs (get_PropertiesValid): use our containing
NamingContainer, not ourselves, to look up controls.
(CheckControlValidationProperty): same.
(GetControlRenderID): same.
(GetControlValidationValue): same.
(AddAttributesToRender): add the display style attribute if
Display != Static, and add the value of IsValid if it's false.
(DetermineRenderUplevel): use a try block around (Page.Request)
since that can raise an exception.
(OnPreRender): set pre_render_called, so we can consult it in
Render.
(Render): complicate this method more to handle more of the
Display/pre_render_called permutations.

2005-07-20  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs: don't use Page.FindControl, use this Control's
FindControl, so it'll use the same naming container.

2005-07-20  Chris Toshok  <toshok@ximian.com>

* Button.cs: hook up the client side validation stuff.

* ImageButton.cs: same.

* LinkButton.cs: same, although it's a little more complicated
here.

2005-07-20  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs: another Page != null check when uplevel
rendering.

2005-07-20  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs: check Page != null when determining if we're
rendering uplevel or not.

2005-07-20  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs (AddAttributesToRender): render the client side
attributes if we're in uplevel mode.
(DetermineRenderUplevel): flesh out a bit - for now basically
return true unless the control has it disabled.
(OnInit): only add the validator to Page's list if there is, in
fact, a page.
(OnUnload): same for removal.
(OnPreRender): hook up client scripting stuff here.  Only the call
to RegisterValidatorCommonScript is a for sure thing here, the
registering of the submit statement and startup script should
probably go elsewhere, but I don't know where.
(RegisterValidatorCommonScript): register the <script
src=".../WebUIValidation.js"> tag, if it's not already there.
(RegisterValidatorDeclaration): add our span object to the
Page_Validators JS array.
(Render): always render the tags (although this is probably not
right), and call RegisterValidatorDeclaration here.

* BaseCompareValidator.cs (AddAttributesToRender): render the
client side attributes if we're in uplevel mode.
(DetermineRenderUplevel): add MonoTODO.. why override this?  Just
call base.DetermineRenderUplevel for now.

* RegularExpressionValidator.cs (AddAttributesToRender): render
the client side attributes if we're in uplevel mode.

* RequiredFieldValidator.cs (AddAttributesToRender): same.

* CompareValidator.cs (AddAttributesToRender): same.

2005-07-19  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs: more fixes from pdb.

2005-07-19  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs: some test-driven fixes.

2005-07-19  Chris Toshok  <toshok@ximian.com>

* BaseValidator.cs: Initial implementation.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* BaseCompareValidator.cs: Initial implementation, with some NYI.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* CompareValidator.cs: wtf, just use the base class's methods.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* CompareValidator.cs: do comparisons based on
BaseCompareValidator.Type.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* CompareValidator.cs: initial implementation.

2005-07-18  Chris Toshok  <toshok@ximian.com>

* RegularExpressionValidator.cs: initial implementation.

2005-08-24  Chris Toshok  <toshok@ximian.com>

* MenuAdapter.cs (OnInit): Call "Page.RegisterRequiresControlState
(Control)" as the docs point out.
(LoadAdapterControlState): throw NIE and flag TODO.

2005-08-24  Chris Toshok  <toshok@ximian.com>

* HierarchicalDataBoundControlAdapter.cs (PerformDataBinding):
this takes no arguments.

2005-08-24  Chris Toshok  <toshok@ximian.com>

* WebControlAdapter.cs, HierarchicalDataBoundControlAdapter.cs,
DataBoundControlAdapter.cs, HideDisabledControlAdapter.cs,
MenuAdapter.cs: fix namespace.

2005-08-24  Chris Toshok  <toshok@ximian.com>

* DataBoundControlAdapter.cs, HideDisabledControlAdapter.cs,
HierarchicalDataBoundControlAdapter.cs, MenuAdapter.cs,
WebControlAdapter.cs: initial implementations.  Mostly completely
(as per msdn2 docs, anyway).

svn path=/trunk/mcs/; revision=48917

23 files changed:
mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls.WebParts/Part.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls.WebParts/WebPart.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/CompareValidator.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/CompositeControl.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/RegularExpressionValidator.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceCommandType.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceFilteringEventArgs.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceFilteringEventHandler.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI/ClientScriptManager.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI/DataBinder.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI/Page.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web/HttpBrowserCapabilities.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web/HttpCookie.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web/HttpCookieCollection.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web/HttpFileCollection.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web/HttpModuleCollection.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web/HttpResponseHeader.cs [new file with mode: 0644]

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 (file)
index 0000000..a156e9e
--- /dev/null
@@ -0,0 +1,94 @@
+//
+// 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)
+               {
+                       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);
+               }
+               
+               bool System.Web.IHttpHandler.IsReusable { get { return true; } }
+       }
+}
+
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 (file)
index 0000000..94059bc
--- /dev/null
@@ -0,0 +1,114 @@
+//
+// System.Web.UI.WebControls.WebParts.Part
+//
+// Authors: Chris Toshok <toshok@novell.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;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+
+       public abstract class Part: Panel, INamingContainer, ICompositeControlDesignerAccessor
+       {
+               string description;
+               string title;
+               PartChromeState chrome_state;
+               PartChromeType chrome_type;
+
+               internal Part ()
+               {
+                       description = "";
+                       title = "";
+                       chrome_state = PartChromeState.Normal;
+                       chrome_type = PartChromeType.Default;
+               }
+
+               [MonoTODO]
+               public override void DataBind()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO("not sure exactly what this one does..")]
+               void ICompositeControlDesignerAccessor.RecreateChildControls ()
+               {
+                       /* for now just call CreateChildControls to force
+                        * the recreation of our children. */
+                       CreateChildControls ();
+               }
+
+               public virtual PartChromeState ChromeState
+               {
+                       get {
+                               return chrome_state;
+                       }
+                       set {
+                               chrome_state = value;
+                       }
+               }
+
+               public virtual PartChromeType ChromeType
+               {
+                       get {
+                               return chrome_type;
+                       }
+                       set {
+                               chrome_type = value;
+                       }
+               }
+
+               [MonoTODO]
+               public virtual new ControlCollection Controls
+               {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public virtual string Description
+               {
+                       get {
+                               return description;
+                       }
+                       set {
+                               description = value;
+                       }
+               }
+
+               public virtual string Title
+               {
+                       get {
+                               return title;
+                       }
+                       set {
+                               title = value;
+                       }
+               }
+
+       }
+}
+
+#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 (file)
index 0000000..c1b3367
--- /dev/null
@@ -0,0 +1,476 @@
+//
+// System.Web.UI.WebControls.WebParts.Part
+//
+// Authors: Chris Toshok <toshok@novell.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;
+
+namespace System.Web.UI.WebControls.WebParts
+{
+       public abstract class WebPart : Part, IWebPart, IWebActionable
+#if IWebEditableInterface
+         , IWebEditable
+#endif
+       {
+               [Flags]
+               enum Allow {
+                       Close      = 0x01,
+                       Connect    = 0x02,
+                       Edit       = 0x04,
+                       Hide       = 0x08,
+                       Minimize   = 0x10,
+                       ZoneChange = 0x20
+               }
+
+
+               WebPartVerbCollection verbs;
+               Allow allow;
+               string auth_filter;
+               string catalog_icon_url;
+
+               protected WebPart ()
+               {
+                       verbs = new WebPartVerbCollection();
+                       allow = Allow.Close | Allow.Connect | Allow.Edit | Allow.Hide | Allow.Minimize | Allow.ZoneChange;
+                       auth_filter = "";
+                       catalog_icon_url = "";
+               }
+
+#if IWebEditableInterface
+               [MonoTODO]
+               public virtual EditorPartCollection CreateEditorParts ()
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
+
+               [MonoTODO]
+               protected void SetPersonalizationDirty ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static void SetPersonalizationDirty (Control control)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void TrackViewState ()
+               {
+                       base.TrackViewState();
+
+                       foreach (IStateManager verb in verbs) {
+                               verb.TrackViewState();
+                       }
+               }
+
+               protected internal virtual void OnClosing (EventArgs e)
+               { /* no base class implementation */ }
+
+               protected internal virtual void OnConnectModeChanged (EventArgs e)
+               { /* no base class implementation */ }
+
+               protected internal virtual void OnDeleting (EventArgs e)
+               { /* no base class implementation */ }
+
+               protected internal virtual void OnEditModeChanged (EventArgs e)
+               { /* no base class implementation */ }
+
+               public virtual bool AllowClose 
+               {
+                       get {
+                               return (allow & Allow.Close) != 0;
+                       }
+                       set {
+                               if (value)
+                                       allow |= Allow.Close;
+                               else
+                                       allow &= ~Allow.Close;
+                       }
+               }
+
+               public virtual bool AllowConnect 
+               {
+                       get {
+                               return (allow & Allow.Connect) != 0;
+                       }
+                       set {
+                               if (value)
+                                       allow |= Allow.Connect;
+                               else
+                                       allow &= ~Allow.Connect;
+                       }
+               }
+
+               public virtual bool AllowEdit 
+               {
+                       get {
+                               return (allow & Allow.Edit) != 0;
+                       }
+                       set {
+                               if (value)
+                                       allow |= Allow.Edit;
+                               else
+                                       allow &= ~Allow.Edit;
+                       }
+               }
+
+               public virtual bool AllowHide 
+               {
+                       get {
+                               return (allow & Allow.Hide) != 0;
+                       }
+                       set {
+                               if (value)
+                                       allow |= Allow.Hide;
+                               else
+                                       allow &= ~Allow.Hide;
+                       }
+               }
+
+               public virtual bool AllowMinimize 
+               {
+                       get {
+                               return (allow & Allow.Minimize) != 0;
+                       }
+                       set {
+                               if (value)
+                                       allow |= Allow.Minimize;
+                               else
+                                       allow &= ~Allow.Minimize;
+                       }
+               }
+
+               public virtual bool AllowZoneChange 
+               {
+                       get {
+                               return (allow & Allow.ZoneChange) != 0;
+                       }
+                       set {
+                               if (value)
+                                       allow |= Allow.ZoneChange;
+                               else
+                                       allow &= ~Allow.ZoneChange;
+                       }
+               }
+
+               [MonoTODO]
+               public virtual string AuthorizationFilter 
+               {
+                       get {
+                               return auth_filter;
+                       }
+                       set {
+                               auth_filter = value;
+                       }
+               }
+
+               [MonoTODO]
+               public virtual string CatalogIconImageUrl 
+               {
+                       get {
+                               return catalog_icon_url;
+                       }
+                       set {
+                               catalog_icon_url = value;
+                       }
+               }
+
+               [MonoTODO ("why override?")]
+               public override PartChromeState ChromeState 
+               {
+                       get {
+                               return base.ChromeState;
+                       }
+                       set {
+                               base.ChromeState = value;
+                       }
+               }
+
+               [MonoTODO ("why override?")]
+               public override PartChromeType ChromeType 
+               {
+                       get {
+                               return base.ChromeType;
+                       }
+                       set {
+                               base.ChromeType = value;
+                       }
+               }
+
+               [MonoTODO]
+               public string ConnectErrorMessage 
+               {
+                       get {
+                               return "";
+                       }
+               }
+
+               [MonoTODO ("why override?")]
+               public override string Description 
+               {
+                       get {
+                               return base.Description;
+                       }
+                       set {
+                               base.Description = value;
+                       }
+               }
+
+               [MonoTODO]
+               /* msdn2 lists this as an override, but it doesn't appear to work with our implementation */
+               public /*override*/ ContentDirection Direction 
+               {
+                       get {
+                       throw new NotImplementedException ();
+                       }
+                       set {
+                       throw new NotImplementedException ();
+                       }
+               }
+
+               public string DisplayTitle 
+               {
+                       get {
+                               return "Untitled";
+                       }
+               }
+
+               [MonoTODO]
+               public virtual WebPartExportMode ExportMode 
+               {
+                       get {
+                       throw new NotImplementedException ();
+                       }
+                       set {
+                       throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public bool HasSharedData 
+               {
+                       get {
+                       throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public bool HasUserData 
+               {
+                       get {
+                       throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO("why override?")]
+               public override Unit Height 
+               {
+                       get {
+                               return base.Height;
+                       }
+                       set {
+                               base.Height = value;
+                       }
+               }
+
+               [MonoTODO]
+               public virtual WebPartHelpMode HelpMode 
+               {
+                       get {
+                       throw new NotImplementedException ();
+                       }
+                       set {
+                       throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public virtual string HelpUrl 
+               {
+                       get {
+                       throw new NotImplementedException ();
+                       }
+                       set {
+                       throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public virtual bool Hidden 
+               {
+                       get {
+                       throw new NotImplementedException ();
+                       }
+                       set {
+                       throw new NotImplementedException ();
+                       }
+               }
+
+               public virtual string ImportErrorMessage 
+               {
+                       get {
+                               return ViewState.GetString("ImportErrorMessage", "Cannot import this Web Part.");
+                       }
+                       set {
+                               ViewState ["ImportErrorMessage"] = value;
+                       }
+               }
+
+               [MonoTODO]
+               public bool IsClosed 
+               {
+                       get {
+                       throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO("not virtual and no setter..")]
+               public bool IsShared 
+               {
+                       get {
+                               return false;
+                       }
+               }
+
+               [MonoTODO("not virtual and no setter..")]
+               public bool IsStandalone 
+               {
+                       get {
+                               return true;
+                       }
+               }
+
+               [MonoTODO]
+               public bool IsStatic 
+               {
+                       get {
+                       throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public virtual string Subtitle 
+               {
+                       get {
+                       throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO ("why override?")]
+               public override string Title 
+               {
+                       get {
+                               return base.Title;
+                       }
+                       set {
+                               base.Title = value;
+                       }
+               }
+
+               [MonoTODO]
+               public virtual string TitleIconImageUrl 
+               {
+                       get {
+                       throw new NotImplementedException ();
+                       }
+                       set {
+                       throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public virtual string TitleUrl 
+               {
+                       get {
+                       throw new NotImplementedException ();
+                       }
+                       set {
+                       throw new NotImplementedException ();
+                       }
+               }
+
+               public virtual WebPartVerbCollection Verbs 
+               {
+                       get {
+                               return verbs;
+                       }
+               }
+
+#if IWebEditableInterface
+               [MonoTODO]
+               public virtual object WebBrowsableObject 
+               {
+                       get {
+                       throw new NotImplementedException ();
+                       }
+               }
+#endif
+
+#if notyet
+               [MonoTODO]
+               protected WebPartManager WebPartManager 
+               {
+                       get {
+                       throw new NotImplementedException ();
+                       }
+               }
+#endif
+
+               [MonoTODO ("why override?")]
+               public override Unit Width 
+               {
+                       get {
+                               return base.Width;
+                       }
+                       set {
+                               base.Width = value;
+                       }
+               }
+
+#if notyet
+               [MonoTODO]
+               public WebPartZoneBase Zone 
+               {
+                       get {
+                       throw new NotImplementedException ();
+                       }
+               }
+#endif
+
+               [MonoTODO]
+               public int ZoneIndex 
+               {
+                       get {
+                       throw new NotImplementedException ();
+                       }
+               }
+       }
+
+}
+
+#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 100644 (file)
index 0000000..603fd5e
--- /dev/null
@@ -0,0 +1,225 @@
+//
+// System.Web.UI.WebControls.BaseCompareValidator
+//
+// Authors:
+//     Chris Toshok (toshok@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.Text;
+using System.Threading;
+using System.Web;
+using System.Web.UI.WebControls;
+using System.Globalization;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+
+       public abstract class BaseCompareValidator : BaseValidator {
+
+               ValidationDataType type;
+
+               public BaseCompareValidator ()
+               {
+                       type = ValidationDataType.String;
+               }
+
+               protected override void AddAttributesToRender (HtmlTextWriter w)
+               {
+                       if (RenderUplevel) {
+                               w.AddAttribute ("datatype", type.ToString());
+                       }
+
+                       base.AddAttributesToRender (w);
+               }
+
+               public static bool CanConvert (string text,
+                                              ValidationDataType type)
+               {
+                       object value;
+
+                       return Convert (text, type, out value);
+               }
+
+               protected static bool Convert (string text,
+                                              ValidationDataType type,
+                                              out object value)
+               {
+                       try {
+                               switch (type) {
+                               case ValidationDataType.String:
+                                       if (text == null) {
+                                               value = null;
+                                               return false;
+                                       }
+                                       else {
+                                               value = text;
+                                               return true;
+                                       }
+                               case ValidationDataType.Integer:
+                                       value = Int32.Parse (text);
+                                       return true;
+                               case ValidationDataType.Double:
+                                       value = Double.Parse(text);
+                                       return true;
+                               case ValidationDataType.Date:
+                                       value = DateTime.Parse(text);
+                                       return true;
+                               case ValidationDataType.Currency:
+                                       value = Decimal.Parse(text, NumberStyles.Currency);
+                                       return true;
+                               default:
+                                       value = null;
+                                       return false;
+                               }
+                       }
+                       catch {
+                               value = null;
+                               return false;
+                       }
+
+               }
+
+               protected static bool Compare (string left,
+                                              string right,
+                                              ValidationCompareOperator op,
+                                              ValidationDataType type)
+               {
+                       object lo, ro;
+
+                       if (!Convert (left, type, out lo))
+                               return false;
+
+                       /* DataTypeCheck is a unary operator that only
+                        * depends on the lhs */
+                       if (op == ValidationCompareOperator.DataTypeCheck)
+                               return true;
+
+                       /* pretty crackladen, but if we're unable to
+                        * convert the rhs to @type, the comparison
+                        * succeeds */
+                       if (!Convert (right, type, out ro))
+                               return true;
+
+                       int comp = ((IComparable)lo).CompareTo ((IComparable)ro);
+
+                       switch (op) {
+                       case ValidationCompareOperator.Equal:
+                               return comp == 0;
+                       case ValidationCompareOperator.NotEqual:
+                               return comp != 0;
+                       case ValidationCompareOperator.LessThan:
+                               return comp < 0;
+                       case ValidationCompareOperator.LessThanEqual:
+                               return comp <= 0;
+                       case ValidationCompareOperator.GreaterThan:
+                               return comp > 0;
+                       case ValidationCompareOperator.GreaterThanEqual:
+                               return comp >= 0;
+                       default:
+                               return false;
+                       }
+               }
+
+               [MonoTODO ("why override?")]
+               protected override bool DetermineRenderUplevel ()
+               {
+                       return base.DetermineRenderUplevel();
+               }
+
+               protected static string GetDateElementOrder ()
+               {
+                       // I hope there's a better way to implement this...
+                       string pattern = Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern;
+                       StringBuilder order = new StringBuilder();
+                       bool seen_date = false;
+                       bool seen_year = false;
+                       bool seen_month = false;
+
+                       pattern = pattern.ToLower ();
+
+                       for (int i = 0; i < pattern.Length; i ++) {
+                               char c = pattern[ i ];
+                               if (c != 'm' && c != 'd' && c != 'y')
+                                       continue;
+
+                               if (c == 'm') {
+                                       if (!seen_month) order.Append ("m");
+                                       seen_month = true;
+                               }
+                               else if (c == 'y') {
+                                       if (!seen_year) order.Append ("y");
+                                       seen_year = true;
+                               }
+                               else /* (c == 'd') */ {
+                                       if (!seen_date) order.Append ("d");
+                                       seen_date = true;
+                               }
+                       }
+
+                       return order.ToString ();
+               }
+
+               protected static int GetFullYear (int two_digit_year)
+               {
+#if NET_2_0
+                       /* This is an implementation that matches the
+                        * docs on msdn, but MS doesn't seem to go by
+                        * their docs (at least in 1.0). */
+                       int cutoff = CutoffYear;
+                       int twodigitcutoff = cutoff % 100;
+
+                       if (two_digit_year <= twodigitcutoff) {
+                               return cutoff - twodigitcutoff + two_digit_year;
+                       }
+                       else {
+                               return cutoff - twodigitcutoff - 100 + two_digit_year;
+                       }
+#else
+                       /* This is the broken implementation in 1.0 */
+                       int cutoff = CutoffYear;
+                       int twodigitcutoff = cutoff % 100;
+
+                       return cutoff - twodigitcutoff + two_digit_year;
+#endif
+               }
+
+               protected static int CutoffYear {
+                       get {
+                               return CultureInfo.CurrentCulture.Calendar.TwoDigitYearMax;
+                       }
+               }
+
+               [DefaultValue(ValidationDataType.String)]
+               public ValidationDataType Type {
+                       get {
+                               return type;
+                       }
+                       set {
+                               type = value;
+                       }
+               }
+       }
+
+}
+
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 100644 (file)
index 0000000..3031423
--- /dev/null
@@ -0,0 +1,517 @@
+//
+// System.Web.UI.WebControls.BaseValidator
+//
+// Authors:
+//     Chris Toshok (toshok@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.Web;
+using System.Web.UI.WebControls;
+using System.Web.Configuration;
+using System.ComponentModel;
+using System.Drawing;
+using System.Reflection;
+using System.Collections;
+
+namespace System.Web.UI.WebControls {
+       [DefaultProperty("ErrorMessage")]
+       [Designer("System.Web.UI.Design.WebControls.BaseValidatorDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+       public abstract class BaseValidator : Label, IValidator
+       {
+               bool render_uplevel;
+               bool valid;
+               Color forecolor;
+
+               protected BaseValidator ()
+               {
+                       this.valid = true;
+                       this.ForeColor = Color.Red;
+               }
+
+               // New in NET1.1 sp1
+               [Browsable(false)]
+#if ONLY_1_1
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+#endif         
+               [EditorBrowsable(EditorBrowsableState.Never)]
+               public override string AssociatedControlID {
+                       get {
+                               return base.AssociatedControlID;
+                       }
+                       set {
+                               base.AssociatedControlID = value;
+                       }
+               }
+
+#if NET_2_0
+               [Themeable (false)]
+               [DefaultValue ("")]
+               public string ValidationGroup {
+                       get {
+                               return ViewState.GetString ("ValidationGroup", String.Empty);
+                       }
+                       set {
+                               ViewState["ValidationGroup"] = value;
+                       }
+               }
+
+               [Themeable (false)]
+               [DefaultValue (false)]
+               public bool SetFocusOnError {
+                       get {
+                               return ViewState.GetBool ("SetFocusOnError", false);
+                       }
+                       set {
+                               ViewState["SetFocusOnError"] = value;
+                       }
+               }
+
+               /* listed in corcompare */
+               [MonoTODO("Why override?")]
+               [PersistenceMode (PersistenceMode.InnerDefaultProperty)]
+               [DefaultValue ("")]
+               public override string Text 
+               {
+                       get {
+                               return base.Text;
+                       }
+                       set {
+                               base.Text = value;
+                       }
+               }
+#endif
+
+#if NET_2_0
+               [IDReferenceProperty (typeof (Control))]
+               [Themeable (false)]
+#endif
+               [TypeConverter(typeof(System.Web.UI.WebControls.ValidatedControlConverter))]
+               [DefaultValue("")]
+               public string ControlToValidate {
+                       get {
+                               return ViewState.GetString ("ControlToValidate", String.Empty);
+                       }
+                       set {
+                               ViewState ["ControlToValidate"] = value;
+                       }
+               }
+
+#if NET_2_0
+               [Themeable (false)]
+#endif
+#if ONLY_1_1           
+               [Bindable(true)]
+#endif         
+               [DefaultValue(ValidatorDisplay.Static)]
+               public ValidatorDisplay Display {
+                       get {
+                               return (ValidatorDisplay)ViewState.GetInt ("Display", (int)ValidatorDisplay.Static);
+                       }
+                       set {
+                               ViewState ["Display"] = (int)value;
+                       }
+               }
+
+#if NET_2_0
+               [Themeable (false)]
+#endif
+               [DefaultValue(true)]
+               public bool EnableClientScript {
+                       get {
+                               return ViewState.GetBool ("EnableClientScript", true);
+                       }
+                       set {
+                               ViewState ["EnableClientScript"] = value;
+                       }
+               }
+
+               public override bool Enabled {
+                       get {
+                               return ViewState.GetBool ("Enabled", true);
+                       }
+                       set {
+                               ViewState ["Enabled"] = value;
+                       }
+               }
+
+#if NET_2_0
+               [Localizable (true)]
+#endif
+#if ONLY_1_1
+               [Bindable(true)]
+#endif         
+               [DefaultValue("")]
+               public virtual string ErrorMessage {
+                       get {
+                               return ViewState.GetString ("ErrorMessage", String.Empty);
+                       }
+                       set {
+                               ViewState ["ErrorMessage"] = value;
+                       }
+               }
+
+               [DefaultValue("Color [Red]")]
+               public override Color ForeColor {
+                       get {
+                               return forecolor;
+                       }
+                       set {
+                               forecolor = value;
+                               base.ForeColor = value;
+                       }
+               }
+
+               [Browsable(false)]
+               [DefaultValue(true)]
+#if NET_2_0
+               [Themeable (false)]
+#endif
+               [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               public virtual bool IsValid {
+                       get {
+                               return valid;
+                       }
+                       set {
+                               valid = value;
+                       }
+               }
+
+               protected bool PropertiesValid {
+                       get {
+                               Control control = NamingContainer.FindControl (ControlToValidate);
+                               if (control == null)
+                                       return false;
+                               else
+                                       return true;
+                       }
+               }
+
+               protected bool RenderUplevel {
+                       get {
+                               return render_uplevel;
+                       }
+               }
+
+               internal bool GetRenderUplevel ()
+               {
+                       return render_uplevel;
+               }
+
+               protected override void AddAttributesToRender (HtmlTextWriter writer)
+               {
+                       /* if we're rendering uplevel, add our attributes */
+                       if (RenderUplevel) {
+                               if (ControlToValidate != String.Empty)
+                                       writer.AddAttribute ("controltovalidate", ControlToValidate);
+
+                               if (ErrorMessage != String.Empty)
+                                       writer.AddAttribute ("errormessage", ErrorMessage);
+                               if (Text != String.Empty)
+                                       writer.AddAttribute ("text", Text);
+
+                               if (!Enabled)
+                                       writer.AddAttribute ("enabled", Enabled.ToString());
+                               if (!IsValid)
+                                       writer.AddAttribute ("isvalid", IsValid.ToString());
+
+                               if (Display == ValidatorDisplay.Static) {
+                                       writer.AddStyleAttribute ("visibility", "hidden");
+                               }
+                               else {
+                                       writer.AddAttribute ("display", Display.ToString());
+                                       writer.AddStyleAttribute ("display", "none");
+                               }
+                       }
+
+                       base.AddAttributesToRender (writer);
+               }
+
+               protected void CheckControlValidationProperty (string name, string propertyName)
+               {
+                       Control control = NamingContainer.FindControl (name);
+                       PropertyDescriptor prop = null;
+
+                       if (control == null)
+                               throw new HttpException (String.Format ("Unable to find control id '{0}'.", name));
+
+                       prop = BaseValidator.GetValidationProperty (control);
+                       if (prop == null)
+                               throw new HttpException (String.Format ("Unable to find ValidationProperty attribute '{0}' on control '{1}'", propertyName, name));
+               }
+
+               protected virtual bool ControlPropertiesValid ()
+               {
+                       if (ControlToValidate.Length == 0) {
+                               throw new HttpException("ControlToValidate property cannot be emtpy");
+                       }
+
+                       CheckControlValidationProperty (ControlToValidate, "");
+
+                       return true;
+               }
+
+               protected virtual bool DetermineRenderUplevel ()
+               {
+                       if (!EnableClientScript)
+                               return false;
+
+                       try {
+                               if (Page == null || Page.Request == null)
+                                       return false;
+                       }
+                       catch {
+                               /* this can happen with a fake Page in nunit
+                                * tests, since Page.Context == null */
+                               return false;
+                       }
+
+                       return (
+                               /* From someplace on the web: "JavaScript 1.2
+                                * and later (also known as ECMAScript) has
+                                * built-in support for regular
+                                * expressions" */
+                               ((Page.Request.Browser.EcmaScriptVersion.Major == 1
+                                 && Page.Request.Browser.EcmaScriptVersion.Minor >= 2)
+                                || (Page.Request.Browser.EcmaScriptVersion.Major > 1))
+                       
+                               /* document.getElementById, .getAttribute,
+                                * etc, are all DOM level 1.  I don't think we
+                                * use anything in level 2.. */
+                               && Page.Request.Browser.W3CDomVersion.Major >= 1);
+               }
+
+               protected abstract bool EvaluateIsValid ();
+
+               protected string GetControlRenderID (string name)
+               {
+                       Control control = NamingContainer.FindControl (name);
+                       if (control == null)
+                               return null;
+
+                       return control.ClientID;
+               }
+
+               protected string GetControlValidationValue (string name)
+               {
+                       Control control = NamingContainer.FindControl (name);
+
+                       if (control == null)
+                               return null;
+
+                       PropertyDescriptor prop = BaseValidator.GetValidationProperty (control);
+                       if (prop == null)
+                               return null;
+
+                       object o = prop.GetValue (control);
+                       if (o is string)
+                               return (string)o;
+                       else if (o is ListItem)
+                               return ((ListItem)o).Value;
+                       else {
+                               // XXX
+                               return null;
+                       }
+               }
+
+               public static PropertyDescriptor GetValidationProperty (object o)
+               {
+                       PropertyDescriptorCollection props;
+                       System.ComponentModel.AttributeCollection col;
+
+                       props = TypeDescriptor.GetProperties (o);
+                       col = TypeDescriptor.GetAttributes (o);
+
+                       foreach (Attribute at in col) {
+                               ValidationPropertyAttribute vpa = at as ValidationPropertyAttribute;
+                               if (vpa != null && vpa.Name != null)
+                                       return props[vpa.Name];
+                       }
+
+                       return null;
+               }
+
+#if NET_2_0
+               protected internal
+#else          
+               protected
+#endif         
+               override void OnInit (EventArgs e)
+               {
+                       /* according to an msdn article, this is done here */
+                       if (Page != null) {
+                               Page.Validators.Add (this);
+
+#if NET_2_0
+                               if (ValidationGroup != "")
+                                       Page.GetValidators (ValidationGroup).Add (this);
+#endif
+                       }
+                       base.OnInit (e);
+               }
+
+               bool pre_render_called = false;
+
+#if NET_2_0
+               protected internal
+#else
+               protected
+#endif         
+               override void OnPreRender (EventArgs e)
+               {
+                       base.OnPreRender (e);
+
+                       pre_render_called = true;
+
+                       render_uplevel = DetermineRenderUplevel ();
+                       if (RenderUplevel) {
+                               RegisterValidatorCommonScript ();
+
+                               Page.RegisterOnSubmitStatement ("Mono-System.Web-ValidationOnSubmitStatement",
+                                                               "if (!ValidatorCommonOnSubmit()) return false;");
+                               Page.RegisterStartupScript ("Mono-System.Web-ValidationStartupScript",
+                                                           "<script language=\"JavaScript\">\n" + 
+                                                           "<!--\n" + 
+                                                           "var Page_ValidationActive = false;\n" + 
+                                                           "ValidatorOnLoad();\n" +
+                                                           "\n" + 
+                                                           "function ValidatorOnSubmit() {\n" + 
+                                                           "        if (Page_ValidationActive) {\n" + 
+                                                           "                return ValidatorCommonOnSubmit();\n" + 
+                                                           "        }\n" + 
+                                                           "        return true;\n" + 
+                                                           "}\n" + 
+                                                           "// -->\n" + 
+                                                           "</script>\n");
+                       }
+               }
+
+#if NET_2_0
+               protected internal
+#else          
+               protected
+#endif         
+               override void OnUnload (EventArgs e)
+               {
+                       /* according to an msdn article, this is done here */
+                       if (Page != null) {
+                               Page.Validators.Remove (this);
+
+#if NET_2_0
+                               if (ValidationGroup != "")
+                                       Page.GetValidators (ValidationGroup).Remove (this);
+#endif
+
+                       }
+                       base.OnUnload (e);
+               }
+
+               protected void RegisterValidatorCommonScript ()
+               {
+                       if (!Page.IsClientScriptBlockRegistered ("Mono-System.Web-ValidationClientScriptBlock")) {
+                               Page.RegisterClientScriptBlock ("Mono-System.Web-ValidationClientScriptBlock",
+                                                               String.Format ("<script language=\"JavaScript\" src=\"{0}\"></script>",
+                                                                              Page.ClientScript.GetWebResourceUrl (GetType(),
+                                                                                                                   "WebUIValidation.js")));
+                       }
+               }
+
+               protected virtual void RegisterValidatorDeclaration ()
+               {
+                       Page.RegisterArrayDeclaration ("Page_Validators",
+                                                      String.Format ("document.getElementById ('{0}')", ID));
+               }
+
+#if NET_2_0
+               protected internal
+#else          
+               protected
+#endif         
+               override void Render (HtmlTextWriter writer)
+               {
+                       /* we have to be in a server form */
+                       /* XXX it appears MS doesn't do this */
+                       //Page.VerifyRenderingInServerForm (this);
+
+                       if (RenderUplevel) {
+                               /* according to an msdn article, this is done here */
+                               RegisterValidatorDeclaration ();
+                       }
+
+                       bool render_tags = false;
+                       bool render_text = false;
+                       bool render_nbsp = false;
+
+                       if (!pre_render_called) {
+                               render_tags = true;
+                               render_text = true;
+                       }
+                       else if (RenderUplevel) {
+                               render_tags = true;
+                               if (Display == ValidatorDisplay.Dynamic)
+                                       render_text = true;
+                       }
+                       else {
+                               if (Display == ValidatorDisplay.Static) {
+                                       render_tags = !valid;
+                                       render_text = !valid;
+                                       render_nbsp = valid;
+                               }
+                       }
+
+                       if (render_tags) {
+                               AddAttributesToRender (writer);
+                               writer.RenderBeginTag (HtmlTextWriterTag.Span);
+                       }
+
+                       if (render_text || render_nbsp) {
+                               string text;
+                               if (render_text) {
+                                       if (Text != "")
+                                               text = Text;
+                                       else
+                                               text = ErrorMessage;
+                               }
+                               else {
+                                       text = "&nbsp;";
+                               }
+
+                               writer.Write (text);
+                       }
+
+                       if (render_tags) {
+                               writer.RenderEndTag ();
+                       }
+               }
+
+               /* the docs say "public sealed" here */
+               public virtual void Validate ()
+               {
+                       if (Enabled && Visible)
+                               valid = ControlPropertiesValid () && EvaluateIsValid ();
+                       else
+                               valid = true;
+               }
+       }
+
+}
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 (file)
index 0000000..e2c5bdf
--- /dev/null
@@ -0,0 +1,120 @@
+//
+// System.Web.UI.WebControls.CompareValidator
+//
+// Authors:
+//     Chris Toshok (toshok@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.Web;
+using System.Web.UI.WebControls;
+using System.Globalization;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+       [ToolboxData("<{0}:CompareValidator runat=server ErrorMessage=\"CompareValidator\"></{0}:CompareValidator>")]
+       public class CompareValidator : BaseCompareValidator
+       {
+               public CompareValidator ()
+               {
+               }
+
+               protected override void AddAttributesToRender (HtmlTextWriter w)
+               {
+                       if (RenderUplevel) {
+                               if (ControlToCompare != "")
+                                       w.AddAttribute ("controltocompare", ControlToCompare);
+                               if (ValueToCompare != "")
+                                       w.AddAttribute ("valuetocompare", ValueToCompare);
+                               w.AddAttribute ("operator", Operator.ToString());
+                               w.AddAttribute("evaluationfunction", "CompareValidatorEvaluateIsValid");
+                       }
+
+                       base.AddAttributesToRender (w);
+               }
+
+               protected override bool ControlPropertiesValid ()
+               {
+                       /* if the control id is the default "", or if we're
+                        * using the one Operator that ignores the control
+                        * id.. */
+                       if (ControlToCompare == "" || Operator == ValidationCompareOperator.DataTypeCheck)
+                               return base.ControlPropertiesValid();
+
+                       /* attempt to locate the ControlToCompare somewhere on the page */
+                       Control control = Page.FindControl (ControlToCompare);
+                       if (control == null)
+                               throw new HttpException (String.Format ("Unable to locate ControlToCompare with id `{0}'", ControlToCompare));
+
+                       return base.ControlPropertiesValid ();
+               }
+
+               protected override bool EvaluateIsValid ()
+               {
+                       /* wtf? */
+                       if (GetControlValidationValue (ControlToValidate) == "")
+                               return true;
+
+                       string compare;
+                       /* ControlToCompare takes precendence, if it's set. */
+                       compare = (ControlToCompare != "" ? GetControlValidationValue (ControlToCompare) : ValueToCompare);
+
+                       return BaseCompareValidator.Compare (GetControlValidationValue (ControlToValidate), compare,
+                                                            Operator,
+                                                            this.Type);
+               }
+
+               [DefaultValue("")]
+               [TypeConverter(typeof(System.Web.UI.WebControls.ValidatedControlConverter))]
+               public string ControlToCompare {
+                       get {
+                               return ViewState.GetString ("ControlToCompare", String.Empty);
+                       }
+                       set {
+                               ViewState["ControlToCompare"] = value;
+                       }
+               }
+
+               [DefaultValue(ValidationCompareOperator.Equal)]
+               public ValidationCompareOperator Operator {
+                       get {
+                               return (ValidationCompareOperator)ViewState.GetInt ("Operator", (int)ValidationCompareOperator.Equal);
+                       }
+
+                       set {
+                               ViewState ["Operator"] = (int)value;
+                       }
+               }
+
+               [Bindable(true)]
+               [DefaultValue("")]
+               public string ValueToCompare {
+                       get {
+                               return ViewState.GetString ("ValueToCompare", String.Empty);
+                       }
+                       set {
+                               ViewState ["ValueToCompare"] = value;
+                       }
+               }
+       }
+}
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 (file)
index 0000000..a46a79a
--- /dev/null
@@ -0,0 +1,76 @@
+//
+// System.Web.UI.WebControls.CompositeControl
+//
+// Authors: Ben Maurer <bmaurer@novell.com>
+//          Chris Toshok <toshok@novell.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.ComponentModel;
+
+namespace System.Web.UI.WebControls {
+
+#if NET_2_0
+       [Designer ("System.Web.UI.Design.WebControls.CompositeControlDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+       public abstract class CompositeControl : WebControl, INamingContainer, ICompositeControlDesignerAccessor {
+
+               protected CompositeControl ()
+               {
+               }
+
+               public override void DataBind ()
+               {
+                       /* make sure all the child controls have been created */
+                       EnsureChildControls ();
+                       /* and then... */
+                       base.DataBind();
+               }
+
+               protected internal override void Render (HtmlTextWriter w)
+               {
+                       /* make sure all the child controls have been created */
+                       EnsureChildControls ();
+                       /* and then... */
+                       base.Render (w);
+               }
+
+               [MonoTODO("not sure exactly what this one does..")]
+               void ICompositeControlDesignerAccessor.RecreateChildControls ()
+               {
+                       /* for now just call CreateChildControls to force
+                        * the recreation of our children. */
+                       CreateChildControls ();
+               }
+       
+               public override ControlCollection Controls {
+                       get {
+                               /* make sure all the child controls have been created */
+                               EnsureChildControls ();
+                               /* and then... */
+                               return base.Controls;
+                       }
+               }
+       }
+#endif
+
+}
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 (file)
index 0000000..8d45712
--- /dev/null
@@ -0,0 +1,161 @@
+//
+// System.Web.UI.WebControls.HyperLinkColumn.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-2005 Novell, Inc (http://www.novell.com)
+//
+
+using System.ComponentModel;
+using System.Data;
+
+namespace System.Web.UI.WebControls
+{
+        public class HyperLinkColumn : DataGridColumn
+        {
+               public HyperLinkColumn ()
+               {
+               }
+
+               [DefaultValue("")]
+               public virtual string DataNavigateUrlField {
+                       get {
+                               return ViewState.GetString ("DataNavigateUrlField", String.Empty);
+                       }
+                       set { ViewState ["DataNavigateUrlField"] = value; }
+               }
+
+               [DefaultValue("")]
+               [Description("The formatting applied to the value bound to the NavigateUrl property.")]
+               public virtual string DataNavigateUrlFormatString {
+                       get {
+                               return ViewState.GetString ("DataNavigateUrlFormatString", String.Empty);
+                       }
+                       set { ViewState ["DataNavigateUrlFormatString"] = value; }
+               }
+
+               [DefaultValue("")]
+               public virtual string DataTextField {
+                       get {
+                               return ViewState.GetString ("DataTextField", String.Empty);
+                       }
+                       set { ViewState ["DataTextField"] = value; }
+               }
+
+               [Description("The formatting applied to the value bound to the Text property.")]
+               [DefaultValue("")]
+               public virtual string DataTextFormatString {
+                       get {
+                               return ViewState.GetString ("DataTextFormatString", String.Empty);
+                       }
+                       set { ViewState ["DataTextFormatString"] = value; }
+               }
+               
+               [DefaultValue("")]
+               public virtual string NavigateUrl {
+                       get {
+                               return ViewState.GetString ("NavigateUrl", String.Empty);
+                       }
+                       set { ViewState ["NavigateUrl"] = value; }
+               }
+
+               [DefaultValue("")]
+               public virtual string Target {
+                       get {
+                               return ViewState.GetString ("Target", String.Empty);
+                       }
+                       set { ViewState ["Target"] = value; }
+               }
+
+               [DefaultValue("")]
+               public virtual string Text {
+                       get {
+                               return ViewState.GetString ("Text", String.Empty);
+                       }
+                       set { ViewState ["Text"] = value; }
+               }
+
+               protected virtual string FormatDataNavigateUrlValue (object value)
+               {
+                       string format = DataNavigateUrlFormatString;
+                       if (format == "")
+                               format = null;
+
+                       return DataBinder.FormatResult (value, format);
+               }
+
+               protected virtual string FormatDataTextValue (object value)
+               {
+                       string format = DataTextFormatString;
+                       if (format == "")
+                               format = null;
+
+                       return DataBinder.FormatResult (value, format);
+               }
+
+               public override void Initialize ()
+               {
+                       base.Initialize ();
+               }
+
+               void ItemDataBinding (object sender, EventArgs args)
+               {
+                       TableCell cell = (TableCell)sender;
+                       HyperLink ctrl = (HyperLink)cell.Controls[0];
+                       DataGridItem item = (DataGridItem)cell.NamingContainer;
+
+                       if (DataNavigateUrlField != "")
+                               ctrl.NavigateUrl = FormatDataNavigateUrlValue (DataBinder.Eval (item.DataItem, DataNavigateUrlField));
+                       else
+                               ctrl.NavigateUrl = NavigateUrl;
+
+                       if (DataTextField != "")
+                               ctrl.Text = FormatDataTextValue (DataBinder.Eval (item.DataItem, DataTextField));
+                       else
+                               ctrl.Text = Text;
+
+                       ctrl.Target = Target;
+               }
+
+               public override void InitializeCell (TableCell cell, int column_index, ListItemType item_type)
+               {
+                       base.InitializeCell (cell, column_index, item_type);
+
+                       switch (item_type)
+                       {
+                       case ListItemType.Separator: 
+                       case ListItemType.Pager:
+                       case ListItemType.Footer:
+                       case ListItemType.Header: {
+                               // Base handles header and footer, dunno about the others
+                               return;
+                       }
+                       case ListItemType.Item:
+                       case ListItemType.EditItem:
+                       case ListItemType.AlternatingItem:
+                               cell.DataBinding += ItemDataBinding;
+                               cell.Controls.Add (new HyperLink ());
+                               break;
+                       }
+               }
+        }
+}
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 (file)
index 0000000..ca40c4a
--- /dev/null
@@ -0,0 +1,73 @@
+//
+// System.Web.UI.WebControls.RegularExpressionValidator
+//
+// Authors:
+//     Chris Toshok (toshok@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.ComponentModel;
+using System.Web;
+using System.Web.UI.WebControls;
+using System.Text.RegularExpressions;
+
+namespace System.Web.UI.WebControls {
+       [ToolboxData ("<{0}:RegularExpressionValidator runat=server ErrorMessage=\"RegularExpressionValidator\"></{0}:RegularExpressionValidator>")]
+       public class RegularExpressionValidator : BaseValidator
+       {
+               public RegularExpressionValidator ()
+               {
+               }
+
+               protected override void AddAttributesToRender (HtmlTextWriter w)
+               {
+                       if (RenderUplevel) {
+                               w.AddAttribute ("evaluationfunction", "RegularExpressionValidatorEvaluateIsValid");
+                               if (ValidationExpression != "")
+                                       w.AddAttribute ("validationexpression", ValidationExpression);
+                       }
+
+                       base.AddAttributesToRender (w);
+               }
+
+               protected override bool EvaluateIsValid ()
+               {
+                       if (GetControlValidationValue (ControlToValidate).Trim() == "")
+                               return true;
+
+                       return Regex.IsMatch (GetControlValidationValue(ControlToValidate), ValidationExpression);
+               }
+
+               [Bindable(true)]
+               [DefaultValue ("")]
+               [Editor ("System.Web.UI.Design.WebControls.RegexTypeEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+               public string ValidationExpression {
+                       get {
+                               return ViewState.GetString ("ValidationExpression", "");
+                       }
+                       set {
+                               ViewState ["ValidationExpression"] = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceCommandType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceCommandType.cs
new file mode 100644 (file)
index 0000000..a991e2d
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// System.Web.UI.WebControls.SqlDataSourceCommandType
+//
+// Authors:
+//     Chris Toshok (toshok@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
+namespace System.Web.UI.WebControls {
+
+       public enum SqlDataSourceCommandType
+       {
+               StoredProcedure,
+               Text
+       }
+
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceFilteringEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceFilteringEventArgs.cs
new file mode 100644 (file)
index 0000000..decb8df
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// System.Web.UI.WebControls.SqlDataSourceFilteringEventArgs
+//
+// Authors:
+//     Chris Toshok (toshok@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.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+       public class SqlDataSourceFilteringEventArgs :  CancelEventArgs
+       {
+               public SqlDataSourceFilteringEventArgs (IOrderedDictionary param_values)
+               {
+                       this.param_values = param_values;
+               }
+
+               public IOrderedDictionary ParameterValues
+               {
+                       get {
+                               return param_values;
+                       }
+               }
+
+               IOrderedDictionary param_values;
+       }
+}
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceFilteringEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceFilteringEventHandler.cs
new file mode 100644 (file)
index 0000000..e70264e
--- /dev/null
@@ -0,0 +1,34 @@
+//
+// System.Web.UI.WebControls.SqlDataSourceFilteringEventHandler
+//
+// Authors:
+//     Chris Toshok (toshok@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
+namespace System.Web.UI.WebControls {
+       public delegate void SqlDataSourceFilteringEventHandler (object sender, SqlDataSourceFilteringEventArgs e);
+}
+#endif
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 (file)
index 0000000..3aa6fcd
--- /dev/null
@@ -0,0 +1,436 @@
+//
+// 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;
+               }
+
+               [Obsolete ("Use GetPostBackEventReference instead")]
+               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, 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.UniqueID, argument, clientCallback, context, null, false);
+               }
+
+               public string GetCallbackEventReference (Control control, string argument, string clientCallback, string context, bool useAsync)
+               {
+                       return GetCallbackEventReference (control.UniqueID, argument, clientCallback, context, null, useAsync);
+               }
+
+               public string GetCallbackEventReference (Control control, string argument, string clientCallback, string context, string clientErrorCallback, bool useAsync)
+               {
+                       return GetCallbackEventReference (control.UniqueID, argument, clientCallback, context, clientErrorCallback, useAsync);
+               }
+
+               public string GetCallbackEventReference (string target, string argument, string clientCallback, string context, string clientErrorCallback, bool useAsync)
+               {
+                       if (!IsClientScriptIncludeRegistered (typeof(Page), "callback"))
+                               RegisterClientScriptInclude (typeof(Page), "callback", GetWebResourceUrl (typeof(Page), "callback.js"));
+                       
+                       return string.Format ("WebForm_DoCallback ('{0}', {1}, {2}, {3}, {4})", target, argument, clientCallback, context, clientErrorCallback);
+               }
+#endif
+               
+#if NET_2_0
+               public
+#else
+               internal
+#endif
+               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); 
+               }
+               
+
+               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);
+               }
+
+#if NET_2_0
+               [MonoTODO]
+               public void RegisterClientScriptResource (Type type, string resourceName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void RegisterExpandoAttribute (string controlId, 
+                                                     string name, 
+                                                     string value)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void RegisterExpandoAttribute(string controlId, 
+                                                    string attributeName, 
+                                                    string attributeValue, 
+                                                    bool encode)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
+               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 GetClientValidationEvent ()
+               {
+                       return "if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate();";
+               }
+
+
+               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/DataBinder.cs b/mcs/class/System.Web/System.Web.UI/DataBinder.cs
new file mode 100644 (file)
index 0000000..6d5512f
--- /dev/null
@@ -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 ()
+               {
+               }
+
+               internal 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/Page.cs b/mcs/class/System.Web/System.Web.UI/Page.cs
new file mode 100644 (file)
index 0000000..0bb2f32
--- /dev/null
@@ -0,0 +1,1507 @@
+//
+// 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;
+using System.Web.UI.HtmlControls;
+using System.Web.UI.WebControls;
+
+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 ("Microsoft.VSDesigner.WebForms.WebFormDesigner, " + Consts.AssemblyMicrosoft_VSDesigner, typeof (IRootDesigner))]
+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 {
+                       if (_context != null)
+                               return _context.Request;
+
+                       throw new HttpException("Request is not available without context");
+               }
+       }
+
+       [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.GetPostBackEventReference (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 object GetSavedViewState ()
+       {
+               return _savedViewState;
+       }
+
+       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 {}
+                       if (Thread.CurrentThread.CurrentCulture.Equals (culture) == false)
+                               Thread.CurrentThread.CurrentCulture = culture;
+
+                       if (Thread.CurrentThread.CurrentUICulture.Equals (uiculture) == false)
+                               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);
+       }
+
+       internal string GetSubmitStatements ()
+       {
+               return scriptManager.WriteSubmitStatements ();
+       }
+
+       [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);
+       }
+
+       internal virtual bool AreValidatorsUplevel ()
+       {
+               bool uplevel = false;
+
+               foreach (IValidator v in Validators) {
+                       BaseValidator bv = v as BaseValidator;
+                       if (bv == null) continue;
+
+                       if (bv.GetRenderUplevel()) {
+                               uplevel = true;
+                               break;
+                       }
+               }
+
+               return uplevel;
+       }
+
+       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;
+       }
+
+       bool rendering_trace;
+       internal void SetRenderingTrace (bool val)
+       {
+               rendering_trace = true;
+       }
+
+       [EditorBrowsable (EditorBrowsableState.Advanced)]
+       public virtual void VerifyRenderingInServerForm (Control control)
+       {
+               // When calling RenderControl in Trace to figure out the size this won't throw.
+               if (rendering_trace)
+                       return;
+
+               if (!renderingForm)
+                       throw new HttpException ("Control '" +
+                                                control.ClientID +
+                                                "' of type '" +
+                                                control.GetType ().Name +
+                                                "' must be placed inside a form tag with runat=server.");
+       }
+       
+       #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 ();
+       int event_mask;
+       const int initcomplete_mask = 1;
+       const int loadcomplete_mask = 1 << 1;
+       const int preinit_mask = 1 << 2;
+       const int preload_mask = 1 << 3;
+       const int prerendercomplete_mask = 1 << 4;
+       const int savestatecomplete_mask = 1 << 5;
+       
+       public event EventHandler InitComplete {
+               add {
+                       event_mask |= initcomplete_mask;
+                       Events.AddHandler (InitCompleteEvent, value);
+               }
+               remove { Events.RemoveHandler (InitCompleteEvent, value); }
+       }
+       
+       public event EventHandler LoadComplete {
+               add {
+                       event_mask |= loadcomplete_mask;
+                       Events.AddHandler (LoadCompleteEvent, value);
+               }
+               remove { Events.RemoveHandler (LoadCompleteEvent, value); }
+       }
+       
+       public event EventHandler PreInit {
+               add {
+                       event_mask |= preinit_mask;
+                       Events.AddHandler (PreInitEvent, value);
+               }
+               remove { Events.RemoveHandler (PreInitEvent, value); }
+       }
+       
+       public event EventHandler PreLoad {
+               add {
+                       event_mask |= preload_mask;
+                       Events.AddHandler (PreLoadEvent, value);
+               }
+               remove { Events.RemoveHandler (PreLoadEvent, value); }
+       }
+       
+       public event EventHandler PreRenderComplete {
+               add {
+                       event_mask |= prerendercomplete_mask;
+                       Events.AddHandler (PreRenderCompleteEvent, value);
+               }
+               remove { Events.RemoveHandler (PreRenderCompleteEvent, value); }
+       }
+       
+       public event EventHandler SaveStateComplete {
+               add {
+                       event_mask |= savestatecomplete_mask;
+                       Events.AddHandler (SaveStateCompleteEvent, value);
+               }
+               remove { Events.RemoveHandler (SaveStateCompleteEvent, value); }
+       }
+       
+       protected virtual void OnInitComplete (EventArgs e)
+       {
+               if ((event_mask & initcomplete_mask) != 0) {
+                       EventHandler eh = (EventHandler) (Events [InitCompleteEvent]);
+                       if (eh != null) eh (this, e);
+               }
+       }
+       
+       protected virtual void OnLoadComplete (EventArgs e)
+       {
+               if ((event_mask & loadcomplete_mask) != 0) {
+                       EventHandler eh = (EventHandler) (Events [LoadCompleteEvent]);
+                       if (eh != null) eh (this, e);
+               }
+       }
+       
+       protected virtual void OnPreInit (EventArgs e)
+       {
+               if ((event_mask & preinit_mask) != 0) {
+                       EventHandler eh = (EventHandler) (Events [PreInitEvent]);
+                       if (eh != null) eh (this, e);
+               }
+       }
+       
+       protected virtual void OnPreLoad (EventArgs e)
+       {
+               if ((event_mask & preload_mask) != 0) {
+                       EventHandler eh = (EventHandler) (Events [PreLoadEvent]);
+                       if (eh != null) eh (this, e);
+               }
+       }
+       
+       protected virtual void OnPreRenderComplete (EventArgs e)
+       {
+               if ((event_mask & prerendercomplete_mask) != 0) {
+                       EventHandler eh = (EventHandler) (Events [PreRenderCompleteEvent]);
+                       if (eh != null) eh (this, e);
+               }
+       }
+       
+       protected virtual void OnSaveStateComplete (EventArgs e)
+       {
+               if ((event_mask & savestatecomplete_mask) != 0) {
+                       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;
+       }
+
+
+       protected internal void AddContentTemplate (string templateName, ITemplate template)
+       {
+               Master.AddContentTemplate (templateName, template);
+       }
+               
+       #endif
+}
+}
diff --git a/mcs/class/System.Web/System.Web/HttpBrowserCapabilities.cs b/mcs/class/System.Web/System.Web/HttpBrowserCapabilities.cs
new file mode 100644 (file)
index 0000000..310649e
--- /dev/null
@@ -0,0 +1,462 @@
+// 
+// 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;
+                       }
+               }
+
+               public Version EcmaScriptVersion {
+                       get {
+                               if (!Get (HaveEcmaScriptVersion)) {
+                                       string ver_str;
+                                       Set (HaveEcmaScriptVersion);
+                                       ver_str = this ["ecmascriptversion"];
+                                       if (ver_str == null)
+                                               ecmaScriptVersion = new Version (0, 0);
+                                       else
+                                               ecmaScriptVersion = new Version (ver_str);
+                               }
+
+                               return ecmaScriptVersion;
+                       }
+               }
+
+               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;
+                       }
+               }
+
+               public Version W3CDomVersion {
+                       get {
+                               if (!Get (HaveW3CDomVersion)) {
+                                       string ver_str;
+                                       Set (HaveW3CDomVersion);
+                                       ver_str = this ["w3cdomversion"];
+                                       if (ver_str == null)
+                                               w3CDomVersion = new Version (0, 0);
+                                       else
+                                               w3CDomVersion = new Version (ver_str);
+                               }
+
+                               return w3CDomVersion;
+                       }
+               }
+
+               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/HttpCacheVaryByHeaders.cs b/mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs
new file mode 100644 (file)
index 0000000..85b9ee4
--- /dev/null
@@ -0,0 +1,175 @@
+//
+// System.Web.HttpVaryByHeaders.cs 
+//
+// Author:
+//     Chris Toshok (toshok@novell.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.Collections;
+
+namespace System.Web {
+
+       public sealed class HttpCacheVaryByHeaders {
+
+               /* I would have much rather seen this class just use the
+                * Hashtable, and have the getter/setters for the builtin
+                * fields just manipulate that Hashtable, but that doesn't
+                * appear to work in MS's implementation.  If you do:
+                *
+                *         vary_by_hdrs["User-Agent"] = true;
+                *
+                * then
+                *
+                *         (vary_by_hdrs.UserAgent == true)
+                *
+                * will be false, which is completely counterintuitive
+                * and broken. The same holds true in reverse:
+                *
+                *         vary_by_hdrs.UserAgent = true;
+                *
+                * does not mean
+                *
+                *         vary_by_hdrs["User-Agent"] == true.
+                */
+               bool vary_by_unspecified;
+
+               bool vary_by_accept;
+               bool vary_by_user_agent;
+               bool vary_by_user_charset;
+               bool vary_by_user_language;
+
+               Hashtable fields;
+
+               internal HttpCacheVaryByHeaders ()
+               {
+                       /* the field names are meant to be case insensitive */
+                       fields = new Hashtable(CaseInsensitiveHashCodeProvider.Default,
+                                              CaseInsensitiveComparer.Default);
+               }
+
+               internal string[] GetHeaderNames ()
+               {
+                       string[] names;
+
+                       if (vary_by_unspecified) {
+                               names = new string[1];
+                               names[0] = "*";
+                       }
+                       else {
+                               int builtin_count = ((vary_by_accept ? 1 : 0)
+                                                    + (vary_by_user_agent ? 1 : 0)
+                                                    + (vary_by_user_charset ? 1 : 0)
+                                                    + (vary_by_user_language ? 1 : 0));
+
+                               names = new string [fields.Count + builtin_count];
+
+                               int i = 0;
+                               if (vary_by_accept) names[i++] = "Accept";
+                               if (vary_by_user_agent) names[i++] = "User-Agent";
+                               if (vary_by_user_charset) names[i++] = "Accept-Charset";
+                               if (vary_by_user_language) names[i++] = "Accept-Language";
+
+                               fields.Keys.CopyTo (names, builtin_count);
+                       }
+
+                       return names;
+               }
+
+               public bool AcceptTypes {
+                       get {
+                               return vary_by_accept;
+                       }
+                       set {
+                               vary_by_unspecified = false;
+                               vary_by_accept = value;
+                       }
+               }
+
+               public bool UserAgent {
+                       get {
+                               return vary_by_user_agent;
+                       }
+                       set {
+                               vary_by_unspecified = false;
+                               vary_by_user_agent = value;
+                       }
+               }
+
+               public bool UserCharSet {
+                       get {
+                               return vary_by_user_charset;
+                       }
+                       set {
+                               vary_by_unspecified = false;
+                               vary_by_user_charset = value;
+                       }
+               }
+
+               public bool UserLanguage {
+                       get {
+                               return vary_by_user_language;
+                       }
+                       set {
+                               vary_by_unspecified = false;
+                               vary_by_user_language = value;
+                       }
+               }
+
+               public bool this [ string header ] {
+                       get {
+                               if (header == null)
+                                       throw new ArgumentNullException ();
+
+                               return fields.Contains (header);
+                       }
+                       set {
+                               if (header == null)
+                                       throw new ArgumentNullException ();
+
+                               vary_by_unspecified = false;
+                               if (value)
+                                       if (!fields.Contains (header))
+                                               fields.Add (header, true);
+                               else
+                                       fields.Remove (header);
+                       }
+               }
+
+               public void VaryByUnspecifiedParameters ()
+               {
+                       fields.Clear();
+
+                       vary_by_unspecified =
+                         vary_by_accept = 
+                         vary_by_user_agent =
+                         vary_by_user_charset =
+                         vary_by_user_language = false;
+
+                       vary_by_unspecified = true;
+               }
+       }
+
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs b/mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs
new file mode 100644 (file)
index 0000000..a422e78
--- /dev/null
@@ -0,0 +1,101 @@
+//
+// System.Web.HttpVaryByParams.cs 
+//
+// Author:
+//     Chris Toshok (toshok@novell.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.Collections;
+using System.Text;
+
+namespace System.Web {
+
+       public sealed class HttpCacheVaryByParams {
+
+               bool ignore_parms;
+               Hashtable parms;
+
+               internal HttpCacheVaryByParams ()
+               {
+                       /* the parameter names are meant to be case insensitive */
+                       parms = new Hashtable(CaseInsensitiveHashCodeProvider.Default,
+                                             CaseInsensitiveComparer.Default);
+               }
+
+               internal string[] GetParamNames ()
+               {
+                       string[] names;
+
+                       names = new string [parms.Count];
+
+                       parms.Keys.CopyTo (names, 0);
+
+                       return names;
+               }
+
+               internal BaseResponseHeader GetResponseHeader ()
+               {
+                       StringBuilder builder = new StringBuilder ("");
+
+                       foreach (string parm in parms.Keys) {
+                               builder.Append (parm);
+                               builder.Append ("; ");
+                       }
+
+                       return new UnknownResponseHeader ("Vary", builder.ToString());
+               }
+
+               public bool IgnoreParams {
+                       get {
+                               return ignore_parms;
+                       }
+                       set {
+                               ignore_parms = value;
+                       }
+               }
+
+               public bool this [ string param ] {
+                       get {
+                               if (param == null)
+                                       throw new ArgumentNullException ();
+
+                               return parms.Contains (param);
+                       }
+                       set {
+                               if (param == null)
+                                       throw new ArgumentNullException ();
+
+                               ignore_parms = false;
+                               if (value)
+                                       if (!parms.Contains (param))
+                                               parms.Add (param, true);
+                               else
+                                       parms.Remove (param);
+                       }
+               }
+       }
+
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCookie.cs b/mcs/class/System.Web/System.Web/HttpCookie.cs
new file mode 100644 (file)
index 0000000..7b3a676
--- /dev/null
@@ -0,0 +1,241 @@
+//
+// System.Web.HttpCookie.cs 
+//
+// Author:
+//     Chris Toshok (toshok@novell.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.Collections.Specialized;
+
+namespace System.Web {
+
+       public sealed class HttpCookie {
+
+               string path = "/";
+               string domain;
+               DateTime expires = DateTime.MinValue;
+               string name;
+               bool secure;
+               NameValueCollection values;
+
+               [Obsolete]
+               internal HttpCookie (string name, string value, string path, DateTime expires)
+               {
+                       this.name = name;
+                       this.values = new CookieNVC();
+                       this.Value = value;
+                       this.path = path;
+                       this.expires = expires;
+               }
+
+               public HttpCookie (string name)
+               {
+                       this.name = name;
+                       values = new CookieNVC();
+                       Value = "";
+               }
+
+               public HttpCookie (string name, string value)
+                 : this (name)
+               {
+                       Value = value;
+               }
+
+               internal BaseResponseHeader GetCookieHeader ()
+               {
+                       StringBuilder builder = new StringBuilder ("");
+
+                       builder.Append (name);
+                       builder.Append ("=");
+                       builder.Append (Value);
+
+                       if (domain != null) {
+                               builder.Append ("; domain=");
+                               builder.Append (domain);
+                       }
+              
+                       if (path != null) {
+                               builder.Append ("; path=");
+                               builder.Append (path);
+                       }
+
+                       if (expires != DateTime.MinValue) {
+                               builder.Append ("; expires=");
+                               builder.Append (expires.ToUniversalTime().ToString("r"));
+                       }
+
+                       if (secure) {
+                               builder.Append ("; secure");
+                       }
+
+                       return new UnknownResponseHeader ("Set-Cookie", builder.ToString());
+               }
+
+               public string Domain {
+                       get {
+                               return domain;
+                       }
+                       set {
+                               domain = value;
+                       }
+               }
+
+               public DateTime Expires {
+                       get {
+                               return expires;
+                       }
+                       set {
+                               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 {
+                               return values.ToString ();
+                       }
+                       set {
+                               values.Clear ();
+                               
+                               if (value != null && value != "") {
+                                       string [] components = value.Split ('&');
+                                       foreach (string kv in components){
+                                               int pos = kv.IndexOf ('=');
+                                               if (pos == -1){
+                                                       values.Add (null, kv);
+                                               } else {
+                                                       string key = kv.Substring (0, pos);
+                                                       string val = kv.Substring (pos+1);
+                                                       
+                                                       values.Add (key, val);
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               public NameValueCollection Values {
+                       get {
+                               return values;
+                       }
+               }
+
+
+               /*
+                * simple utility class that just overrides ToString
+                * to get the desired behavior for
+                * HttpCookie.Values
+                */
+               class CookieNVC : NameValueCollection
+               {
+                       public override string ToString ()
+                       {
+                               StringBuilder builder = new StringBuilder ("");
+
+                               bool first_key = true;
+                               foreach (string key in Keys) {
+                                       if (!first_key)
+                                               builder.Append ("&");
+
+                                       bool first_val = true;
+                                       foreach (string v in GetValues (key)) {
+                                               if (!first_val)
+                                                       builder.Append ("&");
+
+                                               if (key != null) {
+                                                       builder.Append (key);
+                                                       builder.Append ("=");
+                                               }
+                                               builder.Append (v);
+                                               first_val = false;
+                                       }
+                                       first_key = false;
+                               }
+
+                               return builder.ToString();
+                       }
+
+                       /* MS's implementation has the interesting quirk that if you do:
+                        * cookie.Values[null] = "foo"
+                        * it clears out the rest of the values.
+                        */
+                       public override void Set (string name, string value)
+                       {
+                               if (this.IsReadOnly)
+                                       throw new NotSupportedException ("Collection is read-only");
+
+                               if (name == null)
+                                       Clear();
+
+                               base.Set (name, value);
+                       }
+               }
+       }
+
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCookieCollection.cs b/mcs/class/System.Web/System.Web/HttpCookieCollection.cs
new file mode 100644 (file)
index 0000000..b668291
--- /dev/null
@@ -0,0 +1,161 @@
+//
+// System.Web.HttpCookieCollection.cs 
+//
+// Author:
+//     Chris Toshok (toshok@novell.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.Collections.Specialized;
+
+namespace System.Web {
+
+       public sealed class HttpCookieCollection : NameObjectCollectionBase {
+
+               private bool auto_fill = false;
+
+               [Obsolete ("Don't use this constructor, use the (bool, bool) one, as it's more clear what it does")]
+               internal HttpCookieCollection (HttpResponse Response, bool ReadOnly)
+               {
+                       auto_fill = Response != null;
+                       IsReadOnly = ReadOnly;
+               }
+
+               internal HttpCookieCollection (bool auto_fill, bool read_only)
+               {
+                       this.auto_fill = auto_fill;
+                       IsReadOnly = read_only;
+               }
+
+               internal HttpCookieCollection (string cookies)
+               {
+                       if (cookies == null || cookies == "")
+                               return;
+
+                       string[] cookie_components = cookies.Split (';');
+                       foreach (string kv in cookie_components) {
+                               int pos = kv.IndexOf ('=');
+                               if (pos == -1) {
+                                       /* XXX ugh */
+                                       continue;
+                               }
+                               else {
+                                       string key = kv.Substring (0, pos);
+                                       string val = kv.Substring (pos+1);
+
+                                       Add (new HttpCookie (key.Trim (), val.Trim()));
+                               }
+                       }
+               }
+
+               public HttpCookieCollection ()
+               {
+               }
+
+               public void Add (HttpCookie cookie)
+               {
+                       if (BaseGet (cookie.Name) != null)
+                               return;
+
+                       BaseAdd (cookie.Name, cookie);
+               }
+
+               public void Clear ()
+               {
+                       BaseClear ();
+               }
+
+               public void CopyTo (Array array, int index)
+               {
+                       /* XXX this is kind of gross and inefficient
+                        * since it makes a copy of the superclass's
+                        * list */
+                       object[] values = BaseGetAllValues();
+                       values.CopyTo (array, index);
+               }
+
+               public string GetKey (int index)
+               {
+                       HttpCookie cookie = (HttpCookie)BaseGet (index);
+                       if (cookie == null)
+                               return null;
+                       else
+                               return cookie.Name;
+               }
+
+               public void Remove (string name)
+               {
+                       BaseRemove (name);
+               }
+
+               public void Set (HttpCookie cookie)
+               {
+                       BaseSet (cookie.Name, cookie);
+               }
+
+               public HttpCookie Get (int index)
+               {
+                       return (HttpCookie)BaseGet (index);
+               }
+
+               public HttpCookie Get (string name)
+               {
+                       return (HttpCookie)BaseGet (name);
+               }
+
+               public HttpCookie this [int index]
+               {
+                       get {
+                               return (HttpCookie)BaseGet (index);
+                       }
+               }
+
+               public HttpCookie this [string name]
+               {
+                       get {
+                               HttpCookie cookie = (HttpCookie)BaseGet (name);
+                               if (!IsReadOnly && auto_fill && cookie == null) {
+                                       cookie = new HttpCookie (name);
+                                       BaseAdd (name, cookie);
+                               }
+                               return cookie;
+                       }
+               }
+
+               public string[] AllKeys {
+                       get {
+                               /* XXX another inefficient copy due to
+                                * lack of exposure from the base
+                                * class */
+                               string[] keys = new string [Keys.Count];
+                               for (int i = 0; i < Keys.Count; i ++)
+                                       keys[i] = Keys[i];
+                               
+                               return keys;
+                       }
+               }
+       }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpFileCollection.cs b/mcs/class/System.Web/System.Web/HttpFileCollection.cs
new file mode 100644 (file)
index 0000000..7b486f8
--- /dev/null
@@ -0,0 +1,89 @@
+//
+// System.Web.HttpFileCollection.cs
+//
+// Author:
+//     Chris Toshok (toshok@novell.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.Collections.Specialized;
+
+namespace System.Web {
+
+       public sealed class HttpFileCollection : NameObjectCollectionBase
+       {
+               internal HttpFileCollection ()
+               {
+               }
+
+               internal void AddFile (string name, HttpPostedFile file)
+               {
+                       BaseAdd (name, file);
+               }
+
+               public void CopyTo (Array dest, int index)
+               {
+                       /* XXX this is kind of gross and inefficient
+                        * since it makes a copy of the superclass's
+                        * list */
+                       object[] values = BaseGetAllValues();
+                       values.CopyTo (dest, index);
+               }
+
+               public string GetKey (int index)
+               {
+                       return BaseGetKey (index);
+               }
+
+               public HttpPostedFile Get (int index)
+               {
+                       return (HttpPostedFile)BaseGet (index);
+               }
+
+               public HttpPostedFile Get (string key)
+               {
+                       return (HttpPostedFile)BaseGet (key);
+               }
+
+               public HttpPostedFile this [string key] {
+                       get {
+                               return Get (key);
+                       }
+               }
+
+               public HttpPostedFile this [int index] {
+                       get {
+                               return Get (index);
+                       }
+               }
+
+               public string[] AllKeys {
+                       get {
+                               return BaseGetAllKeys();
+                       }
+               }
+       }
+
+}
diff --git a/mcs/class/System.Web/System.Web/HttpModuleCollection.cs b/mcs/class/System.Web/System.Web/HttpModuleCollection.cs
new file mode 100644 (file)
index 0000000..642793f
--- /dev/null
@@ -0,0 +1,89 @@
+//
+// System.Web.HttpModuleCollection.cs
+//
+// Author:
+//     Chris Toshok (toshok@novell.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.Collections.Specialized;
+
+namespace System.Web {
+
+       public sealed class HttpModuleCollection : NameObjectCollectionBase
+       {
+               internal HttpModuleCollection ()
+               {
+               }
+
+               internal void AddModule (string key, IHttpModule m)
+               {
+                       BaseAdd (key, m);
+               }
+
+               public void CopyTo (Array dest, int index)
+               {
+                       /* XXX this is kind of gross and inefficient
+                        * since it makes a copy of the superclass's
+                        * list */
+                       object[] values = BaseGetAllValues();
+                       values.CopyTo (dest, index);
+               }
+         
+               public string GetKey (int index)
+               {
+                       return BaseGetKey (index);
+               }
+
+               public IHttpModule Get (int index)
+               {
+                       return (IHttpModule)BaseGet (index);
+               }
+
+               public IHttpModule Get (string key)
+               {
+                       return (IHttpModule)BaseGet (key);
+               }
+
+               public IHttpModule this [string key] {
+                       get {
+                               return Get (key);
+                       }
+               }
+
+               public IHttpModule this [int index] {
+                       get {
+                               return Get (index);
+                       }
+               }
+
+               public string[] AllKeys {
+                       get {
+                               return BaseGetAllKeys();
+                       }
+               }
+       }
+
+}
diff --git a/mcs/class/System.Web/System.Web/HttpResponseHeader.cs b/mcs/class/System.Web/System.Web/HttpResponseHeader.cs
new file mode 100644 (file)
index 0000000..82e30af
--- /dev/null
@@ -0,0 +1,76 @@
+//
+// System.Web.HttpResponseHeader.cs 
+//
+// Author:
+//     Chris Toshok (toshok@novell.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.Collections;
+using System.Text;
+
+namespace System.Web {
+
+       internal abstract class BaseResponseHeader {
+               public string Value;
+         
+               internal BaseResponseHeader (string val)
+               {
+                       Value = val;
+               }
+
+               internal abstract void SendContent (HttpWorkerRequest wr);
+       }
+
+       internal sealed class KnownResponseHeader : BaseResponseHeader {
+               public int ID;
+
+               internal KnownResponseHeader (int ID, string val) : base (val)
+               {
+                       this.ID = ID;
+               }
+
+               internal override void SendContent (HttpWorkerRequest wr)
+               {
+                       wr.SendKnownResponseHeader (ID, Value);
+               }
+       }
+
+       internal  class UnknownResponseHeader : BaseResponseHeader {
+               public string Name;
+
+               public UnknownResponseHeader (string name, string val) : base (val)
+               {
+                       Name = name;
+               }
+       
+               internal override void SendContent (HttpWorkerRequest wr)
+               {
+                       wr.SendUnknownResponseHeader (Name, Value);
+               }
+               
+       }
+}
+