fields = ['college', 'field', 'title', 'year']
class Contact (AttributeHolder):
- fields = ['office', 'email', 'website', 'phone', 'lab', 'lab_phone']
+ fields = ['office', 'email', 'website', 'groupsite',
+ 'phone', 'lab', 'lab_phone']
class Bio (AttributeHolder):
- fields = ['specialization', 'publications', 'profile', 'cv']
+ fields = ['category', 'specialization', 'publications', 'profile', 'cv']
class Professor (AttributeHolder):
fields = ['name', 'title', 'graduations', 'contact', 'bio']
if m in degrees:
degrees.remove(m)
return '|'.join(degrees)
+
+ def colleges(self):
+ titles = self.degrees().split('|')
+ return '|'.join([g.college for g in self.graduations
+ if g.title in titles])
+
+ def program(self):
+ "Sub-field(s)"
+ if self.contact.group_site == None:
+ return 'Physics'
+ #TODO: group to sub-field logic
+
+ def sites(self):
+ if self.contact.groupsite == None:
+ return ('<a href="%s">%s</a>'
+ % (self.contact.website, self.contact.website))
+ return ('Group Website: <a href="%s">%s</a>|Personal Website: <a href="%s">%s</a>'
+ % (self.contact.groupsite, self.contact.groupsite,
+ self.contact.website, self.contact.website))
+
+ def lab_contact(self):
+ "Lab Name, Lab Phone"
+ if self.contact.lab != None:
+ assert self.contact.lab_phone != None, unicode(self.name)
+ return '%s, %s' % (self.contact.lab, self.contact.lab_phone)
+ assert self.contact.lab_phone == None, unicode(self.name)
+ return None
)
p.title = prof['position']
if prof['position1'] != None:
- p.title += ', %s' % prof['position1']
+ p.title += '|%s' % prof['position1']
p.graduations = []
degrees = []
if prof['degrees'] != None:
office=prof['office'],
email=prof['email'],
website=prof['personalpage'],
+ groupsite=prof['grouppage'],
phone=prof['phone'],
lab=prof['lab'],
lab_phone=prof['labphone'],
)
p.bio = Bio(
- specialization=prof['research'], # prof['grouppage']
+ role=prof['category'],
+ specialization=prof['research'],
publications=None,
profile=prof['profile'],
cv=None,
self.s.expand_nav_section('facultyDirectory')
def __call__(self, prof):
- self.create_prof_page(prof)
- TODO
-
- def create_prof_page(self, prof):
name = '%s %s' % (prof.name.first_middle, prof.name.last)
+ self.create_prof_page(name)
+ self.lock_section()
+ settings = [
+ ('Degrees:', prof.degrees()),
+ ('College:', prof.colleges()),
+ ('Program:', prof.program()),
+ ('Office:', prof.contact.office),
+ ('Specialization:', prof.bio.specialization),
+ ('Research Interests:', ''),
+ ('Personal Site:', prof.sites()),
+ ('Title:', prof.title),
+ ('First Name:', prof.name.first_middle),
+ ('Last Name:', prof.name.last),
+ ('Bio:', '<p>\n%s\n%</p>'+prof.bio.profile.replace(
+ '\n', '\n</p>\n<p>\n')),
+ ('Headshot:', ('/Images/physics/headshots/%s'
+ % name.lower().replace('.','').replace(' ','_'))),
+ ('Email:', prof.contact.email),
+ ('Phone:', prof.contact.phone),
+ ('Fax:', prof.lab_contact()),
+ ('Page Title - This shows in the tab and title bar of the brower -- Google rates it highly:', name),
+ ("Menu Title - This shows in the menus and navigation blocks -- it's usually a shorted version of the page title:", name),
+ ("Breadcrumb Title - This shows in the breadcrumb trail -- it's usually a very short version of the page title:", name),
+ ("See Also title - Other items that refer to this one will use this text:", name),
+ ]
+ for field_name,value in settings:
+ if value == None:
+ value = ''
+ granddad,field = s.find_field(field_name)
+ field.clear()
+ field.send_keys(value)
+ #granddad,field = s.find_field('Headshot:')
+ #granddad.find_element_by_link_text('Properties')
+ # TODO, set width/height
+ s.publish_section('Added/updated Prof. %s' % prof.name.last)
+
+ def create_prof_page(self, name):
self.s.open_nav_section(name)
return
self.s.open_nav_section('Copy of Shyamalendu Bose')
% (popup, current_window))
self.s.open_nav_section(name)
+ def lock_section(self):
+ try:
+ self.s.lock_section()
+ except NoSuchElementException, e:
+ self.s.logger.info("can't lock %s (already locked?), skipping" % raw_name)
+
def main(argv):
import optparse