class TripleToggle(Toggle): def __init__(self, lname, llabel, mname, mlabel, rname, rlabel): Toggle.__init__(self, lname, llabel) self.mtoggle = Toggle(mname, mlabel) self.rtoggle = Toggle(rname, rlabel) def _input(self, info): left_toggle = Toggle._input(self, info) middle_label = self.mtoggle._label(info) middle_toggle = self.mtoggle._input(info) right_label = self.rtoggle._label(info) right_toggle = self.rtoggle._input(info) return ('<table><tr><td style="padding-left: 0px;">' + left_toggle + '<td style="padding-left: 2em;">%s</td><td>%s</td>' % (middle_label, middle_toggle) + '<td style="padding-left: 2em;">%s</td><td>%s</td>' % (right_label, right_toggle) + '</td></tr></table>')
def _input(self, info): left_toggle = Toggle._input(self, info) middle_label = self.mtoggle._label(info) middle_toggle = self.mtoggle._input(info) right_label = self.rtoggle._label(info) right_toggle = self.rtoggle._input(info) return ('<table><tr><td style="padding-left: 0px;">' + left_toggle + '<td style="padding-left: 2em;">%s</td><td>%s</td>' % (middle_label, middle_toggle) + '<td style="padding-left: 2em;">%s</td><td>%s</td>' % (right_label, right_toggle) + '</td></tr></table>')
def __init__(self, past=False): SemSearchArray.__init__(self) speaker = TextBox( name="speaker", label="Speaker", width=textwidth, extra=['style="width:300px; margin-right:64px;"'], ) affiliation = TextBox( name="affiliation", label="Affiliation", width=textwidth, ) date = TextBox( name="daterange", id="daterange", label="Date", example=datetime.now(current_user.tz).strftime("%B %d, %Y -"), example_value=True, example_span=False, width=textwidth, extra=['autocomplete="off"'], ) time = TextBox( name="timerange", label="Time", example="8:00 - 18:00", example_span=False, width=textwidth, ) livestream_available = Toggle("access", "Livestream available") videoslidespaper = TripleToggle("video", "Has video", "slides", "slides", "paper", "paper") self.array = [ [self.institution, self.audience], [speaker, videoslidespaper if past else self.recent], [affiliation] if past else [affiliation, livestream_available], [date, time], ]
def __init__(self, lname, llabel, mname, mlabel, rname, rlabel): Toggle.__init__(self, lname, llabel) self.mtoggle = Toggle(mname, mlabel) self.rtoggle = Toggle(rname, rlabel)
def __init__(self, past=False): ## pick institution where it is held institution = SelectBox( name="institution", label="Institution", options=[("", ""), ("None", "No institution",),] + [(elt["shortname"], elt["name"]) for elt in institutions_shortnames()], width=textwidth+10, # select boxes need 10px more than text areas ) venue = SelectBox( name="venue", label=static_knowl("venue"), options=[("", ""), ("online", "online"), ("in-person", "in-person") ] ) assert venue speaker = TextBox( name="speaker", label="Speaker", width=textwidth, extra=['style="width:300px; margin-right:64px;"'], ) affiliation = TextBox( name="affiliation", label="Affiliation", width=textwidth, ) date = TextBox( name="daterange", id="daterange", label="Date", example=datetime.now(current_user.tz).strftime("%B %d, %Y -"), example_value=True, example_span=False, width=textwidth, extra=['autocomplete="off"'], ) time = TextBox( name="timerange", label="Time", example="8:00 - 18:00", example_span=False, width=textwidth, ) recent = ComboBox( name="recent", label="Edited within", spantext="hours", spanextras=' style="margin-left:5px;"', example="168", example_span=False, width=50, ) video = Toggle(name="video", label="Has video") self.array = [ [institution, video if past else recent], [speaker, affiliation], [date, time], ]
def __init__(self): ## subjects subject = SelectBox(name="seminar_subject", label="Subject", options=[("", "")] + subject_pairs()) ## topics topic = SelectBox(name="talk_topic", label="Topic", options=[("", "")] + user_topics()) ## pick institution where it is held institution = SelectBox( name="talk_institution", label="Institution", options=[ ("", ""), ( "None", "No institution", ), ] + [(elt["shortname"], elt["name"]) for elt in institutions_shortnames()], ) venue = SelectBox(name="talk_venue", label=static_knowl("venue"), options=[("", ""), ("online", "online"), ("in-person", "in-person")]) assert venue ## keywords for seminar or talk keywords = TextBox( name="talk_keywords", label="Anywhere", colspan=(1, 2, 1), width=textwidth, ) ## type of access access = SelectBox( name="talk_access", label="Access", options=[ ("", ""), ("open", "Any visitor can view link"), ("users", "Any logged-in user can view link"), ], ) ## number of results to display # count = TextBox(name="talk_count", label="Results to display", example=50, example_value=True) speaker = TextBox( name="speaker", label="Speaker", colspan=(1, 2, 1), width=textwidth, ) affiliation = TextBox( name="affiliation", label="Affiliation", colspan=(1, 2, 1), width=160 * 2 - 1 * 20, ) title = TextBox( name="title", label="Title", colspan=(1, 2, 1), width=textwidth, ) date = TextBox( name="daterange", id="daterange", label="Date", example=datetime.now(current_user.tz).strftime("%B %d, %Y -"), example_value=True, colspan=(1, 2, 1), width=160 * 2 - 1 * 20, ) lang_dict = languages_dict() language = SelectBox( name="talk_language", label="Language", options=[("", ""), ("en", "English")] + [(code, lang_dict[code]) for code in sorted(db.talks.distinct("language")) if code != "en"], ) video = Toggle(name="video", label="Has video") self.array = [[subject, keywords], [topic, title], [institution, speaker], [language, affiliation], [access, date], [video] # [venue], # [count], ]