Esempio n. 1
0
def dashboard(request):
    """ Returns user's unique dashboard.

    Displays new comments since last_login from any discussions including user.
    Ex: Felicity S. replied to Series: "Palmer Tech Innovation Conference" discussion
    Displays table of new content created since last_login
    Displays any content with deadlines sameday/next day for any content where user is part of team.
    Displays log of other user activity since last_login
    Ex: Oliver Q. added "Dhark Indicted" to Story: "Star City Organized Crime Leader Arrested"
    """
    # query for new comments since last_login from any discussions the user has participated in
    recent_comments = User.recent_comments(request.user)
    # if no new comments, display 10 most recent older comments
    older_comments = User.inbox_comments(request.user)[:10]
    # query for any new content created since last_login
    new_stories = Story.objects.filter(creation_date__gte=request.user.last_login)[:8]
    # if no new stories, display 10 most recent stories
    old_stories = Story.objects.filter(organization = request.user.organization)[:10]

    # TODO: query for other user activity since last_login

    return render(request, 'editorial/dashboard.html', {
        'recent_comments': recent_comments,
        'older_comments': older_comments,
        'new_stories': new_stories,
        'old_stories': old_stories,
    })
Esempio n. 2
0
def dashboard(request):
    """ Returns user's unique dashboard.

    Displays new comments since last_login from any discussions including user.
    Ex: Felicity S. replied to Series: "Palmer Tech Innovation Conference" discussion
    Displays table of new content created since last_login
    Displays any content with deadlines sameday/next day for any content where user is part of team.
    Displays log of other user activity since last_login
    Ex: Oliver Q. added "Dhark Indicted" to Story: "Star City Organized Crime Leader Arrested"
    """
    # get user organization
    organization = request.user.organization
    # query for new comments since last_login from any discussions the user has participated in
    recent_comments = User.recent_comments(request.user)
    # if no new comments, display 10 most recent older comments
    older_comments = User.inbox_comments(request.user)[:10]

    if organization:
        # retrieve all organization comments
        all_comments = Organization.get_org_comments(organization)
        # query for new stories shared to network
        networks = Organization.get_org_networks(organization)
        # facets where run_date=today
        running_today = Organization.get_org_stories_running_today(organization)
        # facets where due_edit=today
        edit_today = Organization.get_org_stories_due_for_edit_today(organization)
    else:
        all_comments = []
        networks = []
        running_today = []
        edit_today = []

    shared_networkstories = []
    for network in networks:
        stories = Network.get_network_shared_stories(network)
        shared_networkstories.extend(stories)
    shared_networkstories = [story for story in shared_networkstories if story.organization != organization]
    networkstories = set(shared_networkstories)

    # query for any new content created since last_login
    new_stories = Story.objects.filter(creation_date__gte=request.user.last_login)[:8]
    # if no new stories, display 10 most recent stories
    old_stories = Story.objects.filter(organization = request.user.organization)[:10]

    copied_shared_stories = StoryCopyDetail.objects.filter(original_org=request.user.organization)
    # TODO: query for other user activity since last_login

    return render(request, 'editorial/dashboard.html', {
        'networks': networks,
        'recent_comments': recent_comments,
        'older_comments': older_comments,
        'all_comments': all_comments,
        'new_stories': new_stories,
        'old_stories': old_stories,
        'running_today': running_today,
        'edit_today': edit_today,
        'shared_networkstories': shared_networkstories,
        'copied_shared_stories': copied_shared_stories,
    })
Esempio n. 3
0
def discussion(request):
    """ Return discussion inbox.

    Displays comments from SeriesPlan Discussions involving user.
    Displays comments from StoryPlan Discussions involving user.
    Displays comments from any Facet Editing Discussion involving user.
    Displays comments from any PrivateDiscussion involving user.
    """

    comments = User.inbox_comments(request.user)

    private_messages_received = User.private_messages_received(request.user)
    private_messages_sent = User.private_messages_sent(request.user)

    return render(request, 'editorial/discussion.html', {
        'comments': comments,
        'private_messages_received': private_messages_received,
        'private_messages_sent': private_messages_sent,
    })