Esempio n. 1
0
 def bindings(self):
     return (
         Binding(
             'continent-details',
             _("Continent details"),
             self._continents,
             'continent',
             single=True,
             descr=
             _("Shows the details of the currently selected main table record."
               )),
         Binding(
             'other-countries',
             _("Other countries of the same continent"),
             'cb.Countries',
             condition=lambda r: pd.EQ(
                 'continent',
                 r['continent'],
             ),
             prefill=lambda r: {'name': r['name'].value()},
             descr=_(
                 "Displays a table of all countries from the same continent as the "
                 "currently selected main form country.")),
         Binding(
             'webform',
             _("Wikipedia"),
             uri=self._continent_uri,
             descr=
             _("Shows Wikipedia information about the currently selected country."
               )),
     )
Esempio n. 2
0
 def bindings(self):
     return (
         Binding('roles', _("Uživatelské role"),
                 self._spec_name('UserRoles'), 'uid'),
         Binding('sessions', _("Historie přihlášení"),
                 self._spec_name('UserSessionLog'), 'uid'),
     )
Esempio n. 3
0
 def bindings(self):
     return (
         Binding('content', _("Content"), uri=lambda r: 'help:'+r['help_id'].value()),
         Binding('fields', _("Fields"), 'help.FieldItemsHelp', 'spec_name'),
         Binding('profiles', _("Profiles"), 'help.ProfileItemsHelp', 'spec_name'),
         Binding('actions', _("Actions"), 'help.ActionItemsHelp', 'spec_name'),
         Binding('bindings', _("Side Forms"), 'help.BindingItemsHelp', 'spec_name'),
         )
Esempio n. 4
0
class FormUserList(Specification):
    public = True
    table = 'ev_pytis_form_user_list'
    title = _(u"Uživatelé")
    fields = (
        Field('login', _(u"Login")),
        )
    bindings = (Binding('users', _(u"Formuláře"), 'statistics.FormUserStatistics',
                        condition=(lambda row: pytis.data.EQ('login', row['login']))),
                Binding('profiles', _("Profiles"), 'profiles.FormProfiles', 'username'),
                )
Esempio n. 5
0
 def bindings(self):
     return (
         Binding(
             'rights',
             _("Přístupová práva"),
             self._spec_name('Rights'),
             condition=lambda r: pd.EQ('menu_item_id', r['menu_item_id']),
             prefill=lambda r: {
                 'menu_item_id': r['menu_item_id'].value(),
                 'mod_id': r['mod_id'].value()
             }),
         Binding('content', _("Content"), content=self._page_content),
     )
Esempio n. 6
0
class CryptoAreas(Specification):
    public = True
    table = db_pytis_crypto.CPytisCryptoNames
    title = _(u"Šifrovací oblasti")
    sorting = (('name', pytis.data.ASCENDENT,),)
    bindings = (Binding('users', _(u"Uživatelé"), 'crypto.Users', binding_column='name'),)

    def actions(self):
        return (pytis.presentation.Action('change_password', _(u"Změnit heslo administrátora"),
                                          self._change_admin_password),)

    def _change_admin_password(self, row):
        area = row['name'].value()
        if not area:
            return
        db_key = pytis.extensions.dbfunction('pytis_crypto_db_key',
                                             ('key_name_', pytis.data.sval('pytis'),))
        import config
        connection_data = config.dbconnection
        key_id, key = pytis.extensions.crypto_admin_key(area, 'admin', connection_data)
        if not key_id or not key:
            pytis.form.run_dialog(pytis.form.Error,
                                  _(u"Nebyl nalezen klíč administrátora pro tuto oblast"))
            return
        row = pytis.form.new_record("crypto.NewAdminPasswd", multi_insert=False)
        if not row:
            return
        old_password = row["old_password"].value()
        if not pytis.extensions.check_crypto_password(key, old_password, connection_data):
            pytis.form.run_dialog(pytis.form.Error, _(u"Chybné heslo"))
        encrypted_old_password = rsa_encrypt(db_key, old_password)
        new_password = row["new_password"].value()
        encrypted_new_password = rsa_encrypt(db_key, new_password)
        function = pytis.data.DBFunctionDefault('pytis_crypto_change_password', connection_data)
        row = pytis.data.Row((('id_', key_id,),
                              ('old_psw', pytis.data.sval(encrypted_old_password),),
                              ('new_psw', pytis.data.sval(encrypted_new_password),),))
        if not function.call(row)[0][0].value():
            pytis.form.run_dialog(pytis.form.Error, _(u"Heslo se změnit nepodařilo"))
            return
        pytis.form.run_dialog(pytis.form.Message, _(u"Heslo bylo změněno"))

    def on_new_record(self, *args, **kwargs):
        return None

    def on_edit_record(self, row):
        return None

    def on_delete_record(self, row):
        return None
Esempio n. 7
0
class FormShortStatistics(Specification):
    public = True
    table = 'ev_pytis_form_short_summary'
    title = _(u"Přehled používaných formulářů")
    fields = (
        Field('form', _(u"Jméno formuláře")),
        Field('class', _("Form Class")),
        Field('n_users', _(u"Počet uživatelů")),
        Field('n_open', _(u"Počet otevření")),
        Field('avg_start', _(u"Průměrná doba startu")),
        Field('last_used', _(u"Poslední spuštění")),
        )
    bindings = (Binding('users', _(u"Uživatelé"), 'statistics.FormUsers',
                        condition=(lambda row: pytis.data.AND(pytis.data.EQ('form', row['form']),
                                                              pytis.data.EQ('class', row['class'])))),
                )
Esempio n. 8
0
 def bindings(self):
     return (Binding('users', _("Uživatelé zařazení do této role"),
                     self._spec_name('RoleUsers'), 'role_id'), )
Esempio n. 9
0
 def bindings(self):
     return (Binding('actions', _("Dostupné akce tohoto modul"),
                     self._spec_name('Actions'), 'mod_id'), )
Esempio n. 10
0
File: misc.py Progetto: cerha/pytis
 def bindings(self):
     return (
         Binding('webform', _("Product Info"), content=self._content,
                 descr=_("Shows web page generated from LCG structured text.")),
     )
Esempio n. 11
0
 def bindings(self):
     return (Binding('viewer', _("Viewer"), content=self._pdf, content_type='pdf'),)
Esempio n. 12
0
class Continents(Specification):
    """Codebook of continents and their codes.

    Codebook is a regular view.  Any view can be used as a codebook.  It is,
    however, possible to define several properties of a view, which influence
    its use in the codebook context.  They are all covered by the
    'CodebookSpec' instance passed as the 'cb' argument of the specification.
    See the 'CodebookSpec' documentation for more information about the
    available options.

    Using a view as a codebook for a particular field is than done by passing
    its name as the 'codebook' argument in the field specification.  See the
    specification of 'Countries' below for an example.

    """
    public = True
    title = _("Continents")
    table = dbdefs.Continents
    fields = (
        Field('id',
              width=3,
              column_width=6,
              fixed=True,
              filter=TextFilter.ALPHANUMERIC,
              post_process=PostProcess.UPPER),
        Field('name', width=40),
        Field('smallest', codebook='cb.Countries'),
    )
    cb = CodebookSpec(display='name')
    bindings = (
        Binding('all-countries',
                _("All Countries"),
                'cb.Countries',
                'continent',
                search=lambda r: r['id'].value() == 'EU' and pd.sval('CZ') or
                None),
        Binding('islands',
                _("Islands"),
                'cb.Countries',
                'continent',
                condition=lambda r: pd.WM(
                    'name', pd.WMValue(pd.String(), '*island*'))),
        Binding('disabled-countries', _("Disabled Countries"),
                'cb.DisabledCountries', 'continent'),
        Binding('random-numbers',
                _("Random numbers"),
                'misc.RandomNumbers',
                arguments=lambda r: {}),
    )
    prints = (
        (_("Default"),
         'output/None'),  # This spec doen't exist, so defaults are used.
        (_("Countries of the current continent"),
         'cb.PrintContinentCountries'),
        PrintAction('p_countries_continents',
                    _("Countries of the current continent as specification"),
                    'cb.PrintContinentCountries'),
        PrintAction('p_overflow', _("PDF LayoutError"), 'cb.PrintOverflow'),
        (_("Template based"), 'output/Continents'),
        (_("Database template"), 'ContinentsDB'),
        (_("Iterated table"), 'IteratedContinents'),
    )