[Mono-dev] [Mono-Dev]: Modifications to System.Web javascript for J2EE portal support

Eyal Alaluf eyala at mainsoft.com
Mon Jan 22 12:17:40 EST 2007


Hi, Marek and everyone.

 

Attached is a diff to improve support for J2EE portlets for the
TARGET_J2EE configuration. In order to keep the code paths common, most
of the diff is not under '#if TARGET_j2EE'. Therefore I'd like you to
review and approve it before I can commit.

The main issue stems from the fact that portlets in J2EE render HTML
fragments and not the whole page. That is one page can contain several
portlets and therefore several ASP.Net pages. This breaks implicit code
assumptions about uniqueness of global variables. The most important
example is the 'theForm' variable. For Portlet support one cannot assume
that on the client side there is exactly one 'theForm' defined.

The changes common with Mono are:

*        An internal property called 'theForm' is added to
System.Web.UI.Page. Its value for TARGET_J2EE will be different for
every portlet.

*        We pass the 'theForm' as a parameter to all the JavaScript
functions that use it directly.

a.    In cases of callback functions (like functions assigned to
window.onload) we create a function whose name depends upon the portlet
namespace and that passes 'theForm' to the global JavaScript function.

*        We save a reference to 'theForm' within the tree view data
(also in details view and grid view data). This allows the JavaScript of
these controls to pass the form to the 'WebForm_DoCallback' function.

 

It is important to note that before this change some key JavaScript
functions were compatible with MS JavaScript functions. After the change
these methods have an extra parameter indicating the form. This means
that if someone used such a function from his JavaScript code then his
code will be broken. 

Do you think that being compatible with MS on JavaScript is an important
feature? Unlike the C# API MS does not document these functions and even
tries to abstract their existence in some of System.Web API (e.g. the
ClientScriptManager class).

 

Your comments are welcome.

 

Eyal.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070122/f41e4824/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Portal.jscript.diff
Type: application/octet-stream
Size: 19941 bytes
Desc: Portal.jscript.diff
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070122/f41e4824/attachment.obj 


More information about the Mono-devel-list mailing list