class fields(WidgetsList): name = HiddenField() slug = HiddenField() parent_id = HiddenField() delete = SubmitButton( default=N_('Delete'), css_classes=['btn', 'table-row', 'delete', 'btn-inline-delete'])
class fields(WidgetsList): came_from = HiddenField(validator=NotEmpty) associableid = HiddenField(validator=NotEmpty) name = TextField(label_text=l_('Name'), size=TF_SIZE, validator=All(UnicodeString, NotEmpty, MaxLength(255))) email = TextField(label_text=l_('E-Mail'), size=TF_SIZE, validator=All(Email, NotEmpty)) text = TextArea(label_text=l_('Text'), rows=TA_ROWS, cols=TA_COLS)
class fields(WidgetsList): # TODO: handle format with babel localization publish_on = HiddenField(validator=DateTimeConverter( format='%b %d %Y @ %H:%M')) publish_until = HiddenField(validator=DateTimeConverter( format='%b %d %Y @ %H:%M')) status = HiddenField(validator=None) update_button = SubmitButton()
class fields(WidgetsList): _method = HiddenField(default='DELETE', validator=None) mediaid = HiddenField(validator=NotEmpty) id_ = TextField(size=TF_SIZE, validator=None, disabled=True) mediatype_ = TextField(label_text=l_('Type'), size=TF_SIZE, validator=None, disabled=True) uri_ = TextField(label_text='URI', size=TF_SIZE, validator=None, disabled=True)
class fields(WidgetsList): _method = HiddenField(default='PUT', validator=None) articleid = HiddenField(validator=NotEmpty) id_ = TextField(size=TF_SIZE, validator=None, disabled=True) title_ = TextField(label_text=l_('Title'), size=TF_SIZE, validator=None, disabled=True) categoryid = SingleSelectField(label_text=l_('Category'), size=SF_SIZE) tagids = TextField(label_text=l_('Tags'), size=TF_SIZE, attrs=dict(title=l_('Comma separated list of tags')))
class fields(WidgetsList): _method = HiddenField(default='PUT', validator=None) tagid = HiddenField(validator=NotEmpty) id_ = TextField(size=TF_SIZE, validator=None, disabled=True) languageid = CascadingSingleSelectField(label_text=l_('Language'), size=SF_SIZE, cascadeurl=tg.url('/tag/translation'), extra=['tagid']) name = TextField(label_text=l_('Name'), size=TF_SIZE, validator=All(UnicodeString, NotEmpty, MaxLength(255)))
class fields(WidgetsList): _method = HiddenField(default='PUT', validator=None) categoryid = HiddenField(validator=NotEmpty) id_ = TextField(size=TF_SIZE, validator=None, disabled=True) languageid = CascadingSingleSelectField(label_text=l_('Language'), size=SF_SIZE, cascadeurl=tg.url('/category/translation'), extra=['categoryid']) name = TextField(label_text=l_('Name'), size=TF_SIZE, validator=All(UnicodeString, NotEmpty, MaxLength(50))) description = TextArea(label_text=l_('Description'), rows=TA_ROWS, cols=TA_COLS)
def __create_hidden_fields(self): fields = {} fields['sprox_id'] = HiddenField(id='sprox_id') for field in self.__hide_fields__: if field not in self.__omit_fields__: args = {} if field in self.__field_widget_args__: args.update(self.__field_widget_args__[field]) fields[field] = HiddenField(id=field, identifier=field, **args) return fields
class TipoDeItemForm(TableForm): fields = [ HiddenField('idFase', label_text='idFase'), Spacer(), TextField('nombre', label_text='Nombre'), Spacer(), TextField('descripcion', label_text='Descripcion'), HiddenField('id') ] submit_text = 'Crear TipoDeItem'
class fields(WidgetsList): _method = HiddenField(default='DELETE', validator=None) commentid = HiddenField(validator=NotEmpty) id_ = TextField(size=TF_SIZE, validator=None, disabled=True) date_ = TextField(label_text=l_('Date'), size=TF_SIZE, validator=None, disabled=True) to_ = TextField(label_text=l_('To'), size=TF_SIZE, validator=None, disabled=True) name_ = TextField(label_text=l_('Name'), size=TF_SIZE, validator=None, disabled=True) text_ = TextArea(label_text=l_('Text'), rows=TA_ROWS, cols=TA_COLS, validator=None, disabled=True)
class TagRowForm(Form): template = 'admin/tags/row-form.html' id = None submit_text = None params = ['tag'] event = events.Admin.TagRowForm fields = [ HiddenField('name'), HiddenField('slug'), SubmitButton('delete', default=N_('Delete'), css_classes=['btn', 'table-row', 'delete', 'btn-inline-delete']), ]
class fields(WidgetsList): _method = HiddenField(default='PUT', validator=None) commentid = HiddenField(validator=NotEmpty) id_ = TextField(size=TF_SIZE, validator=None, disabled=True) date_ = TextField(label_text=l_('Date'), size=TF_SIZE, validator=None, disabled=True) to_ = TextField(label_text=l_('To'), size=TF_SIZE, validator=None, disabled=True) name = TextField(label_text=l_('Name'), size=TF_SIZE, validator=All(UnicodeString, NotEmpty, MaxLength(255))) email = TextField(label_text=l_('E-Mail'), size=TF_SIZE, validator=All(Email, NotEmpty)) text = TextArea(label_text=l_('Text'), rows=TA_ROWS, cols=TA_COLS)
class fields(WidgetsList): n_theme = HiddenField(name='name', default='theme') v_theme = SingleSelectField(label_text=l_('Theme'), name='value', size=SF_SIZE) n_title = HiddenField(name='name', default='title') v_title = TextField(label_text=l_('Site Title'), name='value', size=TF_SIZE) n_copyright = HiddenField(name='name', default='copyright') v_copyright = TextField(label_text=l_('Copyright Notice'), name='value', size=TF_SIZE) n_cc = HiddenField(name='name', default='cc') v_cc = SingleSelectField(label_text=l_('Creative Commons License'), name='value', size=SF_SIZE) spacer1 = Spacer(label_text='') n_logo_media = HiddenField(name='name', default='logo_media') v_logo_media = SingleSelectField(label_text=l_('Logo Media'), name='value', size=SF_SIZE) n_banner_media = HiddenField(name='name', default='banner_media') v_banner_media = SingleSelectField(label_text=l_('Banner Media'), name='value', size=SF_SIZE) n_banner_link = HiddenField(name='name', default='banner_link') v_banner_link = SingleSelectField(label_text=l_('Banner Link'), name='value', size=SF_SIZE) spacer2 = Spacer(label_text='') n_max_results = HiddenField(name='name', default='max_results') v_max_results = TextField(label_text=l_('Max results per page'), name='value', size=TN_SIZE)
class fields(WidgetsList): _method = HiddenField(default='PUT', validator=None) pageid = HiddenField(validator=NotEmpty) id_ = TextField(size=TF_SIZE, validator=None, disabled=True) languageid = CascadingSingleSelectField(label_text=l_('Language'), size=SF_SIZE, cascadeurl=tg.url('/page/translation'), extra=['pageid']) version = CascadingSingleSelectField(label_text=l_('Version'), size=SF_SIZE, cascadeurl=tg.url('/page/version'), extra=['pageid', 'languageid']) modified = TextField(disabled=True, label_text=l_('Last Modified'), validator=None) name = TextField(label_text=l_('Name'), size=TF_SIZE, validator=All(UnicodeString, NotEmpty, MaxLength(255))) text = TextArea(label_text=l_('Text'), rows=TA_ROWS, cols=TA_COLS)
class UserProyForm(TableForm): fases_options = [] usuarios_options = [] permisos_options = [(4, u'ver_item'), (5, u'crear_item'), (6, u'editar_item'),\ (7, u'borrar_item'), (8, u'revertir_item'), (9, u'revivir_item'),\ (10, u'abm_adjuntos'), (11, u'aprobar_item'), (12, u'crear_relaciones'),\ (13, u'crear_linea_base'), (14, u'abrir_linea_base')] #user_options = [x for x in (DBSession.query(User.user_id, User.user_name))] #permisos_options = [x for x in enumerate (("aprobar", "leer", "escribir"))] fields = [ HiddenField('idProyecto', label_text='IdProyecto'), Spacer(), SingleSelectField('idFase', options=fases_options, label_text='Fase'), Spacer(), SingleSelectField('iduser', options=usuarios_options, label_text='Usuario'), Spacer(), CheckBoxList('idPermiso', options=permisos_options, label_text='Permisos'), Spacer() ] submit_text = 'Agregar Usuario'
class TipoDeItemEditForm(EditableForm): __model__ = TipoDeItem __field_widgets__ = { 'nombre': HiddenField('nombre', label_text='Nombre'), 'descripcion': TextField('descripcion', label_text='Descripcion'), } __omit_fields__ = ['id', 'idFase', 'nrogeneracion']
class ItemForm(TableForm): #class ItemForm(DojoAddRecordForm): #__model__ = Item #__omit_fields__ = ['id','idTipoDeItem','idFase','idLineaBase','version', 'nrohistorial','ultimaversion', 'estado'] tiid = 0 #campotipo= DBSession.query(Campos.tipoDeDato, Campos.nombre).filter_by(idTipoDeItem=13).all() comlejidadoptions = [(1, 'Muy Baja (1)'), (2, 'Baja (2)'), (3, 'Media (3)'), (4, 'Alta (4)'), (5, 'Muy Alta (5)')] #campo_options=[] #campotipo=campo_options __require_fields__ = ['nombre'] fields = [ TextField('nombre', label_text='Nombre', disabled=True), Spacer(), HiddenField('idFase', label_text='idFase'), HiddenField('version', label_text='version'), HiddenField('estado', label_text='estado'), SingleSelectField('complejidad', options=comlejidadoptions, label_text='Complejidad'), Spacer(), #CalendarDatePicker('fechaCreacion', date_format='%d-%m-%y'), #Spacer(), HiddenField('nrohistorial', label_text='nrohistorial'), #SingleSelectField('idTipoDeItem', options=tipo_options), HiddenField('idTipoDeItem', label_text='idTipoDeItem'), ] #log.debug(campotipo) """ for ct in campotipo: #log.debug(ct[1]) campo1 = TextField(ct[1], label_text= ct[1]) fields.append(campo1) """ submit_text = 'Crear Item'
class fields(WidgetsList): _method = HiddenField(default='PUT', validator=None) linkid = HiddenField(validator=NotEmpty) id_ = TextField(size=TF_SIZE, validator=None, disabled=True) uri = TextField(label_text='URI', size=TF_SIZE, validator=All(UnicodeString, NotEmpty, MaxLength(255))) languageid = CascadingSingleSelectField(label_text=l_('Language'), size=SF_SIZE, cascadeurl=tg.url('/link/translation'), extra=['linkid']) version = CascadingSingleSelectField(label_text=l_('Version'), size=SF_SIZE, cascadeurl=tg.url('/link/version'), extra=['linkid', 'languageid']) modified = TextField(disabled=True, label_text=l_('Last Modified'), validator=None) name = TextField(label_text=l_('Name'), size=TF_SIZE, validator=All(UnicodeString, NotEmpty, MaxLength(255))) description = TextArea(label_text=l_('Description'), rows=TA_ROWS, cols=TA_COLS) tagids = TextField(label_text=l_('Tags'), size=TF_SIZE, attrs=dict(title=l_('Comma separated list of tags')))
class DetalleItemForm(TableForm): #action = 'CrearFase' #genre_options = [x for x in (DBSession.query(TipoDeItem.id, TipoDeItem.nombre))] atributos_options = [] fields = [ #SingleSelectField('idTipoDeItem', options=genre_options), HiddenField('tipo', label_text='Tipo de Dato'), Spacer(), SingleSelectField('nombrecampo', options=atributos_options, label_text='Atributo'), TextField('valor', label_text='valor'), Spacer(), HiddenField('iditem', label_text='iditem'), ] submit_text = 'Crear DetalleItem'
class CamposForm(TableForm): tipo_options = [x for x in (('string', 'integer', 'date'))] fields = [ TextField('nombre', label_text='Nombre'), HiddenField('idTipoDeItem', label_text='Tipo de Item'), Spacer(), SingleSelectField('tipoDeDato', options=tipo_options, label_text='Tipo de Dato'), ] submit_text = 'Crear Atributo'
class FaseForm(TableForm): #action = 'CrearFase' fields = [ TextField('nombre', label_text='Nombre'), Spacer(), TextField('descripcion', label_text='Descripcion'), Spacer(), HiddenField('idproyec', label_text='idproyec') ] submit_text = 'Crear Fase'
class ImportarTipoDeItemForm(TableForm): importar_options=[] fields = [ HiddenField('fid', label_text='fid'), CheckBoxList('TiposDeItemImportar', options=importar_options), ] submit_text = 'Importar'
class RelacionItemForm(TableForm): #action = 'CrearRelacionItem' anterior_options = [] actual_options = [] fields = [ HiddenField('idItem1', label_text='Item'), CheckBoxList('idItem2Anterior', options=anterior_options, label_text='Fase anterior'), CheckBoxList('idItem2', options=actual_options, label_text='Fase actual') ] submit_text = 'Crear Relacion Item'
def _do_get_field_widgets(self, fields): metadata_keys = self.__metadata__.keys() widgets = {} for field_name in fields: if field_name in self.__field_widgets__: widgets[field_name] = self.__field_widgets__[field_name] continue if field_name in self.__add_fields__: widget = self.__add_fields__[field_name] if widget is None: widget = Widget(field_name) widgets[field_name] = widget continue if field_name in self.__ignore_field_names__: continue if field_name in self.__hide_fields__: continue if field_name not in metadata_keys: continue field = self.__metadata__[field_name] if inspect.isclass(field): identifier = ClassViewer(field) field_widget_type = self.__field_widget_types__.get( field_name, self.__widget_selector__.select(field)) field_widget_args = self._do_get_field_widget_args( field_name, field) if field_name in self._do_get_disabled_fields(): # in this case, we display the current field, disabling it, and also add # a hidden field into th emix field_widget_args['disabled'] = True widgets[field_name] = (HiddenField(id=field_name.replace( '.', '_'), identifier=field_name), field_widget_type(**field_widget_args)) else: widgets[field_name] = field_widget_type(**field_widget_args) widgets.update(self.__create_hidden_fields()) return widgets
class LineaBaseForm(TableForm): #action = 'CrearLineaBase' #genre_options = [x for x in (DBSession.query(Group).filter_by(group_name="lider").one()).users] #item_options = [] items_options = [] fields = [ TextField('nombre', label_text='Nombre'), HiddenField('idFase', label_text='idFase'), Spacer(), #CalendarDatePicker('fechaCreacion', date_format='%d-%m-%y'), #Spacer(), CheckBoxList('items', options=items_options), Spacer(), ] submit_text = 'Crear LineaBase'
class ItemEditForm(EditableForm): __model__ = Item __disable_fields__ = ['nombre'] comlejidadoptions = [(1, 'Muy Baja (1)'), (2, 'Baja (2)'), (3, 'Media (3)'), (4, 'Alta (4)'), (5, 'Muy Alta (5)')] __field_widgets__ = { 'nombre': HiddenField('nombre', label_text='Nombre'), 'complejidad': SingleSelectField('complejidad', options=comlejidadoptions, label_text='complejidad') } __omit_fields__ = [ 'id', 'idTipoDeItem', 'idFase', 'fechaCreacion', 'idLineaBase', 'version', 'nrohistorial', 'ultimaversion', 'estado' ]
class fields(WidgetsList): _method = HiddenField(default='PUT', validator=None) languageid = HiddenField(validator=NotEmpty) id_ = TextField(validator=None, disabled=True) name = TextField(label_text=l_('Name'), size=TF_SIZE, validator=All(UnicodeString, NotEmpty, MaxLength(50)))
def _do_get_field_widgets(self, fields): widgets = super(FormBase, self)._do_get_field_widgets(fields) widgets['sprox_id'] = HiddenField('sprox_id') return widgets
class SEOSettingsForm(ListForm): template = 'admin/box-form.html' id = 'settings-form' css_class = 'form' submit_text = None fields = [ ListFieldSet( 'general', suppress_label=True, legend=N_('General', domain='mediacore_seo'), css_classes=['details_fieldset'], children=[ TextField( 'seo_general_meta_description', label_text=N_('Site Meta Description', domain='mediacore_seo'), ), TextField( 'seo_general_meta_keywords', label_text=N_('Site Meta Keywords', domain='mediacore_seo'), help_text=N_('Comma Separated)', domain='mediacore_seo'), ), ], ), ListFieldSet( 'explore', suppress_label=True, legend=N_('Explore Page', domain='mediacore_seo'), css_classes=['details_fieldset'], children=[ TextField( 'seo_explore_page_title', label_text=N_('Page Title', domain='mediacore_seo'), ), TextField( 'seo_explore_meta_description', label_text=N_('Meta Description', domain='mediacore_seo'), ), TextField( 'seo_explore_meta_keywords', label_text=N_('Meta Keywords', domain='mediacore_seo'), help_text=N_('(Comma Separated)', domain='mediacore_seo'), ) ], ), ListFieldSet( 'podcast', suppress_label=True, legend=N_('Podcast Page', domain='mediacore_seo'), css_classes=['details_fieldset'], children=[ TextField( 'seo_podcast_page_title', label_text=N_('Page Title', domain='mediacore_seo'), ), TextField( 'seo_podcast_meta_description', label_text=N_('Meta Description', domain='mediacore_seo'), ), TextField( 'seo_podcast_meta_keywords', label_text=N_('Meta Keywords', domain='mediacore_seo'), help_text=N_('(Comma Separated)', domain='mediacore_seo'), ) ], ), ListFieldSet( 'category', suppress_label=True, legend=N_('Category Page', domain='mediacore_seo'), css_classes=['details_fieldset'], children=[ TextField( 'seo_category_page_title', label_text=N_('Page Title', domain='mediacore_seo'), ), TextField( 'seo_category_meta_description', label_text=N_('Meta Description', domain='mediacore_seo'), ), TextField( 'seo_category_meta_keywords', label_text=N_('Meta Keywords', domain='mediacore_seo'), help_text=N_('(Comma Separated)', domain='mediacore_seo'), ) ], ), ListFieldSet( 'upload', suppress_label=True, legend=N_('Upload Page', domain='mediacore_seo'), css_classes=['details_fieldset'], children=[ TextField( 'seo_upload_page_title', label_text=N_('Page Title', domain='mediacore_seo'), ), TextField( 'seo_upload_meta_description', label_text=N_('Meta Description', domain='mediacore_seo'), ), TextField( 'seo_upload_meta_keywords', label_text=N_('Meta Keywords', domain='mediacore_seo'), help_text=N_('(Comma Separated)', domain='mediacore_seo'), ) ], ), ListFieldSet( 'options', suppress_label=True, legend=N_('Options', domain='mediacore_seo'), css_classes=['details_fieldset'], children=[ CheckBox( 'seo_options_noindex_categories', label_text=N_('Enable NOINDEX for Categories', domain='mediacore_seo'), validator=Bool(if_missing=''), ), CheckBox( 'seo_options_noindex_rss', label_text=N_('Enable NOINDEX for RSS', domain='mediacore_seo'), validator=Bool(if_missing=''), ), # XXX: Argh toscawidgets will mark the fieldset as invalid (missing) # when neither of the above checkboxes are checked, unless # we ensure some 'options' value is always passed. HiddenField('dummy_field', default='1'), ], ), SubmitButton('save', default=N_('Save', domain='mediacore_seo'), named_button=True, suppress_label=True, css_classes=['btn', 'btn-save']), ]
def new(self, tid=None, *args, **kw): """Display a page to show a new record.""" fid = DBSession.query(TipoDeItem.idFase).filter_by(id=tid).first() comlejidadoptions = [(1, 'Muy Baja (1)'), (2, 'Baja (2)'), (3, 'Media (3)'), (4, 'Alta (4)'), (5, 'Muy Alta (5)')] campos = [ TextField('nombre', label_text='Nombre', disabled=True), Spacer(), HiddenField('idFase', label_text='idFase'), HiddenField('version', label_text='version'), HiddenField('estado', label_text='estado'), SingleSelectField('complejidad', options=comlejidadoptions, label_text='complejidad'), Spacer(), HiddenField('nrohistorial', label_text='nrohistorial'), HiddenField('idTipoDeItem', label_text='idTipoDeItem'), ] camponombre = DBSession.query( Campos.tipoDeDato, Campos.nombre, Campos.id).filter_by(idTipoDeItem=tid).all() for ct in camponombre: #log.debug(ct[1]) if str(ct[0]).__eq__('date'): campo1 = CalendarDatePicker(str(ct[2]), label_text=ct[1] + ' (' + ct[0] + ')', date_format='%d/%m/%Y') else: campo1 = TextField(str(ct[2]), label_text=ct[1] + ' (' + ct[0] + ')') campos.append(campo1) campos.append(Spacer()) #self.new_form = TableForm('tf', fields=campos, submit_text='Guardar') #tmpl_context.widget = self.new_form tmpl_context.widget = TableForm('create_table_form', fields=campos, submit_text='Guardar') """El tipo de Item elegido es extraido para asignar su nombre al item""" tipo_item_elegido = DBSession.query(TipoDeItem).filter_by( id=tid).first() nrogenerado = tipo_item_elegido.nrogeneracion + 1 if int(nrogenerado) < 10: nombreitem = tipo_item_elegido.nombre + '-00' + str(nrogenerado) elif int(nrogenerado) < 100: nombreitem = tipo_item_elegido.nombre + '-0' + str(nrogenerado) else: nombreitem = tipo_item_elegido.nombre + '-' + str(nrogenerado) return dict(value={ 'idTipoDeItem': tid, 'idFase': fid, 'nombre': nombreitem }, model=self.model.__name__)