2004-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Fri, 4 Jun 2004 04:01:07 +0000 (04:01 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Fri, 4 Jun 2004 04:01:07 +0000 (04:01 -0000)
* System.Web/HttpRequest.cs: added ClientTarget internal property.

* System.Web.Compilation/PageCompiler.cs: override CreateConstructor
to add assignment for ClientTarget.

* System.Web.Configuration/HttpCapabilitiesBase.cs: ClientTarget takes
precedence over UserAgent.

* System.Web.UI/Page.cs: implemented ClientTarget.
* System.Web.UI/PageParser.cs: support for clientTarget and check for
validity.

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

mcs/class/System.Web/System.Web.Compilation/ChangeLog
mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs
mcs/class/System.Web/System.Web.Configuration/ChangeLog
mcs/class/System.Web/System.Web.Configuration/HttpCapabilitiesBase.cs
mcs/class/System.Web/System.Web.UI/ChangeLog
mcs/class/System.Web/System.Web.UI/Page.cs
mcs/class/System.Web/System.Web.UI/PageParser.cs
mcs/class/System.Web/System.Web/ChangeLog
mcs/class/System.Web/System.Web/HttpRequest.cs

index 306a075e387b87bb235dd7fe030135fd6f2e30f3..c3aa9bb6c7a077d303300a3ab37ef215c6e6877a 100644 (file)
@@ -1,3 +1,8 @@
+2004-06-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * PageCompiler.cs: override CreateConstructor to add assignment for
+       ClientTarget.
+       
 2004-06-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * TemplateControlCompiler.cs: use CodeDelegateCreateExpression instead
index 9cd8933c61bda779957c07677745f9569f16f1c1..a29f11bd6d4322c7ed2545cac634878e3ed90cfb 100644 (file)
@@ -28,6 +28,21 @@ namespace System.Web.Compilation
                        this.pageParser = pageParser;
                }
 
+               protected override void CreateConstructor (CodeStatementCollection localVars,
+                                                       CodeStatementCollection trueStmt)
+               {
+                       if (pageParser.ClientTarget != null) {
+                               CodeExpression prop;
+                               prop = new CodePropertyReferenceExpression (thisRef, "ClientTarget");
+                               CodeExpression ct = new CodePrimitiveExpression (pageParser.ClientTarget);
+                               if (localVars == null)
+                                       localVars = new CodeStatementCollection ();
+                               localVars.Add (new CodeAssignStatement (prop, ct));
+                       }
+
+                       base.CreateConstructor (localVars, trueStmt);
+               }
+               
                protected override void AddInterfaces () 
                {
                        base.AddInterfaces ();
index 0c46e5c889bbc254368dbde718f07b092b3aeb6c..6428eca97149654f77836f4fc0a64a70dcf59172 100644 (file)
@@ -1,3 +1,7 @@
+2004-06-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpCapabilitiesBase.cs: ClientTarget takes precedence over UserAgent.
+
 2004-06-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * WebConfigurationSettings.cs: when the virtual path is not /, don't
index 52259e2df9ad90c70ac71a31685d7fc5ffdda8b1..656ef34a9573c2819dbccb11150357542f858154 100644 (file)
@@ -5,7 +5,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002 Ximian, Inc (http://www.ximian.com)
-// (C) 2003 Novell, Inc (http://www.novell.com)
+// (C) 2003,2004 Novell, Inc (http://www.novell.com)
 //
 
 namespace System.Web.Configuration
@@ -26,7 +26,10 @@ namespace System.Web.Configuration
 
                public static HttpCapabilitiesBase GetConfigCapabilities (string configKey, HttpRequest request)
                {
-                       string ua = request.UserAgent;
+                       string ua = request.ClientTarget;
+                       if (ua == null)
+                               ua = request.UserAgent;
+
                        HttpBrowserCapabilities bcap = new HttpBrowserCapabilities ();
                        bcap.capabilities = CapabilitiesLoader.GetCapabilities (ua);
                        bcap.Init ();
index 8dcb2e2e3de3fccea092d21d88906c2fc0f5cd13..0a077659191c7653aecde2d2b2945c6ebc5ee190 100644 (file)
@@ -1,3 +1,8 @@
+2004-06-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * Page.cs: implemented ClientTarget.
+       * PageParser.cs: support for clientTarget and check for validity.
+
 2004-06-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * Control.cs:
index ad42b085ae13f8ed2baa23620c3f9f0eb4e4a316..469a5bf85927a0e29d8552d0135972d12a7cb1fe 100755 (executable)
@@ -61,6 +61,7 @@ public class Page : TemplateControl, IHttpHandler
        bool handleViewState;
        string viewStateUserKey;
        NameValueCollection _requestValueCollection;
+       string clientTarget;
 
        [EditorBrowsable (EditorBrowsableState.Never)]
        protected const string postEventArgumentID = "__EVENTARGUMENT";
@@ -103,14 +104,17 @@ public class Page : TemplateControl, IHttpHandler
                get { return _context.Cache; }
        }
 
-       [MonoTODO]
        [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 { throw new NotImplementedException (); }
-               set { throw new NotImplementedException (); }
+               get { return (clientTarget == null) ? "" : clientTarget; }
+               set {
+                       clientTarget = value;
+                       if (value == "")
+                               clientTarget = null;
+               }
        }
 
        [EditorBrowsable (EditorBrowsableState.Never)]
@@ -669,6 +673,9 @@ public class Page : TemplateControl, IHttpHandler
        public void ProcessRequest (HttpContext context)
        {
                _context = context;
+               if (clientTarget != null)
+                       Request.ClientTarget = clientTarget;
+
                WireupAutomaticEvents ();
                //-- Control execution lifecycle in the docs
 
index acb958abe232893a539d71ee9dae6c97ef7f29d3..e50f00e39eec71c7b141ea54cf9e0ad1d5bed62e 100644 (file)
@@ -8,6 +8,7 @@
 //
 using System;
 using System.Collections;
+using System.Collections.Specialized;
 using System.Globalization;
 using System.Text;
 using System.Web;
@@ -30,6 +31,7 @@ namespace System.Web.UI
                string uiculture;
                string errorPage;
                bool validateRequest;
+               string clientTarget;
                Type baseType = typeof (Page);
 
                public PageParser ()
@@ -191,10 +193,21 @@ namespace System.Web.UI
                        
                        errorPage = GetString (atts, "ErrorPage", null);
                        validateRequest = GetBool (atts, "ValidateRequest", PagesConfig.ValidateRequest);
+                       clientTarget = GetString (atts, "ClientTarget", null);
+                       if (clientTarget != null) {
+                               NameValueCollection coll;
+                               coll = (NameValueCollection) Context.GetConfig ("system.web/clientTarget");
+                               if (coll == null || coll [clientTarget] == null) {
+                                       ThrowParseException (String.Format (
+                                                       "ClientTarget '{0}' is an invalid alias. See the " +
+                                                       "documentation for <clientTarget> config. section.",
+                                                       clientTarget));
+                               }
+                               clientTarget = (string) coll [clientTarget];
+                       }
 
                        // Ignored by now
                        GetString (atts, "Buffer", null);
-                       GetString (atts, "ClientTarget", null);
                        GetString (atts, "EnableViewStateMac", null);
                        GetString (atts, "SmartNavigation", null);
 
@@ -276,6 +289,10 @@ namespace System.Web.UI
                internal bool ValidateRequest {
                        get { return validateRequest; }
                }
+
+               internal string ClientTarget {
+                       get { return clientTarget; }
+               }
        }
 }
 
index 0b15c9ec3766c765a2cc861db2cfd37a2b5d832d..eb404d33c707bff1b78e1dddf4d0b11e5e8e9246 100644 (file)
@@ -1,3 +1,7 @@
+2004-06-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpRequest.cs: added ClientTarget internal property.
+
 2004-06-03  Lluis Sanchez Gual <lluis@ximian.com>
 
        * HttpApplication.cs: Clear the http handler list after releasing the
index 3216c9ce5c32589200598f3c089990efe7340010..cbca55f94da6a87954a03aa98b81e31f8613c1da 100644 (file)
@@ -66,6 +66,7 @@ namespace System.Web {
                private bool rewritten;
                Stream userFilter;
                HttpRequestStream requestFilter;
+               string clientTarget;
 #if NET_1_1
                bool validateCookies;
                bool validateForm;
@@ -1198,6 +1199,16 @@ namespace System.Web {
                        headers.MakeReadOnly ();
                }
 
+               internal string ClientTarget {
+                       get { return clientTarget; }
+                       set {
+                               if (value != clientTarget) {
+                                       clientTarget = value;
+                                       _browser = null;
+                               }
+                       }
+               }
+
 #if NET_1_1
                static void ValidateNameValueCollection (string name, NameValueCollection coll)
                {