[open-ils-commits] r137 - in servres/trunk/conifer: static syrup templates (gfawcett)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Mar 3 22:17:44 EST 2009


Author: gfawcett
Date: 2009-03-03 22:17:42 -0500 (Tue, 03 Mar 2009)
New Revision: 137

Added:
   servres/trunk/conifer/templates/add_new_course.xhtml
Modified:
   servres/trunk/conifer/static/main.css
   servres/trunk/conifer/syrup/models.py
   servres/trunk/conifer/syrup/urls.py
   servres/trunk/conifer/syrup/views.py
   servres/trunk/conifer/templates/my_courses.xhtml
Log:
vestigal add-new-course interface.


Modified: servres/trunk/conifer/static/main.css
===================================================================
--- servres/trunk/conifer/static/main.css	2009-03-04 02:08:42 UTC (rev 136)
+++ servres/trunk/conifer/static/main.css	2009-03-04 03:17:42 UTC (rev 137)
@@ -195,4 +195,14 @@
 .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

Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py	2009-03-04 02:08:42 UTC (rev 136)
+++ servres/trunk/conifer/syrup/models.py	2009-03-04 03:17:42 UTC (rev 137)
@@ -152,13 +152,18 @@
     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)
+    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')
 
-    # 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',
+    # 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 @@
         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:

Modified: servres/trunk/conifer/syrup/urls.py
===================================================================
--- servres/trunk/conifer/syrup/urls.py	2009-03-04 02:08:42 UTC (rev 136)
+++ servres/trunk/conifer/syrup/urls.py	2009-03-04 03:17:42 UTC (rev 137)
@@ -9,6 +9,7 @@
 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'),

Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py	2009-03-04 02:08:42 UTC (rev 136)
+++ servres/trunk/conifer/syrup/views.py	2009-03-04 03:17:42 UTC (rev 137)
@@ -114,6 +114,15 @@
 def my_courses(request):
     return g.render('my_courses.xhtml')
 
+class NewCourseForm(ModelForm):
+    class Meta:
+        model = models.Course
+
+ at 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():

Added: servres/trunk/conifer/templates/add_new_course.xhtml
===================================================================
--- servres/trunk/conifer/templates/add_new_course.xhtml	                        (rev 0)
+++ servres/trunk/conifer/templates/add_new_course.xhtml	2009-03-04 03:17:42 UTC (rev 137)
@@ -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>

Modified: servres/trunk/conifer/templates/my_courses.xhtml
===================================================================
--- servres/trunk/conifer/templates/my_courses.xhtml	2009-03-04 02:08:42 UTC (rev 136)
+++ servres/trunk/conifer/templates/my_courses.xhtml	2009-03-04 03:17:42 UTC (rev 137)
@@ -20,6 +20,7 @@
   <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>



More information about the open-ils-commits mailing list