예제 #1
0
    def dashboard(self, id=None, offset=0):
        context = {
            'model': model,
            'session': model.Session,
            'user': c.user or c.author,
            'auth_user_obj': c.userobj,
            'for_view': True
        }
        data_dict = {'id': id, 'user_obj': c.userobj, 'offset': offset}
        self._setup_template_variables(context, data_dict)

        q = request.params.get('q', u'')
        filter_type = request.params.get('type', u'')
        filter_id = request.params.get('name', u'')

        c.followee_list = get_action('followee_list')(context, {
            'id': c.userobj.id,
            'q': q
        })
        c.dashboard_activity_stream_context = self._get_dashboard_context(
            filter_type, filter_id, q)
        c.dashboard_activity_stream = h.dashboard_activity_stream(
            c.userobj.id, filter_type, filter_id, offset)

        # Mark the user's new activities as old whenever they view their
        # dashboard page.
        get_action('dashboard_mark_activities_old')(context, {})

        return render('user/dashboard.html')
예제 #2
0
def index(offset=0):
    context = {
        u'model': model,
        u'session': model.Session,
        u'user': g.user,
        u'auth_user_obj': g.userobj,
        u'for_view': True
    }
    data_dict = {u'user_obj': g.userobj, u'offset': offset}
    extra_vars = _extra_template_variables(context, data_dict)

    q = request.params.get(u'q', u'')
    filter_type = request.params.get(u'type', u'')
    filter_id = request.params.get(u'name', u'')

    extra_vars[u'followee_list'] = logic.get_action(u'followee_list')(
        context, {
            u'id': g.userobj.id,
            u'q': q
        })
    extra_vars[u'dashboard_activity_stream_context'] = _get_dashboard_context(
        filter_type, filter_id, q)
    extra_vars[u'dashboard_activity_stream'] = h.dashboard_activity_stream(
        g.userobj.id, filter_type, filter_id, offset)

    # Mark the user's new activities as old whenever they view their
    # dashboard page.
    logic.get_action(u'dashboard_mark_activities_old')(context, {})

    return base.render(u'user/dashboard.html', extra_vars)
예제 #3
0
파일: user.py 프로젝트: tbalaz/dghr
    def dashboard(self, id=None, offset=0):
        context = {
            'model': model,
            'session': model.Session,
            'user': c.user or c.author,
            'auth_user_obj': c.userobj,
            'for_view': True
        }
        data_dict = {'id': id, 'user_obj': c.userobj, 'offset': offset}
        self._setup_template_variables(context, data_dict)

        q = request.params.get('q', u'')
        filter_type = request.params.get('type', u'')
        filter_id = request.params.get('name', u'')

        c.followee_list = get_action('followee_list')(context, {
            'id': c.userobj.id,
            'q': q
        })
        c.dashboard_activity_stream_context = self._get_dashboard_context(
            filter_type, filter_id, q)
        c.dashboard_activity_stream = h.dashboard_activity_stream(
            c.userobj.id, filter_type, filter_id, offset)

        # Mark the user's new activities as old whenever they view their
        # dashboard page.
        get_action('dashboard_mark_activities_old')(context, {})

        return render('user/dashboard.html')
예제 #4
0
def index(offset=0):
    context = {
        u'model': model,
        u'session': model.Session,
        u'user': g.user,
        u'auth_user_obj': g.userobj,
        u'for_view': True
    }
    data_dict = {u'user_obj': g.userobj, u'offset': offset}
    extra_vars = _extra_template_variables(context, data_dict)

    q = request.params.get(u'q', u'')
    filter_type = request.params.get(u'type', u'')
    filter_id = request.params.get(u'name', u'')

    extra_vars[u'followee_list'] = logic.get_action(u'followee_list')(
        context, {
            u'id': g.userobj.id,
            u'q': q
        })
    extra_vars[u'dashboard_activity_stream_context'] = _get_dashboard_context(
        filter_type, filter_id, q)
    extra_vars[u'dashboard_activity_stream'] = h.dashboard_activity_stream(
        g.userobj.id, filter_type, filter_id, offset)

    # Mark the user's new activities as old whenever they view their
    # dashboard page.
    logic.get_action(u'dashboard_mark_activities_old')(context, {})

    return base.render(u'user/dashboard.html', extra_vars)
예제 #5
0
    def dashboard(self, id=None, offset=0):
        context = {
            'model': model,
            'session': model.Session,
            'user': c.user,
            'auth_user_obj': c.userobj,
            'for_view': True
        }

        if authz.auth_is_anon_user(context):
            h.flash_error(_('Not authorized to see this page'))
            return h.redirect_to(controller='user', action='login')

        data_dict = {'id': id, 'user_obj': c.userobj, 'offset': offset}
        self._setup_template_variables(context, data_dict)

        q = request.params.get('q', u'')
        filter_type = request.params.get('type', u'')
        filter_id = request.params.get('name', u'')

        c.followee_list = get_action('followee_list')(context, {
            'id': c.userobj.id,
            'q': q
        })
        c.dashboard_activity_stream_context = self._get_dashboard_context(
            filter_type, filter_id, q)
        c.dashboard_activity_stream = h.dashboard_activity_stream(
            c.userobj.id, filter_type, filter_id, offset)

        # Mark the user's new activities as old whenever they view their
        # dashboard page.
        get_action('dashboard_mark_activities_old')(context, {})
        return render('user/dashboard.html')
예제 #6
0
파일: user.py 프로젝트: nvdnkpr/ckan
    def dashboard(self, id=None, offset=0):
        context = {'model': model, 'session': model.Session,
                   'user': c.user or c.author, 'for_view': True}
        data_dict = {'id': id, 'user_obj': c.userobj, 'offset': offset}
        self._setup_template_variables(context, data_dict)

        c.dashboard_activity_stream = h.dashboard_activity_stream(id, offset)

        # Mark the user's new activities as old whenever they view their
        # dashboard page.
        get_action('dashboard_mark_activities_old')(context, {})

        return render('user/dashboard.html')
예제 #7
0
파일: user.py 프로젝트: Web5design/ckan
    def dashboard(self, id=None, offset=0):
        context = {"model": model, "session": model.Session, "user": c.user or c.author, "for_view": True}
        data_dict = {"id": id, "user_obj": c.userobj, "offset": offset}
        self._setup_template_variables(context, data_dict)

        q = request.params.get("q", u"")
        filter_type = request.params.get("type", u"")
        filter_id = request.params.get("name", u"")

        c.followee_list = get_action("followee_list")(context, {"id": c.userobj.id, "q": q})
        c.dashboard_activity_stream_context = self._get_dashboard_context(filter_type, filter_id, q)
        c.dashboard_activity_stream = h.dashboard_activity_stream(id, filter_type, filter_id, offset)

        # Mark the user's new activities as old whenever they view their
        # dashboard page.
        get_action("dashboard_mark_activities_old")(context, {})

        return render("user/dashboard.html")
예제 #8
0
    def dashboard(self, id=None, offset=0):
        '''Opens up the dashboard page on signup or login
        '''
        context = {
            'model': model,
            'session': model.Session,
            'user': c.user,
            'auth_user_obj': c.userobj,
            'for_view': True
        }
        if user_analytics_present(context):
            data_dict = {'id': id, 'user_obj': c.userobj, 'offset': offset}
            self._setup_template_variables(context, data_dict)

            q = request.params.get('q', u'')
            filter_type = request.params.get('type', u'')
            filter_id = request.params.get('name', u'')

            c.followee_list = toolkit.get_action('followee_list')(
                context, {
                    'id': c.userobj.id,
                    'q': q
                })
            c.dashboard_activity_stream_context = self._get_dashboard_context(
                filter_type, filter_id, q)
            c.dashboard_activity_stream = h.dashboard_activity_stream(
                c.userobj.id, filter_type, filter_id, offset)

            # Mark the user's new activities as old whenever they view their
            # dashboard page.
            toolkit.get_action('dashboard_mark_activities_old')(context, {})

            return render('user/dashboard.html')
        else:
            return self.edit(id=None,
                             data=None,
                             errors=None,
                             error_summary=None)
예제 #9
0
파일: home.py 프로젝트: virgorasion/data2
    def index(self, error=None, offset=0):
        for item in p.PluginImplementations(p.IAuthenticator):
            item.login()

        if 'error' in request.params:
            h.flash_error(request.params['error'])

        if not c.user:
            came_from = request.params.get('came_from')
            if not came_from:
                came_from = h.url_for(controller='user', action='logged_in')
            c.login_handler = h.url_for(
                self._get_repoze_handler('login_handler_path'),
                came_from=came_from)
            if error:
                vars = {'error_summary': {'': error}}
            else:
                vars = {}
            h.redirect_to(controller='user', action='login')
            # return base.render('user/login.html', extra_vars=vars)
        else:
            try:
                # package search
                context = {
                    'model': model,
                    'session': model.Session,
                    'user': c.user,
                    'auth_user_obj': c.userobj,
                    'for_view': True
                }
                data_dict = {
                    'q': '*:*',
                    'facet.field': h.facets(),
                    'rows': 4,
                    'start': 0,
                    'sort': 'views_recent desc',
                    'fq': 'capacity:"public"'
                }
                query = logic.get_action('package_search')(context, data_dict)
                c.search_facets = query['search_facets']
                c.package_count = query['count']
                c.datasets = query['results']

                c.facet_titles = {
                    'organization': _('Organizations'),
                    'groups': _('Groups'),
                    'tags': _('Tags'),
                    'res_format': _('Formats'),
                    'license': _('Licenses'),
                }

            except search.SearchError:
                c.package_count = 0

            if c.userobj and not c.userobj.email:
                url = h.url_for(controller='user', action='edit')
                msg = _('Please <a href="%s">update your profile</a>'
                        ' and add your email address. ') % url + \
                    _('%s uses your email address'
                        ' if you need to reset your password.') \
                    % config.get('ckan.site_title')
                h.flash_notice(msg, allow_html=True)

            q = request.params.get('q', u'')
            filter_type = request.params.get('type', u'')
            filter_id = request.params.get('name', u'')

            c.followee_list = logic.get_action('followee_list')(
                context, {
                    'id': c.userobj.id,
                    'q': q
                })
            # c.dashboard_activity_stream_context = self._get_dashboard_context(
            #     filter_type, filter_id, q)
            c.dashboard_activity_stream = h.dashboard_activity_stream(
                c.userobj.id, filter_type, filter_id, offset)

            return base.render('home/index.html', cache_force=True)
예제 #10
0
def dashboard_activity_stream(*args, **kwargs):
    try:
        return core_helpers.dashboard_activity_stream(*args, **kwargs)
    except toolkit.NotAuthorized:
        return []