You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(204) |
Dec
(147) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(52) |
Feb
(33) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Argiris K. <be...@us...> - 2005-11-25 20:45:55
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7932/Core Modified Files: MagicAjaxModule.cs Util.cs Web.config Log Message: Moved 'OutputCompareMode' to magicAjaxSection. Renamed 'AjaxCallScriptPath' to 'ScriptPath' since we are using it for other script files too. Index: Web.config =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/Web.config,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Web.config 24 Nov 2005 13:13:04 -0000 1.6 --- Web.config 25 Nov 2005 20:45:47 -0000 1.7 *************** *** 8,14 **** <!-- MagicAjax configuration : ! [Optional] ajaxCallScriptPath - Alternative path for "AjaxCallObject.js" If omitted, the embedded "AjaxCallObject.js" file is used (default). ! example: <magicAjax ajaxCallScriptPath="~/script" /> tracing - "true" : When an AjaxCall is invoked a popup window displays the data that were sent to the server and the data that the client received. Used to monitor the traffic of AjaxCalls. --- 8,18 ---- <!-- MagicAjax configuration : ! [Optional] scriptPath - Alternative path for "AjaxCallObject.js" If omitted, the embedded "AjaxCallObject.js" file is used (default). ! example: <magicAjax scriptPath="~/script" /> ! outputCompareMode - "HashCode" : Use String.GetHashCode() to find changed Html output ! "MD5" : Use MD5 hashing to find changed Html output (slower and larger in size, but practically no collisions) ! "FullHtml" : Use the complete Html output to find changes (for debugging purposes only) ! Default is "HashCode" tracing - "true" : When an AjaxCall is invoked a popup window displays the data that were sent to the server and the data that the client received. Used to monitor the traffic of AjaxCalls. *************** *** 28,37 **** the maximum number of page objects that can refer to the same page. Default is 5. pageStore/maxPagesLimitAlert - if it's true, an alert box is displayed when the maxConcurrentPages ! limit is reached. Default is false ! pageStore/outputCompareMode - "HashCode" : Use String.GetHashCode() to find changed Html output ! "MD5" : Use MD5 hashing to find changed Html output (slower and larger in size, but practically no collisions) ! "FullHtml" : Use the complete Html output to find changes (for debugging purposes only) ! Default is "HashCode" --> <magicAjax tracing="false"> <pageStore --- 32,38 ---- the maximum number of page objects that can refer to the same page. Default is 5. pageStore/maxPagesLimitAlert - if it's true, an alert box is displayed when the maxConcurrentPages ! limit is reached. Default is false --> <magicAjax + outputCompareMode="HashCode" tracing="false"> <pageStore *************** *** 41,45 **** maxConcurrentPages="5" maxPagesLimitAlert="false" - outputCompareMode="HashCode" /> </magicAjax> --- 42,45 ---- Index: Util.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/Util.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Util.cs 25 Nov 2005 09:29:15 -0000 1.10 --- Util.cs 25 Nov 2005 20:45:47 -0000 1.11 *************** *** 62,66 **** public static string GetFingerprint(string input) { ! MagicAjax.Configuration.OutputCompareMode compareMode = MagicAjaxContext.Current.Configuration.PageStore.CompareMode; switch (compareMode) { --- 62,66 ---- public static string GetFingerprint(string input) { ! MagicAjax.Configuration.OutputCompareMode compareMode = MagicAjaxContext.Current.Configuration.CompareMode; switch (compareMode) { Index: MagicAjaxModule.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/MagicAjaxModule.cs,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** MagicAjaxModule.cs 25 Nov 2005 12:29:15 -0000 1.34 --- MagicAjaxModule.cs 25 Nov 2005 20:45:47 -0000 1.35 *************** *** 103,107 **** <script language='javascript'> if (typeof(AJAXCbo) == 'undefined') ! alert(""Unable to find script library '{0}/{1}'. Copy the file to the required location, or change the 'ajaxCallScriptPath' setting at magicAjax section of web.config.""); else AJAXCbo.HookAjaxCall({2},{3},{4}); --- 103,107 ---- <script language='javascript'> if (typeof(AJAXCbo) == 'undefined') ! 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}); *************** *** 192,196 **** <script language='javascript'> if (typeof(WebPartManager_Cleanup) == 'undefined') ! alert(""Unable to find script library '{0}/{1}'. Copy the file to the required location, or change the 'ajaxCallScriptPath' setting at magicAjax section of web.config.""); </script>"; --- 192,196 ---- <script language='javascript'> if (typeof(WebPartManager_Cleanup) == 'undefined') ! 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.""); </script>"; |
From: Argiris K. <be...@us...> - 2005-11-25 20:45:55
|
Update of /cvsroot/magicajax/magicajax/Core/UI/Controls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7932/Core/UI/Controls Modified Files: AjaxPanel.cs Log Message: Moved 'OutputCompareMode' to magicAjaxSection. Renamed 'AjaxCallScriptPath' to 'ScriptPath' since we are using it for other script files too. Index: AjaxPanel.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/UI/Controls/AjaxPanel.cs,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** AjaxPanel.cs 24 Nov 2005 13:13:04 -0000 1.22 --- AjaxPanel.cs 25 Nov 2005 20:45:47 -0000 1.23 *************** *** 873,877 **** string[] namevalue = namevaluepair.Split('#'); ! if (MagicAjaxContext.Current.Configuration.PageStore.CompareMode == MagicAjax.Configuration.OutputCompareMode.FullHtml) { controlHtmlFingerprints.Add(string.Format("{0}_{1}", panelClientID, namevalue[0]), UnicodeEncoding.Default.GetString(Convert.FromBase64String(namevalue[1]))); --- 873,877 ---- string[] namevalue = namevaluepair.Split('#'); ! if (MagicAjaxContext.Current.Configuration.CompareMode == MagicAjax.Configuration.OutputCompareMode.FullHtml) { controlHtmlFingerprints.Add(string.Format("{0}_{1}", panelClientID, namevalue[0]), UnicodeEncoding.Default.GetString(Convert.FromBase64String(namevalue[1]))); *************** *** 933,937 **** string keyWithoutNamingcontainer = key.Substring(panelClientID.Length + 1); ! if (MagicAjaxContext.Current.Configuration.PageStore.CompareMode == MagicAjax.Configuration.OutputCompareMode.FullHtml) { sbuilder.AppendFormat("{0}#{1}", keyWithoutNamingcontainer, Convert.ToBase64String(UnicodeEncoding.Default.GetBytes((string)_controlHtmlFingerprints[key]))); --- 933,937 ---- string keyWithoutNamingcontainer = key.Substring(panelClientID.Length + 1); ! if (MagicAjaxContext.Current.Configuration.CompareMode == MagicAjax.Configuration.OutputCompareMode.FullHtml) { sbuilder.AppendFormat("{0}#{1}", keyWithoutNamingcontainer, Convert.ToBase64String(UnicodeEncoding.Default.GetBytes((string)_controlHtmlFingerprints[key]))); |
From: Argiris K. <be...@us...> - 2005-11-25 12:29:25
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28780/Core Modified Files: MagicAjaxModule.cs Log Message: A minor correction and some fixes for tracing. Index: MagicAjaxModule.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/MagicAjaxModule.cs,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** MagicAjaxModule.cs 24 Nov 2005 19:23:05 -0000 1.33 --- MagicAjaxModule.cs 25 Nov 2005 12:29:15 -0000 1.34 *************** *** 122,126 **** #else // src-request to "AjaxCallObject.js.aspx" will be handled by Application_BeginRequest, which returns the embedded AjaxCallObject.js script ! includeScript = String.Format("<script language='javascript' type=\"text/javascript\" src=\"{0}\"></script>", "AjaxCallObject.js.aspx"); #endif } --- 122,126 ---- #else // src-request to "AjaxCallObject.js.aspx" will be handled by Application_BeginRequest, which returns the embedded AjaxCallObject.js script ! includeScript = String.Format("<script type=\"text/javascript\" src=\"{0}\"></script>", "AjaxCallObject.js.aspx"); #endif } |
From: Argiris K. <be...@us...> - 2005-11-25 12:29:25
|
Update of /cvsroot/magicajax/magicajax/Core/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28780/Core/script Modified Files: AjaxCallObject.js Log Message: A minor correction and some fixes for tracing. Index: AjaxCallObject.js =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/script/AjaxCallObject.js,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** AjaxCallObject.js 24 Nov 2005 20:14:05 -0000 1.23 --- AjaxCallObject.js 25 Nov 2005 12:29:15 -0000 1.24 *************** *** 394,398 **** { this.WriteTrace("<b>!!! AjaxCall was aborted !!!</b>"); ! this.TraceWindow.document.close(); if (waitElement) --- 394,398 ---- { this.WriteTrace("<b>!!! AjaxCall was aborted !!!</b>"); ! this.CloseTrace(); if (waitElement) *************** *** 403,407 **** { this.WriteTrace("<b>!!! Server reported an Error !!!</b>"); ! this.TraceWindow.document.close(); if (waitElement) --- 403,407 ---- { this.WriteTrace("<b>!!! Server reported an Error !!!</b>"); ! this.CloseTrace(); if (waitElement) *************** *** 463,466 **** --- 463,475 ---- AjaxCallObject.prototype.CreateTracingWindow = function() { + for (var i=0; i < __TraceWindows.length; i++) + { + if (__TraceWindows[i].closed) + { + __TraceWindows.splice(i, 1); + i--; + } + } + this.TraceWindow = null; for (var i=0; i < __TraceWindows.length; i++) *************** *** 514,519 **** this.WriteTrace(data.split("<").join("<").split("\r\n").join("<br>")); this.WriteTrace("<b>------------------------------</b><br>"); ! this.TraceWindow.document.close(); ! this.TraceWindow.TraceFinished = true; } --- 523,527 ---- this.WriteTrace(data.split("<").join("<").split("\r\n").join("<br>")); this.WriteTrace("<b>------------------------------</b><br>"); ! this.CloseTrace(); } *************** *** 523,526 **** --- 531,540 ---- } + AjaxCallObject.prototype.CloseTrace = function() + { + this.TraceWindow.document.close(); + this.TraceWindow.TraceFinished = true; + } + AjaxCallObject.prototype.SetAttributesOfControl = function(clientID, attributes) { |
From: Argiris K. <be...@us...> - 2005-11-25 09:29:24
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25344/Core Modified Files: Util.cs Log Message: Do not disable 'defer' if it's on a external script file tag. Index: Util.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/Util.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Util.cs 24 Nov 2005 19:23:05 -0000 1.9 --- Util.cs 25 Nov 2005 09:29:15 -0000 1.10 *************** *** 43,52 **** tag = tag.Insert(tag.Length - 1, " defer"); } - else if (tag.IndexOf(" defer") != -1) - { - // It's an external script file with a 'defer' attribute. - // Disable 'defer' by replacing it - tag = tag.Replace(" defer", " nodefer"); - } if ( tag.Length != match.Value.Length ) --- 43,46 ---- |
From: Argiris K. <be...@us...> - 2005-11-25 00:05:00
|
Update of /cvsroot/magicajax/magicajax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29526 Added Files: Readme.txt Log Message: Added Docs folder. Replaced 'cc1' tag in the examples by 'ajax'. --- NEW FILE: Readme.txt --- Please read Readme.html in the Docs folder. ----- Copyright 2005 The MagicAjax.NET Team. This file is part of the MagicAjax.NET framework. MagicAjax.NET is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. MagicAjax.NET is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with MagicAjax.NET; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
From: Argiris K. <be...@us...> - 2005-11-25 00:04:59
|
Update of /cvsroot/magicajax/magicajax/Examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29526/Examples Modified Files: AjaxWebParts.aspx Examples.aspx Log Message: Added Docs folder. Replaced 'cc1' tag in the examples by 'ajax'. Index: Examples.aspx =================================================================== RCS file: /cvsroot/magicajax/magicajax/Examples/Examples.aspx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Examples.aspx 11 Nov 2005 06:17:50 -0000 1.1 --- Examples.aspx 25 Nov 2005 00:04:50 -0000 1.2 *************** *** 1,4 **** <%@ Page language="c#" %> ! <%@ Register TagPrefix="cc1" Namespace="MagicAjax.UI.Controls" Assembly="MagicAjax" %> <html> <head> --- 1,4 ---- <%@ Page language="c#" %> ! <%@ Register TagPrefix="ajax" Namespace="MagicAjax.UI.Controls" Assembly="MagicAjax" %> <html> <head> *************** *** 16,27 **** <hr /> <h5>1. Simple button showing server time</h5> ! <cc1:ajaxpanel ID="Ajaxpanel1" runat="server"> <asp:Button runat="server" ID="ShowTime" Text="Show server's date & time" OnClick="ShowTime_Click" /> <asp:Label runat="server" ID="lblShowTime" BackColor="Blue" ForeColor="White" /> ! </cc1:ajaxpanel> <hr> <h5>2. Master/detail dropdown lists</h5> ! <cc1:ajaxpanel ID="Ajaxpanel2" runat="server"> Please pick a car: <asp:DropDownList id="brand" runat="server" AutoPostBack="true" OnSelectedIndexChanged="brand_SelectedIndexChanged"> --- 16,27 ---- <hr /> <h5>1. Simple button showing server time</h5> ! <ajax:ajaxpanel ID="Ajaxpanel1" runat="server"> <asp:Button runat="server" ID="ShowTime" Text="Show server's date & time" OnClick="ShowTime_Click" /> <asp:Label runat="server" ID="lblShowTime" BackColor="Blue" ForeColor="White" /> ! </ajax:ajaxpanel> <hr> <h5>2. Master/detail dropdown lists</h5> ! <ajax:ajaxpanel ID="Ajaxpanel2" runat="server"> Please pick a car: <asp:DropDownList id="brand" runat="server" AutoPostBack="true" OnSelectedIndexChanged="brand_SelectedIndexChanged"> *************** *** 31,39 **** <asp:Button id="select" runat="server" Text="Select Car" Enabled="false" OnClick="select_Click" /> <asp:Label id="lblSelectedCar" runat="server" /> ! </cc1:ajaxpanel> <hr> <h5>3. Datagrid (sorting and selecting)</h5> ! <cc1:ajaxpanel ID="Ajaxpanel3" runat="server"> <asp:DataGrid id="grid" Runat="server" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" BackColor="White" CellPadding="4" AllowSorting="True" PageSize="3" --- 31,39 ---- <asp:Button id="select" runat="server" Text="Select Car" Enabled="false" OnClick="select_Click" /> <asp:Label id="lblSelectedCar" runat="server" /> ! </ajax:ajaxpanel> <hr> <h5>3. Datagrid (sorting and selecting)</h5> ! <ajax:ajaxpanel ID="Ajaxpanel3" runat="server"> <asp:DataGrid id="grid" Runat="server" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" BackColor="White" CellPadding="4" AllowSorting="True" PageSize="3" *************** *** 48,52 **** <PagerStyle HorizontalAlign="Center" ForeColor="#330099" BackColor="#FFFFCC"></PagerStyle> </asp:DataGrid> ! </cc1:ajaxpanel> </form> --- 48,52 ---- <PagerStyle HorizontalAlign="Center" ForeColor="#330099" BackColor="#FFFFCC"></PagerStyle> </asp:DataGrid> ! </ajax:ajaxpanel> </form> Index: AjaxWebParts.aspx =================================================================== RCS file: /cvsroot/magicajax/magicajax/Examples/AjaxWebParts.aspx,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AjaxWebParts.aspx 14 Nov 2005 16:11:56 -0000 1.2 --- AjaxWebParts.aspx 25 Nov 2005 00:04:50 -0000 1.3 *************** *** 1,4 **** <%@ Page language="c#" %> ! <%@ Register TagPrefix="cc1" Namespace="MagicAjax.UI.Controls" Assembly="MagicAjax" %> <html> <head> --- 1,4 ---- <%@ Page language="c#" %> ! <%@ Register TagPrefix="ajax" Namespace="MagicAjax.UI.Controls" Assembly="MagicAjax" %> <html> <head> *************** *** 16,20 **** <hr /> <h5>1. WebPart demo</h5> ! <cc1:ajaxpanel ID="Ajaxpanel1" runat="server"> <asp:Button runat="server" id="Toggle" Text="Switch to EditMode" OnClick="Toggle_Click" /> <table><tr><td> --- 16,20 ---- <hr /> <h5>1. WebPart demo</h5> ! <ajax:ajaxpanel ID="Ajaxpanel1" runat="server"> <asp:Button runat="server" id="Toggle" Text="Switch to EditMode" OnClick="Toggle_Click" /> <table><tr><td> *************** *** 45,49 **** </asp:CatalogZone> </td></tr></table> ! </cc1:ajaxpanel> </form> </body> --- 45,49 ---- </asp:CatalogZone> </td></tr></table> ! </ajax:ajaxpanel> </form> </body> |
From: Argiris K. <be...@us...> - 2005-11-25 00:02:15
|
Update of /cvsroot/magicajax/magicajax/Docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27675/Docs Log Message: Directory /cvsroot/magicajax/magicajax/Docs added to the repository |
From: Argiris K. <be...@us...> - 2005-11-24 20:14:14
|
Update of /cvsroot/magicajax/magicajax/Core/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13790/Core/script Modified Files: AjaxCallObject.js Log Message: Fixed another issue about IE and Server.Transfer Index: AjaxCallObject.js =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/script/AjaxCallObject.js,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** AjaxCallObject.js 23 Nov 2005 19:34:23 -0000 1.22 --- AjaxCallObject.js 24 Nov 2005 20:14:05 -0000 1.23 *************** *** 584,589 **** AjaxCallObject.prototype.SetHtmlOfPage = function(html) { document.write(html); ! document.close(); } --- 584,590 ---- AjaxCallObject.prototype.SetHtmlOfPage = function(html) { + document.close(); // for IE document.write(html); ! document.close(); // for Firefox } |
From: Argiris K. <be...@us...> - 2005-11-24 19:23:15
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3953/Core Modified Files: MagicAjaxModule.cs Util.cs Log Message: Fixed the IE problem about script execution order of document.write. If browser is IE, the 'defer' attribute is added to script tags, excluding the external script file tags. Index: Util.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/Util.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Util.cs 24 Nov 2005 13:13:04 -0000 1.8 --- Util.cs 24 Nov 2005 19:23:05 -0000 1.9 *************** *** 5,8 **** --- 5,9 ---- using System.Security.Cryptography; using System.Text; + using System.Text.RegularExpressions; namespace MagicAjax *************** *** 13,16 **** --- 14,64 ---- internal class Util { + public const string ScriptPattern = "<script.[^>]*>"; + + /// <summary> + /// Add 'defer' attribute to script tags excluding external script files. + /// </summary> + /// <remarks> + /// IE has a weird bug and when document.write is called, it + /// executes the scripts of the html BEFORE the external script files. + /// So add 'defer' attribute to the scripts so that external script files + /// are executed first. + /// </remarks> + /// <param name="html"></param> + /// <returns></returns> + public static string AddDeferToScriptTags (string html) + { + StringBuilder sb = new StringBuilder(html); + MatchCollection scriptMatches = Regex.Matches(html, ScriptPattern, RegexOptions.IgnoreCase); + + int diff = 0; + for (int i=0; i < scriptMatches.Count; i++) + { + Match match = scriptMatches[i]; + string tag = match.Value.ToLower(); + + if (tag.IndexOf(" src=") == -1) + { + // It's script block, add 'defer' attribute + tag = tag.Insert(tag.Length - 1, " defer"); + } + else if (tag.IndexOf(" defer") != -1) + { + // It's an external script file with a 'defer' attribute. + // Disable 'defer' by replacing it + tag = tag.Replace(" defer", " nodefer"); + } + + if ( tag.Length != match.Value.Length ) + { + int sbIndex = match.Index + diff; + sb.Replace(match.Value, tag, sbIndex, match.Value.Length); + diff += tag.Length - match.Value.Length; + } + } + + return sb.ToString(); + } + /// <summary> /// Create a base64 encoded MD5 sum string of an input string Index: MagicAjaxModule.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/MagicAjaxModule.cs,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** MagicAjaxModule.cs 24 Nov 2005 14:03:31 -0000 1.32 --- MagicAjaxModule.cs 24 Nov 2005 19:23:05 -0000 1.33 *************** *** 122,126 **** #else // src-request to "AjaxCallObject.js.aspx" will be handled by Application_BeginRequest, which returns the embedded AjaxCallObject.js script ! includeScript = String.Format("<script type=\"text/javascript\" src=\"{0}\"></script>", "AjaxCallObject.js.aspx"); #endif } --- 122,126 ---- #else // src-request to "AjaxCallObject.js.aspx" will be handled by Application_BeginRequest, which returns the embedded AjaxCallObject.js script ! includeScript = String.Format("<script language='javascript' type=\"text/javascript\" src=\"{0}\"></script>", "AjaxCallObject.js.aspx"); #endif } *************** *** 630,633 **** --- 630,642 ---- { string html = _filter.GetHtmlPage(); + if (_request.Browser != null && _request.Browser.Browser == "IE") + { + // IE has a weird bug and when document.write is called, it + // executes the scripts of the html BEFORE the external script files. + // So add 'defer' attribute to the scripts so that external script files + // are executed first. + html = Util.AddDeferToScriptTags(html); + + } AjaxCallHelper.WriteSetHtmlOfPageScript(html); } |
From: Dion O. <dol...@us...> - 2005-11-24 14:03:42
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29043/magicajax/Core Modified Files: MagicAjaxModule.cs Log Message: Added _threadAbortExceptionThrown member variable. Index: MagicAjaxModule.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/MagicAjaxModule.cs,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** MagicAjaxModule.cs 24 Nov 2005 13:13:04 -0000 1.31 --- MagicAjaxModule.cs 24 Nov 2005 14:03:31 -0000 1.32 *************** *** 54,58 **** public class MagicAjaxModule: IHttpModule { ! private bool _exceptionThrown; private PageFilter _filter; private HttpRequest _request; --- 54,58 ---- public class MagicAjaxModule: IHttpModule { ! private bool _threadAbortExceptionThrown; private PageFilter _filter; private HttpRequest _request; *************** *** 393,397 **** // Init private fields ! _exceptionThrown = false; _request = context.Request; _response = context.Response; --- 393,397 ---- // Init private fields ! _threadAbortExceptionThrown = false; _request = context.Request; _response = context.Response; *************** *** 479,490 **** try { ! _exceptionThrown = true; ! HttpContext.Current.Handler.ProcessRequest (HttpContext.Current); } catch (System.Threading.ThreadAbortException) { ! // ThreadAbortException is for Server.Transfer, Response.Redirect ! // and AjaxCallHelper.End ! _exceptionThrown = false; throw; } --- 479,488 ---- try { ! HttpContext.Current.Handler.ProcessRequest(HttpContext.Current); } catch (System.Threading.ThreadAbortException) { ! // ThreadAbortException is for Server.Transfer, Response.Redirect and AjaxCallHelper.End ! _threadAbortExceptionThrown = true; throw; } *************** *** 588,599 **** try { - _exceptionThrown = true; ProcessAjaxCall(_magicAjaxContext.StoredPageInfo.Page); } catch (System.Threading.ThreadAbortException) { ! // ThreadAbortException is for Server.Transfer, Response.Redirect ! // and AjaxCallHelper.End ! _exceptionThrown = false; throw; } --- 586,595 ---- try { ProcessAjaxCall(_magicAjaxContext.StoredPageInfo.Page); } catch (System.Threading.ThreadAbortException) { ! // ThreadAbortException is for Server.Transfer, Response.Redirect and AjaxCallHelper.End ! _threadAbortExceptionThrown = true; throw; } *************** *** 618,622 **** try { ! if (_magicAjaxContext.IsAjaxCall && !_magicAjaxContext.CompletedAjaxCall && !_exceptionThrown) { // There was a Response.Redirect or Server.Transfer during AjaxCall --- 614,618 ---- try { ! if (_magicAjaxContext.IsAjaxCall && !_magicAjaxContext.CompletedAjaxCall && _threadAbortExceptionThrown) { // There was a Response.Redirect or Server.Transfer during AjaxCall |
From: Argiris K. <be...@us...> - 2005-11-24 13:13:16
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17446/Core Modified Files: MagicAjaxContext.cs MagicAjaxModule.cs Util.cs Web.config Log Message: Moved Configuration to MagicAjaxContext.Current so that configuration options can be set for a specific page. Any changes that occur to Configuration settings are stored in a hidden field on page and restored at a postback/ajaxcall Index: Web.config =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/Web.config,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Web.config 21 Nov 2005 12:18:36 -0000 1.5 --- Web.config 24 Nov 2005 13:13:04 -0000 1.6 *************** *** 48,52 **** <httpModules> ! <add name="MagicAjaxModule" type="MagicAjax.MagicAjaxModule, MagicAjax" /> </httpModules> --- 48,52 ---- <httpModules> ! <add name="MagicAjax" type="MagicAjax.MagicAjaxModule, MagicAjax" /> </httpModules> Index: MagicAjaxContext.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/MagicAjaxContext.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MagicAjaxContext.cs 24 Nov 2005 00:43:13 -0000 1.4 --- MagicAjaxContext.cs 24 Nov 2005 13:13:04 -0000 1.5 *************** *** 37,44 **** private bool _isBrowserSupported = false; private StoredPageInfo _storedPageInfo = null; #endregion #region Public properties ! /// <summary> /// Returns true if request was made from the browser's XmlHttpRequest object --- 37,60 ---- private bool _isBrowserSupported = false; private StoredPageInfo _storedPageInfo = null; + private MagicAjaxConfiguration _configuration = null; #endregion #region Public properties ! ! /// <summary> ! /// Configuration settings for MagicAjax. ! /// </summary> ! /// <remarks> ! /// During a page request/postback, configuration settings are getting initialized ! /// by the settings of web.config but can change for a particular page request/postback ! /// at the Load event. ! /// During an AjaxCall, the configuration settings will be the same as the page request ! /// that the AjaxCall belongs to. Changes during an AjaxCall are not allowed. ! /// </remarks> ! public MagicAjaxConfiguration Configuration ! { ! get { return _configuration; } ! } ! /// <summary> /// Returns true if request was made from the browser's XmlHttpRequest object *************** *** 51,55 **** /// <summary> ! /// True of ajax call was completed /// </summary> public bool CompletedAjaxCall --- 67,71 ---- /// <summary> ! /// True if ajax call was completed /// </summary> public bool CompletedAjaxCall *************** *** 99,103 **** public bool IsPageNoStoreMode { ! get { return MagicAjaxContext.Configuration.PageStore.Mode == MagicAjax.Configuration.PageStoreMode.NoStore; } } --- 115,119 ---- public bool IsPageNoStoreMode { ! get { return _configuration.PageStore.Mode == MagicAjax.Configuration.PageStoreMode.NoStore; } } *************** *** 150,153 **** --- 166,176 ---- public MagicAjaxContext() { + // Load configuration from web.config + _configuration = (MagicAjaxConfiguration)ConfigurationSettings.GetConfig("magicAjax"); + if (_configuration == null) + { + _configuration = new MagicAjaxConfiguration(null); + } + //store initial settings on first call (per request) if (HttpContext.Current != null) *************** *** 200,222 **** } } - - private static MagicAjaxConfiguration _configuration = null; - public static MagicAjaxConfiguration Configuration - { - get - { - if (_configuration == null) - { - // Note: there is no need to cache this as singleton, .NET framework does this automatically (only a single instance is created) - _configuration = (MagicAjaxConfiguration)ConfigurationSettings.GetConfig("magicAjax"); - if (_configuration == null) - { - _configuration = new MagicAjaxConfiguration(null); - } - } - - return _configuration; - } - } #endregion } --- 223,226 ---- Index: Util.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/Util.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Util.cs 23 Nov 2005 15:28:28 -0000 1.7 --- Util.cs 24 Nov 2005 13:13:04 -0000 1.8 *************** *** 20,24 **** public static string GetFingerprint(string input) { ! MagicAjax.Configuration.OutputCompareMode compareMode = MagicAjaxContext.Configuration.PageStore.CompareMode; switch (compareMode) { --- 20,24 ---- public static string GetFingerprint(string input) { ! MagicAjax.Configuration.OutputCompareMode compareMode = MagicAjaxContext.Current.Configuration.PageStore.CompareMode; switch (compareMode) { Index: MagicAjaxModule.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/MagicAjaxModule.cs,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** MagicAjaxModule.cs 24 Nov 2005 12:59:12 -0000 1.30 --- MagicAjaxModule.cs 24 Nov 2005 13:13:04 -0000 1.31 *************** *** 92,100 **** public static void EnableAjaxOnPage(Page page) { ! if (page == null || MagicAjaxContext.Current.IsAjaxCallForPage(page)) return; // Enable AJAX only MagicAjax-supported browsers. // Other browsers will get a plain postback page. ! if (!MagicAjaxContext.Current.IsBrowserSupported) return; --- 92,101 ---- public static void EnableAjaxOnPage(Page page) { ! MagicAjaxContext magicAjaxContext = MagicAjaxContext.Current; ! if (page == null || magicAjaxContext.IsAjaxCallForPage(page)) return; // Enable AJAX only MagicAjax-supported browsers. // Other browsers will get a plain postback page. ! if (!magicAjaxContext.IsBrowserSupported) return; *************** *** 110,114 **** { // Provides the location of the script file. ! string location = MagicAjaxContext.Configuration.ScriptPath; string includeScript; --- 111,115 ---- { // Provides the location of the script file. ! string location = magicAjaxContext.Configuration.ScriptPath; string includeScript; *************** *** 131,135 **** page.RegisterClientScriptBlock( "AJAXCALL_FOR_MAGICAJAX", includeScript ); ! bool pageIsStored = (MagicAjaxContext.Configuration.PageStore.Mode != PageStoreMode.NoStore); if ( pageIsStored ) --- 132,136 ---- page.RegisterClientScriptBlock( "AJAXCALL_FOR_MAGICAJAX", includeScript ); ! bool pageIsStored = (magicAjaxContext.Configuration.PageStore.Mode != PageStoreMode.NoStore); if ( pageIsStored ) *************** *** 146,151 **** } ! bool unloadStoredPage = MagicAjaxContext.Configuration.PageStore.UnloadStoredPage; ! page.RegisterStartupScript("AJAXCALL_HOOK", String.Format(STARTUP_SCRIPT_FORMAT, location, "AjaxCallObject.js", pageIsStored.ToString().ToLower(), unloadStoredPage.ToString().ToLower(), MagicAjaxContext.Configuration.Tracing.ToString().ToLower())); } } --- 147,157 ---- } ! // Save to page any changes that may occured to Configuration ! string configState = magicAjaxContext.Configuration.GetState(); ! if ( configState != null) ! page.RegisterHiddenField ("__MAGICAJAX_CONFIG", configState); ! ! bool unloadStoredPage = magicAjaxContext.Configuration.PageStore.UnloadStoredPage; ! page.RegisterStartupScript("AJAXCALL_HOOK", String.Format(STARTUP_SCRIPT_FORMAT, location, "AjaxCallObject.js", pageIsStored.ToString().ToLower(), unloadStoredPage.ToString().ToLower(), magicAjaxContext.Configuration.Tracing.ToString().ToLower())); } } *************** *** 170,174 **** if (capabilities.Win32 && (capabilities.MSDomVersion.CompareTo(new Version(5, 5)) >= 0)) { ! string location = MagicAjaxContext.Configuration.ScriptPath; if (location == null) { --- 176,180 ---- if (capabilities.Win32 && (capabilities.MSDomVersion.CompareTo(new Version(5, 5)) >= 0)) { ! string location = MagicAjaxContext.Current.Configuration.ScriptPath; if (location == null) { *************** *** 220,224 **** StoredPageInfo pageInfo = new StoredPageInfo(page); ! if (storedPages.Count < MagicAjaxContext.Configuration.PageStore.MaxConcurrentPages) { pageInfoIndex = storedPages.Add(pageInfo); --- 226,230 ---- StoredPageInfo pageInfo = new StoredPageInfo(page); ! if (storedPages.Count < MagicAjaxContext.Current.Configuration.PageStore.MaxConcurrentPages) { pageInfoIndex = storedPages.Add(pageInfo); *************** *** 251,255 **** } ! if (MagicAjaxContext.Configuration.PageStore.MaxPagesLimitAlert) { page.RegisterStartupScript("__AJAX_PAGENOTSTOREDWARNING", --- 257,261 ---- } ! if (MagicAjaxContext.Current.Configuration.PageStore.MaxPagesLimitAlert) { page.RegisterStartupScript("__AJAX_PAGENOTSTOREDWARNING", *************** *** 263,267 **** if (saveStoredPagesList) { ! switch (MagicAjaxContext.Configuration.PageStore.Mode) { case PageStoreMode.Session: --- 269,273 ---- if (saveStoredPagesList) { ! switch (MagicAjaxContext.Current.Configuration.PageStore.Mode) { case PageStoreMode.Session: *************** *** 270,277 **** case PageStoreMode.Cache: HttpContext.Current.Cache.Add(key, storedPages, null, System.Web.Caching.Cache.NoAbsoluteExpiration, ! TimeSpan.FromMinutes(MagicAjaxContext.Configuration.PageStore.CacheTimeout), System.Web.Caching.CacheItemPriority.Default, null); break; default: ! throw new ConfigurationException(String.Format("MagicAjax configuration: The pageStore mode '{0}' is not supported for storing the page.", MagicAjaxContext.Configuration.PageStore.Mode)); } } --- 276,283 ---- case PageStoreMode.Cache: HttpContext.Current.Cache.Add(key, storedPages, null, System.Web.Caching.Cache.NoAbsoluteExpiration, ! TimeSpan.FromMinutes(MagicAjaxContext.Current.Configuration.PageStore.CacheTimeout), System.Web.Caching.CacheItemPriority.Default, null); break; default: ! throw new ConfigurationException(String.Format("MagicAjax configuration: The pageStore mode '{0}' is not supported for storing the page.", MagicAjaxContext.Current.Configuration.PageStore.Mode)); } } *************** *** 339,343 **** return null; ! switch (MagicAjaxContext.Configuration.PageStore.Mode) { case PageStoreMode.Session: --- 345,349 ---- return null; ! switch (MagicAjaxContext.Current.Configuration.PageStore.Mode) { case PageStoreMode.Session: *************** *** 354,358 **** default: ! throw new ConfigurationException(String.Format("MagicAjax configuration: The pageStore mode '{0}' is not supported for storing the page.", MagicAjaxContext.Configuration.PageStore.Mode)); } } --- 360,364 ---- default: ! throw new ConfigurationException(String.Format("MagicAjax configuration: The pageStore mode '{0}' is not supported for storing the page.", MagicAjaxContext.Current.Configuration.PageStore.Mode)); } } *************** *** 360,364 **** protected static string GetStoredPagesKey(Page page) { ! switch (MagicAjaxContext.Configuration.PageStore.Mode) { case PageStoreMode.Session: --- 366,370 ---- protected static string GetStoredPagesKey(Page page) { ! switch (MagicAjaxContext.Current.Configuration.PageStore.Mode) { case PageStoreMode.Session: *************** *** 369,373 **** default: ! throw new ConfigurationException(String.Format("MagicAjax configuration: The pageStore mode '{0}' is not supported for storing the page.", MagicAjaxContext.Configuration.PageStore.Mode)); } } --- 375,379 ---- default: ! throw new ConfigurationException(String.Format("MagicAjax configuration: The pageStore mode '{0}' is not supported for storing the page.", MagicAjaxContext.Current.Configuration.PageStore.Mode)); } } *************** *** 449,455 **** _magicAjaxContext.IsAjaxCall = (_request.Form["__AJAXCALL"] != null); ! NameValueCollection _form = _request.Form; ! if ( PageStoreMode.NoStore == MagicAjaxContext.Configuration.PageStore.Mode ) { // The page is not stored --- 455,469 ---- _magicAjaxContext.IsAjaxCall = (_request.Form["__AJAXCALL"] != null); ! string configState = _request.Form["__MAGICAJAX_CONFIG"]; ! if (configState != null) ! { ! _magicAjaxContext.Configuration.LoadState (configState); ! if (_magicAjaxContext.IsAjaxCall) ! _magicAjaxContext.Configuration.IsLocked = true; ! } ! pageKey = _request.Form[PageKeyFieldName]; ! ! if ( pageKey == null ) { // The page is not stored *************** *** 490,494 **** string vsValue = _filter.GetViewStateFieldValue(); ! if (vsValue != null && _form["__VIEWSTATE"] != vsValue) { AjaxCallHelper.WriteSetFieldScript("__VIEWSTATE", vsValue); --- 504,508 ---- string vsValue = _filter.GetViewStateFieldValue(); ! if (vsValue != null && _request.Form["__VIEWSTATE"] != vsValue) { AjaxCallHelper.WriteSetFieldScript("__VIEWSTATE", vsValue); *************** *** 498,502 **** // Check if this request is to add/remove/replace a WebPart // If so, send back updated WebPartManager drag&drop javascript (IE only) ! if (!string.IsNullOrEmpty(_form["__WPPS"])) { string wpmValue = _filter.GetWebPartManagerScriptValue(requestPage.Form.ClientID); --- 512,516 ---- // Check if this request is to add/remove/replace a WebPart // If so, send back updated WebPartManager drag&drop javascript (IE only) ! if (!string.IsNullOrEmpty(_request.Form["__WPPS"])) { string wpmValue = _filter.GetWebPartManagerScriptValue(requestPage.Form.ClientID); *************** *** 518,531 **** // The page is stored - pageKey = _form[PageKeyFieldName]; - - if (pageKey == null) - { - if ( _magicAjaxContext.IsAjaxCall ) - throw new MagicAjaxException(String.Format("Hidden field '{0}' wasn't found. Page isn't AJAX enabled.", PageKeyFieldName)); - else - return; - } - _magicAjaxContext.StoredPageInfo = GetStoredPageInfo(pageKey); if (_magicAjaxContext.StoredPageInfo == null) --- 532,535 ---- *************** *** 533,537 **** if (_magicAjaxContext.IsAjaxCall) { ! // Stored Page wasn't found, could be that the session expired. // Have the browser do a refresh. // It will stop the current execution and will throw Application_EndRequest event --- 537,542 ---- if (_magicAjaxContext.IsAjaxCall) { ! // Stored Page wasn't found, could be that the session expired or ! // the client returned to an unloaded page. // Have the browser do a refresh. // It will stop the current execution and will throw Application_EndRequest event |
From: Argiris K. <be...@us...> - 2005-11-24 13:13:12
|
Update of /cvsroot/magicajax/magicajax/Core/Configuration In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17446/Core/Configuration Modified Files: MagicAjaxConfiguration.cs Log Message: Moved Configuration to MagicAjaxContext.Current so that configuration options can be set for a specific page. Any changes that occur to Configuration settings are stored in a hidden field on page and restored at a postback/ajaxcall Index: MagicAjaxConfiguration.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/Configuration/MagicAjaxConfiguration.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MagicAjaxConfiguration.cs 23 Nov 2005 15:28:28 -0000 1.6 --- MagicAjaxConfiguration.cs 24 Nov 2005 13:13:03 -0000 1.7 *************** *** 2,6 **** using System.Xml; using System.Configuration; ! using System.Collections.Specialized; namespace MagicAjax.Configuration --- 2,7 ---- using System.Xml; using System.Configuration; ! using System.Collections; ! using System.Web.UI; namespace MagicAjax.Configuration *************** *** 22,25 **** --- 23,38 ---- public struct PageStore { + #region Private Fields + private Hashtable _state; + private bool _isLocked; + + // web.config settings + private PageStoreMode _origMode; + private bool _origUnloadStoredPage; + private int _origCacheTimeout; + private int _origMaxConcurrentPages; + private bool _origMaxPagesLimitAlert; + private OutputCompareMode _origCompareMode; + // active settings private PageStoreMode _mode; private bool _unloadStoredPage; *************** *** 28,35 **** --- 41,65 ---- private bool _maxPagesLimitAlert; private OutputCompareMode _compareMode; + #endregion + #region Public Properties public PageStoreMode Mode { get { return _mode; } + set + { + if ( _isLocked && value != _mode ) + throw new MagicAjaxException("Configuration settings have been locked and cannot change."); + + if ( value != _origMode ) + { + _mode = value; + _state["Mode"] = _mode; + } + else + { + _state.Remove("Mode"); + } + } } *************** *** 37,40 **** --- 67,85 ---- { get { return _unloadStoredPage; } + set + { + if ( _isLocked && value != _unloadStoredPage ) + throw new MagicAjaxException("Configuration settings have been locked and cannot change."); + + if ( value != _origUnloadStoredPage ) + { + _unloadStoredPage = value; + _state["UnloadStoredPage"] = _unloadStoredPage; + } + else + { + _state.Remove("UnloadStoredPage"); + } + } } *************** *** 42,45 **** --- 87,105 ---- { get { return _cacheTimeout; } + set + { + if ( _isLocked && value != _cacheTimeout ) + throw new MagicAjaxException("Configuration settings have been locked and cannot change."); + + if ( value != _origCacheTimeout ) + { + _cacheTimeout = value; + _state["CacheTimeout"] = _cacheTimeout; + } + else + { + _state.Remove("CacheTimeout"); + } + } } *************** *** 47,50 **** --- 107,125 ---- { get { return _maxConcurrentPages; } + set + { + if ( _isLocked && value != _maxConcurrentPages ) + throw new MagicAjaxException("Configuration settings have been locked and cannot change."); + + if ( value != _origMaxConcurrentPages ) + { + _maxConcurrentPages = value; + _state["MaxConcurrentPages"] = _maxConcurrentPages; + } + else + { + _state.Remove("MaxConcurrentPages"); + } + } } *************** *** 52,55 **** --- 127,145 ---- { get { return _maxPagesLimitAlert; } + set + { + if ( _isLocked && value != _maxPagesLimitAlert ) + throw new MagicAjaxException("Configuration settings have been locked and cannot change."); + + if ( value != _origMaxPagesLimitAlert ) + { + _maxPagesLimitAlert = value; + _state["MaxPagesLimitAlert"] = _maxPagesLimitAlert; + } + else + { + _state.Remove("MaxPagesLimitAlert"); + } + } } *************** *** 57,70 **** { get { return _compareMode; } } public PageStore(PageStoreMode mode, bool unloadStoredPage, int cacheTimeout, int maxConcurrentPages, bool maxPagesLimitAlert, OutputCompareMode compareMode) { ! _mode = mode; ! _cacheTimeout = cacheTimeout; ! _maxConcurrentPages = maxConcurrentPages; ! _maxPagesLimitAlert = maxPagesLimitAlert; ! _compareMode = compareMode; ! _unloadStoredPage = unloadStoredPage; } } --- 147,230 ---- { get { return _compareMode; } + set + { + if ( _isLocked && value != _compareMode ) + throw new MagicAjaxException("Configuration settings have been locked and cannot change."); + + if ( value != _origCompareMode ) + { + _compareMode = value; + _state["CompareMode"] = _compareMode; + } + else + { + _state.Remove("CompareMode"); + } + } + } + #endregion + + internal bool IsDirty + { + get { return ( _state.Keys.Count > 0 ); } + } + + internal bool IsLocked + { + get { return _isLocked; } + set { _isLocked = value; } + } + + internal string GetState() + { + if ( ! IsDirty ) + return null; + + System.IO.StringWriter writer = new System.IO.StringWriter(); + new LosFormatter().Serialize(writer, _state); + return writer.ToString(); + } + + internal void LoadState(string stateString) + { + Hashtable state = new LosFormatter().Deserialize(stateString) as Hashtable; + foreach (string key in state.Keys) + { + switch (key) + { + case "Mode": + Mode = (PageStoreMode) state[key]; + break; + case "CacheTimeout": + CacheTimeout = (int) state[key]; + break; + case "MaxConcurrentPages": + MaxConcurrentPages = (int) state[key]; + break; + case "MaxPagesLimitAlert": + MaxPagesLimitAlert = (bool) state[key]; + break; + case "CompareMode": + CompareMode = (OutputCompareMode) state[key]; + break; + case "UnloadStoredPage": + UnloadStoredPage = (bool) state[key]; + break; + default: + throw new MagicAjaxException(String.Format("PageStore.LoadState: Unknown property '{0}'.", key)); + } + } } public PageStore(PageStoreMode mode, bool unloadStoredPage, int cacheTimeout, int maxConcurrentPages, bool maxPagesLimitAlert, OutputCompareMode compareMode) { ! _state = new Hashtable(); ! _isLocked = false; ! _origMode = _mode = mode; ! _origCacheTimeout = _cacheTimeout = cacheTimeout; ! _origMaxConcurrentPages = _maxConcurrentPages = maxConcurrentPages; ! _origMaxPagesLimitAlert = _maxPagesLimitAlert = maxPagesLimitAlert; ! _origCompareMode = _compareMode = compareMode; ! _origUnloadStoredPage = _unloadStoredPage = unloadStoredPage; } } *************** *** 75,85 **** public class MagicAjaxConfiguration { private string _scriptPath; private bool _tracing; ! private PageStore _pageStore; public string ScriptPath { get { return _scriptPath; } } --- 235,270 ---- public class MagicAjaxConfiguration { + #region Private Fields + private Hashtable _state = new Hashtable(); + private bool _isLocked = false; + + private PageStore _pageStore; + // web.config settings + private string _origScriptPath; + private bool _origTracing; + // active settings private string _scriptPath; private bool _tracing; ! #endregion + #region Public Properties public string ScriptPath { get { return _scriptPath; } + set + { + if ( _isLocked && value != _scriptPath ) + throw new MagicAjaxException("Configuration settings have been locked and cannot change."); + + if ( value != _origScriptPath ) + { + _scriptPath = value; + _state["ScriptPath"] = _scriptPath; + } + else + { + _state.Remove("ScriptPath"); + } + } } *************** *** 87,90 **** --- 272,290 ---- { get { return _tracing; } + set + { + if ( _isLocked && value != _tracing ) + throw new MagicAjaxException("Configuration settings have been locked and cannot change."); + + if ( value != _origTracing ) + { + _tracing = value; + _state["Tracing"] = _tracing; + } + else + { + _state.Remove("Tracing"); + } + } } *************** *** 93,96 **** --- 293,349 ---- get { return _pageStore; } } + #endregion + + internal bool IsDirty + { + get { return ( _state.Keys.Count > 0 || _pageStore.IsDirty ); } + } + + internal bool IsLocked + { + get { return _isLocked; } + set + { + _isLocked = value; + _pageStore.IsLocked = value; + } + } + + internal string GetState() + { + if ( ! IsDirty ) + return null; + + if ( _pageStore.IsDirty ) + _state["PageStoreState"] = _pageStore.GetState(); + + System.IO.StringWriter writer = new System.IO.StringWriter(); + new LosFormatter().Serialize(writer, _state); + + _state.Remove("PageStoreState"); + return writer.ToString(); + } + + internal void LoadState(string stateString) + { + Hashtable state = new LosFormatter().Deserialize(stateString) as Hashtable; + foreach (string key in state.Keys) + { + switch (key) + { + case "ScriptPath": + ScriptPath = (string) state[key]; + break; + case "Tracing": + Tracing = (bool) state[key]; + break; + case "PageStoreState": + _pageStore.LoadState((string)state[key]); + break; + default: + throw new MagicAjaxException(String.Format("MagicAjaxConfiguration.LoadState: Unknown property '{0}'.", key)); + } + } + } public MagicAjaxConfiguration(XmlNode xml) *************** *** 225,228 **** --- 478,483 ---- _pageStore = new PageStore(mode, unloadStoredPage, cacheTimeout, maxPages, maxPagesLimitAlert, compareMode); + _origScriptPath = _scriptPath; + _origTracing = _tracing; } } |
From: Argiris K. <be...@us...> - 2005-11-24 13:13:12
|
Update of /cvsroot/magicajax/magicajax/Core/UI/Controls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17446/Core/UI/Controls Modified Files: AjaxPanel.cs Log Message: Moved Configuration to MagicAjaxContext.Current so that configuration options can be set for a specific page. Any changes that occur to Configuration settings are stored in a hidden field on page and restored at a postback/ajaxcall Index: AjaxPanel.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/UI/Controls/AjaxPanel.cs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** AjaxPanel.cs 23 Nov 2005 15:12:48 -0000 1.21 --- AjaxPanel.cs 24 Nov 2005 13:13:04 -0000 1.22 *************** *** 873,877 **** string[] namevalue = namevaluepair.Split('#'); ! if (MagicAjaxContext.Configuration.PageStore.CompareMode == MagicAjax.Configuration.OutputCompareMode.FullHtml) { controlHtmlFingerprints.Add(string.Format("{0}_{1}", panelClientID, namevalue[0]), UnicodeEncoding.Default.GetString(Convert.FromBase64String(namevalue[1]))); --- 873,877 ---- string[] namevalue = namevaluepair.Split('#'); ! if (MagicAjaxContext.Current.Configuration.PageStore.CompareMode == MagicAjax.Configuration.OutputCompareMode.FullHtml) { controlHtmlFingerprints.Add(string.Format("{0}_{1}", panelClientID, namevalue[0]), UnicodeEncoding.Default.GetString(Convert.FromBase64String(namevalue[1]))); *************** *** 933,937 **** string keyWithoutNamingcontainer = key.Substring(panelClientID.Length + 1); ! if (MagicAjaxContext.Configuration.PageStore.CompareMode == MagicAjax.Configuration.OutputCompareMode.FullHtml) { sbuilder.AppendFormat("{0}#{1}", keyWithoutNamingcontainer, Convert.ToBase64String(UnicodeEncoding.Default.GetBytes((string)_controlHtmlFingerprints[key]))); --- 933,937 ---- string keyWithoutNamingcontainer = key.Substring(panelClientID.Length + 1); ! if (MagicAjaxContext.Current.Configuration.PageStore.CompareMode == MagicAjax.Configuration.OutputCompareMode.FullHtml) { sbuilder.AppendFormat("{0}#{1}", keyWithoutNamingcontainer, Convert.ToBase64String(UnicodeEncoding.Default.GetBytes((string)_controlHtmlFingerprints[key]))); |
From: Dion O. <dol...@us...> - 2005-11-24 12:59:25
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12328/magicajax/Core Modified Files: MagicAjaxModule.cs Log Message: small fix Index: MagicAjaxModule.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/MagicAjaxModule.cs,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** MagicAjaxModule.cs 24 Nov 2005 12:29:47 -0000 1.29 --- MagicAjaxModule.cs 24 Nov 2005 12:59:12 -0000 1.30 *************** *** 484,489 **** { AjaxCallHelper.Redirect(_response.RedirectLocation); - _response.Flush(); - return; } #endif --- 484,487 ---- |
From: Dion O. <dol...@us...> - 2005-11-24 12:29:55
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7490/magicajax/Core Modified Files: MagicAjaxModule.cs Log Message: Added support for Response.Redirect for ASP.NET 2.0 Problem: In ASP.NET 2.0, no ThreadAbortException is thrown when a Response.Redirect is done in HttpContext.Current.Handler.ProcessRequest. I solved this by checking if the request is being redirected, and call AjaxCallHelper.Redirect to output the 'redirecting' javascript. Note: Server.Transfer for ASP.NET 2.0 isn't supported by MagicAjax yet. Index: MagicAjaxModule.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/MagicAjaxModule.cs,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** MagicAjaxModule.cs 24 Nov 2005 00:43:13 -0000 1.28 --- MagicAjaxModule.cs 24 Nov 2005 12:29:47 -0000 1.29 *************** *** 390,394 **** _request = context.Request; _response = context.Response; ! _magicAjaxContext = MagicAjaxContext.Current; --- 390,394 ---- _request = context.Request; _response = context.Response; ! _magicAjaxContext = MagicAjaxContext.Current; *************** *** 476,479 **** --- 476,492 ---- } + #if NET_2_0 + // In ASP.NET 2.0, no ThreadAbortException is thrown when a Response.Redirect is + // done in HttpContext.Current.Handler.ProcessRequest. We solved this by checking + // if the request is being redirected, and output the redirecting javascript. + // Note: Server.Transfer for ASP.NET 2.0 isn't supported by MagicAjax yet. + if (_response.IsRequestBeingRedirected) + { + AjaxCallHelper.Redirect(_response.RedirectLocation); + _response.Flush(); + return; + } + #endif + _response.Flush(); |
From: Argiris K. <be...@us...> - 2005-11-24 00:43:22
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14689/Core Modified Files: MagicAjaxContext.cs MagicAjaxModule.cs Log Message: Added some private fields to MagicAjaxModule and moved ExceptionThrown to it. Index: MagicAjaxContext.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/MagicAjaxContext.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MagicAjaxContext.cs 23 Nov 2005 19:34:22 -0000 1.3 --- MagicAjaxContext.cs 24 Nov 2005 00:43:13 -0000 1.4 *************** *** 35,39 **** private bool _isAjaxCall = false; private bool _completedAjaxCall = false; - private bool _exceptionThrown = false; private bool _isBrowserSupported = false; private StoredPageInfo _storedPageInfo = null; --- 35,38 ---- *************** *** 61,73 **** /// <summary> - /// Has an exception been thrown during this callback - /// </summary> - public bool ExceptionThrown - { - get { return _exceptionThrown; } - set { _exceptionThrown = value; } - } - - /// <summary> /// Returns if this browser is supported by MagicAjax. /// For now (version 0.2) only IE and FireFox are supported. --- 60,63 ---- Index: MagicAjaxModule.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/MagicAjaxModule.cs,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** MagicAjaxModule.cs 23 Nov 2005 19:34:23 -0000 1.27 --- MagicAjaxModule.cs 24 Nov 2005 00:43:13 -0000 1.28 *************** *** 54,58 **** --- 54,62 ---- public class MagicAjaxModule: IHttpModule { + private bool _exceptionThrown; private PageFilter _filter; + private HttpRequest _request; + private HttpResponse _response; + private MagicAjaxContext _magicAjaxContext; #region IHttpModule implementation *************** *** 382,385 **** --- 386,396 ---- HttpContext context = ((HttpApplication)sender).Context; + // Init private fields + _exceptionThrown = false; + _request = context.Request; + _response = context.Response; + _magicAjaxContext = MagicAjaxContext.Current; + + // Check if the request is for the embedded AjaxCallObject.js script if (context.Request.RawUrl.EndsWith("AjaxCallObject.js.aspx")) *************** *** 415,419 **** } ! string pageKey = HttpContext.Current.Request.QueryString["__AJAX_PAGEUNLOAD"]; if (pageKey != null) { --- 426,430 ---- } ! string pageKey = _request.QueryString["__AJAX_PAGEUNLOAD"]; if (pageKey != null) { *************** *** 421,425 **** // Don't let the browser cache it or the next page unload request // will not reach the server. ! HttpContext.Current.Response.Cache.SetNoStore(); application.CompleteRequest(); } --- 432,436 ---- // Don't let the browser cache it or the next page unload request // will not reach the server. ! _response.Cache.SetNoStore(); application.CompleteRequest(); } *************** *** 434,442 **** // Continue only if it is a postback or an AjaxCall ! if ( "GET" == HttpContext.Current.Request.HttpMethod ) return; ! MagicAjaxContext.Current.IsAjaxCall = (HttpContext.Current.Request.Form["__AJAXCALL"] != null); ! NameValueCollection _form = HttpContext.Current.Request.Form; if ( PageStoreMode.NoStore == MagicAjaxContext.Configuration.PageStore.Mode ) --- 445,453 ---- // Continue only if it is a postback or an AjaxCall ! if ( "GET" == _request.HttpMethod ) return; ! _magicAjaxContext.IsAjaxCall = (_request.Form["__AJAXCALL"] != null); ! NameValueCollection _form = _request.Form; if ( PageStoreMode.NoStore == MagicAjaxContext.Configuration.PageStore.Mode ) *************** *** 444,452 **** // The page is not stored ! if (MagicAjaxContext.Current.IsAjaxCall) { //insert output filter ! _filter = new PageFilter(HttpContext.Current.Response.Filter); ! HttpContext.Current.Response.Filter = _filter; AjaxCallHelper.Init(); --- 455,463 ---- // The page is not stored ! if (_magicAjaxContext.IsAjaxCall) { //insert output filter ! _filter = new PageFilter(_response.Filter); ! _response.Filter = _filter; AjaxCallHelper.Init(); *************** *** 454,458 **** try { ! MagicAjaxContext.Current.ExceptionThrown = true; HttpContext.Current.Handler.ProcessRequest (HttpContext.Current); } --- 465,469 ---- try { ! _exceptionThrown = true; HttpContext.Current.Handler.ProcessRequest (HttpContext.Current); } *************** *** 461,469 **** // ThreadAbortException is for Server.Transfer, Response.Redirect // and AjaxCallHelper.End ! MagicAjaxContext.Current.ExceptionThrown = false; throw; } ! HttpContext.Current.Response.Flush(); string vsValue = _filter.GetViewStateFieldValue(); --- 472,480 ---- // ThreadAbortException is for Server.Transfer, Response.Redirect // and AjaxCallHelper.End ! _exceptionThrown = false; throw; } ! _response.Flush(); string vsValue = _filter.GetViewStateFieldValue(); *************** *** 500,504 **** if (pageKey == null) { ! if ( MagicAjaxContext.Current.IsAjaxCall ) throw new MagicAjaxException(String.Format("Hidden field '{0}' wasn't found. Page isn't AJAX enabled.", PageKeyFieldName)); else --- 511,515 ---- if (pageKey == null) { ! if ( _magicAjaxContext.IsAjaxCall ) throw new MagicAjaxException(String.Format("Hidden field '{0}' wasn't found. Page isn't AJAX enabled.", PageKeyFieldName)); else *************** *** 506,518 **** } ! MagicAjaxContext.Current.StoredPageInfo = GetStoredPageInfo(pageKey); ! if (MagicAjaxContext.Current.StoredPageInfo == null) { ! if (MagicAjaxContext.Current.IsAjaxCall) { // Stored Page wasn't found, could be that the session expired. // Have the browser do a refresh. // It will stop the current execution and will throw Application_EndRequest event ! AjaxCallHelper.Redirect (HttpContext.Current.Request.RawUrl); } else --- 517,529 ---- } ! _magicAjaxContext.StoredPageInfo = GetStoredPageInfo(pageKey); ! if (_magicAjaxContext.StoredPageInfo == null) { ! if (_magicAjaxContext.IsAjaxCall) { // Stored Page wasn't found, could be that the session expired. // Have the browser do a refresh. // It will stop the current execution and will throw Application_EndRequest event ! AjaxCallHelper.Redirect (_request.RawUrl); } else *************** *** 522,535 **** } ! if (!MagicAjaxContext.Current.IsAjaxCall) { // PostBack. Do some really hacky stuff to get the real viewstate. ! string vs = GetViewStateOfPage(MagicAjaxContext.Current.StoredPageInfo.Page); if (vs != null) { ! Util.SetPrivateField(HttpContext.Current.Request.Form, typeof(NameObjectCollectionBase), "_readOnly", false); ! HttpContext.Current.Request.Form["__VIEWSTATE"] = vs; ! Util.SetPrivateField(HttpContext.Current.Request.Form, typeof(NameObjectCollectionBase), "_readOnly", true); } } --- 533,546 ---- } ! if (!_magicAjaxContext.IsAjaxCall) { // PostBack. Do some really hacky stuff to get the real viewstate. ! string vs = GetViewStateOfPage(_magicAjaxContext.StoredPageInfo.Page); if (vs != null) { ! Util.SetPrivateField(_request.Form, typeof(NameObjectCollectionBase), "_readOnly", false); ! _request.Form["__VIEWSTATE"] = vs; ! Util.SetPrivateField(_request.Form, typeof(NameObjectCollectionBase), "_readOnly", true); } } *************** *** 537,559 **** { // AjaxCall ! _filter = new PageFilter(HttpContext.Current.Response.Filter); ! HttpContext.Current.Response.Filter = _filter; ! if (MagicAjaxContext.Current.StoredPageInfo.AjaxCallsCount == 0) { // For bypassing the VerifyRenderingInServerForm check ! Util.SetPrivateField(MagicAjaxContext.Current.StoredPageInfo.Page, typeof(Page), "_inOnFormRender", true); ! if (MagicAjaxContext.Current.StoredPageInfo.Page.Validators.Count == 0) { // Restore the validators ! ArrayList validators = Util.GetChildControlsOfType(MagicAjaxContext.Current.StoredPageInfo.Page, typeof(IValidator), false); foreach (IValidator valid in validators) ! MagicAjaxContext.Current.StoredPageInfo.Page.Validators.Add(valid); } } ! MagicAjaxContext.Current.StoredPageInfo.AjaxCallsCount++; ! MagicAjaxContext.Current.StoredPageInfo.LastAccess = DateTime.Now; AjaxCallHelper.Init(); --- 548,570 ---- { // AjaxCall ! _filter = new PageFilter(_response.Filter); ! _response.Filter = _filter; ! if (_magicAjaxContext.StoredPageInfo.AjaxCallsCount == 0) { // For bypassing the VerifyRenderingInServerForm check ! Util.SetPrivateField(_magicAjaxContext.StoredPageInfo.Page, typeof(Page), "_inOnFormRender", true); ! if (_magicAjaxContext.StoredPageInfo.Page.Validators.Count == 0) { // Restore the validators ! ArrayList validators = Util.GetChildControlsOfType(_magicAjaxContext.StoredPageInfo.Page, typeof(IValidator), false); foreach (IValidator valid in validators) ! _magicAjaxContext.StoredPageInfo.Page.Validators.Add(valid); } } ! _magicAjaxContext.StoredPageInfo.AjaxCallsCount++; ! _magicAjaxContext.StoredPageInfo.LastAccess = DateTime.Now; AjaxCallHelper.Init(); *************** *** 561,566 **** try { ! MagicAjaxContext.Current.ExceptionThrown = true; ! ProcessAjaxCall(MagicAjaxContext.Current.StoredPageInfo.Page); } catch (System.Threading.ThreadAbortException) --- 572,577 ---- try { ! _exceptionThrown = true; ! ProcessAjaxCall(_magicAjaxContext.StoredPageInfo.Page); } catch (System.Threading.ThreadAbortException) *************** *** 568,572 **** // ThreadAbortException is for Server.Transfer, Response.Redirect // and AjaxCallHelper.End ! MagicAjaxContext.Current.ExceptionThrown = false; throw; } --- 579,583 ---- // ThreadAbortException is for Server.Transfer, Response.Redirect // and AjaxCallHelper.End ! _exceptionThrown = false; throw; } *************** *** 589,612 **** protected void Application_EndRequest(object sender, EventArgs e) { ! if (!MagicAjaxContext.Current.IsAjaxCall || MagicAjaxContext.Current.CompletedAjaxCall || MagicAjaxContext.Current.ExceptionThrown) ! return; ! ! // There was a Response.Redirect or Server.Transfer during AjaxCall ! ! if (HttpContext.Current.Response.RedirectLocation != null) ! { ! // Handle Response.Redirect ! AjaxCallHelper.Redirect (HttpContext.Current.Response.RedirectLocation); ! } ! else { ! // Handle Server.Transfer ! AjaxCallHelper.Init(); ! if (_filter != null) { ! string html = _filter.GetHtmlPage(); ! AjaxCallHelper.WriteSetHtmlOfPageScript(html); } ! AjaxCallHelper.End(); } } --- 600,634 ---- protected void Application_EndRequest(object sender, EventArgs e) { ! try { ! if (_magicAjaxContext.IsAjaxCall && !_magicAjaxContext.CompletedAjaxCall && !_exceptionThrown) { ! // There was a Response.Redirect or Server.Transfer during AjaxCall ! ! if (_response.RedirectLocation != null) ! { ! // Handle Response.Redirect ! AjaxCallHelper.Redirect (_response.RedirectLocation); ! } ! else ! { ! // Handle Server.Transfer ! AjaxCallHelper.Init(); ! if (_filter != null) ! { ! string html = _filter.GetHtmlPage(); ! AjaxCallHelper.WriteSetHtmlOfPageScript(html); ! } ! AjaxCallHelper.End(); ! } } ! } ! finally ! { ! // Clear private fields ! _request = null; ! _response = null; ! _magicAjaxContext = null; ! _filter = null; } } *************** *** 632,639 **** RaiseAjaxCallEvent (page); ! if (MagicAjaxContext.Current.AjaxCallType == AjaxCallType.Control) { ! string target = HttpContext.Current.Request.Form["__EVENTTARGET"]; ! string argument = HttpContext.Current.Request.Form["__EVENTARGUMENT"]; RaisePostBackEventInChild (page, target, argument); } --- 654,661 ---- RaiseAjaxCallEvent (page); ! if (_magicAjaxContext.AjaxCallType == AjaxCallType.Control) { ! string target = _request.Form["__EVENTTARGET"]; ! string argument = _request.Form["__EVENTARGUMENT"]; RaisePostBackEventInChild (page, target, argument); } *************** *** 764,770 **** // an AjaxCall occurs. So, do a manual check. RadioButtonList rbList = (RadioButtonList) con; ! if (HttpContext.Current.Request.Form[rbList.UniqueID] != rbList.SelectedValue) { ! if (handler.LoadPostData(con.UniqueID, HttpContext.Current.Request.Form)) list.Add (con); } --- 786,792 ---- // an AjaxCall occurs. So, do a manual check. RadioButtonList rbList = (RadioButtonList) con; ! if (_request.Form[rbList.UniqueID] != rbList.SelectedValue) { ! if (handler.LoadPostData(con.UniqueID, _request.Form)) list.Add (con); } *************** *** 777,781 **** { bool oldSelected = cbList.Items[listItem].Selected; ! handler.LoadPostData(String.Format("{0}:{1}", con.UniqueID, listItem), HttpContext.Current.Request.Form); if (oldSelected != cbList.Items[listItem].Selected) changed = true; --- 799,803 ---- { bool oldSelected = cbList.Items[listItem].Selected; ! handler.LoadPostData(String.Format("{0}:{1}", con.UniqueID, listItem), _request.Form); if (oldSelected != cbList.Items[listItem].Selected) changed = true; *************** *** 787,791 **** else { ! if (handler.LoadPostData(con.UniqueID, HttpContext.Current.Request.Form)) { list.Add (con); --- 809,813 ---- else { ! if (handler.LoadPostData(con.UniqueID, _request.Form)) { list.Add (con); |
From: Argiris K. <be...@us...> - 2005-11-23 19:34:38
|
Update of /cvsroot/magicajax/magicajax/Core/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2430/Core/script Modified Files: AjaxCallObject.js Log Message: Tracing reuses the same trace window. Replaced keeping/restoring the page's form html with the previous implementation of RBS_Control_Stores. Some corrections to allow compilation for NET 1.1 and CustomControls. Index: AjaxCallObject.js =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/script/AjaxCallObject.js,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** AjaxCallObject.js 23 Nov 2005 09:05:06 -0000 1.21 --- AjaxCallObject.js 23 Nov 2005 19:34:23 -0000 1.22 *************** *** 1,5 **** __AJAXCboList = new Array(); __bPageIsStored = false; - __PageStateCacheName = null; __bTracing = false; __PreviousOnFormSubmit = null; --- 1,4 ---- *************** *** 62,66 **** } ! AjaxCallObject.prototype.HookAjaxCall = function(bPageIsStored, bUnloadStoredPage, pageStateCacheName, bTracing) { __PreviousOnFormSubmit = document.forms[0].onsubmit; --- 61,65 ---- } ! AjaxCallObject.prototype.HookAjaxCall = function(bPageIsStored, bUnloadStoredPage, bTracing) { __PreviousOnFormSubmit = document.forms[0].onsubmit; *************** *** 74,81 **** __bPageIsStored = bPageIsStored; - __PageStateCacheName = pageStateCacheName; __bTracing = bTracing; ! document.forms[0][__PageStateCacheName].setAttribute("ExcludeFromPost", "true"); if ( !bPageIsStored || !bUnloadStoredPage ) --- 73,83 ---- __bPageIsStored = bPageIsStored; __bTracing = bTracing; ! if (typeof(RBS_Controls) != "undefined") ! { ! for (var i=0; i < RBS_Controls.length; i++) ! RBS_Controls_Store[i].setAttribute("ExcludeFromPost", "true"); ! } if ( !bPageIsStored || !bUnloadStoredPage ) *************** *** 86,89 **** --- 88,98 ---- __PreviousOnPageBeforeUnload = window.onbeforeunload; window.onbeforeunload = this.OnPageBeforeUnload; + + __PreviousOnPageUnload = window.onunload; + window.onunload = function() { + AJAXCbo.ClearTracingWindows(); + if (__PreviousOnPageUnload != null) + __PreviousOnPageUnload(); + } } else *************** *** 96,101 **** AjaxCallObject.prototype.OnFormSubmit = function() { ! AJAXCbo.ClearTracingWindows(); ! document.forms[0][__PageStateCacheName].value = ""; var target; --- 105,114 ---- AjaxCallObject.prototype.OnFormSubmit = function() { ! // Empty the cached html of RenderedByScript controls ! if (typeof(RBS_Controls) != "undefined") ! { ! for (var i=0; i < RBS_Controls.length; i++) ! RBS_Controls_Store[i].value = ""; ! } var target; *************** *** 123,126 **** --- 136,140 ---- else { + AJAXCbo.ClearTracingWindows(); return true; } *************** *** 130,135 **** AjaxCallObject.prototype.DoPostBack = function(eventTarget, eventArgument) { ! AJAXCbo.ClearTracingWindows(); ! document.forms[0][__PageStateCacheName].value = ""; var target; --- 144,153 ---- AjaxCallObject.prototype.DoPostBack = function(eventTarget, eventArgument) { ! // Empty the cached html of RenderedByScript controls ! if (typeof(RBS_Controls) != "undefined") ! { ! for (var i=0; i < RBS_Controls.length; i++) ! RBS_Controls_Store[i].value = ""; ! } var target; *************** *** 161,165 **** --- 179,186 ---- { if (__PreviousPostBack != null) + { + AJAXCbo.ClearTracingWindows(); __PreviousPostBack(eventTarget, eventArgument); + } } } *************** *** 167,178 **** AjaxCallObject.prototype.OnPageLoad = function() { ! // Restore the html of form ! var html = document.forms[0][__PageStateCacheName].value; ! if (html != "") { ! document.forms[0].innerHTML = decodeURIComponent(html.substr(5)); ! document.forms[0][__PageStateCacheName].value = ""; } - if (__PreviousOnPageLoad != null) return __PreviousOnPageLoad(); --- 188,204 ---- AjaxCallObject.prototype.OnPageLoad = function() { ! // Restore the html of RenderedByScript controls ! if (typeof(RBS_Controls) != "undefined") { ! for (var i=0; i < RBS_Controls.length; i++) ! { ! var html = RBS_Controls_Store[i].value; ! if (html != "") ! { ! RBS_Controls[i].innerHTML = decodeURIComponent(html.substring(5, html.length)); ! RBS_Controls_Store[i].value = ""; ! } ! } } if (__PreviousOnPageLoad != null) return __PreviousOnPageLoad(); *************** *** 181,188 **** AjaxCallObject.prototype.OnPageBeforeUnload = function() { ! // Will be null if an Error page is displayed. ! if (document.forms[0][__PageStateCacheName] != null) ! document.forms[0][__PageStateCacheName].value = "HTML:" + encodeURIComponent(document.forms[0].innerHTML); ! if (__PreviousOnPageBeforeUnload != null) return __PreviousOnPageBeforeUnload(); --- 207,217 ---- AjaxCallObject.prototype.OnPageBeforeUnload = function() { ! // Save the html of RenderedByScript controls, so that it can be restored for the ! // browser's "Back Button" ! if (typeof(RBS_Controls) != "undefined") ! { ! for (var i=0; i < RBS_Controls.length; i++) ! RBS_Controls_Store[i].value = "HTML:" + encodeURIComponent(RBS_Controls[i].innerHTML); ! } if (__PreviousOnPageBeforeUnload != null) return __PreviousOnPageBeforeUnload(); *************** *** 191,194 **** --- 220,225 ---- AjaxCallObject.prototype.OnPageUnload = function() { + AJAXCbo.ClearTracingWindows(); + if (document.forms[0]["__AJAX_PAGEKEY"] == null) return; *************** *** 432,437 **** AjaxCallObject.prototype.CreateTracingWindow = function() { ! this.TraceWindow = window.open("","_blank","location=no,resizable=yes,scrollbars=yes"); ! __TraceWindows.push(this.TraceWindow); } --- 463,480 ---- AjaxCallObject.prototype.CreateTracingWindow = function() { ! this.TraceWindow = null; ! for (var i=0; i < __TraceWindows.length; i++) ! { ! if (__TraceWindows[i].TraceFinished) ! { ! this.TraceWindow = __TraceWindows[i]; ! } ! } ! ! if (this.TraceWindow == null) ! { ! this.TraceWindow = window.open("","_blank","location=no,resizable=yes,scrollbars=yes"); ! __TraceWindows.push(this.TraceWindow); ! } } *************** *** 440,449 **** for (var i=0; i < __TraceWindows.length; i++) { ! if (__TraceWindows[i].closed || __TraceWindows[i].TraceFinished) ! { ! __TraceWindows[i].close(); ! __TraceWindows.splice(i, 1); ! i--; ! } } } --- 483,489 ---- for (var i=0; i < __TraceWindows.length; i++) { ! __TraceWindows[i].close(); ! __TraceWindows.splice(i, 1); ! i--; } } |
From: Argiris K. <be...@us...> - 2005-11-23 19:34:38
|
Update of /cvsroot/magicajax/magicajax/CustomControls/UI/Controls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2430/CustomControls/UI/Controls Modified Files: AjaxLinkedPanelListControl.cs Log Message: Tracing reuses the same trace window. Replaced keeping/restoring the page's form html with the previous implementation of RBS_Control_Stores. Some corrections to allow compilation for NET 1.1 and CustomControls. Index: AjaxLinkedPanelListControl.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/CustomControls/UI/Controls/AjaxLinkedPanelListControl.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AjaxLinkedPanelListControl.cs 18 Nov 2005 18:53:08 -0000 1.4 --- AjaxLinkedPanelListControl.cs 23 Nov 2005 19:34:23 -0000 1.5 *************** *** 126,133 **** protected override void OnPreRender(EventArgs e) { ! if ( !AjaxCallHelper.IsAjaxCallForPage(this.Page) ) { // ÐñÝðåé íá ðñïçãåßôáé ç äÞëùóç ôïõ AjaxCallObject.js ! MagicAjaxModule.Instance.EnableAjaxOnPage(this.Page); if (!Page.IsClientScriptBlockRegistered( "AJAXLINKEDPANELLIST_SCRIPTS" )) --- 126,133 ---- protected override void OnPreRender(EventArgs e) { ! if ( !MagicAjaxContext.Current.IsAjaxCallForPage(this.Page) ) { // ÐñÝðåé íá ðñïçãåßôáé ç äÞëùóç ôïõ AjaxCallObject.js ! MagicAjaxModule.EnableAjaxOnPage(this.Page); if (!Page.IsClientScriptBlockRegistered( "AJAXLINKEDPANELLIST_SCRIPTS" )) |
From: Argiris K. <be...@us...> - 2005-11-23 19:34:34
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2430/Core Modified Files: MagicAjaxContext.cs MagicAjaxModule.cs PageFilter.cs Log Message: Tracing reuses the same trace window. Replaced keeping/restoring the page's form html with the previous implementation of RBS_Control_Stores. Some corrections to allow compilation for NET 1.1 and CustomControls. Index: PageFilter.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/PageFilter.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PageFilter.cs 23 Nov 2005 15:12:48 -0000 1.1 --- PageFilter.cs 23 Nov 2005 19:34:23 -0000 1.2 *************** *** 1,5 **** using System; using System.IO; - using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; --- 1,4 ---- Index: MagicAjaxContext.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/MagicAjaxContext.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MagicAjaxContext.cs 23 Nov 2005 15:21:13 -0000 1.2 --- MagicAjaxContext.cs 23 Nov 2005 19:34:22 -0000 1.3 *************** *** 1,4 **** using System; - using System.Collections.Generic; using System.Text; using System.Web; --- 1,3 ---- Index: MagicAjaxModule.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/MagicAjaxModule.cs,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** MagicAjaxModule.cs 23 Nov 2005 15:12:48 -0000 1.26 --- MagicAjaxModule.cs 23 Nov 2005 19:34:23 -0000 1.27 *************** *** 100,104 **** alert(""Unable to find script library '{0}/{1}'. Copy the file to the required location, or change the 'ajaxCallScriptPath' setting at magicAjax section of web.config.""); else ! AJAXCbo.HookAjaxCall({2},{3},{4},{5}); </script>"; --- 100,104 ---- alert(""Unable to find script library '{0}/{1}'. Copy the file to the required location, or change the 'ajaxCallScriptPath' setting at magicAjax section of web.config.""); else ! AJAXCbo.HookAjaxCall({2},{3},{4}); </script>"; *************** *** 128,132 **** bool pageIsStored = (MagicAjaxContext.Configuration.PageStore.Mode != PageStoreMode.NoStore); - string pageStateCacheName; if ( pageIsStored ) --- 128,131 ---- *************** *** 141,164 **** page.RegisterHiddenField (PageKeyFieldName, key); } - - // At storing modes we don't mess with the ViewState field, so use - // a different name for the hidden field at each page request so that - // it can be reset for Firefox's "Refresh". - pageStateCacheName = "__PAGE_STATE_CACHE" + DateTime.Now.Ticks; } - else - { - // Firefox, when performing a refresh, loads the page but keeps any changed INPUT - // field values. Thus, the html of __PAGE_STATE_CACHE is restored - // as if the page was loaded because of the browser's "Back Button". - // We cannot avoid this because Firefox also keeps any changes that occured - // to ViewState, so we need the controls to keep their changes. - pageStateCacheName = "__PAGE_STATE_CACHE"; - } - - page.RegisterHiddenField(pageStateCacheName, String.Empty); bool unloadStoredPage = MagicAjaxContext.Configuration.PageStore.UnloadStoredPage; ! page.RegisterStartupScript("AJAXCALL_HOOK", String.Format(STARTUP_SCRIPT_FORMAT, location, "AjaxCallObject.js", pageIsStored.ToString().ToLower(), unloadStoredPage.ToString().ToLower(), AjaxCallHelper.EncodeString(pageStateCacheName), MagicAjaxContext.Configuration.Tracing.ToString().ToLower())); } } --- 140,147 ---- page.RegisterHiddenField (PageKeyFieldName, key); } } bool unloadStoredPage = MagicAjaxContext.Configuration.PageStore.UnloadStoredPage; ! page.RegisterStartupScript("AJAXCALL_HOOK", String.Format(STARTUP_SCRIPT_FORMAT, location, "AjaxCallObject.js", pageIsStored.ToString().ToLower(), unloadStoredPage.ToString().ToLower(), MagicAjaxContext.Configuration.Tracing.ToString().ToLower())); } } |
From: Argiris K. <be...@us...> - 2005-11-23 19:34:32
|
Update of /cvsroot/magicajax/magicajax/Core/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2430/Core/UI Modified Files: RenderedByScriptControl.cs Log Message: Tracing reuses the same trace window. Replaced keeping/restoring the page's form html with the previous implementation of RBS_Control_Stores. Some corrections to allow compilation for NET 1.1 and CustomControls. Index: RenderedByScriptControl.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/UI/RenderedByScriptControl.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** RenderedByScriptControl.cs 22 Nov 2005 00:59:22 -0000 1.11 --- RenderedByScriptControl.cs 23 Nov 2005 19:34:23 -0000 1.12 *************** *** 182,185 **** --- 182,226 ---- } + protected override void OnLoad(EventArgs e) + { + base.OnLoad (e); + + if (!IsChildOfRenderedByScriptControl(this)) + { + string hiddenStore; + + if ( IsPageNoStoreMode ) + { + // Firefox, when performing a refresh, loads the page but keeps any INPUT + // field values. Thus, the html of a RenderedByScriptControl is restored + // as if the page was loaded because of the browser's "Back Button". + // We cannot avoid this because Firefox also keeps any changes that occured + // to ViewState, so we need the controls to keep their changes. + hiddenStore = this.ClientID + "$RBS_Store"; + } + else + { + // At storing modes we don't mess with the ViewState field, so use + // a different name for the hidden field at each page request so that + // it can be reset for Firefox's "Refresh". + hiddenStore = this.ClientID + "$RBS_Store" + DateTime.Now.Ticks; + } + + Page.RegisterHiddenField(hiddenStore, null); + Page.RegisterArrayDeclaration("RBS_Controls", String.Format("document.getElementById(\"{0}$RBS_Holder\")", this.ClientID)); + Page.RegisterArrayDeclaration("RBS_Controls_Store", String.Format("document.forms[0][\"{0}\"]", hiddenStore)); + } + } + + protected bool IsChildOfRenderedByScriptControl(Control control) + { + if (control.Parent == null || control.Parent == control.Page) + return false; + else if (control.Parent is RenderedByScriptControl) + return true; + else + return IsChildOfRenderedByScriptControl(control.Parent); + } + protected override void OnAjaxCall(EventArgs e) { *************** *** 206,210 **** if ( !IsAjaxCall || (writer.InnerWriter is IScriptRenderingDisabler && (writer.InnerWriter as IScriptRenderingDisabler).DisableScriptRendering) ) { ! base.Render (writer); _isHtmlRendered = true; --- 247,261 ---- if ( !IsAjaxCall || (writer.InnerWriter is IScriptRenderingDisabler && (writer.InnerWriter as IScriptRenderingDisabler).DisableScriptRendering) ) { ! if ( !IsChildOfRenderedByScriptControl(this) ) ! { ! // Put the html of this control inside a SPAN tag so that it can ! // be saved and restored when the page is loaded from the Browser's cache, ! // i.e. when the back button is pressed. ! writer.Write("<span id='{0}$RBS_Holder'>", this.ClientID); ! base.Render (writer); ! writer.Write("</span>"); ! } ! else ! base.Render (writer); _isHtmlRendered = true; |
From: Dion O. <dol...@us...> - 2005-11-23 15:28:40
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2409/magicajax/Core Modified Files: AjaxCallHelper.cs Util.cs Log Message: moved ResolveUrl() to Utils.cs Index: Util.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/Util.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Util.cs 23 Nov 2005 15:12:48 -0000 1.6 --- Util.cs 23 Nov 2005 15:28:28 -0000 1.7 *************** *** 1,4 **** --- 1,5 ---- using System; using System.Collections; + using System.Web; using System.Web.UI; using System.Security.Cryptography; *************** *** 17,21 **** /// <param name="str"></param> /// <returns></returns> ! static public string GetFingerprint(string input) { MagicAjax.Configuration.OutputCompareMode compareMode = MagicAjaxContext.Configuration.PageStore.CompareMode; --- 18,22 ---- /// <param name="str"></param> /// <returns></returns> ! public static string GetFingerprint(string input) { MagicAjax.Configuration.OutputCompareMode compareMode = MagicAjaxContext.Configuration.PageStore.CompareMode; *************** *** 36,39 **** --- 37,56 ---- /// <summary> + /// Resolves relative url's (starting with "~"). + /// Use this when Control.ResolveUrl() is not available. + /// </summary> + /// <param name="url"></param> + /// <returns></returns> + public static string ResolveUrl(string url) + { + if (url != null && url.StartsWith("~") && HttpContext.Current != null) + { + string appPath = HttpContext.Current.Request.ApplicationPath.Length > 1 ? HttpContext.Current.Request.ApplicationPath : string.Empty; + url = appPath + url.Substring(1); + } + return url; + } + + /// <summary> /// Call a private method from the given object. /// </summary> Index: AjaxCallHelper.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/AjaxCallHelper.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AjaxCallHelper.cs 23 Nov 2005 15:21:13 -0000 1.9 --- AjaxCallHelper.cs 23 Nov 2005 15:28:28 -0000 1.10 *************** *** 252,271 **** } } - - /// <summary> - /// Resolves relative url's (starting with "~"). - /// Use this when Control.ResolveUrl() is not available. - /// </summary> - /// <param name="url"></param> - /// <returns></returns> - public static string ResolveUrl(string url) - { - if (url != null && url.StartsWith("~") && HttpContext.Current != null) - { - string appPath = HttpContext.Current.Request.ApplicationPath.Length > 1 ? HttpContext.Current.Request.ApplicationPath : string.Empty; - url = appPath + url.Substring(1); - } - return url; - } #endregion --- 252,255 ---- *************** *** 278,282 **** { Init(); ! Write(String.Format("window.location.href=\"{0}\";\r\n", ResolveUrl(url))); End(); } --- 262,266 ---- { Init(); ! Write(String.Format("window.location.href=\"{0}\";\r\n", Util.ResolveUrl(url))); End(); } |
From: Dion O. <dol...@us...> - 2005-11-23 15:28:39
|
Update of /cvsroot/magicajax/magicajax/Core/Configuration In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2409/magicajax/Core/Configuration Modified Files: MagicAjaxConfiguration.cs Log Message: moved ResolveUrl() to Utils.cs Index: MagicAjaxConfiguration.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/Configuration/MagicAjaxConfiguration.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MagicAjaxConfiguration.cs 21 Nov 2005 12:18:36 -0000 1.5 --- MagicAjaxConfiguration.cs 23 Nov 2005 15:28:28 -0000 1.6 *************** *** 112,116 **** { // Resolve relative scriptPath url's (starting with "~") ! _scriptPath = AjaxCallHelper.ResolveUrl(attrib.Value); } --- 112,116 ---- { // Resolve relative scriptPath url's (starting with "~") ! _scriptPath = Util.ResolveUrl(attrib.Value); } |
From: Dion O. <dol...@us...> - 2005-11-23 15:21:22
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv675/magicajax/Core Modified Files: AjaxCallHelper.cs MagicAjaxContext.cs Log Message: Move AjaxCallType from AjaxCallhelper to MagicAjaxContext Index: AjaxCallHelper.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/AjaxCallHelper.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AjaxCallHelper.cs 23 Nov 2005 15:12:48 -0000 1.8 --- AjaxCallHelper.cs 23 Nov 2005 15:21:13 -0000 1.9 *************** *** 30,52 **** { /// <summary> - /// Defines the various AjaxCall types - /// </summary> - public enum AjaxCallType - { - /// <summary> - /// Client didn't invoke an AjaxCall - /// </summary> - None, - /// <summary> - /// Standard AjaxCall invoked by a control on the page - /// </summary> - Control, - /// <summary> - /// AjaxCall invoked by the AjaxCallTimer - /// </summary> - Timer - } - - /// <summary> /// Helper functions for AjaxCall handling. /// </summary> --- 30,33 ---- Index: MagicAjaxContext.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/MagicAjaxContext.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MagicAjaxContext.cs 23 Nov 2005 15:12:48 -0000 1.1 --- MagicAjaxContext.cs 23 Nov 2005 15:21:13 -0000 1.2 *************** *** 10,13 **** --- 10,32 ---- { /// <summary> + /// Defines the various AjaxCall types + /// </summary> + public enum AjaxCallType + { + /// <summary> + /// Client didn't invoke an AjaxCall + /// </summary> + None, + /// <summary> + /// Standard AjaxCall invoked by a control on the page + /// </summary> + Control, + /// <summary> + /// AjaxCall invoked by the AjaxCallTimer + /// </summary> + Timer + } + + /// <summary> /// MagicAjaxContext contains all information about the MagicAjax configuration and current request /// </summary> |
From: Dion O. <dol...@us...> - 2005-11-23 15:19:37
|
Update of /cvsroot/magicajax/magicajax/Core/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32687/magicajax/Core/UI Modified Files: AjaxUserControl.cs Log Message: minor change (check for HttpContext.Current not null for designmode) Index: AjaxUserControl.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/UI/AjaxUserControl.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AjaxUserControl.cs 23 Nov 2005 15:12:48 -0000 1.7 --- AjaxUserControl.cs 23 Nov 2005 15:19:29 -0000 1.8 *************** *** 73,77 **** public bool IsAjaxCall { ! get { return MagicAjaxContext.Current.IsAjaxCallForPage(this.Page); } } --- 73,77 ---- public bool IsAjaxCall { ! get { return HttpContext.Current != null && MagicAjaxContext.Current.IsAjaxCallForPage(this.Page); } } |