<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title><%= h html_title %></title>
  <meta name="description" content="<%= Redmine::Info.app_name %>" />
  <meta name="keywords" content="issue,bug,tracker" />
  <%= csrf_meta_tag %>
  <%= favicon %>
  <%= javascript_heads %>
  <%= heads_for_theme %>
  <%= stylesheet_link_tag  'org_new_style','jquery/jquery-ui-1.9.2' %>
  <%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%>
  <%= javascript_include_tag 'attachments' %>
  <%#= call_hook :view_layouts_base_html_head %>
  <!-- page specific tags -->
  <%#= yield :header_tags -%>
  <!-- MathJax的配置 -->
  <script type="text/javascript"
          src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
  </script>
  <!-- 配置 ： 在生成的公式图片上去掉Math定义的右键菜单，$$ $$ \( \) \[ \] 中的公式给予显示-->
  <script type="text/x-mathjax-config">
        MathJax.Hub.Config({
        showMathMenu: false,
        showMathMenuMSIE: false,
          tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
        });
  </script>
  <script>
      jQuery(document).ready(function($){
          // browser window scroll (in pixels) after which the "back to top" link is shown
          var offset = 300,
          //browser window scroll (in pixels) after which the "back to top" link opacity is reduced
                  offset_opacity = 1200,
          //duration of the top scrolling animation (in ms)
                  scroll_top_duration = 700,
          //grab the "back to top" link
                  $back_to_top = $('.cd-top');

          //hide or show the "back to top" link
          $(window).scroll(function(){
              ( $(this).scrollTop() > offset ) ? $back_to_top.addClass('cd-is-visible') : $back_to_top.removeClass('cd-is-visible cd-fade-out');
              if( $(this).scrollTop() > offset_opacity ) {
                  $back_to_top.addClass('cd-fade-out');
              }
          });

          //smooth scroll to top
          $back_to_top.on('click', function(event){
              event.preventDefault();
              $('body,html').animate({
                          scrollTop: 0 ,
                      }, scroll_top_duration
              );
          });

      });
  </script>

</head>

<!--add by huang-->
<script type="text/javascript">
    function org_new_files_upload()
    {
        $('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_org_new_files',:locals => {:org => @organization, :org_attachment_type => 0}) %>');
        showModal('ajax-modal', '513px');
        $('#ajax-modal').siblings().remove();
        $('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
        $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9");
        $('#ajax-modal').parent().addClass("popbox_polls");
    }

    function org_new_files_banner_upload()
    {
        $('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_org_new_files_banner',:locals => {:org => @organization, :org_attachment_type => 1}) %>');
        showModal('ajax-modal', '513px');
        $('#ajax-modal').siblings().remove();
        $('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
        $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9");
        $('#ajax-modal').parent().addClass("popbox_polls");
    }
</script>
<body onload="prettyPrint();">
<div class="cl"></div>
<div class="container">
  <div class="header">
    <div class="header-con">
      <% if User.current.admin_of_org?(@organization) %>
          <div class="logo fl">
            <% if @org_logo_attchment.blank? %>
                <a class="logo-img"><img src="/images/org_new_style/logo.jpg" alt=""/></a>
            <% else %>
                <img src="/attachments/<%= @org_logo_attchment.id %>/<%= @org_logo_attchment.filename %>" class="logo-img">
            <% end %>
            <a href="#" class="logo-add" title="点击替换LOGO" onclick="org_new_files_upload();"></a>
          </div>
       <% else %>
          <div class="logo fl">
            <% if @org_logo_attchment.blank? %>
                <a class="logo-img"><img src="/images/org_new_style/logo.jpg" alt=""/></a>
            <% else %>
                <img src="/attachments/<%= @org_logo_attchment.id %>/<%= @org_logo_attchment.filename %>" class="logo-img">
            <% end %>
          </div>
       <% end %>
      <%= render :partial => 'organizations/org_logined_header' %>
    </div>
    <div class="cl"></div>
  </div><!--header end-->

  <div class="nav-box">
    <div class="nav-con">
      <div class="nav fl">
        <% @subfield_content.each do |field| %>
            <% if is_default_field?(field) %>
                <% case field.name %>
        <% when 'activity' %>
                    <%= link_to "首页", organization_path(@organization), :class => "fl navact" %>
                <% when 'course' %>
                    <a href="#course_<%= field.id %>" class="fl"> 课程动态</a>
                <% when 'project' %>
                    <a href="#project_<%= field.id %>" class="fl">项目动态</a>
                <% end %>
            <% else %>
                <% if field.field_type == "Post" && field.hide == 0 %>
                    <a href="#message_<%= field.id %>" class="fl"><%= field.name %></a>
                <% elsif field.field_type == "Resource" && field.hide == 0 %>
                    <a href="#resource_<%= field.id %>" class="fl"><%= field.name %></a>
                <% end %>
            <% end %>
        <% end %>
        <% if User.current.admin_of_org?(@organization) %>
            <a href="<%= setting_organization_path(@organization) %>" class="fl">配置</a>
        <% end %>
      </div>
      <div class="cl"></div>
    </div>
  </div>
  <!--nav end-->

  <div class="banner">
    <div class="banner-inner">
      <% if User.current.admin_of_org?(@organization) %>
          <% if @org_banner_attchment.blank? %>
              <img class="banner-img" src="/images/org_new_style/banner.jpg" alt=""/>
          <% else %>
              <img src="/attachments/<%= @org_banner_attchment.id %>/<%= @org_banner_attchment.filename %>" class="banner-img">
          <% end %>
          <a href="#" class="banner-add" title="点击替换图片" onclick="org_new_files_banner_upload();"></a>
          <div class="banner-txt">
            <p ><%= @organization.name  %></p>
          </div>
      <% else %>
          <% if @org_banner_attchment.blank? %>
              <img class="banner-img" src="/images/org_new_style/banner.jpg" alt=""/>
          <% else %>
              <img src="/attachments/<%= @org_banner_attchment.id %>/<%= @org_banner_attchment.filename %>" class="banner-img">
          <% end %>
          <div class="banner-txt">
            <p ><%= @organization.name  %></p>
          </div>
      <% end %>
    </div>
  </div>

  <!--模块-->
  <% @subfield_content.each do |field| %>
      <% if is_default_field?(field) %>
          <% case field.name %>
          <% when 'course' %>
              <div class="box1 bg-grey" style="display:<%= field.hide == 0?'block':'none' %>;">
               <% if field.status == 0 %>
                    <div class="content ">
                      <div class="box-top"  id="course_<%= field.id %>"><h2 class="box-title">课程动态</h2></div>
                      <% if @course_acts.blank? %>
                          <p class="nocontent">暂无内容，敬请期待！</p>
                          <div class="cl"></div>
                          <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
                          <div class="cl"></div>
                      <% else %>
                          <div class="course-list">
                            <ul class="clearfix">
                              <% unless @course_acts.nil? %>
                                  <%= render :partial => 'organizations/org_new_course_pic', :locals => {:activities => @course_acts.first(3)} %>
                              <% end %>
                              <div class="cl"></div>
                              <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
                              <div class="cl"></div>
                            </ul>
                          </div>
                      <% end %>
                    </div><!--content end-->
               <% else %>
                    <div class="content">
                      <div class="box-top"  id="course_<%= field.id %>"><h2 class="box-title">课程动态</h2></div>
                      <% if @course_acts.blank? %>
                          <p class="nocontent">暂无内容，敬请期待！</p>
                          <div class="cl"></div>
                          <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
                          <div class="cl"></div>
                      <% else %>
                          <div class="row">
                            <%= render :partial => 'organizations/org_new_course_act_list', :locals =>{:activities => @course_acts, :field => field, :organization => @organization} %>
                            <!--row-ziyuan end-->
                          </div>
                          <div class="cl"></div>
                          <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
                          <div class="cl"></div>
                      <% end %>


                    </div><!--row end-->
               <% end %>
              </div><!--box1 end-->
          <% when 'project' %>
            <div class="box1" style="display:<%= field.hide == 0?'block':'none' %>;">
            <% if field.status == 0 %>
                <div class="content ">
                  <div class="box-top"  id="project_<%= field.id %>"><h2 class="box-title">项目动态</h2><p class="box-title-p"></p></div>
                  <% if @project_acts.blank? %>
                      <p class="nocontent">暂无内容，敬请期待！</p>
                      <div class="cl"></div>
                      <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
                      <div class="cl"></div>
                  <% else %>
                      <div class="course-list">
                        <ul class="clearfix">
                          <% unless @project_acts.nil? %>
                              <%= render :partial => 'organizations/org_new_project_pic', :locals => {:activities => @project_acts.first(3)} %>
                          <% end %>
                          <div class="cl"></div>
                          <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
                          <div class="cl"></div>
                        </ul>
                      </div>
                  <% end %>

                </div><!--content end-->
            <% else %>
                <div class="content">
                  <div class="box-top" style="display:<%= field.hide == 0?'block':'none' %>;"  id="project_<%= field.id %>"><h2 class="box-title">项目动态</h2><p class="box-title-p"></p></div>
                  <% if @project_acts.blank? %>
                      <p class="nocontent">暂无内容，敬请期待！</p>
                      <div class="cl"></div>
                      <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
                      <div class="cl"></div>
                  <% else %>
                      <div class="row">
                        <%= render :partial => 'organizations/org_new_project_act_list', :locals =>{:activities => @project_acts, :field => field, :organization => @organization} %>
                        <!--row-ziyuan end-->
                      </div>
                      <div class="cl"></div>
                      <%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
                      <div class="cl"></div>
                  <% end %>

                </div><!--row end-->
            <% end %>
            </div>
          <% end %>
      <% else %>
          <% if field.field_type == "Post" %> <%# 讨论类型 %>
            <% org_subfield = OrgSubfield.find(field.id) %>
            <% org_subfield_ids = org_subfield.org_document_comments.map(&:id) << 0 %>
            <% org_acts = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{org_subfield.id})").order('updated_at desc') %>
            <%# message_ats = get_message_org(@organization.id, field.id) %>
              <%# ids = field.org_document_comments.map{|o| o.id}.join(",") %>
              <div class="box1 bg-grey" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
                <% if field.status == 0 %>
                    <div class="content">
                      <div class="box-top" id="message_<%= field.id %>"><h2 class="box-title"><%= field.name %></h2></div>
                      <% if org_acts.blank? %>
                          <p class="nocontent">暂无内容，敬请期待！</p>
                          <div class="cl"></div>
                          <% if !field.subfield_subdomain_dir.nil? %> <!--讨论帖子-->
                              <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
                                  <%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank"  %>
                              <% else %>
                                  <%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank"  %>
                              <% end %>
                          <% else %>
                              <%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank"  %>
                          <% end %>

                          <%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
                          <div class="cl"></div>
                      <% else %>
                          <div class="course-list">
                            <ul class="clearfix">

                              <% org_acts.first(3).each do |act| %>
                                  <%= render :partial => 'organizations/org_new_forum_pic', :locals => {:activity => act, :field => field, :organization => @organization} %>
                              <% end %>
                              <div class="cl"></div>
                            </ul>
                            <% if !field.subfield_subdomain_dir.nil? %> <!--讨论帖子-->
                                <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
                                    <%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank"  %>
                                <% else %>
                                    <%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank"  %>
                                <% end %>
                            <% else %>
                                <%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank"  %>
                            <% end %>
                            <%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
                            <div class="cl"></div>
                          </div>
                      <% end %>

                    </div><!--content end-->
                <% else %>
                    <div class="content">
                      <div class="box-top" id="message_<%= field.id %>"><h2 class="box-title"><%= field.name %></h2></div>
                      <% if org_acts.blank? %>
                          <p class="nocontent">暂无内容，敬请期待！</p>
                          <div class="cl"></div>
                          <% if !field.subfield_subdomain_dir.nil? %> <!--讨论帖子-->
                              <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
                                  <%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank"  %>
                              <% else %>
                                  <%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank"  %>
                              <% end %>
                          <% else %>
                              <%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank"  %>
                          <% end %>
                          <div class="cl"></div>
                      <% else %>
                          <div class="row">
                            <% org_acts.each do |act| %>
                                <%= render :partial => 'organizations/org_new_forum_list', :locals => {:activity => act, :field => field, :organization => @organization} %>
                            <% end %>
                            <!--row-ziyuan end-->
                          </div>
                          <div class="cl"></div>
                          <% if !field.subfield_subdomain_dir.nil? %> <!--讨论帖子-->
                              <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
                                  <%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank"  %>
                              <% else %>
                                  <%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank"  %>
                              <% end %>
                          <% else %>
                              <%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank"  %>
                          <% end %>
                          <div class="cl"></div>
                      <% end %>

                    </div><!--row end-->
                    <div class="cl"></div>
                <% end %>
              </div><!--box1 end-->
          <% elsif field.field_type == "Resource" %>
              <% org_attachs = get_attach_org2(field) %>
              <div class="box1" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
                <div class="content">
                  <div class="box-top" id="resource_<%= field.id %>"><h2 class="box-title"><%= field.name %></h2></div>
                  <% if org_attachs.blank? %>
                      <p class="nocontent">暂无内容，敬请期待！</p>
                      <div class="cl"></div>
                      <% if !field.subfield_subdomain_dir.nil? %>
                          <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
                              <%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30", :target => "_blank" %>
                          <% else %>
                              <%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30", :target => "_blank"  %>
                          <% end %>
                      <% else %>
                          <%= link_to "More", org_subfield_files_path(field), :class => "more-btn-center mt30", :target => "_blank"  %>
                      <% end %>
                      <%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
                      <div class="cl"></div>
                  <% else %>
                      <div class="row">
                        <%= render :partial => 'organizations/org_new_resource', :locals => {:org_attachs => org_attachs} %>
                        <!--row-ziyuan end-->
                      </div>

                      <div class="cl"></div>
                      <% if !field.subfield_subdomain_dir.nil? %>
                          <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
                              <%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30", :target => "_blank" %>
                          <% else %>
                              <%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30", :target => "_blank"  %>
                          <% end %>
                      <% else %>
                          <%= link_to "More", org_subfield_files_path(field), :class => "more-btn-center mt30", :target => "_blank"  %>
                      <% end %>
                      <%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
                      <div class="cl"></div>
                  <% end %>

                </div><!--row end-->
                <div class="cl"></div>
              </div><!--box1 end-->
              </div>
          <% end %>
      <% end %>
  <% end %>

  <%# 更新访问数,刷新的时候更新访问次数 %>
  <%  update_visiti_count @organization %>
  <%# over %>

  <div class="footer">
    <div class="footer-con">
      <ul>
        <li><a href="<%= about_us_path %>" target="_blank" class="fl">关于我们</a></li>
        <li><a href="<%= agreement_path %>" target="_blank" class="fl"> 服务协议 </a></li>
        <li><a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="fl">帮助中心</a></li>
        <li><a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="fl"> 贴吧交流</a></li>
      </ul>
      <div class="cl"></div>
      <p>Copyright 2007~2016  All Rights Reserved<br>湘ICP备09019772</p>
    </div>
  </div>
  <!--backtop end-->
  <main class="cd-container">
  </main>
  <a href="#0" class="cd-top">Top</a>

  </div><!--container end-->

  <!--页面底部-->
  <div class="cl"></div>
  <div id="ajax-modal" style="display:none;"></div>

  <div id="ajax-indicator" style="display:none;">
    <span><%= l(:label_loading) %></span>
  </div>
  <%#= call_hook :view_layouts_base_body_bottom %>
  </body>
</html>

