You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Lars Trieloff (JIRA)" <ji...@apache.org> on 2007/10/23 13:28:50 UTC
[jira] Created: (SLING-77) Provide an easy-to-use Javascript API
for JCR
Provide an easy-to-use Javascript API for JCR
---------------------------------------------
Key: SLING-77
URL: https://issues.apache.org/jira/browse/SLING-77
Project: Sling
Issue Type: Improvement
Components: microsling
Reporter: Lars Trieloff
As discussed here, I propose a Javascript-tailor-made wrapper API to make JCRNodes more accessible to script and template authors
http://thread.gmane.org/gmane.comp.apache.sling.devel/491
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (SLING-77) Provide an easy-to-use Javascript API
for JCR
Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SLING-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12537265 ]
Bertrand Delacretaz commented on SLING-77:
------------------------------------------
Patch committed in revision 587848, thanks!
I have also adapted the examples in src/main/webapp/server-side-javascript.html.
> Provide an easy-to-use Javascript API for JCR
> ---------------------------------------------
>
> Key: SLING-77
> URL: https://issues.apache.org/jira/browse/SLING-77
> Project: Sling
> Issue Type: Improvement
> Components: microsling
> Reporter: Lars Trieloff
> Assignee: Bertrand Delacretaz
> Attachments: sling-77.patch
>
>
> As discussed here, I propose a Javascript-tailor-made wrapper API to make JCRNodes more accessible to script and template authors
> http://thread.gmane.org/gmane.comp.apache.sling.devel/491
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (SLING-77) Provide an easy-to-use Javascript API
for JCR
Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SLING-77?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bertrand Delacretaz reassigned SLING-77:
----------------------------------------
Assignee: (was: Bertrand Delacretaz)
> Provide an easy-to-use Javascript API for JCR
> ---------------------------------------------
>
> Key: SLING-77
> URL: https://issues.apache.org/jira/browse/SLING-77
> Project: Sling
> Issue Type: Improvement
> Components: microsling
> Reporter: Lars Trieloff
> Attachments: sling-77.patch
>
>
> As discussed here, I propose a Javascript-tailor-made wrapper API to make JCRNodes more accessible to script and template authors
> http://thread.gmane.org/gmane.comp.apache.sling.devel/491
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (SLING-77) Provide an easy-to-use Javascript API
for JCR
Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SLING-77?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Carsten Ziegeler updated SLING-77:
----------------------------------
Component/s: (was: microsling)
Post Servlets
> Provide an easy-to-use Javascript API for JCR
> ---------------------------------------------
>
> Key: SLING-77
> URL: https://issues.apache.org/jira/browse/SLING-77
> Project: Sling
> Issue Type: Improvement
> Components: Post Servlets
> Reporter: Lars Trieloff
> Attachments: sling-77.patch
>
>
> As discussed here, I propose a Javascript-tailor-made wrapper API to make JCRNodes more accessible to script and template authors
> http://thread.gmane.org/gmane.comp.apache.sling.devel/491
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (SLING-77) Provide an easy-to-use Javascript API
for JCR
Posted by "Lars Trieloff (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SLING-77?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lars Trieloff updated SLING-77:
-------------------------------
Attachment: sling-77.patch
This patch adds host objects for Resource and for Node. The Resource API allows you to get a Javascript representation of the Node using the resource.item property. A script can then iterate over all properties and child nodes of a resource as if it were a hashmap (or any Javascript object). In order to list all properties of a node, following script could be used:
<%-- microsling ESP template example, store this as html.esp --%>
<html>
<body>
<p>This page is generated from an ESP template!</p>
<h1><%= resource.uri %></h1>
<ol>
<%
for (var prop in resource.item) {
%><li><strong><%= prop %></strong>:
<% if (resource.item[prop].substr) {
//this is a string, just show it
%><%= resource.item[prop] %><%
} else {
//this is an array (multi-value-property), loop over it
for (var val in resource.item[prop]) {
%><span><%= resource.item[prop][val] %></span> <%
}
} %></li><%
}
%></ol>
<a href="/microsling<%= resource.uri %>.edit.html">Edit</a>
</body>
</html>
this example also shows how to deal with multi-value properties that will be represented as a javascript array of strings. Same-name child nodes will be represented as node objects in an array. If you have a property and a child-node of the same name, the array will contain a string and a node.
Using following code you can iterate over a number of children and create something like a directory listing: (saved as sling/scripts/nodetypes/nt/unstructured/html.esp)
<%-- microsling ESP template example, store this as html.esp --%>
<html>
<body>
<p>This directory listing is generated from an ESP template!</p>
<h1><%= resource.uri %></h1>
<ol>
<%
for (var prop in resource.item) {
if (resource.item[prop]["text"]) {
%><li><a href="/microsling<%= resource.item[prop] %>.html"><%= resource.item[prop] %></a></li><%
}
}
%>
</ol>
</body>
</html>
> Provide an easy-to-use Javascript API for JCR
> ---------------------------------------------
>
> Key: SLING-77
> URL: https://issues.apache.org/jira/browse/SLING-77
> Project: Sling
> Issue Type: Improvement
> Components: microsling
> Reporter: Lars Trieloff
> Attachments: sling-77.patch
>
>
> As discussed here, I propose a Javascript-tailor-made wrapper API to make JCRNodes more accessible to script and template authors
> http://thread.gmane.org/gmane.comp.apache.sling.devel/491
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (SLING-77) Provide an easy-to-use Javascript API
for JCR
Posted by "Hendy Irawan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SLING-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12714185#action_12714185 ]
Hendy Irawan commented on SLING-77:
-----------------------------------
Is this a JavaScript implementation of JCR API usable with Sling, or a JavaScript implementation of proprietary Sling API?
I'd suggest taking a look at or integrating with Dojo Data and Dojo Store.
Or perhaps, expose a Sling/JCR Dojo Store implementation to the Sling JCR, so Dojo+Dojo Store+Sling Dojo Store implementation can be run on the Sling container.
See: http://www.sitepen.com/blog/2009/01/14/store-explorer/
> Provide an easy-to-use Javascript API for JCR
> ---------------------------------------------
>
> Key: SLING-77
> URL: https://issues.apache.org/jira/browse/SLING-77
> Project: Sling
> Issue Type: Improvement
> Components: Servlets Post
> Reporter: Lars Trieloff
> Attachments: sling-77.patch
>
>
> As discussed here, I propose a Javascript-tailor-made wrapper API to make JCRNodes more accessible to script and template authors
> http://thread.gmane.org/gmane.comp.apache.sling.devel/491
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (SLING-77) Provide an easy-to-use Javascript API
for JCR
Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SLING-77?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bertrand Delacretaz reassigned SLING-77:
----------------------------------------
Assignee: Bertrand Delacretaz
> Provide an easy-to-use Javascript API for JCR
> ---------------------------------------------
>
> Key: SLING-77
> URL: https://issues.apache.org/jira/browse/SLING-77
> Project: Sling
> Issue Type: Improvement
> Components: microsling
> Reporter: Lars Trieloff
> Assignee: Bertrand Delacretaz
> Attachments: sling-77.patch
>
>
> As discussed here, I propose a Javascript-tailor-made wrapper API to make JCRNodes more accessible to script and template authors
> http://thread.gmane.org/gmane.comp.apache.sling.devel/491
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (SLING-77) Provide an easy-to-use Javascript API
for JCR
Posted by "Lars Trieloff (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SLING-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12714341#action_12714341 ]
Lars Trieloff commented on SLING-77:
------------------------------------
Henry, this bug discusses a server-side Javascript API for Sling. For client-side integration there is a separate API, also with Dojo bindings: see http://svn.apache.org/repos/asf/incubator/sling/trunk/contrib/extensions/
> Provide an easy-to-use Javascript API for JCR
> ---------------------------------------------
>
> Key: SLING-77
> URL: https://issues.apache.org/jira/browse/SLING-77
> Project: Sling
> Issue Type: Improvement
> Components: Servlets Post
> Reporter: Lars Trieloff
> Attachments: sling-77.patch
>
>
> As discussed here, I propose a Javascript-tailor-made wrapper API to make JCRNodes more accessible to script and template authors
> http://thread.gmane.org/gmane.comp.apache.sling.devel/491
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (SLING-77) Provide an easy-to-use Javascript API
for JCR
Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SLING-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12537270 ]
Bertrand Delacretaz commented on SLING-77:
------------------------------------------
In revision 587852 I have also moved the velocity and rhino engines to their own packages under "engines"
> Provide an easy-to-use Javascript API for JCR
> ---------------------------------------------
>
> Key: SLING-77
> URL: https://issues.apache.org/jira/browse/SLING-77
> Project: Sling
> Issue Type: Improvement
> Components: microsling
> Reporter: Lars Trieloff
> Assignee: Bertrand Delacretaz
> Attachments: sling-77.patch
>
>
> As discussed here, I propose a Javascript-tailor-made wrapper API to make JCRNodes more accessible to script and template authors
> http://thread.gmane.org/gmane.comp.apache.sling.devel/491
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.