From: Argiris K. <be...@us...> - 2005-12-18 16:44:55
|
Update of /cvsroot/magicajax/magicajax/Core/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25522/Core/UI Modified Files: AjaxControl.cs RenderedByScriptControl.cs Log Message: -Added 'AjaxType' MagicAjax attribute for controls -Added 'ExcludeFlags' MagicAjax attribute for controls -Added AjaxZone control. Index: AjaxControl.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/UI/AjaxControl.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AjaxControl.cs 30 Nov 2005 12:22:29 -0000 1.9 --- AjaxControl.cs 18 Dec 2005 16:44:46 -0000 1.10 *************** *** 34,37 **** --- 34,40 ---- { private MagicAjaxContext _magicAjaxContext; + private bool _isAjaxCall; + private bool _isPageNoStoreMode; + private bool _isInAjaxZone; /// <summary> *************** *** 64,68 **** public bool IsPageNoStoreMode { ! get { return HttpContext.Current != null && MagicAjaxContext.Current.IsPageNoStoreMode; } } --- 67,71 ---- public bool IsPageNoStoreMode { ! get { return _isPageNoStoreMode; } } *************** *** 73,86 **** public bool IsAjaxCall { ! get { return (HttpContext.Current != null && this.Page != null && MagicAjaxContext.Current.IsAjaxCallForPage(this.Page)); } } public AjaxControl() { - _magicAjaxContext = MagicAjaxContext.Current; } public AjaxControl(HtmlTextWriterTag tag) : base(tag) { - _magicAjaxContext = MagicAjaxContext.Current; } --- 76,93 ---- public bool IsAjaxCall { ! get { return _isAjaxCall; } ! } ! ! [Browsable(false),DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] ! public bool IsInAjaxZone ! { ! get { return _isInAjaxZone; } } public AjaxControl() { } public AjaxControl(HtmlTextWriterTag tag) : base(tag) { } *************** *** 90,93 **** --- 97,106 ---- } + protected override void OnLoad(EventArgs e) + { + base.OnLoad (e); + InitAjaxIntrinsics(); + } + protected override void OnPreRender(EventArgs e) { *************** *** 105,108 **** --- 118,123 ---- protected virtual void OnAjaxCall(EventArgs e) { + InitAjaxIntrinsics(); + if (AjaxCall != null) AjaxCall(this, e); *************** *** 111,117 **** --- 126,155 ---- protected virtual void OnAjaxCallEnd(EventArgs e) { + _magicAjaxContext = null; + if (AjaxCallEnd != null) AjaxCallEnd(this, e); } + + protected virtual void InitAjaxIntrinsics() + { + _magicAjaxContext = MagicAjaxContext.Current; + _isAjaxCall = ( HttpContext.Current != null && this.Page != null && MagicAjaxContext.Current.IsAjaxCallForPage(this.Page) ); + _isPageNoStoreMode = ( HttpContext.Current != null && MagicAjaxContext.Current.IsPageNoStoreMode ); + + string ajaxZoneID = Context.Request.Form["__AJAXZONE"]; + _isInAjaxZone = ( ajaxZoneID == null || IsInAjaxZoneRecursive(this, ajaxZoneID) ); + } + + private bool IsInAjaxZoneRecursive (Control control, string ajaxZoneID) + { + if (control.ClientID == ajaxZoneID) + return true; + + if (control.Parent == null || control.Parent == control.Page) + return false; + + return IsInAjaxZoneRecursive(control.Parent, ajaxZoneID); + } } } Index: RenderedByScriptControl.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/UI/RenderedByScriptControl.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** RenderedByScriptControl.cs 30 Nov 2005 12:22:29 -0000 1.14 --- RenderedByScriptControl.cs 18 Dec 2005 16:44:46 -0000 1.15 *************** *** 298,301 **** --- 298,304 ---- public virtual void WriteScript() { + if ( ! this.IsInAjaxZone ) + return; + if ( ! this.Visible ) { |