Show More
@@ -0,0 +1,12 b'' | |||||
|
1 | body { overflow: auto; } | |||
|
2 | div#notebook { overflow: visible; } | |||
|
3 | .ui-widget-content { border: 0px; } | |||
|
4 | #save_widget {margin: 0px !important;} | |||
|
5 | #ipython_notebook {display: none;} | |||
|
6 | span#notebook_name { | |||
|
7 | height: 1em; | |||
|
8 | line-height: 1em; | |||
|
9 | padding: 3px; | |||
|
10 | border: none; | |||
|
11 | font-size: 182%; | |||
|
12 | } No newline at end of file |
@@ -0,0 +1,94 b'' | |||||
|
1 | //---------------------------------------------------------------------------- | |||
|
2 | // Copyright (C) 2008-2011 The IPython Development Team | |||
|
3 | // | |||
|
4 | // Distributed under the terms of the BSD License. The full license is in | |||
|
5 | // the file COPYING, distributed as part of this software. | |||
|
6 | //---------------------------------------------------------------------------- | |||
|
7 | ||||
|
8 | //============================================================================ | |||
|
9 | // On document ready | |||
|
10 | //============================================================================ | |||
|
11 | ||||
|
12 | ||||
|
13 | $(document).ready(function () { | |||
|
14 | if (window.MathJax){ | |||
|
15 | // MathJax loaded | |||
|
16 | MathJax.Hub.Config({ | |||
|
17 | tex2jax: { | |||
|
18 | inlineMath: [ ['$','$'], ["\\(","\\)"] ], | |||
|
19 | displayMath: [ ['$$','$$'], ["\\[","\\]"] ] | |||
|
20 | }, | |||
|
21 | displayAlign: 'left', // Change this to 'center' to center equations. | |||
|
22 | "HTML-CSS": { | |||
|
23 | styles: {'.MathJax_Display': {"margin": 0}} | |||
|
24 | } | |||
|
25 | }); | |||
|
26 | }else if (window.mathjax_url != ""){ | |||
|
27 | // Don't have MathJax, but should. Show dialog. | |||
|
28 | var dialog = $('<div></div>') | |||
|
29 | .append( | |||
|
30 | $("<p></p>").addClass('dialog').html( | |||
|
31 | "Math/LaTeX rendering will be disabled." | |||
|
32 | ) | |||
|
33 | ).append( | |||
|
34 | $("<p></p>").addClass('dialog').html( | |||
|
35 | "If you have administrative access to the notebook server and" + | |||
|
36 | " a working internet connection, you can install a local copy" + | |||
|
37 | " of MathJax for offline use with the following command on the server" + | |||
|
38 | " at a Python or IPython prompt:" | |||
|
39 | ) | |||
|
40 | ).append( | |||
|
41 | $("<pre></pre>").addClass('dialog').html( | |||
|
42 | ">>> from IPython.external import mathjax; mathjax.install_mathjax()" | |||
|
43 | ) | |||
|
44 | ).append( | |||
|
45 | $("<p></p>").addClass('dialog').html( | |||
|
46 | "This will try to install MathJax into the IPython source directory." | |||
|
47 | ) | |||
|
48 | ).append( | |||
|
49 | $("<p></p>").addClass('dialog').html( | |||
|
50 | "If IPython is installed to a location that requires" + | |||
|
51 | " administrative privileges to write, you will need to make this call as" + | |||
|
52 | " an administrator, via 'sudo'." | |||
|
53 | ) | |||
|
54 | ).append( | |||
|
55 | $("<p></p>").addClass('dialog').html( | |||
|
56 | "When you start the notebook server, you can instruct it to disable MathJax support altogether:" | |||
|
57 | ) | |||
|
58 | ).append( | |||
|
59 | $("<pre></pre>").addClass('dialog').html( | |||
|
60 | "$ ipython notebook --no-mathjax" | |||
|
61 | ) | |||
|
62 | ).append( | |||
|
63 | $("<p></p>").addClass('dialog').html( | |||
|
64 | "which will prevent this dialog from appearing." | |||
|
65 | ) | |||
|
66 | ).dialog({ | |||
|
67 | title: "Failed to retrieve MathJax from '" + window.mathjax_url + "'", | |||
|
68 | width: "70%", | |||
|
69 | modal: true, | |||
|
70 | }) | |||
|
71 | }else{ | |||
|
72 | // No MathJax, but none expected. No dialog. | |||
|
73 | } | |||
|
74 | ||||
|
75 | IPython.markdown_converter = new Markdown.Converter(); | |||
|
76 | IPython.read_only = $('meta[name=read_only]').attr("content") == 'True'; | |||
|
77 | ||||
|
78 | $('div#header').addClass('border-box-sizing'); | |||
|
79 | $('div#main_app').addClass('border-box-sizing ui-widget ui-widget-content'); | |||
|
80 | $('div#notebook_panel').addClass('border-box-sizing ui-widget'); | |||
|
81 | ||||
|
82 | IPython.save_widget = new IPython.SaveWidget('span#save_widget'); | |||
|
83 | IPython.login_widget = new IPython.LoginWidget('span#login_widget'); | |||
|
84 | IPython.notebook = new IPython.Notebook('div#notebook'); | |||
|
85 | ||||
|
86 | // These have display: none in the css file and are made visible here to prevent FLOUC. | |||
|
87 | $('div#header').css('display','block'); | |||
|
88 | $('div#main_app').css('display','block'); | |||
|
89 | ||||
|
90 | // Perform these actions after the notebook has been loaded. | |||
|
91 | IPython.notebook.load_notebook(function () {}); | |||
|
92 | ||||
|
93 | }); | |||
|
94 |
@@ -0,0 +1,104 b'' | |||||
|
1 | <!DOCTYPE HTML> | |||
|
2 | <html> | |||
|
3 | ||||
|
4 | <head> | |||
|
5 | <meta charset="utf-8"> | |||
|
6 | ||||
|
7 | <title>IPython Notebook</title> | |||
|
8 | ||||
|
9 | {% if mathjax_url %} | |||
|
10 | <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML" charset="utf-8"></script> | |||
|
11 | {% end %} | |||
|
12 | <script type="text/javascript"> | |||
|
13 | // MathJax disabled, set as null to distingish from *missing* MathJax, | |||
|
14 | // where it will be undefined, and should prompt a dialog later. | |||
|
15 | window.mathjax_url = "{{mathjax_url}}"; | |||
|
16 | </script> | |||
|
17 | ||||
|
18 | <link rel="stylesheet" href="/static/jquery/css/themes/base/jquery-ui.min.css" type="text/css" /> | |||
|
19 | <link rel="stylesheet" href="/static/codemirror/lib/codemirror.css"> | |||
|
20 | <link rel="stylesheet" href="/static/codemirror/mode/markdown/markdown.css"> | |||
|
21 | <link rel="stylesheet" href="/static/codemirror/mode/rst/rst.css"> | |||
|
22 | <link rel="stylesheet" href="/static/codemirror/theme/ipython.css"> | |||
|
23 | <link rel="stylesheet" href="/static/codemirror/theme/default.css"> | |||
|
24 | ||||
|
25 | <link rel="stylesheet" href="/static/prettify/prettify.css"/> | |||
|
26 | ||||
|
27 | <link rel="stylesheet" href="/static/css/boilerplate.css" type="text/css" /> | |||
|
28 | <link rel="stylesheet" href="/static/css/layout.css" type="text/css" /> | |||
|
29 | <link rel="stylesheet" href="/static/css/base.css" type="text/css" /> | |||
|
30 | <link rel="stylesheet" href="/static/css/notebook.css" type="text/css" /> | |||
|
31 | <link rel="stylesheet" href="/static/css/printnotebook.css" type="text/css" /> | |||
|
32 | <link rel="stylesheet" href="/static/css/renderedhtml.css" type="text/css" /> | |||
|
33 | ||||
|
34 | {% comment In the notebook, the read-only flag is used to determine %} | |||
|
35 | {% comment whether to hide the side panels and switch off input %} | |||
|
36 | <meta name="read_only" content="{{read_only and not logged_in}}"/> | |||
|
37 | ||||
|
38 | </head> | |||
|
39 | ||||
|
40 | <body | |||
|
41 | data-project={{project}} data-notebook-id={{notebook_id}} | |||
|
42 | data-base-project-url={{base_project_url}} data-base-kernel-url={{base_kernel_url}} | |||
|
43 | > | |||
|
44 | ||||
|
45 | <div id="header"> | |||
|
46 | <span id="ipython_notebook"><h1><a href='..' alt='dashboard'><img src='/static/ipynblogo.png' alt='IPython Notebook'/></a></h1></span> | |||
|
47 | <span id="save_widget"> | |||
|
48 | <span id="notebook_name"></span> | |||
|
49 | <span id="save_status"></span> | |||
|
50 | </span> | |||
|
51 | ||||
|
52 | <span id="login_widget"> | |||
|
53 | {% comment This is a temporary workaround to hide the logout button %} | |||
|
54 | {% comment when appropriate until notebook.html is templated %} | |||
|
55 | {% if logged_in %} | |||
|
56 | <button id="logout">Logout</button> | |||
|
57 | {% elif not logged_in and login_available %} | |||
|
58 | <button id="login">Login</button> | |||
|
59 | {% end %} | |||
|
60 | </span> | |||
|
61 | ||||
|
62 | </div> | |||
|
63 | ||||
|
64 | ||||
|
65 | <div id="main_app"> | |||
|
66 | ||||
|
67 | <div id="notebook_panel"> | |||
|
68 | <div id="notebook"></div> | |||
|
69 | </div> | |||
|
70 | ||||
|
71 | </div> | |||
|
72 | ||||
|
73 | <script src="/static/jquery/js/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script> | |||
|
74 | <script src="/static/jquery/js/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script> | |||
|
75 | ||||
|
76 | <script src="/static/codemirror/lib/codemirror.js" charset="utf-8"></script> | |||
|
77 | <script src="/static/codemirror/mode/python/python.js" charset="utf-8"></script> | |||
|
78 | <script src="/static/codemirror/mode/htmlmixed/htmlmixed.js" charset="utf-8"></script> | |||
|
79 | <script src="/static/codemirror/mode/xml/xml.js" charset="utf-8"></script> | |||
|
80 | <script src="/static/codemirror/mode/javascript/javascript.js" charset="utf-8"></script> | |||
|
81 | <script src="/static/codemirror/mode/css/css.js" charset="utf-8"></script> | |||
|
82 | <script src="/static/codemirror/mode/rst/rst.js" charset="utf-8"></script> | |||
|
83 | <script src="/static/codemirror/mode/markdown/markdown.js" charset="utf-8"></script> | |||
|
84 | ||||
|
85 | <script src="/static/pagedown/Markdown.Converter.js" charset="utf-8"></script> | |||
|
86 | ||||
|
87 | <script src="/static/prettify/prettify.js" charset="utf-8"></script> | |||
|
88 | <script src="/static/dateformat/date.format.js" charset="utf-8"></script> | |||
|
89 | ||||
|
90 | <script src="/static/js/namespace.js" type="text/javascript" charset="utf-8"></script> | |||
|
91 | <script src="/static/js/utils.js" type="text/javascript" charset="utf-8"></script> | |||
|
92 | <script src="/static/js/cell.js" type="text/javascript" charset="utf-8"></script> | |||
|
93 | <script src="/static/js/codecell.js" type="text/javascript" charset="utf-8"></script> | |||
|
94 | <script src="/static/js/textcell.js" type="text/javascript" charset="utf-8"></script> | |||
|
95 | <script src="/static/js/kernel.js" type="text/javascript" charset="utf-8"></script> | |||
|
96 | <script src="/static/js/kernelstatus.js" type="text/javascript" charset="utf-8"></script> | |||
|
97 | <script src="/static/js/savewidget.js" type="text/javascript" charset="utf-8"></script> | |||
|
98 | <script src="/static/js/loginwidget.js" type="text/javascript" charset="utf-8"></script> | |||
|
99 | <script src="/static/js/notebook.js" type="text/javascript" charset="utf-8"></script> | |||
|
100 | <script src="/static/js/printnotebookmain.js" type="text/javascript" charset="utf-8"></script> | |||
|
101 | ||||
|
102 | </body> | |||
|
103 | ||||
|
104 | </html> |
@@ -285,6 +285,26 b' class NamedNotebookHandler(AuthenticatedHandler):' | |||||
285 | ) |
|
285 | ) | |
286 |
|
286 | |||
287 |
|
287 | |||
|
288 | class PrintNotebookHandler(AuthenticatedHandler): | |||
|
289 | ||||
|
290 | @authenticate_unless_readonly | |||
|
291 | def get(self, notebook_id): | |||
|
292 | nbm = self.application.notebook_manager | |||
|
293 | project = nbm.notebook_dir | |||
|
294 | if not nbm.notebook_exists(notebook_id): | |||
|
295 | raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id) | |||
|
296 | ||||
|
297 | self.render( | |||
|
298 | 'printnotebook.html', project=project, | |||
|
299 | notebook_id=notebook_id, | |||
|
300 | base_project_url=u'/', base_kernel_url=u'/', | |||
|
301 | kill_kernel=False, | |||
|
302 | read_only=self.read_only, | |||
|
303 | logged_in=self.logged_in, | |||
|
304 | login_available=self.login_available, | |||
|
305 | mathjax_url=self.application.ipython_app.mathjax_url, | |||
|
306 | ) | |||
|
307 | ||||
288 | #----------------------------------------------------------------------------- |
|
308 | #----------------------------------------------------------------------------- | |
289 | # Kernel handlers |
|
309 | # Kernel handlers | |
290 | #----------------------------------------------------------------------------- |
|
310 | #----------------------------------------------------------------------------- |
@@ -49,7 +49,7 b' from .handlers import (LoginHandler, LogoutHandler,' | |||||
49 | ProjectDashboardHandler, NewHandler, NamedNotebookHandler, |
|
49 | ProjectDashboardHandler, NewHandler, NamedNotebookHandler, | |
50 | MainKernelHandler, KernelHandler, KernelActionHandler, IOPubHandler, |
|
50 | MainKernelHandler, KernelHandler, KernelActionHandler, IOPubHandler, | |
51 | ShellHandler, NotebookRootHandler, NotebookHandler, NotebookCopyHandler, |
|
51 | ShellHandler, NotebookRootHandler, NotebookHandler, NotebookCopyHandler, | |
52 | RSTHandler, AuthenticatedFileHandler |
|
52 | RSTHandler, AuthenticatedFileHandler, PrintNotebookHandler | |
53 | ) |
|
53 | ) | |
54 | from .notebookmanager import NotebookManager |
|
54 | from .notebookmanager import NotebookManager | |
55 |
|
55 | |||
@@ -98,6 +98,7 b' class NotebookWebApplication(web.Application):' | |||||
98 | (r"/new", NewHandler), |
|
98 | (r"/new", NewHandler), | |
99 | (r"/%s" % _notebook_id_regex, NamedNotebookHandler), |
|
99 | (r"/%s" % _notebook_id_regex, NamedNotebookHandler), | |
100 | (r"/%s/copy" % _notebook_id_regex, NotebookCopyHandler), |
|
100 | (r"/%s/copy" % _notebook_id_regex, NotebookCopyHandler), | |
|
101 | (r"/%s/print" % _notebook_id_regex, PrintNotebookHandler), | |||
101 | (r"/kernels", MainKernelHandler), |
|
102 | (r"/kernels", MainKernelHandler), | |
102 | (r"/kernels/%s" % _kernel_id_regex, KernelHandler), |
|
103 | (r"/kernels/%s" % _kernel_id_regex, KernelHandler), | |
103 | (r"/kernels/%s/%s" % (_kernel_id_regex, _kernel_action_regex), KernelActionHandler), |
|
104 | (r"/kernels/%s/%s" % (_kernel_id_regex, _kernel_action_regex), KernelActionHandler), |
@@ -357,20 +357,6 b' p.dialog {' | |||||
357 | padding : 0.2em; |
|
357 | padding : 0.2em; | |
358 | } |
|
358 | } | |
359 |
|
359 | |||
360 | @media print { |
|
|||
361 | body { overflow: visible !important; } |
|
|||
362 | #menubar, #pager_splitter, #pager { display: none;} |
|
|||
363 | #header {display: none !important; } |
|
|||
364 | #main_app { overflow: visible !important; height: !important auto; } |
|
|||
365 | #notebook_panel { overflow: visible !important; height: !important auto; } |
|
|||
366 | #notebook { |
|
|||
367 | height: !important auto; |
|
|||
368 | overflow-y: !important visible; |
|
|||
369 | overflow-x: !important hidden; |
|
|||
370 | } |
|
|||
371 | .ui-widget-content { border: 0px; } |
|
|||
372 | } |
|
|||
373 |
|
||||
374 | .shortcut_key { |
|
360 | .shortcut_key { | |
375 | display: inline-block; |
|
361 | display: inline-block; | |
376 | width: 15ex; |
|
362 | width: 15ex; |
@@ -84,7 +84,6 b' $(document).ready(function () {' | |||||
84 | IPython.save_widget = new IPython.SaveWidget('span#save_widget'); |
|
84 | IPython.save_widget = new IPython.SaveWidget('span#save_widget'); | |
85 | IPython.quick_help = new IPython.QuickHelp('span#quick_help_area'); |
|
85 | IPython.quick_help = new IPython.QuickHelp('span#quick_help_area'); | |
86 | IPython.login_widget = new IPython.LoginWidget('span#login_widget'); |
|
86 | IPython.login_widget = new IPython.LoginWidget('span#login_widget'); | |
87 | IPython.print_widget = new IPython.PrintWidget(); |
|
|||
88 | IPython.notebook = new IPython.Notebook('div#notebook'); |
|
87 | IPython.notebook = new IPython.Notebook('div#notebook'); | |
89 | IPython.kernel_status_widget = new IPython.KernelStatusWidget('#kernel_status'); |
|
88 | IPython.kernel_status_widget = new IPython.KernelStatusWidget('#kernel_status'); | |
90 | IPython.menubar = new IPython.MenuBar('#menubar') |
|
89 | IPython.menubar = new IPython.MenuBar('#menubar') | |
@@ -97,23 +96,12 b' $(document).ready(function () {' | |||||
97 |
|
96 | |||
98 | if(IPython.read_only){ |
|
97 | if(IPython.read_only){ | |
99 | // hide various elements from read-only view |
|
98 | // hide various elements from read-only view | |
100 | IPython.save_widget.element.find('button#save_notebook').addClass('hidden'); |
|
|||
101 | IPython.quick_help.element.addClass('hidden'); // shortcuts are disabled in read_only |
|
|||
102 | $('div#pager').remove(); |
|
99 | $('div#pager').remove(); | |
103 | $('div#pager_splitter').remove(); |
|
100 | $('div#pager_splitter').remove(); | |
104 | $('button#new_notebook').addClass('hidden'); |
|
|||
105 | $('div#cell_section').addClass('hidden'); |
|
|||
106 | $('div#config_section').addClass('hidden'); |
|
|||
107 | $('div#kernel_section').addClass('hidden'); |
|
|||
108 | $('span#login_widget').removeClass('hidden'); |
|
101 | $('span#login_widget').removeClass('hidden'); | |
109 |
|
102 | |||
110 | // set the notebook name field as not modifiable |
|
103 | // set the notebook name field as not modifiable | |
111 | $('#notebook_name').attr('disabled','disabled') |
|
104 | $('#notebook_name').attr('disabled','disabled') | |
112 |
|
||||
113 | // left panel starts collapsed, but the collapse must happen after |
|
|||
114 | // elements start drawing. Don't draw contents of the panel until |
|
|||
115 | // after they are collapsed |
|
|||
116 | IPython.left_panel.left_panel_element.css('visibility', 'hidden'); |
|
|||
117 | } |
|
105 | } | |
118 |
|
106 | |||
119 | $('div#main_app').css('display','block'); |
|
107 | $('div#main_app').css('display','block'); | |
@@ -126,14 +114,6 b' $(document).ready(function () {' | |||||
126 | IPython.save_widget.update_url(); |
|
114 | IPython.save_widget.update_url(); | |
127 | IPython.layout_manager.do_resize(); |
|
115 | IPython.layout_manager.do_resize(); | |
128 | IPython.pager.collapse(); |
|
116 | IPython.pager.collapse(); | |
129 | if(IPython.read_only){ |
|
|||
130 | // collapse the left panel on read-only |
|
|||
131 | IPython.left_panel.collapse(); |
|
|||
132 | // and finally unhide the panel contents after collapse |
|
|||
133 | setTimeout(function(){ |
|
|||
134 | IPython.left_panel.left_panel_element.css('visibility', 'visible'); |
|
|||
135 | }, 200); |
|
|||
136 | } |
|
|||
137 | },100); |
|
117 | },100); | |
138 | }); |
|
118 | }); | |
139 |
|
119 |
@@ -79,7 +79,7 b'' | |||||
79 | </ul> |
|
79 | </ul> | |
80 | </li> |
|
80 | </li> | |
81 | <hr/> |
|
81 | <hr/> | |
82 |
<li id="print_notebook"><a href=" |
|
82 | <li id="print_notebook"><a href="/{{notebook_id}}/print" target="_blank">Print View</a></li> | |
83 | </ul> |
|
83 | </ul> | |
84 | </li> |
|
84 | </li> | |
85 | <li><a href="#">Edit</a> |
|
85 | <li><a href="#">Edit</a> | |
@@ -174,7 +174,6 b'' | |||||
174 | <script src="/static/js/quickhelp.js" type="text/javascript" charset="utf-8"></script> |
|
174 | <script src="/static/js/quickhelp.js" type="text/javascript" charset="utf-8"></script> | |
175 | <script src="/static/js/loginwidget.js" type="text/javascript" charset="utf-8"></script> |
|
175 | <script src="/static/js/loginwidget.js" type="text/javascript" charset="utf-8"></script> | |
176 | <script src="/static/js/pager.js" type="text/javascript" charset="utf-8"></script> |
|
176 | <script src="/static/js/pager.js" type="text/javascript" charset="utf-8"></script> | |
177 | <script src="/static/js/printwidget.js" type="text/javascript" charset="utf-8"></script> |
|
|||
178 | <script src="/static/js/menubar.js" type="text/javascript" charset="utf-8"></script> |
|
177 | <script src="/static/js/menubar.js" type="text/javascript" charset="utf-8"></script> | |
179 | <script src="/static/js/notebook.js" type="text/javascript" charset="utf-8"></script> |
|
178 | <script src="/static/js/notebook.js" type="text/javascript" charset="utf-8"></script> | |
180 | <script src="/static/js/notebookmain.js" type="text/javascript" charset="utf-8"></script> |
|
179 | <script src="/static/js/notebookmain.js" type="text/javascript" charset="utf-8"></script> |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now