From: Dion O. <dol...@us...> - 2005-11-15 12:38:44
|
Update of /cvsroot/magicajax/magicajax/Core/UI/Controls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27202/magicajax/Core/UI/Controls Modified Files: AjaxPanel.cs Log Message: Updated AjaxPanel, so only in NoStore mode the SHA-1 hashes of the output Html is stored (instead of the full html output). I've done this to make sure the 'Session' and 'Cache' modes are untouched by these changes. Later, we can start using the SHA-1 hashes also for 'Session' and 'Cache' modes. Index: AjaxPanel.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/UI/Controls/AjaxPanel.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AjaxPanel.cs 15 Nov 2005 11:47:53 -0000 1.4 --- AjaxPanel.cs 15 Nov 2005 12:38:36 -0000 1.5 *************** *** 82,85 **** --- 82,86 ---- private ArrayList _addedControls = new ArrayList(); private ArrayList _removedControls = new ArrayList(); + private Hashtable _controlHtmls = new Hashtable(); private Hashtable _controlHtmlHashes = new Hashtable(); private NoVerifyRenderingPage _noVerifyPage = new NoVerifyRenderingPage(); *************** *** 184,188 **** ExtendedRenderControl (control, litewriter); ! _controlHtmlHashes[control] = AjaxCallHelper.GetBase64SHA1Sum(sb.ToString()); sb.Length = 0; --- 185,192 ---- ExtendedRenderControl (control, litewriter); ! if (IsPageNoStoreMode) ! _controlHtmlHashes[control] = AjaxCallHelper.GetBase64SHA1Sum(sb.ToString()); ! else ! _controlHtmls[control] = sb.ToString(); sb.Length = 0; *************** *** 203,206 **** --- 207,211 ---- _addedControls.Clear(); _removedControls.Clear(); + _controlHtmls.Clear(); _controlHtmlHashes.Clear(); } *************** *** 293,297 **** writer.Write (sbFull.ToString()); ! _controlHtmlHashes[con] = AjaxCallHelper.GetBase64SHA1Sum(sb.ToString()); sbFull.Length = 0; --- 298,305 ---- writer.Write (sbFull.ToString()); ! if (IsPageNoStoreMode) ! _controlHtmlHashes[con] = AjaxCallHelper.GetBase64SHA1Sum(sb.ToString()); ! else ! _controlHtmls[con] = sb.ToString(); sbFull.Length = 0; *************** *** 314,317 **** --- 322,326 ---- protected virtual void SaveControlState() { + //note:only for NoStore mode _controlState.SetControlIDs(_controlHtmlHashes); _controlState.Save (this.UniqueID, this.Page); *************** *** 409,413 **** fullwriter.WriteEndTag ("span"); ! _controlHtmlHashes[con] = AjaxCallHelper.GetBase64SHA1Sum(sb.ToString()); sb.Length = 0; --- 418,425 ---- fullwriter.WriteEndTag ("span"); ! if (IsPageNoStoreMode) ! _controlHtmlHashes[con] = AjaxCallHelper.GetBase64SHA1Sum(sb.ToString()); ! else ! _controlHtmls[con] = sb.ToString(); sb.Length = 0; *************** *** 425,429 **** foreach (Control con in _removedControls) { ! _controlHtmlHashes.Remove(con); AjaxCallHelper.WriteRemoveElementScript (ClientID, GetAjaxElemID(con)); } --- 437,445 ---- foreach (Control con in _removedControls) { ! if (IsPageNoStoreMode) ! _controlHtmlHashes.Remove(con); ! else ! _controlHtmls.Remove(con); ! AjaxCallHelper.WriteRemoveElementScript (ClientID, GetAjaxElemID(con)); } *************** *** 445,449 **** output.Write (html); ! _controlHtmlHashes[con] = AjaxCallHelper.GetBase64SHA1Sum(sb.ToString()); } else --- 461,468 ---- output.Write (html); ! if (IsPageNoStoreMode) ! _controlHtmlHashes[con] = AjaxCallHelper.GetBase64SHA1Sum(sb.ToString()); ! else ! _controlHtmls[con] = sb.ToString(); } else *************** *** 451,461 **** ExtendedRenderControl (con, output, litewriter); html = sb.ToString(); - string htmlHashCode = AjaxCallHelper.GetBase64SHA1Sum(html); ! // If it's html rendering sha1 hash is the same, ignore it. ! if (htmlHashCode != (string)_controlHtmlHashes[con]) { ! ExtendedWriteSetHtmlOfElementScript(html, GetAjaxElemID(con)); ! _controlHtmlHashes[con] = htmlHashCode; } } --- 470,493 ---- ExtendedRenderControl (con, output, litewriter); html = sb.ToString(); ! if (IsPageNoStoreMode) { ! string htmlHashCode = AjaxCallHelper.GetBase64SHA1Sum(html); ! ! // If it's html rendering sha1 hash is the same, ignore it. ! if (htmlHashCode != (string)_controlHtmlHashes[con]) ! { ! ExtendedWriteSetHtmlOfElementScript(html, GetAjaxElemID(con)); ! _controlHtmlHashes[con] = htmlHashCode; ! } ! } ! else ! { ! // If it's html rendering is the same, ignore it. ! if (html != (string)_controlHtmls[con]) ! { ! ExtendedWriteSetHtmlOfElementScript(html, GetAjaxElemID(con)); ! _controlHtmls[con] = html; ! } } } *************** *** 714,718 **** { Control con = Controls[i]; ! if (!_addedControls.Contains(con) && _controlHtmlHashes[con] != null) return GetAjaxElemID(con); } --- 746,751 ---- { Control con = Controls[i]; ! ! if (!_addedControls.Contains(con) && ((IsPageNoStoreMode && _controlHtmlHashes[con] != null) || (!IsPageNoStoreMode && _controlHtmls[con] != null))) return GetAjaxElemID(con); } *************** *** 772,776 **** public static string GetPanelControlStateHiddenFieldID (string panelUniqueID) { ! return string.Format("__PANELCONTROLSTATE_{0}", panelUniqueID); } --- 805,809 ---- public static string GetPanelControlStateHiddenFieldID (string panelUniqueID) { ! return string.Format("__AJAXPANELCONTROLSTATE_{0}", panelUniqueID); } |