From: Argiris K. <be...@us...> - 2006-02-09 13:41:11
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13863/Core Modified Files: AjaxCallHelper.cs AssemblyInfo.cs MagicAjaxModule.cs PageFilter.cs Util.cs Log Message: --If another form tag was added to page, MagicAjax did not work; fixed it --Corrected an encoding issue (solution provided by erivas) --Some controls with AutoPostBack set to 'true' were not working properly; fixed it --Set the version number to 0.3.0 Index: PageFilter.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/PageFilter.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PageFilter.cs 11 Jan 2006 20:27:32 -0000 1.10 --- PageFilter.cs 9 Feb 2006 13:40:59 -0000 1.11 *************** *** 124,128 **** _memStream.Read(buffer, 0, (int)_memStream.Length); ! _htmlPage = HttpContext.Current.Response.ContentEncoding.GetString(buffer); } return _htmlPage; --- 124,128 ---- _memStream.Read(buffer, 0, (int)_memStream.Length); ! _htmlPage = System.Text.Encoding.GetEncoding(HttpContext.Current.Response.ContentEncoding.CodePage).GetString(buffer); } return _htmlPage; Index: AjaxCallHelper.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/AjaxCallHelper.cs,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** AjaxCallHelper.cs 8 Feb 2006 20:46:00 -0000 1.30 --- AjaxCallHelper.cs 9 Feb 2006 13:40:59 -0000 1.31 *************** *** 521,525 **** #if NET_2_0 // Reflect head content (title and stylesheets) ! page.Header.SetRenderMethodDelegate(new RenderMethod(RenderHead)); #endif --- 521,526 ---- #if NET_2_0 // Reflect head content (title and stylesheets) ! if (page.Header != null) ! page.Header.SetRenderMethodDelegate(new RenderMethod(RenderHead)); #endif Index: Util.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/Util.cs,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Util.cs 6 Feb 2006 01:39:35 -0000 1.28 --- Util.cs 9 Feb 2006 13:40:59 -0000 1.29 *************** *** 24,27 **** --- 24,28 ---- using System.Web; using System.Web.UI; + using System.Web.UI.HtmlControls; using System.Security.Cryptography; using System.Text; *************** *** 36,40 **** { public const string ScriptPattern = "<script.[^>]*>"; ! public const string FormElementPattern = @"<(?<tag>input|textarea|select)\s+(?<attribute>(?<attrname>[-\w]+)=((""|')(?<attrvalue>.*?)(""|')\s*|(?<attrvalue>[-\w]+)\s*))*.*?(/>|>((?<inner>.*?)</\k'tag'>)?)"; public const string StyleElementPattern = @"<(?<tag>style|link)\s*(?<attribute>(?<attrname>[-\w]+)=((""|')(?<attrvalue>.*?)(""|')\s*|(?<attrvalue>[-\w]+)\s*))*.*?(/>|>(?<inner>.*?)</\k'tag'>)"; --- 37,41 ---- { public const string ScriptPattern = "<script.[^>]*>"; ! public const string FormElementPattern = @"<(?<tag>input|textarea|select)\s+(?<attribute>(?<attrname>[-\w]+)=(""(?<attrvalue>.*?)""\s*|'(?<attrvalue>.*?)'\s*|(?<attrvalue>[-\w]+)\s*))*.*?(/>|>((?<inner>.*?)</\k'tag'>)?)"; public const string StyleElementPattern = @"<(?<tag>style|link)\s*(?<attribute>(?<attrname>[-\w]+)=((""|')(?<attrvalue>.*?)(""|')\s*|(?<attrvalue>[-\w]+)\s*))*.*?(/>|>(?<inner>.*?)</\k'tag'>)"; *************** *** 50,53 **** --- 51,78 ---- /// <summary> + /// Gets the ClientID of the given Page's Form. + /// </summary> + /// <param name="page"></param> + /// <returns></returns> + public static string GetPageFormID(Page page) + { + string id = null; + #if NET_2_0 + if (page.Form != null) + id = page.Form.ClientID; + #else + foreach (Control con in page.Controls) + { + if (con is HtmlForm) + { + id = con.ClientID; + break; + } + } + #endif + return id; + } + + /// <summary> /// Add 'defer' attribute to script tags excluding external script files. /// </summary> *************** *** 154,159 **** string tag = match.Groups["tag"].Value.ToLower(System.Globalization.CultureInfo.InvariantCulture); string name = (string)attrNameValues["name"]; ! if ( name == null ) continue; --- 179,185 ---- string tag = match.Groups["tag"].Value.ToLower(System.Globalization.CultureInfo.InvariantCulture); string name = (string)attrNameValues["name"]; + string clientID = (string)attrNameValues["id"]; ! if (name == null || clientID == null) continue; Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/AssemblyInfo.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AssemblyInfo.cs 7 Feb 2006 10:54:08 -0000 1.10 --- AssemblyInfo.cs 9 Feb 2006 13:40:59 -0000 1.11 *************** *** 39,43 **** // by using the '*' as shown below: ! [assembly: AssemblyVersion("0.2.3.0")] // --- 39,43 ---- // by using the '*' as shown below: ! [assembly: AssemblyVersion("0.3.0.0")] // Index: MagicAjaxModule.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/MagicAjaxModule.cs,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** MagicAjaxModule.cs 24 Jan 2006 16:30:26 -0000 1.62 --- MagicAjaxModule.cs 9 Feb 2006 13:40:59 -0000 1.63 *************** *** 107,111 **** alert(""Unable to find script library '{0}/{1}'. Copy the file to the required location, or change the 'scriptPath' setting at magicAjax section of web.config.""); else ! AJAXCbo.HookAjaxCall({2},{3},{4}); </script>"; --- 107,111 ---- alert(""Unable to find script library '{0}/{1}'. Copy the file to the required location, or change the 'scriptPath' setting at magicAjax section of web.config.""); else ! AJAXCbo.HookAjaxCall({2},{3},{4},{5}); </script>"; *************** *** 160,164 **** bool unloadStoredPage = magicAjaxContext.Configuration.PageStore.UnloadStoredPage; ! page.RegisterStartupScript("AJAXCALL_HOOK", String.Format(STARTUP_SCRIPT_FORMAT, location, "AjaxCallObject.js", pageIsStored.ToString().ToLower(System.Globalization.CultureInfo.InvariantCulture), unloadStoredPage.ToString().ToLower(System.Globalization.CultureInfo.InvariantCulture), magicAjaxContext.Configuration.Tracing.ToString().ToLower(System.Globalization.CultureInfo.InvariantCulture))); } } --- 160,165 ---- bool unloadStoredPage = magicAjaxContext.Configuration.PageStore.UnloadStoredPage; ! string formID = Util.GetPageFormID(page); ! page.RegisterStartupScript("AJAXCALL_HOOK", String.Format(STARTUP_SCRIPT_FORMAT, location, "AjaxCallObject.js", pageIsStored.ToString().ToLower(System.Globalization.CultureInfo.InvariantCulture), unloadStoredPage.ToString().ToLower(System.Globalization.CultureInfo.InvariantCulture), magicAjaxContext.Configuration.Tracing.ToString().ToLower(System.Globalization.CultureInfo.InvariantCulture), AjaxCallHelper.EncodeString(formID))); } } |