168
170
self.plugin_styles[Plugin] = ["project.css"]
169
171
self.plugin_scripts[Plugin] = ["project.js"]
170
172
ctx['offering'] = self.context
171
ctx['subject'] = self.context.subject.short_name
172
ctx['year'] = self.context.semester.year
173
ctx['semester'] = self.context.semester.semester
175
173
ctx['projectsets'] = []
177
175
#Open the projectset Fragment, and render it for inclusion
187
185
for projectset in self.context.project_sets:
188
186
settmpl = loader.load(set_fragment)
189
187
setCtx = Context()
190
setCtx['group_size'] = projectset.max_students_per_group
191
setCtx['projectset_id'] = projectset.id
188
setCtx['projectset'] = projectset
192
189
setCtx['new_project_url'] = self.new_project_url(projectset)
193
190
setCtx['projects'] = []
223
220
if self.context is None:
223
def build_subversion_url(self, svnroot, submission):
224
princ = submission.assessed.principal
226
if isinstance(princ, User):
227
path = 'users/%s' % princ.login
229
path = 'groups/%s_%s_%s_%s' % (
230
princ.project_set.offering.subject.short_name,
231
princ.project_set.offering.semester.year,
232
princ.project_set.offering.semester.semester,
235
return urlparse.urljoin(
237
os.path.join(path, submission.path[1:] if
238
submission.path.startswith(os.sep) else
226
241
def populate(self, req, ctx):
242
self.plugin_styles[Plugin] = ["project.css"]
227
244
ctx['format_datetime_short'] = ivle.date.format_datetime_for_paragraph
245
ctx['build_subversion_url'] = self.build_subversion_url
246
ctx['svn_addr'] = req.config['urls']['svn_addr']
229
247
ctx['project'] = self.context
230
ctx['assesseds'] = self.context.assesseds
232
ctx['submissions'] = []
233
for assessed in self.context.assesseds:
234
if assessed.submissions.count() > 0:
235
ctx['submissions'].append(
236
assessed.submissions.order_by(ProjectSubmission.date_submitted)[-1])
248
ctx['user'] = req.user
239
250
class Plugin(ViewPlugin, MediaPlugin):