You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Peter Svensson <ps...@gmail.com> on 2008/02/09 13:10:25 UTC

Breakthrough with Bunkai

With a lot of help from Bertrand, I've been able to create en esp script
which gives back fairly standard json. I don't know much about which
properties and function s are actually present on each node, so I grabbed
the ones I saw, just  to get a tree up and running.

heres a snippet which I used in conjunction with the 15 minutes Sling
example;

<%
function dumpResource(r, level)
{
        var rv = "\n{";
        rv += 'name: "'+r+'",\n';
        rv += 'type: "'+r.type+'",\n';
        var p = r.properties;
        var iterator = r.children;
        if (iterator.hasNext())
        {
                rv += "children: \n[\n";
                while(iterator.hasNext())
                {
                        rv += dumpResource(iterator.next(), level + 1) + ",
\n";
                }
                rv = rv.substring(0, rv.length-3)+ "]\n";
        }
        else
        {
                rv = rv.substring(0, rv.length-2);
        }
        rv += "}\n";
        return rv;
}

out.print(dumpResource(resource, 1));
%>

And then I created a couple of extra nodes under the example node
/content/mynode and I actually got up a small tree and two childre.

Now I have to clean up my code which is full of failed experiments, and then
we can go forward.

Also, I'm not sure where this script should reside, and where bunkai itself
should be put..
I also need to find a good license to put bunkai under.
The source code editor is not mine, for instance.

Cheers,
PS

Re: Breakthrough with Bunkai

Posted by Peter Svensson <ps...@gmail.com>.
Thanks David. Yes, actually the esp script produces generic JSON. When I get
that in my Ajax call, I then build a Dojo tree-specific object which
attaches the JSOn structure as a property, so it should be usable for
anything that wants general JSON, I hope.

I think I'll let you guys decide where to put Bunkai, if you want it in
somewhere. I don't know to much about specifics of Sling yet.

However, the resource type is fairly important, and I think that I will
choose to read and 'standard' files with Sling, geared towards a web /
JavaScript editing setting.

I'll check the Apache license, which sounds nice. One issue is of course the
EditArea source code editor, which is released under LGPL, and I don't
really know if that has any impact if any on the license I choose to release
Bunkai under.

Cheers,
PS

On Feb 12, 2008 4:44 PM, David Nuescheler <da...@day.com> wrote:

> Hi Peter,
>
> Thanks a lot for the update, that sounds great. Congratulations.
>
> > heres a snippet which I used in conjunction with the 15 minutes Sling
> > example;
> > <... source code ... />
> that looks about what i expected for a dojo-tree specific integration
> effort,
> that you were referring to very early on... is that about right?
>
>
> > Also, I'm not sure where this script should reside, and where bunkai
> itself
> > should be put..
> Generally we (at Day) tend to put applications into the /apps folder.
> So you would find your script somewhere in the /apps/bunkai folder.
>
> I think there are a still couple of open questions around where to put
> what
> when it comes to something very general, like the mentioned alternative
> .json rendition.
>
> > I also need to find a good license to put bunkai under.
> > The source code editor is not mine, for instance.
> I think from an Apache standpoint we certainly would have a recommendation
> about the preferred licensing terms in the part of the galaxy ;)
> [ hint: http://www.apache.org/licenses/LICENSE-2.0.html ]
>
> regards,
> david
>

Re: Breakthrough with Bunkai

Posted by David Nuescheler <da...@day.com>.
Hi Peter,

Thanks a lot for the update, that sounds great. Congratulations.

> heres a snippet which I used in conjunction with the 15 minutes Sling
> example;
> <... source code ... />
that looks about what i expected for a dojo-tree specific integration effort,
that you were referring to very early on... is that about right?


> Also, I'm not sure where this script should reside, and where bunkai itself
> should be put..
Generally we (at Day) tend to put applications into the /apps folder.
So you would find your script somewhere in the /apps/bunkai folder.

I think there are a still couple of open questions around where to put what
when it comes to something very general, like the mentioned alternative
.json rendition.

> I also need to find a good license to put bunkai under.
> The source code editor is not mine, for instance.
I think from an Apache standpoint we certainly would have a recommendation
about the preferred licensing terms in the part of the galaxy ;)
[ hint: http://www.apache.org/licenses/LICENSE-2.0.html ]

regards,
david

Re: Breakthrough with Bunkai

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Peter,

This is great news !

I suggest you create an entry in the new Slign Wiki with your findings
and attach your script(s) (I should be ready with this sometime around
the middle of this week. I will inform the list). From that we may
further explore the options, e.g. creating a new module in Sling
supporting this functionality.

Regards
Felix

Am Samstag, den 09.02.2008, 13:10 +0100 schrieb Peter Svensson:
> With a lot of help from Bertrand, I've been able to create en esp
> script  which gives back fairly standard json. I don't know much about
> which properties and function s are actually present on each node, so
> I grabbed  the ones I saw, just  to get a tree up and running.
> 
> heres a snippet which I used in conjunction with the 15 minutes Sling
> example;
> 
> <%
> function dumpResource(r, level)
> {
>         var rv = "\n{";
>         rv += 'name: "'+r+'",\n';
>         rv += 'type: "'+r.type+'",\n';
>         var p = r.properties;
>         var iterator = r.children;
>         if (iterator.hasNext())
>         {
>                 rv += "children: \n[\n";
>                 while(iterator.hasNext())
>                 {
>                         rv += dumpResource(iterator.next(), level + 1)
> + ", \n";
>                 }
>                 rv = rv.substring(0, rv.length-3)+ "]\n";
>         }
>         else
>         {
>                 rv = rv.substring(0, rv.length-2);
>         }
>         rv += "}\n";
>         return rv;
> }
> 
> out.print(dumpResource(resource, 1));
> %>
> 
> And then I created a couple of extra nodes under the example
> node /content/mynode and I actually got up a small tree and two
> childre.
> 
> Now I have to clean up my code which is full of failed experiments,
> and then we can go forward.
> 
> Also, I'm not sure where this script should reside, and where bunkai
> itself should be put..
> I also need to find a good license to put bunkai under.
> The source code editor is not mine, for instance.
> 
> Cheers,
> PS
> 
> 
>