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

« back to all changes in this revision

Viewing changes to bin/ivle-cloneworksheets

  • Committer: David Coles
  • Date: 2010-07-28 10:52:48 UTC
  • mfrom: (1791.2.10 mediahandlers)
  • Revision ID: coles.david@gmail.com-20100728105248-zvbn9g72v1nsskvd
A series of HTML5 based media handlers using the <audio> and <video> tags.  
This replaces the previous page that just showed a download link (which is 
already available on the menu).

Also solves issue where media files were downloaded by the client twice (once 
in an AJAX request intended only for text).

Known issues:
    * Bug #588285: External BHO will not be able to play media due to not
      having IVLE cookie.
    * Bug #610745: Does not correctly preview revisions
    * Bug #610780: Ogg media does not work in Chromium

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    sys.exit(1)
31
31
 
32
32
if len(sys.argv) != 7:
33
 
    print >> sys.stderr, "usage: %s <oldsubjectcode> <oldyear> <oldsemester> "\
34
 
                         "<newsubjectcode> <newyear> <newsemester>" \
 
33
    print >> sys.stderr, "usage: %s <oldsubjectcode> <oldyear> <oldsemestercode> "\
 
34
                         "<newsubjectcode> <newyear> <newsemestercode>" \
35
35
                         % os.path.basename(sys.argv[0])
36
36
    sys.exit()
37
37
 
40
40
src = store.find(Offering,
41
41
                 Subject.code == unicode(sys.argv[1]),
42
42
                 Semester.year == unicode(sys.argv[2]),
43
 
                 Semester.semester == unicode(sys.argv[3]),
 
43
                 Semester.code == unicode(sys.argv[3]),
44
44
                 Offering.subject_id == Subject.id,
45
45
                 Offering.semester_id == Semester.id).one()
46
46
 
47
47
dst = store.find(Offering,
48
48
                 Subject.code == unicode(sys.argv[4]),
49
49
                 Semester.year == unicode(sys.argv[5]),
50
 
                 Semester.semester == unicode(sys.argv[6]),
 
50
                 Semester.code == unicode(sys.argv[6]),
51
51
                 Offering.subject_id == Subject.id,
52
52
                 Offering.semester_id == Semester.id).one()
53
53
 
54
54
if dst.worksheets.count() > 0:
55
55
    die('%r already has worksheets - doing nothing' % dst)
56
56
 
57
 
for oldws in src.worksheets:
58
 
    newws = Worksheet()
59
 
    newws.seq_no = oldws.seq_no
60
 
    newws.identifier = oldws.identifier
61
 
    newws.name = oldws.name
62
 
    newws.assessable = oldws.assessable
63
 
    newws.data = oldws.data
64
 
    newws.format = oldws.format
65
 
    newws.offering = dst
66
 
    store.add(newws)
67
 
    ivle.worksheet.utils.update_exerciselist(newws)
 
57
dst.clone_worksheets(src)
68
58
 
69
59
print >> sys.stderr, 'copied %d worksheets from %r to %r' \
70
60
                     % (dst.worksheets.count(), src, dst)