You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by "Woonsan Ko (JIRA)" <je...@portals.apache.org> on 2010/04/28 11:24:31 UTC
[jira] Created: (JS2-1194) Some Portlets which contain
'document.write()' js calls (e.g. GWT-based portlet) is not rendered at
first after adding the portlet.
Some Portlets which contain 'document.write()' js calls (e.g. GWT-based portlet) is not rendered at first after adding the portlet.
-----------------------------------------------------------------------------------------------------------------------------------
Key: JS2-1194
URL: https://issues.apache.org/jira/browse/JS2-1194
Project: Jetspeed 2
Issue Type: Bug
Affects Versions: 2.2.1
Reporter: Woonsan Ko
Assignee: Woonsan Ko
This issue has been known for long time for client-side rendering modules, so there were some solutions.
However, we don't have any solution in JetUI yet.
GWT based portlet application should contain a js file, "...nocache.js", which contains "document.write()" calls. This call causes the weird page status after adding the portlet.
By the way, the Jetspeed-2 Desktop had a solution for this problem like the following:
- It retrieves the portlet rendered content from the /portlet pipeline.
- It inspects the content whether the content has <script> tags.
- If it contains a script tag with src attribute, it retrieves the real source content.
- It inspects each code line and replaces with the following rules:
a) Replace "addEventListener|attachEvent" by a custom JS2 code:
/\b([a-z_A-Z$]\w*)\s*\.\s*(addEventListener|attachEvent)\s*\(/
==> "jetspeed.postload_" + methodNm + "(" + nodeRef + "," + script.substr(match.index + match[0].length)
b) Replace "document.write()" by a custom JS2 code:
/\b(document\s*.\s*write(ln)?)\s*\(/
==> "jetspeed.postload_docwrite(" + script.substr(match.index + match[0].length)
c) Replace "location.href = ..." by a custom JS2 code:
/(;\s|\s+)([a-z_A-Z$][\w.]*)\s*\.\s*(URL\s*|(location\s*(\.\s*href\s*){0,1}))=\s*(("[^"]*"|'[^']*'|[^;])[^;]*)/
==> "jetspeed.setdoclocation(" + match[2] + ', "' + memberExpr + '", (' + match[6] + '))' + script.substr(match.index + match[0].length)
- References: PortletWindow.src.js and core.src.js, APA-5, JS2-1063.
However, the solution provided by JS2 desktop has some caveats:
- Looks too hacky.
- If the script uses a different variable name for document, the current code could not detect it. (GWT does this: l = document; )
By the way, we could recommend some best practices for portlet development instead of fixing this problem inside JS2:
- A Portlet should not use "document.write()" calls; Instead, it is recommended to use Portlet 2.0 head contribution where possible.
- A Portlet should not use "addEventListener|attachEvent" calls; Instead, it is recommended to use higher level frameworks such as YUI3.
- It is not recommended for a Portlet to use "location.href = ...;".
Anyway, I don't have a clear idea to solve this problem yet.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
[jira] Resolved: (JS2-1194) Some Portlets which contain
'document.write()' js calls (e.g. GWT-based portlet) is not rendered at
first after adding the portlet.
Posted by "Woonsan Ko (JIRA)" <je...@portals.apache.org>.
[ https://issues.apache.org/jira/browse/JS2-1194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Woonsan Ko resolved JS2-1194.
-----------------------------
Fix Version/s: 2.2.2
Resolution: Fixed
Fixed.
If a portlet definition has "jetui.refresh.page.on.add.portlet" metadata with value, "true", then the page will be refreshed when adding the portlet with toolbox portlet.
> Some Portlets which contain 'document.write()' js calls (e.g. GWT-based portlet) is not rendered at first after adding the portlet.
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Key: JS2-1194
> URL: https://issues.apache.org/jira/browse/JS2-1194
> Project: Jetspeed 2
> Issue Type: Bug
> Affects Versions: 2.2.1
> Reporter: Woonsan Ko
> Assignee: Woonsan Ko
> Fix For: 2.2.2
>
>
> This issue has been known for long time for client-side rendering modules, so there were some solutions.
> However, we don't have any solution in JetUI yet.
> GWT based portlet application should contain a js file, "...nocache.js", which contains "document.write()" calls. This call causes the weird page status after adding the portlet.
> By the way, the Jetspeed-2 Desktop had a solution for this problem like the following:
> - It retrieves the portlet rendered content from the /portlet pipeline.
> - It inspects the content whether the content has <script> tags.
> - If it contains a script tag with src attribute, it retrieves the real source content.
> - It inspects each code line and replaces with the following rules:
> a) Replace "addEventListener|attachEvent" by a custom JS2 code:
> /\b([a-z_A-Z$]\w*)\s*\.\s*(addEventListener|attachEvent)\s*\(/
> ==> "jetspeed.postload_" + methodNm + "(" + nodeRef + "," + script.substr(match.index + match[0].length)
> b) Replace "document.write()" by a custom JS2 code:
> /\b(document\s*.\s*write(ln)?)\s*\(/
> ==> "jetspeed.postload_docwrite(" + script.substr(match.index + match[0].length)
> c) Replace "location.href = ..." by a custom JS2 code:
> /(;\s|\s+)([a-z_A-Z$][\w.]*)\s*\.\s*(URL\s*|(location\s*(\.\s*href\s*){0,1}))=\s*(("[^"]*"|'[^']*'|[^;])[^;]*)/
> ==> "jetspeed.setdoclocation(" + match[2] + ', "' + memberExpr + '", (' + match[6] + '))' + script.substr(match.index + match[0].length)
> - References: PortletWindow.src.js and core.src.js, APA-5, JS2-1063.
> However, the solution provided by JS2 desktop has some caveats:
> - Looks too hacky.
> - If the script uses a different variable name for document, the current code could not detect it. (GWT does this: l = document; )
> By the way, we could recommend some best practices for portlet development instead of fixing this problem inside JS2:
> - A Portlet should not use "document.write()" calls; Instead, it is recommended to use Portlet 2.0 head contribution where possible.
> - A Portlet should not use "addEventListener|attachEvent" calls; Instead, it is recommended to use higher level frameworks such as YUI3.
> - It is not recommended for a Portlet to use "location.href = ...;".
> Anyway, I don't have a clear idea to solve this problem yet.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
[jira] Commented: (JS2-1194) Some Portlets which contain
'document.write()' js calls (e.g. GWT-based portlet) is not rendered at
first after adding the portlet.
Posted by "Woonsan Ko (JIRA)" <je...@portals.apache.org>.
[ https://issues.apache.org/jira/browse/JS2-1194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12861765#action_12861765 ]
Woonsan Ko commented on JS2-1194:
---------------------------------
I found this problem happened when adding WebWidget portlet, too.
Because the script of a widget source is not executed when added dynamically, it displays nothing at first.
After a page refreshment, the widget starts normal displaying.
> Some Portlets which contain 'document.write()' js calls (e.g. GWT-based portlet) is not rendered at first after adding the portlet.
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Key: JS2-1194
> URL: https://issues.apache.org/jira/browse/JS2-1194
> Project: Jetspeed 2
> Issue Type: Bug
> Affects Versions: 2.2.1
> Reporter: Woonsan Ko
> Assignee: Woonsan Ko
>
> This issue has been known for long time for client-side rendering modules, so there were some solutions.
> However, we don't have any solution in JetUI yet.
> GWT based portlet application should contain a js file, "...nocache.js", which contains "document.write()" calls. This call causes the weird page status after adding the portlet.
> By the way, the Jetspeed-2 Desktop had a solution for this problem like the following:
> - It retrieves the portlet rendered content from the /portlet pipeline.
> - It inspects the content whether the content has <script> tags.
> - If it contains a script tag with src attribute, it retrieves the real source content.
> - It inspects each code line and replaces with the following rules:
> a) Replace "addEventListener|attachEvent" by a custom JS2 code:
> /\b([a-z_A-Z$]\w*)\s*\.\s*(addEventListener|attachEvent)\s*\(/
> ==> "jetspeed.postload_" + methodNm + "(" + nodeRef + "," + script.substr(match.index + match[0].length)
> b) Replace "document.write()" by a custom JS2 code:
> /\b(document\s*.\s*write(ln)?)\s*\(/
> ==> "jetspeed.postload_docwrite(" + script.substr(match.index + match[0].length)
> c) Replace "location.href = ..." by a custom JS2 code:
> /(;\s|\s+)([a-z_A-Z$][\w.]*)\s*\.\s*(URL\s*|(location\s*(\.\s*href\s*){0,1}))=\s*(("[^"]*"|'[^']*'|[^;])[^;]*)/
> ==> "jetspeed.setdoclocation(" + match[2] + ', "' + memberExpr + '", (' + match[6] + '))' + script.substr(match.index + match[0].length)
> - References: PortletWindow.src.js and core.src.js, APA-5, JS2-1063.
> However, the solution provided by JS2 desktop has some caveats:
> - Looks too hacky.
> - If the script uses a different variable name for document, the current code could not detect it. (GWT does this: l = document; )
> By the way, we could recommend some best practices for portlet development instead of fixing this problem inside JS2:
> - A Portlet should not use "document.write()" calls; Instead, it is recommended to use Portlet 2.0 head contribution where possible.
> - A Portlet should not use "addEventListener|attachEvent" calls; Instead, it is recommended to use higher level frameworks such as YUI3.
> - It is not recommended for a Portlet to use "location.href = ...;".
> Anyway, I don't have a clear idea to solve this problem yet.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
[jira] Commented: (JS2-1194) Some Portlets which contain
'document.write()' js calls (e.g. GWT-based portlet) is not rendered at
first after adding the portlet.
Posted by "Woonsan Ko (JIRA)" <je...@portals.apache.org>.
[ https://issues.apache.org/jira/browse/JS2-1194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12861760#action_12861760 ]
Woonsan Ko commented on JS2-1194:
---------------------------------
How about adding a jetspeed specific portlet metadata for this kind of portlet?
For example, if a portlet has a jetspeed specific metadata (e.g., "jetui.refresh.page.on.add.portlet = true"), then the JetUI could just refresh the page after adding the portlet fragment. This will solve the problem with the current hybrid JetUI rendering engine.
> Some Portlets which contain 'document.write()' js calls (e.g. GWT-based portlet) is not rendered at first after adding the portlet.
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Key: JS2-1194
> URL: https://issues.apache.org/jira/browse/JS2-1194
> Project: Jetspeed 2
> Issue Type: Bug
> Affects Versions: 2.2.1
> Reporter: Woonsan Ko
> Assignee: Woonsan Ko
>
> This issue has been known for long time for client-side rendering modules, so there were some solutions.
> However, we don't have any solution in JetUI yet.
> GWT based portlet application should contain a js file, "...nocache.js", which contains "document.write()" calls. This call causes the weird page status after adding the portlet.
> By the way, the Jetspeed-2 Desktop had a solution for this problem like the following:
> - It retrieves the portlet rendered content from the /portlet pipeline.
> - It inspects the content whether the content has <script> tags.
> - If it contains a script tag with src attribute, it retrieves the real source content.
> - It inspects each code line and replaces with the following rules:
> a) Replace "addEventListener|attachEvent" by a custom JS2 code:
> /\b([a-z_A-Z$]\w*)\s*\.\s*(addEventListener|attachEvent)\s*\(/
> ==> "jetspeed.postload_" + methodNm + "(" + nodeRef + "," + script.substr(match.index + match[0].length)
> b) Replace "document.write()" by a custom JS2 code:
> /\b(document\s*.\s*write(ln)?)\s*\(/
> ==> "jetspeed.postload_docwrite(" + script.substr(match.index + match[0].length)
> c) Replace "location.href = ..." by a custom JS2 code:
> /(;\s|\s+)([a-z_A-Z$][\w.]*)\s*\.\s*(URL\s*|(location\s*(\.\s*href\s*){0,1}))=\s*(("[^"]*"|'[^']*'|[^;])[^;]*)/
> ==> "jetspeed.setdoclocation(" + match[2] + ', "' + memberExpr + '", (' + match[6] + '))' + script.substr(match.index + match[0].length)
> - References: PortletWindow.src.js and core.src.js, APA-5, JS2-1063.
> However, the solution provided by JS2 desktop has some caveats:
> - Looks too hacky.
> - If the script uses a different variable name for document, the current code could not detect it. (GWT does this: l = document; )
> By the way, we could recommend some best practices for portlet development instead of fixing this problem inside JS2:
> - A Portlet should not use "document.write()" calls; Instead, it is recommended to use Portlet 2.0 head contribution where possible.
> - A Portlet should not use "addEventListener|attachEvent" calls; Instead, it is recommended to use higher level frameworks such as YUI3.
> - It is not recommended for a Portlet to use "location.href = ...;".
> Anyway, I don't have a clear idea to solve this problem yet.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org