Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
f9f24b6
show email address instead of username in user menu
presnick Sep 16, 2015
b0bed81
use document.getElementById to find div when id may have weird charac…
presnick Sep 16, 2015
c985285
Merge branch 'master' into customizations
presnick Dec 26, 2015
7f952d8
put width:60% back in .css so that enumerated items don't go wide
presnick Dec 26, 2015
fa8e2ab
usageassignment now generates HTML with list of links to subchapters
presnick Jan 5, 2016
3184611
get rid of spaces in URLs generated by usageassignment directive
presnick Jan 10, 2016
ca8b52c
better error reporting for not found subchapters
presnick Jan 15, 2016
b90839e
Merge branch 'master' into customizations
presnick Mar 5, 2016
a5232ed
Merge branch 'master' into customizations
presnick Jun 10, 2016
1823711
reset to master's version of .css
presnick Jun 10, 2016
12b2af2
fix typo
presnick Aug 11, 2016
3eb4910
Merge branch 'master' into customizations
presnick Aug 11, 2016
7e3e919
Merge branch 'master' into customizations
presnick Aug 15, 2016
0a2c50f
Merge remote-tracking branch 'upstream/master' into customizations
presnick Aug 24, 2016
4d8dc6a
Merge remote-tracking branch 'upstream/master' into customizations
presnick Aug 25, 2016
9ccb40a
https://github.com/RunestoneInteractive/RunestoneComponents/issues/248
presnick Aug 26, 2016
456cc64
add gradebutton flag for activecode
presnick Aug 26, 2016
6339c4d
Merge branch 'master' into customizations
presnick Aug 27, 2016
75d5d0f
revert processing of gradeable_div for questions; not needed now
presnick Aug 27, 2016
e0cfd3d
additions for autograding
presnick Aug 27, 2016
80706c7
Merge remote-tracking branch 'upstream/master' into customizations
presnick Aug 29, 2016
d880e50
Merge branch 'master' into customizations
presnick Aug 29, 2016
04cebeb
Add files for external exercise directive.
aerenchyma Aug 29, 2016
242676e
Minimal cleanup.
aerenchyma Aug 29, 2016
951f706
This inheritance may be more sensible.
aerenchyma Aug 29, 2016
af68d9d
Add html to db properly.
aerenchyma Aug 30, 2016
706a94d
Switch to using question.py code as template for external directive.
aerenchyma Aug 30, 2016
62ada9a
Add some extra css.
aerenchyma Aug 30, 2016
9286816
first version of assignment component; not debuggede
presnick Aug 30, 2016
6fe830b
intermediate save of componentdb.py to enable merge from autograde
presnick Aug 31, 2016
9138f76
Merge branch 'autograde' into assignment_directive
presnick Aug 31, 2016
d4d62bb
refactoring and additions to componentdb.py
presnick Aug 31, 2016
8d6732c
refactored usageAssignment to use componentDB
presnick Aug 31, 2016
37b0212
Revert "eradicate hard coded forward slashes" because on Windows os.p…
presnick Aug 31, 2016
0cf0b89
os.path where appropriate, and hardcoded / where appropriate
presnick Aug 31, 2016
ade7784
usageAssignment creates questions for pages
presnick Aug 31, 2016
ccf6085
fix indentation
presnick Aug 31, 2016
45c0bb7
add the assignment directive, for creating assignments in DB based on…
presnick Sep 1, 2016
f8b3c37
save assessment_type as summative for assignment directive
presnick Sep 1, 2016
2cb4250
Merge remote-tracking branch 'upstream/master' into assignment_directive
presnick Sep 2, 2016
fe0fe37
Merge branch 'assignment_directive' into customizations
presnick Sep 2, 2016
daec9e6
Merge pull request #2 from aerenchyma/external-exercise-directive
presnick Sep 2, 2016
d264ee8
allow seconds or not in deadlines; fix bug in emitting warnings
presnick Sep 3, 2016
337ba70
allow seconds or not in deadlines; fix bug in emitting warnings
presnick Sep 3, 2016
3852af1
switch from print to sphinx warnings
presnick Sep 3, 2016
26cdd29
Merge remote-tracking branch 'upstream/master'
presnick Sep 3, 2016
1e7ba82
Merge branch 'master' into assignment_directive
presnick Sep 3, 2016
b9cb81e
fix calls to warn
presnick Sep 5, 2016
e6f309a
Merge remote-tracking branch 'upstream/master'
presnick Sep 5, 2016
8e47bcc
Merge branch 'master' into customizations
presnick Sep 5, 2016
a9ad756
Merge branch 'customizations' into assignment_directive
presnick Sep 5, 2016
2665722
fix deadline warnings when not formatted correctly
presnick Sep 5, 2016
a2d95af
remove customization in bookfuncs.js
presnick Sep 5, 2016
cf9c884
Merge branch 'customizations' into assignment_directive
presnick Sep 5, 2016
a6c00b7
Merge remote-tracking branch 'origin/customizations' into customizations
presnick Sep 6, 2016
45bfba9
Merge branch 'customizations' into assignment_directive
presnick Sep 6, 2016
cfd993f
show email instead of username
presnick Sep 6, 2016
7e5218d
Merge remote-tracking branch 'upstream/master'
presnick Sep 10, 2016
c7c45e7
Merge branch 'master' into customizations
presnick Sep 10, 2016
c6d6207
Merge branch 'master' into assignment_directive
presnick Sep 10, 2016
11a5a17
Reformat subchapter appearance and indent for more neatness
aerenchyma Sep 17, 2016
220cd73
Remove unnecessary import post-debug
aerenchyma Sep 17, 2016
e99e44a
Ordered dictionary.
aerenchyma Sep 17, 2016
4fa06d3
Merge pull request #4 from aerenchyma/fix-subch-appearance
presnick Sep 18, 2016
97371af
better saving of htmlsource; autograde field for assignment_questions…
presnick Sep 18, 2016
685e5a1
Merge remote-tracking branch 'upstream/master'
presnick Sep 18, 2016
6dd3a4e
Merge branch 'master' into customizations
presnick Sep 18, 2016
003c720
Merge branch 'customizations' into assignment_directive
presnick Sep 18, 2016
77f3b01
Revert "show email instead of username"
presnick Sep 18, 2016
cedaaf2
external directive bug fix
presnick Sep 18, 2016
bf54a58
save autograde marking in the question_assignment table
presnick Sep 18, 2016
a9b668b
Merge remote-tracking branch 'upstream/master'
presnick Sep 23, 2016
bb89f4a
Merge remote-tracking branch 'upstream/master'
presnick Sep 26, 2016
fe000cc
Merge remote-tracking branch 'upstream/master'
presnick Sep 28, 2016
8087208
Merge remote-tracking branch 'upstream/jshint-cleanup'
presnick Sep 28, 2016
349ee64
Merge branch 'master' into assignment_directive
presnick Oct 4, 2016
5663e2b
delete assignment_questions when adding assignment
presnick Oct 4, 2016
1a5d31e
Merge remote-tracking branch 'upstream/master'
presnick Oct 4, 2016
7c8d272
Merge branch 'master' into assignment_directive
presnick Oct 4, 2016
c39459a
add autograde flag in assignment_question insertion
presnick Oct 5, 2016
b664204
add autograde flag in assignment_question insertion
presnick Oct 5, 2016
cf94c88
Merge branch 'assignment_directive'
presnick Oct 5, 2016
7bdeeb7
Merge remote-tracking branch 'upstream/master' into assignment_directive
presnick Oct 6, 2016
4af900d
Merge remote-tracking branch 'upstream/master'
presnick Oct 6, 2016
1dad718
Merge branch 'master' into assignment_directive
presnick Oct 6, 2016
3ce03a3
remove redundant setting of basecourse which is handled more generica…
presnick Oct 6, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion runestone/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def build(options):
idxfile = os.path.join(options.build.sourcedir,'index.rst')

populateChapterInfo(options.build.project_name, idxfile)
print('Creating Chapter Information')
print('Creating Chapter Information for {}'.format(idxfile))
except ImportError as e:
print('Chapter information database population skipped, This is OK for a standalone build.',e)
except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion runestone/activecode/activecode.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ def run(self):
env.activecodecounter = 0
env.activecodecounter += 1
self.options['name'] = self.arguments[0].strip()

self.options['divid'] = self.arguments[0]

if not self.options['divid']:
raise Exception("No divid for ..activecode or ..actex in activecode.py")

Expand Down
18 changes: 13 additions & 5 deletions runestone/activecode/js/activecode.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,19 @@ ActiveCode.prototype.createGradeSummary = function () {
var report = eval(data)[0];
// check for report['message']
if (report) {
var body = "<h4>Grade Report</h4>" +
"<p>This assignment: " + report['grade'] + "</p>" +
"<p>" + report['comment'] + "</p>" +
"<p>Number of graded assignments: " + report['count'] + "</p>" +
"<p>Average score: " + report['avg'] + "</p>"
if (report['version'] == 2){
// new version; would be better to embed this in HTML for the activecode
var body = "<h4>Grade Report</h4>" +
"<p>This question: " + report['grade'] + " out of " + report['max'] + "</p>" +
"<p>" + report['comment'] + "</p>"
}
else{
var body = "<h4>Grade Report</h4>" +
"<p>This assignment: " + report['grade'] + "</p>" +
"<p>" + report['comment'] + "</p>" +
"<p>Number of graded assignments: " + report['count'] + "</p>" +
"<p>Average score: " + report['avg'] + "</p>"
}

} else {
body = "<h4>The server did not return any grade information</h4>";
Expand Down
14 changes: 12 additions & 2 deletions runestone/assess/multiplechoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from .assessbase import *
import json
import random
from runestone.server.componentdb import addQuestionToDB
from runestone.server.componentdb import addQuestionToDB, addHTMLToDB


class MChoiceNode(nodes.General, nodes.Element):
Expand All @@ -36,6 +36,10 @@ def __init__(self,content):
self.mc_options = content

def visit_mc_node(self,node):

node.delimiter = "_start__{}_".format(node.mc_options['divid'])
self.body.append(node.delimiter)

res = ""
if 'random' in node.mc_options:
node.mc_options['random'] = 'data-random'
Expand Down Expand Up @@ -70,9 +74,15 @@ def depart_mc_node(self,node):


res += node.template_end % node.mc_options

self.body.append(res)

addHTMLToDB(node.mc_options['divid'],
node.mc_options['basecourse'],
"".join(self.body[self.body.index(node.delimiter) + 1:]))

self.body.remove(node.delimiter)





Expand Down
162 changes: 162 additions & 0 deletions runestone/assignment/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Copyright (C) 2015 Paul Resnick
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from __future__ import print_function

__author__ = 'Paul Resnick'

from docutils import nodes
from docutils.parsers.rst import directives
from docutils.parsers.rst import Directive
from runestone.server.componentdb import addAssignmentToDB, addAssignmentQuestionToDB, getCourseID, getOrCreateAssignmentType, getQuestionID, get_HTML_from_DB
from runestone.common.runestonedirective import RunestoneDirective
from datetime import datetime

def setup(app):
app.add_directive('assignment',Assignment)
app.add_node(AssignmentNode, html=(visit_a_node, depart_a_node))

app.connect('doctree-resolved',process_nodes)
app.connect('env-purge-doc', purge)

class AssignmentNode(nodes.General, nodes.Element):
def __init__(self, content):
"""

Arguments:
- `self`:
- `content`:
"""
super(AssignmentNode, self).__init__(name=content['name'])
self.a_components = content


def visit_a_node(self, node):
pass

def depart_a_node(self, node):
question_ids = node.a_components['question_ids']
basecourse = node.a_components['basecourse']
for q_id in question_ids:
src = get_HTML_from_DB(q_id, basecourse)
if src:
self.body.append(src)
else:
self.body.append("<p>Missing HTML source for {}</p>".format(q_id))
print("No HTML source saved for {}; can't include that kind of question until code writing to HTML is implemented for that directive".format(q_id))

def process_nodes(app,env,docname):
pass


def purge(app,env,docname):
pass



class Assignment(RunestoneDirective):
"""
.. assignment:
:name: Problem Set 1
:assignment_type: formative
:questions: (divid_1 50), (divid_2 100), ...
:deadline: 23-09-2016 15:30
:points: integer
"""
required_arguments = 0 # not a sphinx_id for these; just a name parameter
optional_arguments = 0
has_content = False
option_spec = RunestoneDirective.option_spec.copy()
option_spec.update({
'name': directives.unchanged,
'assignment_type': directives.unchanged,
'questions': directives.unchanged,
'deadline':directives.unchanged,
'points':directives.positive_int,
'threshold': directives.positive_int,
'autograde': directives.unchanged,
'generate_html': directives.flag
})

def run(self):
"""
.. assignment:
:name: Problem Set 1
:assignment_type: formative
:questions: (divid_1 50), (divid_2 100), ...
:deadline: 23-09-2016 15:30
:points: integer
:threshold: integer
:autograde: visited
:generate_html:
"""

course_name = self.state.document.settings.env.config.html_context['course_id']
self.options['course_name'] = course_name
course_id = getCourseID(course_name)
basecourse_name = self.state.document.settings.env.config.html_context.get('basecourse', "unknown")
self.options['basecourse'] = self.state.document.settings.env.config.html_context.get('basecourse', "unknown")

name = self.options.get('name') # required; error if missing
assignment_type_name = self.options.get('assignment_type')
assignment_type_id = getOrCreateAssignmentType(assignment_type_name)

deadline = None

if 'deadline' in self.options:
try:
deadline = datetime.strptime(self.options['deadline'], '%Y-%m-%d %H:%M')
except:
try:
deadline = datetime.strptime(self.options['deadline'], '%Y-%m-%d %H:%M:%S')
self.state.document.settings.env.warn(self.state.document.settings.env.docname, "deadline not in preferred format %Y-%m-%d %H:%M but accepting alternate format with seconds")
except:
self.state.document.settings.env.warn(self.state.document.settings.env.docname, "deadline missing or incorrectly formatted; Omitting deadline")

points = self.options.get('points', 0)
threshold = self.options.get('threshold', None)
if threshold:
threshold = int(threshold)
autograde = self.options.get('autograde', None)

assignment_id = addAssignmentToDB(name = name,
course_id = course_id,
assignment_type_id = assignment_type_id,
deadline = deadline,
points = points,
threshold = threshold)

unparsed = self.options.get('questions', None)
question_names = []
if unparsed:
summative_type_id = getOrCreateAssignmentType("summative")
q_strings = unparsed.split(',')
for q in q_strings:
(question_name, points) = q.strip().split()
question_names.append(question_name)
# first get the question_id associated with question_name
question_id = getQuestionID(basecourse_name, question_name)
if question_id:
addAssignmentQuestionToDB(question_id, assignment_id, points, assessment_type = summative_type_id, autograde = autograde)
else:
self.state.document.settings.env.warn(self.state.document.settings.env.docname, "Question {} is not in the database for basecourse {}".format(question_name, basecourse_name))
else:
self.state.document.settings.env.warn(self.state.document.settings.env.docname, "No questions for assignment {}".format(name))
self.options['question_ids'] = question_names

if 'generate_html' in self.options:
return [AssignmentNode(self.options)]
else:
return []
1 change: 0 additions & 1 deletion runestone/common/runestonedirective.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,3 @@ def __init__(self, *args, **kwargs):
self.options['basecourse'] = self.basecourse
self.options['chapter'] = self.chapter
self.options['subchapter'] = self.subchapter

1 change: 1 addition & 0 deletions runestone/external/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .external import *
109 changes: 109 additions & 0 deletions runestone/external/css/external.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
.modal-profile {
display:none;
min-height: 300px;
overflow: hidden;
width: 700px;
padding:25px;
border:1px solid #fff;
box-shadow: 0px 2px 7px #292929;
-moz-box-shadow: 0px 2px 7px #292929;
-webkit-box-shadow: 0px 2px 7px #292929;
border-radius:10px;
-moz-border-radius:10px;
-webkit-border-radius:10px;
background: #f2f2f2;
z-index:50;
}

.modal-lightsout {
display:none;
position:absolute;
top:0;
left:0;
width:100%;
z-index:25;
background:#000 ;
}

.modal-close-profile {
display:none;
position:absolute;
height: 43px;
width: 43px;
background-image: url('close.png');
top:1px;
right:0.5px;
}


.ac_actions{
text-align: center;
}

.ac_sep {
background: #000;
display: inline-block;
margin: -15px 10px;
width: 1px;
height: 35px;
padding: 0;
border: 0;
}
.ac_section{
position: relative;
clear:both;
}
.ac_section>* {
max-width: 500pt;
margin-left: auto;
margin-right: auto;
position:relative;
}
.ac_section .clearfix{
position: initial;
}
.ac_output{
display:none;
max-width: 450px;
}

.ac_caption {
text-align: center;
font-weight: bold;
}

.ac_caption_text {
font-weight: normal;
}
.ac_caption:before {
content: "ActiveCode: " counter(activecode) " ";
counter-increment: activecode;
}

.active_out {
background-color:#dcdcdc;
border-radius: 6px;
min-width: 20em;
max-height: 300px;
overflow: auto;
}

.visible-ac-canvas {
border: 2px solid black;
}

.ac_section>.col-md-12 {
max-width: 100% !important;
}

.full_width ol {
max-width: 100% !important;
}

.ac-disabled {
pointer-events: none;
}

.ac-feedback {
border: 1px solid black;
}
Loading