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

« back to all changes in this revision

Viewing changes to ivle/webapp/admin/offeringservice.py

  • Committer: Matt Giuca
  • Date: 2009-02-24 02:02:03 UTC
  • mto: This revision was merged to the branch mainline in revision 1119.
  • Revision ID: matt.giuca@gmail.com-20090224020203-aqdcjnsj6y7wl32o
Added a new look to the IVLE header bar. Mmmm... Web 2.0.
Added top-level directory image-source, containing SVG and script files for
    generating the images.
ivle/webapp/coremedia/images: Added 'chrome' directory containing the rendered
    images.
Modified ivle/webapp/base/ivle-headings.html and
    ivle/webapp/coremedia/ivle.css to support the new images.
    Note that the H1 and H2 at the top of the page are no longer displayed
    (and their custom styles have been removed). There is a heading image
    instead.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
 
3
 
import ivle.database
4
 
from ivle.database import ProjectSet, Subject, Semester, Offering
5
 
 
6
 
from ivle.webapp.admin.projectservice import ProjectSetRESTView
7
 
from ivle.webapp.groups import GroupsView
8
 
from ivle.webapp.base.rest import (XHTMLRESTView, named_operation,
9
 
                                   require_permission)
10
 
from ivle.webapp.errors import NotFound
11
 
 
12
 
class OfferingRESTView(XHTMLRESTView):
13
 
    """REST view for a subject.
14
 
      
15
 
    This view allows for added a ProjectSet to an existing subject."""
16
 
 
17
 
    template = "subject.html"
18
 
 
19
 
    @named_operation('edit')
20
 
    def add_projectset(self, req, group_size):
21
 
        """Add a new ProjectSet"""
22
 
        new_projectset = ProjectSet()
23
 
        if group_size == '':
24
 
            new_projectset.max_students_per_group = None
25
 
        else:
26
 
            new_projectset.max_students_per_group = int(group_size)
27
 
        new_projectset.offering = self.context
28
 
 
29
 
        req.store.add(new_projectset)
30
 
        req.store.flush()
31
 
 
32
 
        self.ctx['req'] = req
33
 
        self.ctx['projectset'] = new_projectset
34
 
        self.ctx['projects'] = []
35
 
        self.ctx['GroupsView'] = GroupsView
36
 
        self.ctx['ProjectSetRESTView'] = ProjectSetRESTView
37
 
 
38
 
        self.template = 'templates/projectset_fragment.html'
39
 
 
40
 
        return {'success': True, 'projectset_id': new_projectset.id}