[open-ils-commits] r467 - in servres/trunk/conifer: custom syrup syrup/views templates (artunit)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun May 10 22:32:19 EDT 2009
Author: artunit
Date: 2009-05-10 22:32:18 -0400 (Sun, 10 May 2009)
New Revision: 467
Modified:
servres/trunk/conifer/custom/course_codes.py
servres/trunk/conifer/syrup/urls.py
servres/trunk/conifer/syrup/views/general.py
servres/trunk/conifer/syrup/views/search.py
servres/trunk/conifer/templates/search_results.xhtml
Log:
working out instructors more field
Modified: servres/trunk/conifer/custom/course_codes.py
===================================================================
--- servres/trunk/conifer/custom/course_codes.py 2009-05-10 03:18:52 UTC (rev 466)
+++ servres/trunk/conifer/custom/course_codes.py 2009-05-11 02:32:18 UTC (rev 467)
@@ -108,18 +108,24 @@
# Provide your own implementation below.
-_codes = [('ENG100', 'Introduction to English'),
- ('ART108', 'English: An Introduction'),
- ('FRE238', 'Modern French Literature'),
- ('LIB201', 'Intro to Library Science'),
- ('WEB203', 'Advanced Web Design'),]
+#_codes = [('ENG100', 'Introduction to English'),
+# ('ART108', 'English: An Introduction'),
+# ('FRE238', 'Modern French Literature'),
+# ('LIB201', 'Intro to Library Science'),
+# ('WEB203', 'Advanced Web Design'),]
-_crosslists = set(['ENG100', 'ART108'])
+_codes = [('BIOL55-350', 'Molecular Cell Biology'),
+ ('CRIM48-567', 'Current Issues in Criminology'),
+ ('ENGL26-280', 'Contemporary Literary Theory'),
+ ('ENGL26-420', 'Word and Image: The Contemporary Graphic Novel'),
+ ('SOCWK47-457', 'Advanced Social Work Research'),]
+_crosslists = set(['ENGL26-280', 'ENGL26-420'])
+
course_code_is_valid = None
-course_code_example = 'ENG100; FRE238'
+course_code_example = 'BIOL55-350; SOCWK47-457'
def course_code_list():
return [a for (a,b) in _codes]
Modified: servres/trunk/conifer/syrup/urls.py
===================================================================
--- servres/trunk/conifer/syrup/urls.py 2009-05-10 03:18:52 UTC (rev 466)
+++ servres/trunk/conifer/syrup/urls.py 2009-05-11 02:32:18 UTC (rev 467)
@@ -22,6 +22,7 @@
(r'^zsearch/$', 'zsearch'),
#MARK: propose we kill instructors, we have browse
(r'^instructors/$', 'instructors'),
+ (r'^instructors/search/(?P<instructor>.*)$', 'instructor_search'),
#MARK: propose we kill departments, we have browse
(r'^departments/$', 'departments'),
(r'^course/(?P<course_id>\d+)/$', 'course_detail'),
Modified: servres/trunk/conifer/syrup/views/general.py
===================================================================
--- servres/trunk/conifer/syrup/views/general.py 2009-05-10 03:18:52 UTC (rev 466)
+++ servres/trunk/conifer/syrup/views/general.py 2009-05-11 02:32:18 UTC (rev 467)
@@ -1,5 +1,6 @@
from _common import *
from django.utils.translation import ugettext as _
+from search import *
#-----------------------------------------------------------------------------
@@ -30,6 +31,9 @@
page_num=page_num,
count=count)
+def instructor_search(request, instructor):
+ return search(request, with_instructor=instructor)
+
# MARK: propose we get rid of this. We have browse.
def departments(request):
raise NotImplementedError
Modified: servres/trunk/conifer/syrup/views/search.py
===================================================================
--- servres/trunk/conifer/syrup/views/search.py 2009-05-10 03:18:52 UTC (rev 466)
+++ servres/trunk/conifer/syrup/views/search.py 2009-05-11 02:32:18 UTC (rev 467)
@@ -39,19 +39,23 @@
#-----------------------------------------------------------------------------
# Search and search support
-def search(request, in_course=None):
+def search(request, in_course=None, with_instructor=None):
''' Need to work on this, the basic idea is
- put an entry point for instructor and course listings
- page through item entries
If in_course is provided, then limit search to the contents of the specified course.
+ If with_instructor is provided, then limit search to instructors
'''
+
+ print("in_couse is %s" % in_course)
+ print("with_instructor is %s" % with_instructor)
found_entries = None
page_num = int(request.GET.get('page', 1))
count = int(request.GET.get('count', 5))
norm_query = ''
query_string = ''
-
+
#TODO: need to block or do something useful with blank query (seems dumb to do entire list)
#if ('q' in request.GET) and request.GET['q']:
@@ -82,16 +86,20 @@
metadata__name='syrup:barcode',
metadata__value=query_string)
else:
- # Textual (non-numeric) queries.
- item_query = get_query(query_string, ['title', 'metadata__value'])
+ if not with_instructor:
+ # Textual (non-numeric) queries.
+ item_query = get_query(query_string, ['title', 'metadata__value'])
#need to think about sort order here, probably better by author (will make sortable at display level)
- results_list = models.Item.objects.filter(item_query)
+ results_list = models.Item.objects.filter(item_query)
if in_course:
# For an in-course search, we know the user has
# permissions to view the course; no need for
# user_filter_for_items.
results_list = results_list.filter(course=in_course)
+ elif with_instructor:
+ print("in instructor")
+ results_list = results_list.filter(instructor=with_instructor)
else:
results_list = results_list.filter(user_filter_for_items)
Modified: servres/trunk/conifer/templates/search_results.xhtml
===================================================================
--- servres/trunk/conifer/templates/search_results.xhtml 2009-05-10 03:18:52 UTC (rev 466)
+++ servres/trunk/conifer/templates/search_results.xhtml 2009-05-11 02:32:18 UTC (rev 467)
@@ -32,14 +32,16 @@
<td py:if="instructors" valign="top" class="topbox">
<table class="topheading">
<tr>
+ <!--
<th>Last Name</th><th>First Name</th>
+ -->
+ <th>Instructors</th>
</tr>
<tr py:for="instructor in instructors">
- <td>${Markup(instructor.instr_name_hl(norm_query))}</td>
- <td>${instructor.user.first_name}</td>
+ <td> ${Markup(instructor.instr_name_hl(norm_query))},
+ ${instructor.user.first_name}</td>
</tr>
<tr py:if="instr_len > count">
- <td></td>
<!-- will tap into open list here -->
<td>(${instr_len - count} more...)</td>
</tr>
More information about the open-ils-commits
mailing list