added course-site deletion (insecure)
authorgfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Sun, 8 Mar 2009 19:28:49 +0000 (19:28 +0000)
committergfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Sun, 8 Mar 2009 19:28:49 +0000 (19:28 +0000)
Haven't done the access control bit yet.

git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@149 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/static/main.css
conifer/syrup/urls.py
conifer/syrup/views.py
conifer/templates/add_new_course.xhtml

index 7560fec..83071f7 100644 (file)
@@ -56,7 +56,7 @@ h2 { font-size: 135%; }
 h3 { font-size: 120%; }
 
 h1 { color: navy; }
-h2 { color: #066; }
+h2 { color: #338; }
 h3, h4 { color: darkgreen; }
 h1 a, h2 a { color: navy; }
 
@@ -197,7 +197,7 @@ p.todo, div.todo { background-color: #fdd; padding: 6; margin: 12; border-left:
 
 #coursebanner h1 { padding: 0; font-size: 110%; }
 
-#edit_course_link { float: right; margin: 4 0 0 0; font-size: 95%; }
+#edit_course_link { margin: 8 0 8 0; font-size: 95%; }
 
 .breadcrumbs { margin: 8 8 8 0; }
 
index 5bba02a..433502c 100644 (file)
@@ -23,6 +23,7 @@ urlpatterns = patterns('conifer.syrup.views',
     (r'^department/(?P<department_id>.*)/$', 'department_detail'),
     (r'^course/(?P<course_id>\d+)/search/$', 'course_search'),
     (r'^course/(?P<course_id>\d+)/edit/$', 'edit_course'),
+    (r'^course/(?P<course_id>\d+)/edit/delete/$', 'delete_course'),
     (r'^course/(?P<course_id>\d+)/edit/permission/$', 'edit_course_permissions'),
     (ITEM_PREFIX + r'$', 'item_detail'),
     (ITEM_PREFIX + r'dl/(?P<filename>.*)$', 'item_download'),
index 7f2da57..90b5473 100644 (file)
@@ -276,7 +276,16 @@ def edit_course_permissions(request, course_id):
             if course.access == u'STUDT':
                 raise NotImplementedError, 'No course sections yet! Coming soon.'
             return HttpResponseRedirect('.')
-            
+
+@login_required                 # fixme, must be instructor...
+def delete_course(request, course_id):
+    course = get_object_or_404(models.Course, pk=course_id)
+    if request.POST.get('confirm_delete'):
+        course.delete()
+        return HttpResponseRedirect('/syrup/course/')
+    else:
+        return HttpResponseRedirect('../')
+
 #------------------------------------------------------------
 
 @login_required                 # must be, to avoid/audit brute force attacks.
index 19d83de..fd11b23 100644 (file)
@@ -38,7 +38,15 @@ else:
   </table>
   <p><input type="submit" value="Continue"/></p>
   </form>
-
   <div class="gap"/>
+  <div py:if="instance.id">
+    <h2>Delete this course</h2>
+    <form action="delete/" method="POST">
+      <p><input type="checkbox" name="confirm_delete" id="confirm_delete"/>
+      <label for="confirm_delete">Yes, I want to delete this course site and all of its contents.</label>
+      </p>
+      <p><input type="submit" value="Delete this course"/></p>
+    </form>
+  </div>
 </body>
 </html>