Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit a6f2093

Browse files
committed
Merge branch 'bookfuncs-reorg'
2 parents bd05a67 + fd90f67 commit a6f2093

File tree

6 files changed

+29
-11
lines changed

6 files changed

+29
-11
lines changed

runestone/__main__.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,20 @@ def init():
2020
while ' ' in conf_dict['project_name']:
2121
conf_dict['project_name'] = click.prompt("Project name: (one word, NO SPACES)")
2222
conf_dict['build_dir'] = click.prompt("Path to build dir ", default="./build")
23-
conf_dict['login_req'] = click.prompt("Require login ", default="false")
24-
conf_dict['master_url'] = click.prompt("URL for ajax server ", default="http://127.0.0.1:8000")
23+
conf_dict['use_services'] = click.prompt("Use Runestone Web Services ", type=click.Choice(['true', 'false']), default="false")
2524
conf_dict['author'] = click.prompt("Your Name ", default=getpass.getuser())
2625
conf_dict['project_title'] = click.prompt("Title for this project ", default="Runestone Default")
27-
conf_dict['logging'] = click.prompt("Log student actions? ", type=bool, default=True)
28-
conf_dict['log_level'] = 10 if conf_dict['logging'] else 0
26+
conf_dict['python3'] = click.prompt("Use Simple Python3 Semantics ", default="false")
27+
if conf_dict['use_services'] == "true":
28+
conf_dict['login_req'] = click.prompt("Require login ", default="false")
29+
conf_dict['master_url'] = click.prompt("URL for ajax server ", default="http://127.0.0.1:8000")
30+
conf_dict['logging'] = click.prompt("Log student actions? ", type=bool, default=True)
31+
conf_dict['log_level'] = 10 if conf_dict['logging'] else 0
32+
else:
33+
conf_dict['login_req'] = "false"
34+
conf_dict['master_url'] = "http://127.0.0.1:8000"
35+
conf_dict['logging'] = False
36+
conf_dict['log_level'] = 0
2937

3038
shutil.copytree(os.path.join(template_base_dir,'_sources'),'_sources')
3139
shutil.copytree(os.path.join(template_base_dir,'_static'),'_static')

runestone/common/js/bookfuncs.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function timedRefresh() {
138138
function shouldLogin() {
139139
var sli = true;
140140

141-
if (window.location.href.indexOf('file://') > -1) {
141+
if (window.location.href.indexOf('file://') > -1 || (! eBookConfig.useRunestoneServices) ) {
142142
sli = false;
143143
}
144144

@@ -154,6 +154,7 @@ function isLoggedIn() {
154154

155155
function addUserToFooter() {
156156
// test to see if online before doing this.
157+
var x = "user ";
157158
if (shouldLogin()) {
158159
jQuery.get(eBookConfig.ajaxURL + 'getuser', null, gotUser)
159160
} else {
@@ -190,11 +191,15 @@ function addNavbarLoginLink() {
190191

191192

192193
function getNumUsers() {
193-
$.getJSON(eBookConfig.ajaxURL + 'getnumusers', setNumUsers)
194+
if (eBookConfig.useRunestoneServices) {
195+
$.getJSON(eBookConfig.ajaxURL + 'getnumusers', setNumUsers)
196+
}
194197
}
195198

196199
function getOnlineUsers() {
197-
$.getJSON(eBookConfig.ajaxURL + 'getnumonline', setOnlineUsers)
200+
if (eBookConfig.useRunestoneServices) {
201+
$.getJSON(eBookConfig.ajaxURL + 'getnumonline', setOnlineUsers)
202+
}
198203
}
199204

200205
function setOnlineUsers(data) {
90.5 KB
Loading

runestone/common/project_template/_templates/plugin_layouts/sphinx_bootstrap/layout.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,11 @@
216216
eBookConfig.ajaxURL = eBookConfig.app+'/ajax/';
217217
eBookConfig.course = '{{course_id}}';
218218
eBookConfig.logLevel = {{loglevel}};
219-
eBookConfig.loginRequired = {{login_required}}
219+
eBookConfig.loginRequired = {{login_required}};
220220
eBookConfig.build_info = "{{build_info}}";
221221
eBookConfig.isLoggedIn = false;
222+
eBookConfig.useRunestoneServices = {{ use_services }};
223+
eBookConfig.python3 = {{ python3 }};
222224
</script>
223225

224226
<div id="fb-root"></div>

runestone/common/project_template/pavement.tmpl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ options(
2525
'login_required':'%(login_req)s',
2626
'appname':master_app,
2727
'loglevel': %(log_level)d,
28-
'course_url':master_url }
28+
'course_url':master_url,
29+
'use_services': '%(use_services)s',
30+
'python3': '%(python3)s'
31+
}
2932
)
3033
)
3134

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
setup(
77
name='runestone',
88
description='Sphinx extensions for writing interactive documents.',
9-
version='2.0a4',
9+
version='2.0a5',
1010
author = 'Brad Miller',
1111
author_email = '[email protected]',
1212
packages= find_packages(),
@@ -17,7 +17,7 @@
1717
package_data = { '' : ['js/*.js', 'css/*.css', '*.txt']},
1818
license='GPL',
1919
url = 'https://github.com/RunestoneInteractive/RunestoneTools',
20-
download_url = 'https://github.com/RunestoneInteractive/RunestoneTools/tarball/2.0a4',
20+
download_url = 'https://github.com/RunestoneInteractive/RunestoneTools/tarball/2.0a5',
2121
keywords = ['runestone', 'sphinx', 'ebook'], # arbitrary keywords
2222
classifiers=('Development Status :: 5 - Production/Stable',
2323
'Environment :: Console',

0 commit comments

Comments
 (0)