<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %>
    <% document = activity.org_act %>
    <% org_subfield_id = params[:org_subfield_id] %>
    <% flag = 2 %>
    <li>
      <a href="/#" title="" >
        <div class="course-list-img">
          <% iamge_path = get_image_path_from_content(document.content) %>
          <% if iamge_path.nil? %>
              <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %>
          <% else %>
              <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %>
          <% end %>
        </div>
        <h5><%#= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
          <span><%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank' %></span>
        </h5>
        <div class="item-btm clearfix">
        <%=link_to document.try(:creator).try(:realname).nil? ? document.try(:creator).try(:login) : document.try(:creator).try(:realname), user_path(document.creator), :class=>"publisher-name fl", :target => "_blank" %></a>
      <p class="pass-time fl"><span><%= format_date document.created_at %></span></p>
      <div class="fr right-info"> <span> <%= document.children.count %></span></div>
      </div>
      </a>
    </li>
<% elsif activity.container_type == 'OrgSubfield' %>
    <% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where("id=#{activity.org_act_id}").count > 0 %>
        <% message = Message.find(activity.org_act_id) %>
        <% if message.board.org_subfield_id %>
            <li>
              <a href="/#" title="" >
                <div class="course-list-img">
                  <% if message.parent_id.nil? %>
                      <% content = message.content%>
                  <% else %>
                      <% content = message.parent.content%>
                  <% end %>
                  <% iamge_path = get_image_path_from_content(content) %>
                  <% if iamge_path.nil? %>
                      <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), board_message_url_in_org(message.board.id,message.id), :target => "_blank" %>
                  <% else %>
                      <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_url_in_org(message.board.id,message.id), :target => "_blank" %>
                  <% end %>
                </div>
                <h5>
                  <% if message.parent_id.nil? %>
                     <span><%= link_to message.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank' %></span>
                  <% else %>
                      <span><%= link_to message.parent.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank'%></span>
                  <% end %>
                  <%#= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
                  <%#= link_to document.subject, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %>
                </h5>
                <div class="item-btm clearfix">
                <%=link_to message.try(:author).try(:realname).nil? ? message.try(:author).try(:login) : message.try(:author).try(:realname), user_path(message.author), :class=>"publisher-name fl", :target => "_blank" %></a>
              <p class="pass-time fl"><span><%= format_date message.created_on %></span></p>
              <div class="fr right-info"> <span> <%= message.children.count %></span></div>
              </div>
              </a>
            </li>
        <% else %>
            <li>
              <a href="/#" title="" >
                <div class="course-list-img">
                  <% if message.parent_id.nil? %>
                      <% content = message.content%>
                  <% else %>
                      <% content = message.parent.content%>
                  <% end %>
                  <% iamge_path = get_image_path_from_content(content) %>
                  <% if iamge_path.nil? %>
                      <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), board_message_path(message.board,activity), :target => "_blank" %>
                  <% else %>
                      <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_path(message.board,activity), :target => "_blank" %>
                  <% end %>
                </div>
                <h5>
                  <% if message.parent_id.nil? %>
                      <%= link_to message.subject.to_s.html_safe, board_message_path(message.board,message), :class=> "postGrey"
                      %>
                  <% else %>
                      <%= link_to message.parent.subject.to_s.html_safe, board_message_path(message.board,activity), :class=> "postGrey"
                      %>
                  <% end %>

                  <%#= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
                  <%#= link_to document.subject, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %>
                </h5>
                <div class="item-btm clearfix">
                <%=link_to message.try(:author).try(:realname).nil? ? message.try(:author).try(:login) : message.try(:author).try(:realname), user_path(message.author), :class=>"publisher-name fl", :target => "_blank" %></a>
              <p class="pass-time fl"><span><%= format_date message.created_on %></span></p>
              <div class="fr right-info"> <span> <%= message.children.count %></span></div>
              </div>
              </a>
            </li>
        <% end %>
    <% end %>
    <% if activity.org_act_type == 'News' and News.where("id=?", activity.org_act_id).count > 0 %>
        <% news = News.find(activity.org_act_id) %>
        <li>
          <a href="/#" title="" >
            <div class="course-list-img">
              <% iamge_path = get_image_path_from_content(news.description) %>
              <% if iamge_path.nil? %>
                  <%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), news_path(news), :target => "_blank" %>
              <% else %>
                  <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), news_path(news), :target => "_blank" %>
              <% end %>
            </div>
            <h5><%#= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
              <span><%= link_to news.title.to_s, news_path(news), :target => '_blank' %></span>
            </h5>
            <div class="item-btm clearfix">
            <%=link_to news.try(:author).try(:realname).nil? ? news.try(:author).try(:login) : news.try(:author).try(:realname), user_path(news.author), :class=>"publisher-name fl", :target => "_blank" %></a>
          <p class="pass-time fl"><span><%= format_date news.created_on %></span></p>
          <div class="fr right-info"> <span> <%= news.comments.count %></span></div>
          </div>
          </a>
        </li>
    <% end %>
<% end %>




