Implemented EnableScriptGlobalization and EnableScriptLocalization properties
authorIgor Zelmanovich <igorz@mono-cvs.ximian.com>
Wed, 20 Jun 2007 14:50:17 +0000 (14:50 -0000)
committerIgor Zelmanovich <igorz@mono-cvs.ximian.com>
Wed, 20 Jun 2007 14:50:17 +0000 (14:50 -0000)
svn path=/trunk/mcs/; revision=80317

mcs/class/System.Web.Extensions/System.Web.UI/ScriptManager.cs

index 5ed258001cb628e78be9e7aa93d570ae2c519668..4f1607c9ed88f1a39e3c85e1757f3293ae318dc7 100644 (file)
@@ -40,6 +40,7 @@ using System.Web.Configuration;
 using System.Web.UI.HtmlControls;
 using System.IO;
 using System.Globalization;
+using System.Threading;
 
 namespace System.Web.UI
 {
@@ -82,6 +83,8 @@ namespace System.Web.UI
                bool _isInAsyncPostBack;
                string _asyncPostBackSourceElementID;
                ScriptMode _scriptMode = ScriptMode.Auto;
+               bool _enableScriptGlobalization;
+               bool _enableScriptLocalization;
                
                [DefaultValue (true)]
                [Category ("Behavior")]
@@ -162,10 +165,10 @@ namespace System.Web.UI
                [Category ("Behavior")]
                public bool EnableScriptGlobalization {
                        get {
-                               throw new NotImplementedException ();
+                               return _enableScriptGlobalization;
                        }
                        set {
-                               throw new NotImplementedException ();
+                               _enableScriptGlobalization = value;
                        }
                }
 
@@ -173,10 +176,10 @@ namespace System.Web.UI
                [DefaultValue (false)]
                public bool EnableScriptLocalization {
                        get {
-                               throw new NotImplementedException ();
+                               return _enableScriptLocalization;
                        }
                        set {
-                               throw new NotImplementedException ();
+                               _enableScriptLocalization = value;
                        }
                }
 
@@ -354,6 +357,12 @@ namespace System.Web.UI
                        if (IsInAsyncPostBack) {
                                Page.SetRenderMethodDelegate (RenderPageCallback);
                        }
+
+                       if (EnableScriptGlobalization) {
+                               CultureInfo culture = Thread.CurrentThread.CurrentCulture;
+                               string script = null; // TODO: Json serialization of culture
+                               RegisterClientScriptBlock (this, typeof (ScriptManager), "ScriptGlobalization", script, true);
+                       }
                        
                        // Register Scripts
                        foreach (ScriptReference script in GetScriptReferences ()) {
@@ -420,12 +429,12 @@ namespace System.Web.UI
 
                public static void RegisterClientScriptBlock (Control control, Type type, string key, string script, bool addScriptTags)
                {
-                       throw new NotImplementedException ();
+                       RegisterClientScriptBlock (control.Page, type, key, script, addScriptTags);
                }
 
                public static void RegisterClientScriptBlock (Page page, Type type, string key, string script, bool addScriptTags)
                {
-                       throw new NotImplementedException ();
+                       page.ClientScript.RegisterClientScriptBlock (type, key, script, addScriptTags);
                }
 
                public static void RegisterClientScriptInclude (Control control, Type type, string key, string url)