<div class="por_course mt10 clear" style="display:<%= field.hide == 0 ? 'block':'none' %>;">
<% if is_default_field?(field) %>
    <% case field.name %>
    <% when 'course' %>
        <h2 class="por_h2_index clear">班级动态</h2>
        <% if @course_acts.blank? %>
            <p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p>
        <% else %>
            <% @course_acts.first(4).each do |act| %>
                <% if act.org_act_type == "HomeworkCommon" %>
                    <% activity = act.org_act %>
                    <% iamge_path = get_image_path_from_content(activity.description) %>
                    <div class="por_course_bar fl clear">
                      <%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "por_course_title link-black", :title => activity.name.to_s %>
                      <% if iamge_path.nil? %>
                          <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"fl" %>
                      <% else %>
                          <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"fl" %>
                      <% end %>
                      <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
                      <span class=" por_course_time"><%= time_from_now(activity.updated_at) %></span>
                    </div>
                <% elsif act.org_act_type == "Message" %>
                    <% activity = act.org_act %>
                    <% iamge_path = get_image_path_from_content(activity.content) %>
                    <div class="por_course_bar fl clear">
                      <%= link_to activity.parent_id.nil? ? activity.subject : activity.parent.subject, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "por_course_title link-black", :title => activity.parent_id.nil? ? activity.subject : activity.parent.subject %>
                      <% if iamge_path.nil? %>
                          <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"fl" %>
                      <% else %>
                          <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"fl" %>
                      <% end %>
                      <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
                      <span class=" por_course_time"><%= time_from_now activity.updated_on %></span>
                    </div>
                <% elsif act.org_act_type == "News" %>
                    <% activity = News.find(act.org_act_id) %>
                    <% iamge_path = get_image_path_from_content(activity.description) %>
                    <div class="por_course_bar fl clear">
                      <%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "por_course_title link-black", :title => activity.title %>
                      <% if iamge_path.nil? %>
                          <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), news_url_in_org(activity.id), :target => "_blank", :class =>"fl" %>
                      <% else %>
                          <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), news_url_in_org(activity.id), :target => "_blank", :class =>"fl" %>
                      <% end %>
                      <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
                      <span class=" por_course_time"><%= time_from_now activity.created_on %></span>
                    </div>
                <% elsif act.org_act_type == "Poll" %>
                    <% activity = act.org_act %>
                    <% has_commit = has_commit_poll?(activity.id ,User.current)%>
                    <% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
                    <% iamge_path = get_image_path_from_content(activity.polls_description) %>
                    <% if ( activity.polls_status==2) %>
                        <div class="por_course_bar fl clear">
                          <% if has_commit %>
                              <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "por_course_title link-black", :title => poll_name %>
                          <% else %>
                              <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "por_course_title link-black", :title => poll_name %>
                          <% end %>
                          <% if iamge_path.nil? %>
                              <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"fl" %>
                          <% else %>
                              <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"fl" %>
                          <% end %>
                          <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.polls_description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
                          <span class=" por_course_time"><%= time_from_now activity.published_at %></span>
                        </div>
                    <% end %>
                <% end %>
            <% end %>
        <% end %>
    <% when 'project' %>
        <h2 class="por_h2_index clear">项目动态</h2>
        <% if @project_acts.blank? %>
            <p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p>
        <% else %>
            <% @project_acts.first(4).each do |act| %>
                <% if act.org_act_type == "Issue" %>
                    <% activity = act.org_act %>
                    <% iamge_path = get_image_path_from_content(activity.description) %>
                    <div class="por_course_bar fl clear">
                      <%= link_to activity.subject, issue_url_in_org(activity.id), :target => '_blank', :class => "por_course_title link-black", :title => activity.subject %>
                      <% if iamge_path.nil? %>
                          <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), issue_url_in_org(activity.id), :target => "_blank", :class =>"fl" %>
                      <% else %>
                          <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), issue_url_in_org(activity.id), :target => "_blank", :class =>"fl" %>
                      <% end %>
                      <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
                      <span class=" por_course_time"><%= time_from_now activity.updated_on %></span>
                    </div>
                <% elsif act.org_act_type == "Message" %>
                    <% activity = act.org_act %>
                    <% iamge_path = get_image_path_from_content(activity.content) %>
                    <% subject = activity.parent_id.nil? ? activity.subject : activity.parent.subject %>
                    <div class="por_course_bar fl clear">
                      <%= link_to subject, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "por_course_title link-black", :title => subject %>
                      <% if iamge_path.nil? %>
                          <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"fl" %>
                      <% else %>
                          <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"fl" %>
                      <% end %>
                      <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
                      <span class=" por_course_time"><%= time_from_now activity.updated_on %></span>
                    </div>
                <% elsif act.org_act_type == "News" %>
                    <% activity = act.org_act %>
                    <% iamge_path = get_image_path_from_content(activity.description) %>
                    <div class="por_course_bar fl clear">
                      <%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "por_course_title link-black", :title => activity.title %>
                      <% if iamge_path.nil? %>
                          <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), news_url_in_org(activity.id), :target => "_blank", :class =>"fl" %>
                      <% else %>
                          <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), news_url_in_org(activity.id), :target => "_blank", :class =>"fl" %>
                      <% end %>
                      <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
                      <span class=" por_course_time"><%= time_from_now activity.created_on %></span>
                    </div>
                <% end %>
            <% end %>
        <% end %>
    <% end %>
<% else %>
    <% if field.field_type == "Post" %>
        <% org_acts = get_subfield_acts field %>
        <% if org_acts.blank? %>
            <h2 class="por_h2_index clear"><%= field.name %></h2>
            <p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p>
        <% else %>
            <h2 class="por_h2_index clear"><%= field.name %>
              <%= render :partial => 'organizations/link_subfield_more', :locals => {:field => field} %>
            </h2>
            <% org_acts.first(4).each do |activity| %>
                <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
                    <% document = activity.org_act %>
                    <% org_subfield_id = params[:org_subfield_id] %>
                    <% iamge_path = get_image_path_from_content(document.content) %>
                    <div class="por_course_bar fl clear">
                      <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "por_course_title link-black", :title => document.title %>
                      <% if iamge_path.nil? %>
                          <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"fl" %>
                      <% else %>
                          <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"fl" %>
                      <% end %>
                      <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => document.id, :content=> document.content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
                      <span class=" por_course_time"><%= time_from_now document.created_at %></span>
                    </div>
                <% else 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 = activity.org_act %>
                        <% title = message.parent_id.nil? ? message.subject : message.parent.subject %>
                        <% content = message.parent_id.nil? ? message.content : message.parent.content%>
                        <% iamge_path = get_image_path_from_content(content) %>
                        <% if message.board.org_subfield_id %>
                            <div class="por_course_bar fl clear">
                              <%= link_to title, board_message_url_in_org(message.board.id, message.id), :target => '_blank', :class => "por_course_title link-black", :title => title %>
                              <% if iamge_path.nil? %>
                                  <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), board_message_url_in_org(message.board.id, message.id), :target => "_blank", :class =>"fl" %>
                              <% else %>
                                  <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), board_message_url_in_org(message.board.id, message.id), :target => "_blank", :class =>"fl" %>
                              <% end %>
                              <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
                              <span class=" por_course_time"><%= time_from_now  message.created_on %></span>
                            </div>
                        <% else %>
                            <div class="por_course_bar fl clear">
                              <%= link_to title, board_message_path(message.board, message.id), :target => '_blank', :class => "por_course_title link-black", :title => title %>
                              <% if iamge_path.nil? %>
                                  <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), board_message_path(message.board.id, message.id), :target => "_blank", :class =>"fl" %>
                              <% else %>
                                  <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), board_message_path(message.board.id, message.id), :target => "_blank", :class =>"fl" %>
                              <% end %>
                              <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
                              <span class=" por_course_time"><%= time_from_now  message.created_on %></span>
                            </div>
                        <% end %>
                    <% end %>
                    <% if activity.org_act_type == 'News' and News.where(:id => activity.org_act_id).count > 0 %>
                        <% news = activity.org_act %>
                        <% iamge_path = get_image_path_from_content(news.description) %>
                        <div class="por_course_bar fl clear">
                          <%= link_to news.title, news_path(news), :target => '_blank', :class => "por_course_title link-black", :title => news.title %>
                          <% if iamge_path.nil? %>
                              <%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), news_path(news), :target => "_blank", :class =>"fl" %>
                          <% else %>
                              <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), news_path(news), :target => "_blank", :class =>"fl" %>
                          <% end %>
                          <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => news.id, :content=> news.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
                          <span class=" por_course_time"><%= time_from_now  news.created_on %></span>
                        </div>
                    <% end %>
                <% end %>
            <% end %>
        <% end %>
    <% elsif 'Compcou' %>
        <h2 class="por_h2_index clear"><%= field.name %></h2>
        <% if @excellent_courses.blank? %>
            <p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p>
        <% else %>
            <% @excellent_courses.first(4).each do |course| %>
                <div class="por_course_bar fl clear">
                  <%= link_to course.name, course_path(course.id), :target => '_blank', :class => "por_course_title link-black", :title => course.name %>
                  <%= link_to image_tag(url_to_avatar(course),:width => "140", :height => "100"), course_path(course), :target => "_blank", :class => "fl" %>
                  <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => course.id, :content=> course.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
                  <span class=" por_course_time"><%= current_time_and_term course %></span>
                </div>
            <% end %>
        <% end %>
    <% end %>
<% end %>
<div class="cl"></div>
</div><!--por_course end-->