Page Source
from utils.display import Display, Database
from utils.controls import *
from utils.web_exc import WebError
import queries, debugging
from config import docroot
import string, os
class FacultyInterestsDisplay(Display, Database):
multiple_controls = [
"<h4>",
LinkControl(field="login", url="%(person!login)s", subcontrol=FieldControl("name")),
"</h4>",
"<blockquote>", LongFieldControl("research"), "</blockquote>"
]
def __init__(self, req):
Display.__init__(self, req)
def make_page(self, page):
page.set_type("research")
page.append("""<h1>%s</h1>""" % self.get_multiple_title())
page.append(self.multiple_database())
def get_multiple_title(self):
return "Faculty Research Interests"
def db_rows(self):
return self.query.count()
def is_multiple(self):
return 1 # always plural
def db_query(self):
# OK, so we sorta hardcode this by listing the grouping named 'Faculty'
q = queries.Select(tables=["groupings", "grouping_priorities", "titles", "people"],
columns={ 'research' : 'people.research',
'login' : 'people.login',
'name' : "concat(people.fname, ' ', people.lname)" },
order="lname, fname, mname",
distinct = 1,
where="""\
research is not NULL and
research != '' and
grouping_priorities.name = 'Faculty' and
grouping_priorities.id = groupings.id and
titles.title LIKE groupings.title and
titles.context LIKE groupings.context and
titles.login = people.login
""")
q.execute()
self.query = q
def db_fetch(self):
self.fields = self.query.fetch()
return self.fields
def new(req):
return FacultyInterestsDisplay(req)