Exemplo n.º 1
0
class WebhookSchema(colander.Schema):
    hook_url = colander.SchemaNode(colander.String(),
                                   widget=widget.TextInputWidget())
    hook_type = colander.SchemaNode(colander.String(),
                                    widget=widget.SelectWidget(values=hooktypes),
                                    validator=colander.OneOf(('discord', 'generic')))
    enabled = colander.SchemaNode(colander.Boolean(),
                                  widget=widget.CheckboxWidget(template="bootstrap"), required=False)
    jumpEvents = colander.SchemaNode(colander.Boolean(),
                                     widget=widget.CheckboxWidget(template="bootstrap"), required=False)
    marketEvents = colander.SchemaNode(colander.Boolean(),
                                       widget=widget.CheckboxWidget(template="bootstrap"), required=False)
    calendarEvents = colander.SchemaNode(colander.Boolean(),
                                         widget=widget.CheckboxWidget(template="bootstrap"), required=False)
    description = colander.SchemaNode(colander.String(),
                                      widget=widget.TextInputWidget(), required=False)
    id = colander.SchemaNode(colander.Integer(),
                             widget=widget.HiddenWidget(),
                             required=False, default=None, missing=colander.drop)
    owner_id = colander.SchemaNode(colander.Integer(),
                                   widget=widget.HiddenWidget(),
                                   required=False, default=None, missing=colander.drop)
    carrier_id = colander.SchemaNode(colander.Integer(),
                                     widget=widget.HiddenWidget(),
                                     required=False, default=None, missing=colander.drop)
Exemplo n.º 2
0
class CarrierSettings(colander.MappingSchema):
    showItinerary = colander.SchemaNode(colander.Boolean(),
                                        widget=widget.CheckboxWidget(template="bootstrap"),
                                        title='Show Itinerary',
                                        description="Show itinerary on public carrier page")
    showMarket = colander.SchemaNode(colander.Boolean(),
                                     widget=widget.CheckboxWidget(template="bootstrap"),
                                     title='Show Market',
                                     description="Show market items on public carrier page")
    showSearch = colander.SchemaNode(colander.Boolean(),
                                     widget=widget.CheckboxWidget(template="bootstrap"),
                                     title="Show on search pages",
                                     description="Show my carrier on Search and Closest pages")
Exemplo n.º 3
0
class DrillOutline(colander.MappingSchema):
    platforms = (('PC', 'PC'), ('XB', 'XBox'), ('PS', 'PS4'))
    channels = (('#drillrats', '#drillrats'), ('#drillrats2', '#drillrats2'),
                ('#drillrats3', '#drillrats3'))
    client_name = colander.SchemaNode(colander.String(),
                                      description="Damsel's CMDR name. (NOT the Drillee's name!)")
    system = colander.SchemaNode(colander.String(),
                                 widget=widget.AutocompleteInputWidget(
                                     values='https://system.api.fuelrats.com/search', min_length=3),
                                 description="Rescue system, i.e where the Damsel is located.")
    platform = colander.SchemaNode(colander.String(),
                                   widget=widget.SelectWidget(values=platforms),
                                   validator=colander.OneOf(('PC', 'XB', 'PS')),
                                   description="Which platform the damsel is on."
                                   )
    o2status = colander.SchemaNode(colander.String(),
                                   widget=widget.CheckboxWidget(true_val="Not OK",
                                                                false_val="OK"),
                                   description="Code Red cases should only be used in Dispatch drills.",
                                   title="Code Red?")
    channel = colander.SchemaNode(colander.String(),
                                  widget=widget.SelectWidget(values=channels),
                                  validator=colander.OneOf(('#drillrats', '#drillrats2', '#drillrats3')),
                                  description="Which channel to send the case to.")
    overseer = colander.SchemaNode(colander.String(),
                                   description="Who is overseeing the drill.")
Exemplo n.º 4
0
 class ScheduleSchema(colander.Schema):
     selectroute = colander.SchemaNode(colander.Integer(),
                                       widget=widget.SelectWidget(values=routechoices),
                                       required=True, title='Select route')
     departure_time = colander.SchemaNode(colander.DateTime(),
                                          widget=widget.DateTimeInputWidget(id='departuretime'),
                                          required=True)
     reverse_route = colander.SchemaNode(colander.Boolean(),
                                         widget=widget.CheckboxWidget(id='reverseroute'), required=True,
                                         default=False)
Exemplo n.º 5
0
class FormSeguirAtv(CSRFSchema):
    """ 
    Formulário para seguir atividade orçamentária/usuário
    """	
    seguir = SchemaNode(
        Boolean(),	
        label='Receber atualizações desta atividade',
        widget=widget.CheckboxWidget(),
        title='Seguir',
        missing=unicode(''),		
    )		
Exemplo n.º 6
0
class FormCadastrar(CSRFSchema):
    """ 
    Formulário para cadastro de novo usuário
    falta acesso para termos e condições de uso
    """
    nome = SchemaNode(
        String(),
        validator=All(
            Length(max=32),
            #Function(verif_nome_unico, u"Nome já cadastrado"),
            Regex("^(\w)*$", "Usar apenas letras, números ou _"),
        ),
        description='Digite seu nome de usuário'
    )
    email = SchemaNode(
        String(),
        validator=deferred_verif_email_unico,
        description='Digite seu e-mail',
        widget=widget.CheckedInputWidget(
            subject='Email',
            confirm_subject='Confirmar e-mail',
            size=40)
	)
    senha = SchemaNode(
        String(),
        validator=Length(min=5, max=32),
        widget=widget.CheckedPasswordWidget(size=20),
        description='Digite sua senha (no mínimo 5 caracteres) e a confirme'
    )
    confirmar = SchemaNode(
        Boolean(),	
        #description='Aceitar termos e condições',
        label='Aceitar termos e condições',
        widget=widget.CheckboxWidget(),
        title='Confirmar',
        validator=Function(lambda x: x, u'É necessário aceitar as condições'),
    )			
Exemplo n.º 7
0
class FormConfigurar(CSRFSchema):
    """
    Formulário para configuração de perfil do usuário
    """
    
    nome = SchemaNode(
        String(),
        validator=All(
            Length(max=32),
            #Function(verif_email_unico, u"Nome já cadastrado"),
            Regex("^(\w)*$", "Usar apenas letras, números ou _"),
        ),
        missing=unicode(''),		
        description='Digite seu nome de usuário'
    )
    sobrenome = SchemaNode(
        String(),
        validator=All(
            Length(max=32),
            #Function(verif_nome_unico, u"Nome já cadastrado"),
        ),
        missing=unicode(''),		
        description='Digite seu sobrenome'
    )	
    genero = SchemaNode(
        String(),
        missing=unicode(''),
        widget=widget.SelectWidget(values=generos),
        title = "Gênero",		
    )	
    nascimento = SchemaNode(
        String(),	
        #máscara não funciona....
		#Date(),
        missing=unicode(''),
        description='Digite a data de nascimento',
		#DateInputWidget não dá erro pelo menos..
        widget= widget.TextInputWidget(mask='99/99/9999')
    )        
    """
    erro	
    foto = SchemaNode(
        deform.FileData(),
        widget=widget.FileUploadWidget(tmpstore),
        missing=unicode(''),		
        description='Carregar foto'
    ) 
    """		
    rua = SchemaNode(
        String(),
        missing=unicode(''),		
        description='Digite sua rua')
    bairro = SchemaNode(
        String(),
        missing=unicode(''),		
        description='Digite seu bairro')
    cidade = SchemaNode(
        String(),
        missing=unicode(''),		
        description='Digite sua cidade')
    estado = SchemaNode(
        String(),
        missing=unicode(''),
        widget=widget.SelectWidget(values=estados))		
    informacoes = SchemaNode(
        String(),
        missing=unicode(''),		
        description='Digite informações sobre você',
        title='Informações',
        validator=Length(max=100),
        widget=widget.TextAreaWidget(rows=10, cols=60)
    )		
    senha = SchemaNode(
        String(),
        missing=unicode(''),		
        validator=Length(min=5, max=32),
        widget=widget.CheckedPasswordWidget(size=20),
        description='Alterar sua senha (no mínimo 5 caracteres) e a confirme'
    )

    notificacoes_site = SchemaNode(
        Boolean(),	
        label='Receber notificações pelo site',
        widget=widget.CheckboxWidget(),
        title='Notificações',
        missing=unicode(''),		
    )	
    notificacoes_email = SchemaNode(
        Boolean(),	
        label='Receber notificações pelo email',
        widget=widget.CheckboxWidget(),
        title='Notificações',
        missing=unicode(''),		
    )	
    atualizacoes_pontos = SchemaNode(
        Boolean(),	
        label='Atualizações de pontos próximos ao endereço cadastrado',
        widget=widget.CheckboxWidget(),
        title='Atualização',
        missing=unicode(''),		
    )	
    atualizacoes_eventos = SchemaNode(
        Boolean(),	
        label='Eventos próximos ao endereço cadastrado',
        widget=widget.CheckboxWidget(),
        title='Atualização',
        missing=unicode(''),		
    )	
Exemplo n.º 8
0
class AddAccountSchema(colander.Schema):
    """

    """
    # couTimestamp
    cou = colander.SchemaNode(
        colander.Boolean(),
        title='Security and Acceptable Use Policy Acceptance',
        description='Terms and Conditions Agreement - Check this if '
        'you have read and agree to abide by the Center\'s '
        'Security and Acceptable Use Policies.',
        widget=widget.CheckboxWidget(),
        validator=cou_validator,
        oid='cou')

    #   storTimestamp
    stor = colander.SchemaNode(
        colander.Boolean(),
        title='Data Security Policy Acceptance',
        description='Check this if you have read and agree '
        'to the Center\'s storage policies.',
        widget=deform.widget.CheckboxWidget(),
        validator=stor_validator,
        oid='stor')
    #   cybeTimestamp
    # cyber = colander.SchemaNode(
    #     colander.Boolean(),
    #     title='Cyber Security Policy Acceptance',
    #     description='Check this if you have read and agree to abide by '
    #                 'the Center\'s Cyber Security policies.',
    #     widget=deform.widget.CheckboxWidget(),
    #     validator=cyber_validator,
    #     oid='cyber'
    # )

    # titlePrefix = colander.SchemaNode(
    #     colander.String(),
    #     title='Honorary',
    #     description='If you prefer to use n honorary, enter it here.',
    #     # validator=colander.ContainsOnly([x[0] for x in title_prefixes]),
    #     #validator=colander.Length(min=1, max=64),
    #     widget=widget.TextInputWidget(placeholder="Dr., Mr., Ms., etc."),
    #     missing=unicode(''),
    #     oid='titlePrefix'
    # )

    givenName = colander.SchemaNode(
        colander.String(),
        title='Given/First name',
        description='Your given or first name',
        validator=colander.Length(min=1, max=64),
        widget=widget.TextInputWidget(placeholder=''),
        oid='givenName')

    middleName = colander.SchemaNode(
        colander.String(),
        title='Middle name/initial',
        description='Middle name or initial',
        validator=colander.Length(min=0, max=64),
        widget=widget.TextInputWidget(placeholder=''),
        missing=unicode(''),
        oid='middleName')

    sn = colander.SchemaNode(colander.String(),
                             title='Family/Last Name',
                             description='family Name / Last Name',
                             validator=colander.Length(min=1, max=64),
                             widget=widget.TextInputWidget(placeholder=''),
                             oid='sn')

    suffix = colander.SchemaNode(
        colander.String(),
        title='Suffix',
        description='(Sr. Jr. IV, etc.)',
        validator=colander.Length(min=0, max=32),
        widget=widget.TextInputWidget(placeholder='example: III, PhD, etc.'),
        missing=unicode(''),
        oid='suffix')

    cn = colander.SchemaNode(
        colander.String(),
        title='Common or Nick Name',
        description='Your full name. How you want to be addressed.',
        validator=colander.Length(min=3, max=64),
        widget=widget.TextInputWidget(
            placeholder='(Optional) How you want to be addressed '
            'if different from: FirstName LastName'),
        missing=unicode(''),
        oid='cn')

    street = colander.SchemaNode(
        colander.String(),
        title='Street Address',
        description='',
        validator=colander.Length(min=0, max=200),
        widget=widget.TextInputWidget(
            placeholder='business/institution address'),
        oid='street')

    lcity = colander.SchemaNode(colander.String(),
                                title='City',
                                description='',
                                validator=colander.Length(min=1, max=128),
                                widget=widget.TextInputWidget(),
                                oid='lcity')

    st = colander.SchemaNode(colander.String(),
                             title='State/Province',
                             description='',
                             validator=colander.Length(min=1, max=128),
                             widget=widget.TextInputWidget(),
                             oid='l')

    postalCode = colander.SchemaNode(colander.String(),
                                     title='Post/ZIP Code',
                                     description='',
                                     validator=colander.Length(min=2, max=64),
                                     widget=widget.TextInputWidget(),
                                     oid='postalCode')

    country = colander.SchemaNode(
        colander.String(),
        title='Country',
        description='',
        widget=widget.SelectWidget(values=country_codes),
        #validator=colander.OneOf([x[0] for x in country_codes]),
        validator=valid_country,
        oid='country')

    mail = colander.SchemaNode(
        colander.String(),
        title='EMail',
        description='Your primary email account',
        # validator=colander.Email(msg="Please provide your work Email address. This will be the primary account we use to contact you."),
        widget=email_confirm_widget,
        oid='mail')

    # mailPreferred = colander.SchemaNode(
    #     colander.String(),
    #     title='Preferred EMail',
    #     description='optional preferred email account',
    #     missing=unicode(''),
    #     widget=pref_email_confirm_widget,
    #     oid='mail'
    # )

    phone = colander.SchemaNode(
        colander.String(),
        title='Phone number',
        description='Please provide your primary telephone number',
        validator=phone_validator,
        widget=widget.TextInputWidget(),
        oid='phone')

    cell = colander.SchemaNode(
        colander.String(),
        title='Cell phone number',
        description='For contact and verification',
        validator=phone_validator,
        missing=unicode(''),
        widget=widget.TextInputWidget(
            placeholder='(Optional) example: +1-000-000-0000'),
        oid='cell')

    employerType = colander.SchemaNode(
        colander.String(),
        validator=colander.OneOf([x[0] for x in employer_types]),
        widget=deform.widget.RadioChoiceWidget(values=employer_types),
        title='Employer Type',
        description='Select the employer type from the list below that '
        'is most appropriate to your request',
        oid="employerType")

    employerName = colander.SchemaNode(
        colander.String(),
        title='Employer, Institution, or Sponsor Name',
        description='Please provide the name of your employer or '
        'the institution you represent',
        validator=colander.Length(min=3, max=128),
        widget=widget.TextInputWidget(placeholder='employer name here'),
        oid='employerName')

    citizenStatus = colander.SchemaNode(
        colander.String(),
        title='Citizenship Status',
        description='Select one of the following options '
        'that best describes your U.S. citizenship status',
        validator=colander.OneOf([x[0] for x in citizen_types]),
        widget=widget.RadioChoiceWidget(values=citizen_types),
        oid='citizenStatus')

    citizenships = colander.SchemaNode(
        colander.Set(),
        title='Citizenships',
        description='Please select your country or countries of citizenship',
        validator=valid_countries,
        widget=widget.Select2Widget(values=country_codes, multiple=True),
        oid='citizenships',
    )

    #   birthCountry
    birthCountry = colander.SchemaNode(
        colander.String(),
        title='Country of birth',
        description='Please enter/select your country of birth',
        validator=valid_country,
        widget=widget.Select2Widget(values=country_codes),
        oid='birthCountry',
    )

    isnreluser = colander.SchemaNode(
        colander.String(),
        title='Existing NREL Account?',
        description="Select the option that is most true for you.",
        widget=deform.widget.RadioChoiceWidget(values=has_account),
        missing=unicode(''),
        label='Existing or Previous ESIF HPC UserID',
        oid='isnreluser')

    nrelUserID = colander.SchemaNode(
        colander.String(),
        title='Your Existing NREL HPC UserID',
        description='If you have --or previously had-- an NREL UserID, '
        'enter it here.',
        validator=colander.Length(min=1, max=16),
        widget=widget.TextInputWidget(placeholder='example: jsmythe'),
        missing=unicode(''),
        oid='nrelUserID')

    justification = colander.SchemaNode(
        colander.String(),
        title='NREL HPC User Credential Information',
        widget=widget.TextAreaWidget(rows=6, columns=60),
        missing=unicode(''),
        validator=colander.Length(max=1000),
        description="If you don't have an account on NREL HPC systems, "
        "we need some additional information. Please provide "
        "the project handles or titles of the project allocations "
        "you are associated with. "
        "If you don't have an allocation, please tell us "
        "why you are requesting NREL HPC login credentials.",
        oid='comments')

    preferredUID = colander.SchemaNode(
        colander.String(),
        title='*New* ESIF HPC UserID',
        description="Please provide your desired User ID here.<sup>1</sup>"
        "(3 to 16 characters, all lower case.)",
        validator=colander.Length(min=3, max=16),
        widget=widget.TextInputWidget(placeholder="example: jsmythe"),
        missing=unicode(''),
        oid='preferredUID')

    comments = colander.SchemaNode(
        colander.String(),
        title='Additional Notes or Comments',
        widget=deform.widget.TextAreaWidget(
            rows=6,
            columns=60,
            placeholder='If you think we need any additional '
            'information to process or approve your request, '
            'please let us know (project name, PI, NREL contact, etc.).'),
        missing=unicode(''),
        validator=colander.Length(max=1000),
        description='If you think we need any additional '
        'information to process or approve your request, '
        'please let us know.',
        oid='comments')