<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<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 %>
  <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus',:media => 'all' %>
  <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
  <%= javascript_heads %>
  <%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
  <%= heads_for_theme %>
  <%= call_hook :view_layouts_base_html_head %>
  <%= 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>
      var onUserCard = false;
      var onImage = false;
      $(document).ready(function(){
          $("#relateProject,.relatePInfo").mouseover(function(){
              $(".relatePInfo").css("display","block");
          });
          $("#relateProject,.relatePInfo").mouseout(function(){
              $(".relatePInfo").css("display","none");
          });
//          $(".homepagePostPortrait").mouseover(function(){
//              onImage = true;
//              $(this).children(".userCard").css("display","block");
//          });
//          $(".homepagePostPortrait").mouseout(function(){
//              var cur = $(this);
//              onImage = false;
//              setTimeout(function(){
//                  if (onUserCard == false && onImage == false) {
//                      $(cur).children(".userCard").css("display","none");
//                  }
//              },500);
//          });
//          $(".userCard").mouseover(function(){
//              onUserCard = true;
//              $(this).css("display","block");
//          });
//          $(".userCard").mouseout(function(){
//              onUserCard = false;
//              $(this).css("display","none");
//          });
          $(".coursesLineGrey").mouseover(function(){
              $(this).css("color","#ffffff");
          });
          $(".coursesLineGrey").mouseout(function(){
              $(this).css("color","#808080");
          });

          //侧导航栏配置设置
          $(".homepageLeftMenuCoursesLine").mouseover(function(){
              $(this).children(".shild").css("background","url(/images/hwork_icon.png) -82px -399px no-repeat");
              $(this).children().css("color","#ffffff");
          });
          $(".homepageLeftMenuCoursesLine").mouseout(function(){
              $(this).children(".shild").css("background","url(/images/hwork_icon.png) -6px -354px no-repeat");
              $(this).children().css("color","#808080");
          });
          $(".subNavRow").mouseover(function(){
              $(this).css("background-color","#269ac9");
              $(this).children().css("color","#ffffff");
          });
          $(".subNavRow").mouseout(function(){
              $(this).css("background-color","#ffffff");
              $(this).children().css("color","#888888");
          });
      })
  </script>
</head>

<body onload="prettyPrint();">
<div class="navContainer">
  <% is_current_user = User.current.logged? && User.current == @user%>
  <% if User.current.logged? %>
      <%= render :partial => 'layouts/logined_header_show' %>
  <% else%>
      <%= render :partial => 'layouts/unlogin_header' %>
  <% end%>
</div>
<div class="cl"></div>
<div class="homepageContentContainer" id="">
  <!--div class="homepageRightBannerImg"></div-->
  <div class="cl"></div>
  <div class="homepageContent">
    <div class="homepageLeft mt10" id="LSide">
      <div class="user_leftinfo mb10">
        <% if User.current.logged?%>
            <a href ="javascript:void(0);" disabled="true" class="user_leftinfo_img"><%= image_tag(url_to_avatar(@user), width:"74", height: "74", :id=>'nh_user_tx')%></a>
        <% else %>
            <img src="images/user/male.jpg" width="74" height="74" />
        <% end %>
        <% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %>
            <span class="<%= @user.user_extensions.gender == 1 ? 'user_leftinfo_female' : 'user_leftinfo_male' %> "></span>
        <% end %>
        <div class="user_info_inner">
          <div class=" user_leftinfo_namebox" >
            <a href="javascript:void(0);" class="user_leftinfo_name"><%= @user.show_name %></a>
            <% if @user.user_extensions && @user.user_extensions.identity %>
                <span class="user_cirbtn_yellow" ><%= get_user_roll @user %></span>
            <% end%>
          </div>
          <div>
            <div class="user_info_intro">
              <div id="user_brief_introduction_show">
                <%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %>
              </div>
            </div>
            <textarea class="homepageSignatureTextarea none" placeholder="请编辑签名" id="user_brief_introduction_edit" onblur="edit_user_introduction('<%= edit_brief_introduction_user_path(@user.id) %>');"><%= @user.user_extensions.brief_introduction %></textarea>
          </div>
          <ul class="user_atten clear">
            <li>
              <a href="javascript:void(0);" disabled="true">
                <strong>博客</strong><br />
                <span class="sy_cgrey"><%=@user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count %></span>
              </a>
            </li>
            <li>
              <a href="javascript:void(0);" disabled="true">
                <strong>关注</strong><br />
                <span class="sy_cgrey"><%=User.watched_by(@user.id).count %></span>
              </a>
            </li>
            <li>
              <a href="javascript:void(0);" disabled="true">
                <strong>粉丝</strong><br />
                <span class="sy_cgrey"><%= @user.watcher_users.count %></span>
              </a>
            </li>
          </ul>
        </div>
        <div id="watch_user_btn_div">
          <%= link_to "编辑个人资料", my_account_path(:tip => 1), :class => "user_editinfo"%>
        </div>
      </div>

      <div class="user_leftnav ">
        <% if hidden_unproject_infos %>
            <ul class="users_accordion mb10">
              <li id="user_01" class="user_icons_course">
                <a href ="javascript:void(0);" disabled="true">课程</a>
                <% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at)  FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %>
                <% all_count = @user.courses.visible.where("is_delete =?", 0).count%>
                <div class="<%= courses.empty? ? 'none' : ''%>" >
                  <div id="homepageLeftMenuCourses">
                    <ul class="user_sub_menu" id="user_courses_li">
                    </ul>
                  </div>
                  <% if !courses.empty? %>
                      <a class="user_navmorebox" href="javascript:void(0);" id="user_hide_course" >
                        <span id="hide_show_courseicon" class="user_icons_closeclass"></span>
                      </a>
                  <% end %>
                </div>
              </li>
              <% if is_current_user %>
                  <li id="user_02"  class="user_icons_new">
                    <a href ="javascript:void(0);" disabled="true">新建课程</a>
                  </li>
                  <li id="user_03" class="user_icons_new">
                    <a href ="javascript:void(0);" disabled="true">新建班级</a>
                  </li>
                  <li id="user_04" class="user_icons_addclass">
                    <a href ="javascript:void(0);" disabled="true">加入班级</a>
                  </li>
                  <% if @user == User.current %>
                      <li id="user_05" class="user_icons_myhw">
                        <a href ="javascript:void(0);" disabled="true">我的作业</a>
                      </li>
                  <% end %>
              <% end %>
            </ul>
        <% end %>

        <ul class="users_accordion mb10">
          <li id="user_06" class="user_icons_project">
            <a href ="javascript:void(0);" disabled="true">项目</a>
            <% all_count = @user.projects.visible.count%>
            <% projects = @user.projects.visible.select("projects.*, (SELECT MAX(updated_at)  FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)%>
            <div class="<%= projects.empty? ? 'none' : ''%>" >
              <div id="homepageLeftMenuForge">
                <ul class="user_sub_menu" id="user_projects_li">
                </ul>
              </div>
              <% if !projects.empty? %>
                  <a class="user_navmorebox" href="javascript:void(0);" id="user_hide_project" onclick="leftProjectslistChange();">
                    <span id="hide_show_projecticon" class="user_icons_closeclass"></span>
                  </a>
              <% end %>
            </div>
          </li>
          <% if is_current_user %>
              <li id="user_07"  class="user_icons_new">
                <a href ="javascript:void(0);" disabled="true">新建项目</a>
              </li>
              <li id="user_08" class="user_icons_addproject">
                <a href ="javascript:void(0);" disabled="true">加入项目</a>
              </li>
              <!--<li id="user_09" class="user_icons_myissues">-->
              <!--<a href="#user_09" >我的任务</a>-->
              <!--</li>-->
          <% end %>
        </ul>
        <ul class="users_accordion mb10">
          <li id="user_10" class="user_icons_mes">
            <a href ="javascript:void(0);" disabled="true">留言</a>
          </li>
        </ul>
      </div><!--sy_class_leftnav end-->

      <div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %> （自2016年5月）</div>
    </div>
    <div class="homepageRight">
      <%= yield %>
    </div>
  </div>
  <% if hidden_unproject_infos %>
      <%= render :partial => 'layouts/forbidden_new_feedback' %>
  <% end %>
</div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer_show' %>
<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>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
  <div>
    <div><a href="javascript:hideModal();" class="box_close"></a></div>
    <div class="cl"></div>
    <div class="pro_new">
      <h3 class="box_h3 mb10">头像设置</h3>
      <div class="uppicBox">
        <input type="button" class="uppic_btn" onclick="$('#upload_user_image').click();" value="浏览.."/>
        <%= file_field_tag 'avatar[image]',
                           :id => "upload_user_image",
                           :style => 'display:none;',#added by young
                           :size => "1",
                           :multiple => false,
                           :onchange => 'addInputAvatar(this);',
                           :data => {
                                   :max_file_size => Setting.attachment_max_size.to_i.kilobytes,
                                   :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
                                   :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
                                   :file_type => Redmine::Configuration['pic_types'].to_s,
                                   :type_support_message => l(:error_pic_type),
                                   :upload_path => upload_avatar_path(:format => 'js'),
                                   :description_placeholder => nil ,# l(:label_optional_description)
                                   :source_type => @user.class.to_s,
                                   :source_id => @user.id.to_s
                           } %>
        <!--<br/>-->
        <!--<span>只支持jpg,png,gif,大小不超过5M</span>-->
      </div>
      <div class="showpicBox">
        <p>预览</p>
        <%= image_tag(url_to_avatar(@user), :style=>"width:96px;height:96px;",:class=>"mb5 mt10",:nhname=>'avatar_image') %>
        <br/>
        <span >96px*96px</span> <br />
        <div class="mb20"></div>
        <%= image_tag(url_to_avatar(@user), :style=>"width:48px;height:48px;",:class=>"mb5",:nhname=>'avatar_image') %>
        <br />
        <span>48px*48px</span> <br />
      </div>
      <div class="cl mb10"></div>
      <a href="javascript:void(0);" class=" fr grey_btn mr15 f14"> 取&nbsp;&nbsp;消</a>
      <a href="javascript:void(0);" data-remote="true" class="blue_btn fr mr10 f14">确&nbsp;&nbsp;定</a>
    </div><!--talknew end-->
    <div class="cl"></div>
  </div><!--floatbox end-->
</div>
<script type="text/javascript">
    $(function(){
        $('#user_hide_course').hide();
        $('#user_hide_project').hide();
        autoUrl("user_brief_introduction_show");
        if(<%= @is_course == 1 %>) {
            $("#user_course_list").addClass('active');
        } else if(<%= @is_project == 1 %>) {
            $("#user_project_list").addClass('active');
        }
    });

    $("#courseMenu").mouseenter(function(){
        $("#topnav_course_menu").show();
    });
    $("#courseMenu").mouseleave(function(){
        $("#topnav_course_menu").hide();
    });
    $("#projectMenu").mouseenter(function(){
        $("#topnav_project_menu").show();
    });
    $("#projectMenu").mouseleave(function(){
        $("#topnav_project_menu").hide();
    });
    function leftCourseslistChange(){
        var target = $('#user_courses_li>li');
        for(var i = 10; i < target.length; i++){
            target.eq(i).slideToggle();
        }
        $('#hide_show_courseicon').toggleClass("user_icons_closeclass");
        $('#hide_show_courseicon').toggleClass("user_icons_moreclass");

    }
    function leftProjectslistChange(){
        var target = $('#user_projects_li>li');
        for(var i = 10; i < target.length; i++){
            target.eq(i).slideToggle();
        }
        $('#homepageLeftMenuForge').slideToggle();
        $('#hide_show_projecticon').toggleClass("user_icons_closeclass");
        $('#hide_show_projecticon').toggleClass("user_icons_moreclass");
    }
</script>
</body>
</html>
