Esempio n. 1
0
    def uploads(self):
        """ Uploads """

        T = current.T
        db = self.boilerplate.db
        t_images = self.i2pcore.table_name_images

        fields = [
                  db[t_images]['thumb'],
                  db[t_images]['post_id'],
                  db[t_images]['comment'],
                  db[t_images]['upload_on']
                  ]

        self.i2pcore.represent_uploads()  # represent fields

        query = (db[t_images].id > 0)

        table = SQLFORM.grid(query,
                        orderby=~db[t_images].id,
                        fields=fields,
                        csv=False,
                        searchable=False,
                        create=False,
                        editable=False,
                        details=False,
                        paginate=self.rec_x_page,
                        ui=admin_ui()
                        )

        return table
Esempio n. 2
0
    def catlist(self):
        """ Categories List """

        T = current.T
        db = self.boilerplate.db
        t_cats = self.i2pcore.table_name_categories

        links = [lambda row: A(SPAN(_class='icon edit'),
                               SPAN(T('Edit')),
                          _href="%s" % URL(self.controller_name,
                                                   'catedit',
                                                   args=[row.id]),
                          _title='Edit', _class='w2p_trap button16')]

        query = (db[t_cats].id > 0)
        table = SQLFORM.grid(query,
                             links=links,
                             orderby=~db[t_cats].id,
                             csv=False,
                             searchable=False,
                             create=False,
                             editable=False,
                             paginate=self.rec_x_page,
                             ui=admin_ui()
                            )
        return table
Esempio n. 3
0
    def pagelist(self, iswidgets=False):
        """ Page list """

        T = current.T
        db = self.boilerplate.db
        t_posts = self.i2pcore.table_name_post

        self.i2pcore.represent()  # represent fields

        query = (db[t_posts].is_page == True) &\
                (db[t_posts].is_widget == iswidgets)

        fields = [db[t_posts]['id'],
                  db[t_posts]['title'],
                  db[t_posts]['parent'],
                  db[t_posts]['menu_order'],
                  db[t_posts]['menu_show'],
                  db[t_posts]['published']
          ]

        links = [lambda row: A(SPAN(_class='icon edit'), SPAN(T('Edit')),
                            _href="%s" % URL(self.controller_name,
                                        'pageedit',
                                        args=[row.id],
                                        vars={'markup':''}),
                                        _title=T('Edit'),
                                        _class='w2p_trap button16'),
                 lambda row: A(SPAN(_class='icon add'), SPAN(T('Add')),
                             _href="%s" % URL(self.controller_name,
                             'pageadd',
                             args=[row.id]),
                             _title=T('Add page to this page as a child'),
                             _class='w2p_trap button16'),
                 lambda row: A(SPAN(_class='icon view'), SPAN(T('Preview')),
                             _href="%s" % URL(self.controller_name,
                                 'pagepreview',
                                 args=[row.id]),
                                 _title=T('Preview'),
                                 _target='_blank', _class='w2p_trap button16')]

        table = SQLFORM.grid(query,
                        fields=fields,
                        links=links,
                        orderby=~db[t_posts].id,
                        csv=False,
                        searchable=False,
                        create=False,
                        editable=False,
                        details=False,
                        paginate=self.rec_x_page,
                        ui=admin_ui()
                        )
        return table
Esempio n. 4
0
    def groups(self):
        """ List all groups """

        db = self.boilerplate.db
        T = current.T

        query = (db.auth_group.id > 0)

        table = SQLFORM.grid(query,
                             searchable=False,
                             paginate=self.rec_x_pag,
                             ui=admin_ui())

        return table
Esempio n. 5
0
    def groups(self):
        """ List all groups """

        db = self.boilerplate.db
        T = current.T

        query = (db.auth_group.id > 0)

        table = SQLFORM.grid(query,
                        searchable=False,
                        paginate=self.rec_x_pag,
                        ui=admin_ui()
                        )

        return table
Esempio n. 6
0
    def index(self):
        """ Index"""

        db = self.boilerplate.db
        T = current.T

        self.represent()

        query = (db.auth_user.id > 0)
        fields = [db.auth_user.id,
                  db.auth_user.username,
                  db.auth_user.email,
                  db.auth_user.created_on
                  ]

        links = [lambda row: \
                A(SPAN(_class='icon activate'), SPAN(T('Activate')),
              _href="javascript: void(0);",
              _onclick="if(!confirm('%s')){ return } ajax('%s', [], ':eval');" %\
              (T('Activate this user?'),
                  URL(self.controller_name, "activate", args=[row.id])),
              _title=T('Activate user'), _class='w2p_trap button16'),
                 lambda row: \
                 A(SPAN(_class='icon disable'), SPAN(T('Disable')),
                     _href="javascript: void(0);",
                    _onclick="if(!confirm('%s')){ return } ajax('%s', [], ':eval');" %\
                    (T('Disable user?'),
                        URL(self.controller_name, "disable", args=[row.id])),
                    _title=T('Disable user?'), _class='w2p_trap button16'),
                 lambda row: A(SPAN(_class='icon group'), SPAN(T('Membership')),
                        _href=URL(self.controller_name,
                                  'membership',
                                  args=[row.id]),
                        _title=T('Memberships of the user'), _class='w2p_trap button16')]

        table = SQLFORM.grid(query,
                        searchable=False,
                        fields=fields,
                        links=links,
                        create=True,
                        editable=True,
                        paginate=self.rec_x_pag,
                        ui=admin_ui()
                        )

        return table
Esempio n. 7
0
    def index(self):
        """ Index"""

        db = self.boilerplate.db
        T = current.T

        self.represent()

        query = (db.auth_user.id > 0)
        fields = [
            db.auth_user.id, db.auth_user.username, db.auth_user.email,
            db.auth_user.created_on
        ]

        links = [lambda row: \
                A(SPAN(_class='icon activate'), SPAN(T('Activate')),
              _href="javascript: void(0);",
              _onclick="if(!confirm('%s')){ return } ajax('%s', [], ':eval');" %\
              (T('Activate this user?'),
                  URL(self.controller_name, "activate", args=[row.id])),
              _title=T('Activate user'), _class='w2p_trap button16'),
                 lambda row: \
                 A(SPAN(_class='icon disable'), SPAN(T('Disable')),
                     _href="javascript: void(0);",
                    _onclick="if(!confirm('%s')){ return } ajax('%s', [], ':eval');" %\
                    (T('Disable user?'),
                        URL(self.controller_name, "disable", args=[row.id])),
                    _title=T('Disable user?'), _class='w2p_trap button16'),
                 lambda row: A(SPAN(_class='icon group'), SPAN(T('Membership')),
                        _href=URL(self.controller_name,
                                  'membership',
                                  args=[row.id]),
                        _title=T('Memberships of the user'), _class='w2p_trap button16')]

        table = SQLFORM.grid(query,
                             searchable=False,
                             fields=fields,
                             links=links,
                             create=True,
                             editable=True,
                             paginate=self.rec_x_pag,
                             ui=admin_ui())

        return table
Esempio n. 8
0
    def membership(self, iduser):
        """ membership """

        db = self.boilerplate.db
        T = current.T

        query = (db.auth_group.id > 0)
        self.represent_membership(iduser)

        links = [lambda row: \
            A(SPAN(_class='icon activate'), SPAN(T('Assign')),
             _href="javascript: void(0);",
            _onclick="if(!confirm('%s')){ return } ajax('%s', [], ':eval');" % \
            (T('Warning!. Assign user to this group?'),
                URL(self.controller_name,
                    "membership_assign",
                    vars={'user': iduser, 'group':row.id})),
            _title=T('Assign user to this group'), _class='w2p_trap button16'),
                 lambda row: \
             A(SPAN(_class='icon remove'), SPAN(T('Remove')),
            _href="javascript: void(0);",
            _onclick="if(!confirm('%s')){ return } ajax('%s', [], ':eval');" % \
            (T('Warning!. Remove user from this group?.'),
                URL(self.controller_name,
                "membership_remove",
                vars={'user': iduser, 'group': row.id})),
            _title=T('Remove user from this group'), _class='w2p_trap button16')]

        table = SQLFORM.grid(query,
                        links=links,
                        create=False,
                        deletable=False,
                        editable=False,
                        details=False,
                        searchable=False,
                        sortable=False,
                        csv=False,
                        paginate=1000,
                        ui=admin_ui()
                        )

        return table
Esempio n. 9
0
    def membership(self, iduser):
        """ membership """

        db = self.boilerplate.db
        T = current.T

        query = (db.auth_group.id > 0)
        self.represent_membership(iduser)

        links = [lambda row: \
            A(SPAN(_class='icon activate'), SPAN(T('Assign')),
             _href="javascript: void(0);",
            _onclick="if(!confirm('%s')){ return } ajax('%s', [], ':eval');" % \
            (T('Warning!. Assign user to this group?'),
                URL(self.controller_name,
                    "membership_assign",
                    vars={'user': iduser, 'group':row.id})),
            _title=T('Assign user to this group'), _class='w2p_trap button16'),
                 lambda row: \
             A(SPAN(_class='icon remove'), SPAN(T('Remove')),
            _href="javascript: void(0);",
            _onclick="if(!confirm('%s')){ return } ajax('%s', [], ':eval');" % \
            (T('Warning!. Remove user from this group?.'),
                URL(self.controller_name,
                "membership_remove",
                vars={'user': iduser, 'group': row.id})),
            _title=T('Remove user from this group'), _class='w2p_trap button16')]

        table = SQLFORM.grid(query,
                             links=links,
                             create=False,
                             deletable=False,
                             editable=False,
                             details=False,
                             searchable=False,
                             sortable=False,
                             csv=False,
                             paginate=1000,
                             ui=admin_ui())

        return table