Ask Your Question
4

Personalizing the notebook

asked 2011-09-18 14:16:51 +0100

mmarco gravatar image

I am running two notebook servers in the same machine and i want to personalize them (mainly the login screen, and maybe also some translation). I have seen that putting a notebook.css in the $HOME/.sage/ directory i can customize the colors. Also, editing the files in /devel/sagenb-main/sagenb/data/sage/html/ i can personalize the login screen and so on.

My question is: can i do it on a per-notebook basis? Is there some location in the $HOME/.sage/sage_notebook-sagenb/ directory where i can copy the modified files in order to affect that specific notebook?.

I know that, in the worst case, i would do it by copying the whole sage instalation and making the different changes in the two directories, but i would prefear to find a solution that doesn't imply duplicating the instalation.

edit retag flag offensive close merge delete

Comments

I finally did it using javascript. It's not an elegant solution, but it works.

mmarco gravatar imagemmarco ( 2011-09-20 10:06:07 +0100 )edit

Can you post your "answer", or a bit more details about how you did it, as an actual answer? Also, can you open a trac ticket to add this feature? I think it would be great if we could customize each notebook by putting something in the sage_notebook.sagenb directory.

Jason Grout gravatar imageJason Grout ( 2011-09-20 11:33:54 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2011-09-21 19:50:18 +0100

If you are using the flask notebook you can use the SAGENB_TEMPLATE_PATH environment variable to specify the directory to search for the html templates and stylesheets.

Here is the changeset.

edit flag offensive delete link more

Comments

Thanks. Is the flask notebook ready for real use already? When is it expected to substitute the traditional one? And finally: where does the SAGENB_TEMPLATE_PATH must be set?

mmarco gravatar imagemmarco ( 2011-09-22 06:39:55 +0100 )edit

Before starting Sage, you should set SAGENB_TEMPLATE_PATH to a directory which contains a customized version of the contents of the sagenb/data/sage dir from the notebook repository.

burcin gravatar imageburcin ( 2011-09-22 09:23:53 +0100 )edit

Where, in a recent sage release, is SAGENB_TEMPLATE_PATH set ? How is it set to sagenb/data/sage ?

Pedro gravatar imagePedro ( 2012-01-05 09:44:37 +0100 )edit

Pedro, the patch with SAGENB_TEMPLATE_PATH was only merged in the flask notebook AFAIK. There is still ongoing work to include this in Sage-5.0.

burcin gravatar imageburcin ( 2012-01-18 04:43:42 +0100 )edit
0

answered 2011-09-21 18:49:20 +0100

mmarco gravatar image

What i did was basically include this:

<script type="text/javascript">
if (location.href=='url1')
  {
   document.write('content1');
  }

if (location.href=='url2')
  {
   document.write('content2');
  }
</script>

in /devel/sagenb-main/sagenb/data/sage/html/login.html, where url1 and url2 are the complete urls of each notebook, and content1 and content2 the contents you want the paage to show in each case.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-09-18 14:16:51 +0100

Seen: 1,036 times

Last updated: Sep 21 '11