vestigal add-new-course interface.
authorgfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Wed, 4 Mar 2009 03:17:42 +0000 (03:17 +0000)
committergfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Wed, 4 Mar 2009 03:17:42 +0000 (03:17 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@137 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/static/main.css
conifer/syrup/models.py
conifer/syrup/urls.py
conifer/syrup/views.py
conifer/templates/add_new_course.xhtml [new file with mode: 0644]
conifer/templates/my_courses.xhtml

index 7596901..61497f3 100644 (file)
@@ -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
index 8fa1f50..0c27401 100644 (file)
@@ -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:
index 5e1f6a1..9b9e4d2 100644 (file)
@@ -9,6 +9,7 @@ GENERIC_REGEX = r'((?P<obj_id>\d+)/)?(?P<action>.+)?$'
 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_option>.*)/$', 'browse_courses'),
     (r'^prefs/$', 'user_prefs'),
index 4399379..6ae4380 100644 (file)
@@ -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 (file)
index 0000000..ba74a6f
--- /dev/null
@@ -0,0 +1,38 @@
+<?python
+title = _('Add a new course site')
+?>
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:xi="http://www.w3.org/2001/XInclude"
+      xmlns:py="http://genshi.edgewall.org/">
+<xi:include href="master.xhtml"/>
+<head>
+  <title>${title}</title>
+</head>
+<body>
+  <h1>${title}</h1>
+  <form action="." method="POST">
+  <fieldset>
+    <legend>General description</legend>
+  <table class="formtable">
+    <tr><th>Course code</th><td><input type="text"/></td></tr>
+    <tr><th>Title</th><td><input type="text"/></td></tr>
+    <tr><th>Term</th><td>${Markup(form.term)}</td></tr>
+    <tr><th>Department</th><td>${Markup(form.department)}</td></tr>
+  </table>
+  </fieldset>
+  <fieldset>
+    <legend>Access controls</legend>
+    <p>This site will be available to:</p>
+    <select>
+      <option>For now, just myself and designated colleagues</option>
+      <option>Students in my course (I will provide section numbers)</option>
+      <option>Students in my course (I will share a password with them)</option>
+      <option>All Reserves patrons</option>
+    </select>
+  </fieldset>
+  <p><input type="submit" value="Continue"/></p>
+  </form>
+
+  <div class="gap"/>
+</body>
+</html>
index 656a1ba..a796ae5 100644 (file)
@@ -20,6 +20,7 @@ title = _('Welcome to Syrup E-Reserves!')
   <p py:for="course in my_courses" style="font-size: large;">
     <a href="${course.id}/">${course.term}: ${course.code}: ${course.title}</a>
   </p>
+  <p><a href="new/">Add a new course</a></p>
   <div class="gap"/>
 </body>
 </html>