~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/tutorial/__init__.py

  • Committer: William Grant
  • Date: 2009-12-02 03:38:42 UTC
  • mto: This revision was merged to the branch mainline in revision 1353.
  • Revision ID: grantw@unimelb.edu.au-20091202033842-8o1sz0iou60tue4f
Restore SubjectMediaView.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
from ivle.webapp.base.views import BaseView
42
42
from ivle.webapp.base.xhtml import XHTMLView
43
43
from ivle.webapp.base.plugins import ViewPlugin, MediaPlugin
44
 
from ivle.webapp.media import media_url#, BaseMediaFileView
 
44
from ivle.webapp.media import media_url
45
45
from ivle.webapp.errors import NotFound
46
46
from ivle.worksheet.rst import rst as rstfunc
47
47
 
57
57
            exerciseattempt_url)
58
58
from ivle.webapp.tutorial.breadcrumbs import (ExerciseBreadcrumb,
59
59
            WorksheetBreadcrumb)
 
60
from ivle.webapp.tutorial.media import (SubjectMediaFile, SubjectMediaView,
 
61
    subject_to_media)
60
62
 
61
63
class Worksheet:
62
64
    """This class represents a worksheet and a particular students progress
162
164
 
163
165
        ctx['worksheetstream'] = add_exercises(ctx['worksheetstream'], ctx, req)
164
166
 
165
 
#class SubjectMediaView(BaseMediaFileView):
166
 
#    '''The view of subject media files.
167
 
#
168
 
#    URIs pointing here will just be served directly, from the subject's
169
 
#    media directory.
170
 
#    '''
171
 
#    permission = 'view'
172
 
#
173
 
#    def __init__(self, req, subject, path):
174
 
#        self.context = req.store.find(Subject, short_name=subject).one()
175
 
#        self.path = os.path.normpath(path)
176
 
#
177
 
#    def _make_filename(self, req):
178
 
#        # If the subject doesn't exist, self.subject will be None. Die.
179
 
#        if not self.context:
180
 
#            raise NotFound()
181
 
#
182
 
#        subjectdir = os.path.join(req.config['paths']['data'],
183
 
#                                  'content/subjects',
184
 
#                                  self.context.short_name, 'media')
185
 
#        return os.path.join(subjectdir, self.path)
186
 
 
187
167
def get_worksheets(subjectfile):
188
168
    '''Given a subject stream, get all the worksheets and put them in ctx'''
189
169
    worksheets = []
501
481
class Plugin(ViewPlugin, MediaPlugin):
502
482
    forward_routes = (root_to_exercise, offering_to_worksheet,
503
483
        worksheet_to_worksheetexercise, worksheetexercise_to_exerciseattempts,
504
 
        exerciseattempts_to_attempt)
 
484
        exerciseattempts_to_attempt, subject_to_media)
505
485
 
506
486
    reverse_routes = (exercise_url, worksheet_url, worksheetexercise_url,
507
487
        exerciseattempts_url, exerciseattempt_url)
519
499
             (ApplicationRoot, ('+exercises', '+add'), ExerciseAddView),
520
500
             (Exercise, '+edit', ExerciseEditView),
521
501
             (Exercise, '+delete', ExerciseDeleteView),
 
502
             (SubjectMediaFile, '+index', SubjectMediaView),
522
503
 
523
504
             (Offering, ('+worksheets', '+index'), WorksheetsRESTView, 'api'),
524
505
             (DBWorksheet, '+index', WorksheetRESTView, 'api'),