def fields(self): return ( Field('id', _(u"Id"), default=nextval('e_pytis_action_rights_id_seq')), Field('roleid', _(u"Role"), not_null=True, codebook='menu.ApplicationRoles', fixed=True), Field('purpose', _(u"Účel role"), editable=Editable.NEVER, fixed=True), Field('shortname', _("Action"), editable=Editable.NEVER, not_null=True, codebook='menu.ApplicationShortActions', descr=_(u"Identifikátor akce související s danou položkou menu")), Field('colname', _(u"Sloupec"), fixed=True, codebook='menu.ColnameCodebook', not_null=False, runtime_arguments=pytis.presentation.computer(self._specification_arguments), descr=_(u"Sloupec, na který se právo vztahuje")), Field('rightid', _(u"Právo"), not_null=True, codebook='menu.ApplicationRights', fixed=True, descr=_(u"Přidělené nebo odebrané právo")), Field('system', _(u"Systémové"), fixed=True, descr=_(u"Jde o neměnné právo definováno tvůrcem aplikace?")), Field('granted', _(u"Ano/Ne"), fixed=True, default=True, descr=_(u"Je právo povoleno (ano) nebo zakázáno (ne)?")), Field('redundant', _(u"Nadbytečné"), fixed=True, editable=Editable.NEVER, descr=_(u"Je toto právo nadbytečné, bez vlivu na výsledná práva?")), )
def fields(self): return ( Field('help_id', # The computer is only used for help pages (with page_id) so # we don't need to care about other kinds of help_id. New # record is always a new page. computer=computer(lambda r, page_id: 'page/%d' % page_id)), Field('fullname', _("Fullname"), width=50, editable=Editable.NEVER), Field('spec_name', _("Specification Name"), width=50, editable=Editable.NEVER), Field('page_id', default=nextval('e_pytis_help_pages_page_id_seq')), Field('position'), Field('position_nsub'), Field('title', _("Title"), width=20, editable=computer(self._is_page), type=_TreeOrderLTree(tree_column_id='position', subcount_column_id='position_nsub'), ), Field('description', _("Description"), width=70, editable=computer(self._is_page),), Field('content', _("Content"), width=80, height=20, compact=True, text_format=pp.TextFormat.LCG, attachment_storage=self._attachment_storage), Field('menu_help', _(u"Menu item description"), width=80, height=20, compact=True, text_format=pp.TextFormat.LCG, attachment_storage=self._attachment_storage), Field('spec_description', _("Brief form description"), width=80, height=3, compact=True), Field('spec_help', _("Detailed form help"), width=80, height=20, compact=True, text_format=pp.TextFormat.LCG, attachment_storage=self._attachment_storage), Field('parent', _("Parent item"), not_null=False, codebook='help.HelpParents', value_column='page_id', editable=computer(self._is_page), runtime_filter=computer(self._parent_filter), descr=_("Choose the directly superordinate item in menu hierarchy. Leave " "empty for pages at the top level menu.")), Field('ord', _("Ordering"), width=8, fixed=True, type=pd.Integer, maximum=999998, editable=computer(self._is_page), descr=_("Enter a number denoting the order of the item in menu between " "pages of the same hierarchy level. Leave empty to put the item " "automatically to bottom.")), Field('removed', _("Removed"), editable=Editable.NEVER), Field('changed', _("Changed"), editable=Editable.NEVER), )
def fields(self): return ( Field('help_id', # The computer is only used for help pages (, editable=pp.Editable.NEVER, editable=pp.Editable.NEVER, editable=pp.Editable.NEVER, editable=pp.Editable.NEVER, editable=Editable.NEVERwith page_id) so # we don't need to care about other kinds of help_id. New # record is always a new page. computer=computer(lambda r, page_id: 'page/%d' % page_id)), Field('fullname', _("Fullname"), width=50, editable=Editable.NEVER), Field('spec_name', _("Specification Name"), width=50, editable=Editable.NEVER), Field('page_id', default=nextval('e_pytis_help_pages_page_id_seq')), Field('position'), Field('position_nsub'), Field('title', _("Title"), width=20, editable=computer(self._is_page), type=_TreeOrderLTree(tree_column_id='position', subcount_column_id='position_nsub'), ), Field('description', _("Description"), width=70, editable=computer(self._is_page),), Field('content', _("Content"), width=80, height=20, compact=True, text_format=pp.TextFormat.LCG, attachment_storage=self._attachment_storage), Field('menu_help', _(u"Menu item description"), width=80, height=20, compact=True, text_format=pp.TextFormat.LCG, attachment_storage=self._attachment_storage), Field('spec_description', _("Brief form description"), width=80, height=3, compact=True), Field('spec_help', _("Detailed form help"), width=80, height=20, compact=True, text_format=pp.TextFormat.LCG, attachment_storage=self._attachment_storage), Field('parent', _("Parent item"), not_null=False, codebook='help.HelpParents', value_column='page_id', editable=computer(self._is_page), runtime_filter=computer(self._parent_filter), descr=_("Choose the directly superordinate item in menu hierarchy. Leave " "empty for pages at the top level menu.")), Field('ord', _("Ordering"), width=8, fixed=True, type=pd.Integer, maximum=999998, editable=computer(self._is_page), descr=_("Enter a number denoting the order of the item in menu between " "pages of the same hierarchy level. Leave empty to put the item " "automatically to bottom.")), Field('removed', _("Removed"), editable=Editable.NEVER), Field('changed', _("Changed"), editable=Editable.NEVER), )
class UserOutputTemplates(pytis.presentation.Specification): public = True table = 'ev_pytis_user_output_templates' title = _("Uživatelské tiskové šablony") fields = ( Field('id', _("Identifikátor řádku"), default=nextval('e_pytis_output_templates_id_seq'), editable=Editable.NEVER), Field('module', _("Formulář")), Field('specification', _("Název šablony")), Field('template', _("Šablona"), text_format=pytis.presentation.TextFormat.LCG, width=80, height=25, compact=True), Field('rowtemplate', _("Šablona pro jednotlivé řádky"), text_format=pytis.presentation.TextFormat.LCG, width=80, height=25, compact=True), Field('header', _("Hlavička"), text_format=pytis.presentation.TextFormat.LCG, width=80, height=10, compact=True), Field('first_page_header', _("Odlišná hlavička první stránky"), text_format=pytis.presentation.TextFormat.LCG, width=80, height=10, compact=True), Field('footer', _("Patička"), text_format=pytis.presentation.TextFormat.LCG, width=80, height=10, compact=True), Field('style', _("Styl"), width=80, height=25, compact=True), Field('username', _("User")), Field('help', _("Help"), virtual=True, editable=Editable.NEVER, computer=pytis.presentation.computer( pytis.output.Formatter.template_help), width=80, height=25, compact=True), ) columns = ( 'module', 'specification', 'username', 'template', ) layout = pytis.presentation.TabGroup((_("Šablona"), ( 'module', 'specification', 'template', )), (_("Řádková šablona"), ('rowtemplate', )), (_("Hlavičky a patičky"), ( 'header', 'first_page_header', 'footer', )), (_("Styl"), ('style', )), (_("Help"), ('help', ))) def on_delete_record(self, row): if not row['username'].value(): pytis.form.run_dialog(pytis.form.Warning, _("Můžete mazat pouze své vlastní záznamy.")) return None template = row['specification'].value() question = _("Opravdu chcete vymazat tiskovou sestavu %s?") % ( template, ) if not pytis.form.run_dialog(pytis.form.Question, question): return None return pytis.data.EQ(row.keys()[0], row.key()[0]) def check(self, row): condition = pytis.data.AND( pytis.data.EQ('specification', row['specification']), pytis.data.EQ('module', row['module']), pytis.data.NE('id', row['id'])) if pytis.extensions.dbselect('printing.UserOutputTemplates', condition=condition): pytis.form.message(_("Tento název šablony již existuje")) return 'specification'
def _customize_fields(self, fields): fields.modify('range_id', default=nextval('range_types_range_id_seq')) fields.modify('int_range', width=4)
def _customize_fields(self, fields): fields.modify('id', fixed=True, editable=Editable.NEVER, default=nextval('longtable_id_seq'))
def _customize_fields(self, fields): fields.modify('id', fixed=True, editable=Editable.NEVER, default=nextval('passwords_id_seq')) fields.modify('passwd', type=pd.Password(minlen=4, maxlen=16, verify=True), disable_column=True),