From: gfawcett Date: Wed, 4 Mar 2009 03:17:42 +0000 (+0000) Subject: vestigal add-new-course interface. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f00435fdd2f0d9e9dfa629671cbed316b17d4b47;p=Syrup.git vestigal add-new-course interface. git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@137 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- diff --git a/conifer/static/main.css b/conifer/static/main.css index 7596901..61497f3 100644 --- a/conifer/static/main.css +++ b/conifer/static/main.css @@ -195,4 +195,14 @@ p.todo, div.todo { background-color: #fdd; padding: 6; margin: 12; border-left: .breadcrumbs { margin: 8 8 8 0; } .errorlist { float: right; } -.errorlist li { color: red; font-size: 90%; } \ No newline at end of file +.errorlist li { color: red; font-size: 90%; } + + +/* a nice table-style for forms. */ +.formtable tbody th { + padding: 0 8 16 0; + width: 200; + text-align: left; + font-size: 90%; + font-weight: normal; +} \ No newline at end of file diff --git a/conifer/syrup/models.py b/conifer/syrup/models.py index 8fa1f50..0c27401 100644 --- a/conifer/syrup/models.py +++ b/conifer/syrup/models.py @@ -152,13 +152,18 @@ class Course(m.Model): department = m.ForeignKey(Department) term = m.ForeignKey(Term) title = m.CharField(max_length=1024) - active = m.BooleanField(default=True) - moderated = m.BooleanField(_('This is a moderated (non-public) course'), - default=False) - - # Enrol-codes are used for SIS integration (graham's idea-in-progress) - # don't i18nize, I'm probably dropping this. vvvvv - enrol_codes = m.CharField('Registrar keys for class lists, pipe-separated', + access = m.CharField(max_length=5, + choices = [('ANON', _('World-accessible')), + ('LOGIN', _('Accessible to all logged-in users')), + ('STUDT', _('Accessible to course students')), + ('CLOSE', _('Accessible only to course owners'))], + default='CLOSE') + + # For sites that use a passphrase as an invitation. + passkey = m.CharField(db_index=True, unique=True, blank=True, null=True) + + # For sites that have registration-lists from an external system. + enrol_codes = m.CharField(_('Registrar keys for class lists, pipe-separated'), max_length=4098, blank=True, null=True) def __unicode__(self): @@ -221,6 +226,12 @@ class Member(m.Model): default = 'STUDT', max_length = 5) + # a user is 'provided' if s/he was added automatically due to + # membership in an external registration system. The notion is + # that these students can be automatically removed by add/drop + # processors. + provided = m.BooleanField(default=False) + def instr_name_hl(self, terms): hl_instr = self.user.last_name for term in terms: diff --git a/conifer/syrup/urls.py b/conifer/syrup/urls.py index 5e1f6a1..9b9e4d2 100644 --- a/conifer/syrup/urls.py +++ b/conifer/syrup/urls.py @@ -9,6 +9,7 @@ GENERIC_REGEX = r'((?P\d+)/)?(?P.+)?$' urlpatterns = patterns('conifer.syrup.views', (r'^$', 'welcome'), (r'^course/$', 'my_courses'), + (r'^course/new/$', 'add_new_course'), (r'^browse/$', 'browse_courses'), (r'^browse/(?P.*)/$', 'browse_courses'), (r'^prefs/$', 'user_prefs'), diff --git a/conifer/syrup/views.py b/conifer/syrup/views.py index 4399379..6ae4380 100644 --- a/conifer/syrup/views.py +++ b/conifer/syrup/views.py @@ -114,6 +114,15 @@ def browse_courses(request, browse_option=''): def my_courses(request): return g.render('my_courses.xhtml') +class NewCourseForm(ModelForm): + class Meta: + model = models.Course + +@login_required +def add_new_course(request): + form = NewCourseForm(instance=models.Course()) + return g.render('add_new_course.xhtml', **locals()) + def course_detail(request, course_id): course = get_object_or_404(models.Course, pk=course_id) if course.moderated and request.user.is_anonymous(): diff --git a/conifer/templates/add_new_course.xhtml b/conifer/templates/add_new_course.xhtml new file mode 100644 index 0000000..ba74a6f --- /dev/null +++ b/conifer/templates/add_new_course.xhtml @@ -0,0 +1,38 @@ + + + + + ${title} + + +

${title}

+
+
+ General description + + + + + +
Course code
Title
Term${Markup(form.term)}
Department${Markup(form.department)}
+
+
+ Access controls +

This site will be available to:

+ +
+

+
+ +
+ + diff --git a/conifer/templates/my_courses.xhtml b/conifer/templates/my_courses.xhtml index 656a1ba..a796ae5 100644 --- a/conifer/templates/my_courses.xhtml +++ b/conifer/templates/my_courses.xhtml @@ -20,6 +20,7 @@ title = _('Welcome to Syrup E-Reserves!')

${course.term}: ${course.code}: ${course.title}

+

Add a new course