We need a tree implemented on a web page. The tree implementation will be jsTree ([login to view URL]). The tree needs to be managed like a directory structure. That is, directories can be added and deleted (with confirmation). Adding or deleting a folder will raise an event.
Every folder has a name, unique id and a parent id. So the folders will be presented as an array of objects and the software will build the hierarchy according to the id and parent id properties.
The contents of a folder will be activities. An activity is just an object with a name, id and directory property. Double clicking an activity will raise an event. Adding or deleting activities will be offered through a right click menu and result in an event being raised. Activities can be dragged from one folder to another. They cannot be copied.
Activities can be injected at run time. In that case an object would be passed in with a directory id, activity id and a name.
Most (probably all) of the described functionality is already available in the jsTree library. It is only a matter of configuring it. Here is a tutorial ([login to view URL])