Improve ApplicationResponse::includeJavascript to support including JavaScript
snippets in addition to static files
--------------------------------------------------------------------------------------------------------------------
Key: OODT-375
URL: https://issues.apache.org/jira/browse/OODT-375
Project: OODT
Issue Type: Improvement
Components: balance
Affects Versions: 0.3
Reporter: Andrew Hart
Assignee: Andrew Hart
Priority: Minor
Fix For: 0.4
Currently, ApplicationResponse::includeJavascript only accepts a string which
is interpreted as the url to the JavaScript resource to include. That string is
then injected as the 'src' attribute of a '<script type="javascript">' block.
Occasionally it is necessary to make some information (e.g.: a module's
environment information) available to any client-side JavaScript libraries that
might need to make use of it. Because this information is dynamic, the current
format is restrictive as it only accepts urls to static file resources. This
issue proposes changing the method signature in a way that maintains complete
backwards compatibility, but further allows a developer to pass arbitrary
JavaScript to the client. The new signature should be something like:
{code}
public function includeJavascript( $src, $isRaw = false );
{code}
The default behavior (that of providing a URL to a static resource to include)
is unchanged as the $isRaw attribute defaults to false if omitted. If a
developer explicitly passes Boolean true as the second parameter, however, the
contents of $src will be placed in the body of the '<script type="javascript">'
block, instead of as its 'src' attribute.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira