コード例 #1
0
ファイル: main.py プロジェクト: tornaria/seminars
    def __init__(self, conference=False, 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

        organizer = TextBox(
            name="organizer",
            label="Organizer",
            width=textwidth,
        )
        date = TextBox(
            name="daterange",
            id="daterange",
            label="Date",
            example=datetime.now(current_user.tz).strftime("%B %d, %Y -"),
            example_value=True,
            width=textwidth,
            extra=['autocomplete="off"'],
        )
        self.array = [
            [institution],
            [organizer],
        ]
        if conference:
            self.array.append([date])

        assert conference in [True, False]
        self.conference = conference
コード例 #2
0
    def __init__(self):
        self.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
        )
        self.venue = SelectBox(name="venue",
                               label=static_knowl("venue"),
                               options=[("", ""), ("online", "online"),
                                        ("in-person", "in-person")])

        self.recent = ComboBox(
            name="recent",
            label="Edited within",
            spantext="hours",
            spanextras=' style="margin-left:5px;"',
            example="168",
            example_span=False,
            width=50,
        )
        self.audience = SelectBox(
            name="audience",
            label="Audience",
            width=textwidth +
            10,  # select boxes need 10px more than text areas
            options=[("", "")] +
            [(str(code), desc)
             for (code, desc) in audience_options if code <= DEFAULT_AUDIENCE],
        )
コード例 #3
0
ファイル: main.py プロジェクト: akhayoon/seminars
    def __init__(self):
        ## subjects
        subject = SelectBox(name="seminar_subject",
                            label="Subject",
                            options=[("", "")] + subject_pairs())
        ## topics
        topic = SelectBox(name="seminar_topic",
                          label="Topic",
                          options=[("", "")] + user_topics())

        ## pick institution where it is held
        institution = SelectBox(
            name="seminar_institution",
            label="Institution",
            options=[
                ("", ""),
                (
                    "None",
                    "No institution",
                ),
            ] + [(elt["shortname"], elt["name"])
                 for elt in institutions_shortnames()],
        )

        venue = SelectBox(name="seminar_venue",
                          label=static_knowl("venue"),
                          options=[("", ""), ("online", "online"),
                                   ("in-person", "in-person")])
        assert venue

        ## keywords for seminar or talk
        keywords = TextBox(
            name="seminar_keywords",
            label="Anywhere",
            width=textwidth,
        )
        ## type of access
        access = SelectBox(
            name="seminar_access",
            label="Access",
            options=[
                ("", ""),
                ("open", "Any visitor can view link"),
                ("users", "Any logged-in user can view link"),
            ],
        )
        lang_dict = languages_dict()
        language = SelectBox(
            name="seminar_language",
            label="Language",
            options=[("", ""), ("en", "English")] +
            [(code, lang_dict[code])
             for code in sorted(db.talks.distinct("language"))
             if code != "en"],
        )
        ## number of results to display
        # count = TextBox(name="seminar_count", label="Results to display", example=50, example_value=True)

        name = TextBox(
            name="name",
            label="Name",
            width=textwidth,
            example="Thule topology colloquium series",
        )

        self.array = [
            [subject, keywords],
            [topic, name],
            [institution, access],
            [language],
            # [venue],
            # [count],
        ]
コード例 #4
0
ファイル: main.py プロジェクト: tornaria/seminars
    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],
        ]
コード例 #5
0
ファイル: main.py プロジェクト: akhayoon/seminars
    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],
                      ]