manage worksheets in folders

115 views
Skip to first unread message

ndomes

unread,
Oct 10, 2010, 3:34:03 PM10/10/10
to sage-notebook
Hello,

I joined this group, because I'm interested in keeping worksheets in
hierarchic folders similar to a usual file system.

I tried to do some steps but failed soon.
As far as I have learned: during startup of the notebook all notebook
related worksheets are kept in a (linear) list, each worksheet
identified by owner and id_number. That makes it difficult to use
actual folders in the users directory as containers for further
worksheets, even if they easily could be distinguished from folders
containing worksheets (worksheet folders are named with integers).

Probably it is easier to add a 'virtual folder' or 'virtual path' as
new attribute to the class Worksheet and use something like the
implemented search to filter those worksheets fitting the current
'virtual path'.

My questions are:
Are there any people working on a solution?
Is this feature on the agenda of on of the next (major) releases?

Greetings from Germany
Norbert Domes





Message has been deleted

Jason Grout

unread,
Oct 11, 2010, 7:00:11 AM10/11/10
to sage-n...@googlegroups.com
On 10/11/10 1:28 AM, Minh Nguyen wrote:
> Hi Norbert,

>
> On Mon, Oct 11, 2010 at 6:34 AM, ndomes<n.d...@kahani.ks.shuttle.de> wrote:
>> My questions are:
>> Are there any people working on a solution?
>> Is this feature on the agenda of on of the next (major) releases?
>
> There has been a lot of discussion about this. A main consensus is to
> implement something along the line of tags, not folders. A worksheet
> can have multiple tags, but you can only place it in one folder
> (symbolic links is cheating :-).
>
> As far as I know, no one is working on this at the moment. The feature
> you want has been in demand for over a year now. If someone would
> implement it and provide a patch, that person or group of person would
> be hailed as heroes.
>

Indeed!

Jason

ndomes

unread,
Oct 16, 2010, 7:29:14 PM10/16/10
to sage-notebook


On 11 Okt., 13:00, Jason Grout <jason-s...@creativetrax.com> wrote:
> On 10/11/10 1:28 AM, Minh Nguyen wrote:
>
>
>
> > Hi Norbert,
>
> > On Mon, Oct 11, 2010 at 6:34 AM, ndomes<n.do...@kahani.ks.shuttle.de>  wrote:
> >> My questions are:
> >> Are there any people working on a solution?
> >> Is this feature on the agenda of on of  the next (major) releases?
>
> > There has been a lot of discussion about this. A main consensus is to
> > implement something along the line of tags, not folders. A worksheet
> > can have multiple tags, but you can only place it in one folder
> > (symbolic links is cheating :-).
>
> > As far as I know, no one is working on this at the moment. The feature
> > you want has been in demand for over a year now. If someone would
> > implement it and provide a patch, that person or group of person would
> > be hailed as heroes.
>
> Indeed!
>
> Jason


Hello,

I tried a little bit;-))

Here is a short report:

First I defined a new class, providing a virtual directory tree.
The folders contain a list of worksheet identifiers ( 'owner/
id_number').
The storage of worksheets is untouched. Still worksheets are stored in
the users directory in folders named with numbers. The virtual
directory tree holds only references to the worksheets.

Second I included a javascript tree implementation into the notebook
('worksheet_listing.html')
It doesn't works proper yet inside the notebook, there it shows not
actually a tree but only a list of all first level subfolders, but
it's good enough to test the idea.
The javascript tree definition includes relative links like '?
path=folder,subfolder,subsubfolder .
I added the parameter path to the function 'render_worksheet_list' in
'twist.py', where it is passed to the function
'worksheet_list_for_user'. Here a new function 'satisfies_path' is
called and reduces the worksheet list to the worksheets fitting the
given path, using a dictionary relating paths to lists of worksheet-
id's.

These are only a few poor first steps, but i hope, it could be
successful in the end.

What's to do.

I need a javascript tree, working adequately inside the notebook.

Features: expandable and collapsible folders, insert new folders,
rename folders, remove (empty) folders.

All changes have to be passed to the notebooks virtual directory
object (in runtime) (I haven't found yet, how to do this, but its a
crucial point).

The javascript should get the initial tree definition from a file in
the users directory, created from the notebooks virtual directory
object.

The virtual directory tree is pickled to the users directory (like the
history ) and loaded from there when a user starts his notebook.

The virtual directory tree is an attribute of the notebook.

The function 'satisfies_path' gets the dictionary (see above) from the
virtual directory tree.

A new worksheet is automatically joined to the active path of the
virtual tree.

So far my short report.

If anyone is interested in more details, I would be glad to send a
personal mail.

Regards
Norbert



















Rob Beezer

unread,
Oct 17, 2010, 5:35:45 AM10/17/10
to sage-notebook
Hi Norbert,

There is definitely lots of interest in this sort of functionality.

For example, see some preliminary work by William Stein at:
http://trac.sagemath.org/sage_trac/ticket/7655

I would like to be able to create collections of worksheets (chapters
of books) where hyper-links between worksheets are correct before
adding the worksheets to the notebook, and remain correct after the
collection is uploaded. Making the collection and the links is not
hard, but predicting the names of the worksheets (ie their URLs) in
advance is not possible now. Would this sort of functionality be
possible in your approach? In other words, could worksheets be
associated with entries of the virtual tree at upload-time in a
location known before the upload? maybe there would need to be a
mechanism in the upload process to create an entry of the virtual
tree.

It would be great if you were able to create patches to the notebook
code for others to look at and test. A short summary is here:
http://nb.sagemath.org/dev.html

Rob

ndomes

unread,
Oct 18, 2010, 4:16:56 PM10/18/10
to sage-notebook
Hi Rob,

many thanks for the hints.

You ask, if in my approach worksheets could be
associated with entries of the virtual tree at upload-time in a
location known before the upload?

I'm afraid not. The worksheet doesn't know anything about a virtual
folder to which it is assigned.
I use a simple structure.
Instead of an explanation an example -
this is the format of the tree saved in the user directory:
{'active_dir': ['admin'],
'data': [], 'name': 'admin',
'children': [{'data': ['admin/1', 'admin/3', 'admin/4', 'admin/5'],
'name': 'test',
'children': [{'data': ['admin/11', 'admin/13', 'admin/
14', 'admin/15'],
'name': 'one',
'children': [{'data': ['admin/31', 'admin/
35'],
'name': 'three',
'children': [{'data':
['admin/41','admin/44'],
'name':
'four',
'children':
[]} ] } ] },
{'data': ['admin/21', 'admin/23', 'admin/
24', 'admin/25'],
'name': 'two',
'children': [] } ] } ] }

What I can do until now is listing the respective worksheets of
virtual folders in the notebook with a given tree, that is already
stored in the users directory.
What I still cannot do is to manage the tree from inside the notebook.
It may be a question of time ....
I am not experienced in creating patches, may be someone will help?

Norbert

ndomes

unread,
Oct 31, 2010, 1:36:01 PM10/31/10
to sage-notebook
Hello,

if you want to see what I have achieved in adding a virtual directory
you may have a look on some screenshots:

http://www.norbert-domes.de/cms/j15/Sage/

Regards
Norbert

Rob Beezer

unread,
Oct 31, 2010, 1:51:29 PM10/31/10
to sage-notebook
Hi Norbert,

On Oct 31, 7:36 pm, ndomes <n.do...@kahani.ks.shuttle.de> wrote:
> if you want to see what I have achieved in adding a virtual directory
> you may have a look on some screenshots:

That looks very nice. Thanks for working on this - it could be very
useful.

Sorry to be so long in replying, more in a minute.

Rob

Rob Beezer

unread,
Oct 31, 2010, 1:54:45 PM10/31/10
to sage-notebook
On Oct 18, 10:16 pm, ndomes <n.do...@kahani.ks.shuttle.de> wrote:
> I am not experienced in creating patches, may be someone will help?

The following could help:

http://www.sagemath.org/doc/developer/walk_through.html
http://users.aims.ac.za/~beezer/sage-dev.html
http://nb.sagemath.org/dev.html

Last one could be semi-obsolete, see recent sage-notebook posts about
Google code hosting.

Rob

ndomes

unread,
Nov 16, 2010, 4:20:35 PM11/16/10
to sage-notebook
Hi Rob,

I've published my changes, see
http://code.google.com/r/ndomes-virtual-directory/

Unfortunately I couldn't test my changes.
All worked fine in my older Sage installation.( 4.3 )

But testing the local repository failed:
--------------
...> python sagenb/testing/tests/test_worksheet_list.py
...
File "/usr/local/lib/python2.6/site-packages/pexpect.py", line 517,
in _spawn
raise ExceptionPexpect ('The command was not found or was not
executable: %s.' % self.command)
ExceptionPexpect: The command was not found or was not executable:
sage.
--------------

I need an advice, how to get sage started via the test scripts.

In any case I will update Sage first, before I go on with the notebook
scripts.

Nevertheless you may have a look on the way, I try to solve the
problem.


A further topic:
There is an entry in the file todo.txt:

[ ] admin should *NOT* see all users worksheets. This is not good,
e.g.,
when there are 50,000 worksheets!

I think, this could be fixed easily using virtual directories.

Admins personal directory may look like:

admin ---> admins subdirs
...
---> users --> user1
--> user2
...

So admin still can see all worksheets without being showered with all
50,000 worksheets at once.

Regards
Norbert


On 31 Okt., 18:54, Rob Beezer <goo...@beezer.cotse.net> wrote:
> On Oct 18, 10:16 pm, ndomes <n.do...@kahani.ks.shuttle.de> wrote:
>
> > I am not experienced in creating patches, may be someone will help?
>
> The following could help:
>
> http://www.sagemath.org/doc/developer/walk_through.htmlhttp://users.aims.ac.za/~beezer/sage-dev.htmlhttp://nb.sagemath.org/dev.html
Reply all
Reply to author
Forward
0 new messages