Пример #1
0
  def _public(self, request, entity, context):
    """See base.View._public().
    """

    news_feed = NewsFeed(entity)
    context['news_feed'] = news_feed.getFeed() 

    return super(View, self)._public(request=request, entity=entity,
                                     context=context)
Пример #2
0
  def _public(self, request, entity, context):
    """See base.View._public().
    """

    from soc.views.models import student_project as student_project_view

    program_entity = entity.scope

    if timeline_helper.isAfterEvent(program_entity.timeline,
                                    'accepted_students_announced_deadline'):
      # accepted projects
      ap_params = student_project_view.view.getParams().copy()

      # define the list redirect action to show the notification
      ap_params['list_action'] = (redirects.getPublicRedirect, ap_params)
      ap_params['list_description'] = self.DEF_ACCEPTED_PROJECTS_MSG_FMT %(
          entity.name)
      ap_params['list_heading'] = 'soc/student_project/list/heading.html'
      ap_params['list_row'] = 'soc/student_project/list/row.html'

      # only show projects that have not failed
      filter = {'scope': entity,
                'status': ['accepted', 'completed']}

      ap_list = lists.getListContent(request, ap_params, filter, idx=0,
                                     need_content=True)

      contents = []

      if ap_list:
        # this is a temporary fix for sorting Student Projects 
        # by Student name until we have a view that default 
        # sorts it self by name (right now we can't do such query)
        ap_list['data'].sort(key=lambda sp: sp.student.name().lower())

        contents.append(ap_list)

      # construct the list and put it into the context
      context['list'] = soc.logic.lists.Lists(contents)

      # obtain data to construct the organization map as json object
      context['org_map_data'] = self._getMapData(filter)
      
    news_feed = NewsFeed(entity)
    context['news_feed'] = news_feed.getFeed()
    
    return super(View, self)._public(request=request, entity=entity,
                                     context=context)
Пример #3
0
  def _public(self, request, entity, context):
    """See base.View._public().
    """

    if not entity:
      return

    news_feed = NewsFeed(entity)
    context['news_feed'] = news_feed.getFeed() 
    
    try:
      home_doc = entity.home
    except db.Error:
      home_doc = None

    if not home_doc:
      return False

    home_doc.content = helper.templates.unescape(home_doc.content)
    context['home_document'] = home_doc

    # check if the current user is allowed edit the home document
    rights = self._params['rights']

    allowed_to_edit = False

    try:
      # use the IsDocumentWritable check because we have no django args
      rights.checkIsDocumentWritable({'key_name': home_doc.key().name(),
                                      'prefix': home_doc.prefix,
                                      'scope_path': home_doc.scope_path,
                                      'link_id': home_doc.link_id},
                                     'key_name')
      allowed_to_edit = True
    except:
      pass

    if allowed_to_edit:
      # put the link to edit to home document in context
      context['home_document_edit_redirect'] = redirects.getEditRedirect(
          home_doc, {'url_name': 'document'})
    
    return super(View, self)._public(request, entity, context)
Пример #4
0
  def _public(self, request, entity, context):
    """See base.View._public().
    """

    news_feed = NewsFeed(entity)
    context['news_feed'] = news_feed.getFeed()