def before(self, form):
        query = ActivityType.query()
        types = query.filter_by(active=True)

        modes = ActivityMode.query()

        query = ActivityAction.query()
        query = query.filter_by(parent_id=None)
        actions = query.filter_by(active=True)

        activity_appstruct = {
            'footer': self.request.config.get("activity_footer", ""),
            'types': [type_.appstruct() for type_ in types],
            'modes': [mode.appstruct() for mode in modes],
            'actions': self._recursive_action_appstruct(actions)
        }
        self._add_pdf_img_to_appstruct('activity', activity_appstruct)
        form.set_appstruct(activity_appstruct)