<% @nav_dispaly_course_label = 1 %>
<!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 %>
		<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
		<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
		<%= javascript_heads %>
		<%= javascript_include_tag "jquery.leanModal.min" %>
		<%= heads_for_theme %>
		<%= call_hook :view_layouts_base_html_head %>
		<!-- page specific tags -->
		<%= yield :header_tags -%>
	</head>
	<!--add by huang-->
	<body class="<%= h body_css_classes %>">
		<div id="wrapper">
			<div id="wrapper2">
				<div id="wrapper3">					
					<%= render :partial => 'layouts/base_header'%>					
					<div id="main">
						<!--added by huang-->
						<div class="top-content">
							<% @project = Project.find_by_id(@project.id)%>
							<% @course = Course.find_by_extra(@project.identifier)%>
							<table>
								<tr>
									<td class="info_font" style="width: 240px; color: #15bccf">高校课程实践社区</td>
									<td style="color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
									<td rowspan="2" width="250px">
										<div class="top-content-search">
											<%= form_tag(:controller => 'projects', :action => 'search', :method => :get) do %>
											<%= text_field_tag 'name', params[:name], :size => 20 %>
											<%= hidden_field_tag 'project_type', @project.project_type %>
											<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
											<% end %>
										</div>
									</td>
								</tr>
								<tr>
									<td style="padding-left: 8px"><%=link_to request.host()+"/course", :controller => 'projects', :action => 'course' %></td>
									<td><p class="top-content-list"><%=link_to "主页", home_path %> > <%=link_to l(:label_course_practice), :controller => 'projects', :action => 'course' %> > <%=link_to @project.name, nil %></p></td>
								</tr>
							</table>							
						</div>
						<!-- end -->
						<!--project page-->
						<div id="sidebar">
							<div class="spaceleft">
								<!--informations-->
								<div class="inf_user_image">
									<% @project = Project.find_by_id(@project.id) %>
									<% @course = Course.find_by_extra(@project.identifier) %>
									<table>
										<tr><td valign="top">
											<% if(@project.project_type==1) %>
											<% if get_avatar?(@project) %>
											<%= image_tag(url_to_avatar(@project), :class => "avatar2") %>
											<% else %>
											<%= link_to image_tag('../images/avatars/Project/course.jpg',  :class => "avatar2"), project_path(@project) %>
											<% end %>
											<% else %>
											<%= image_tag(url_to_avatar(@project), :class => "avatar2") %>
											<% end %> </td>
											<td>
												<table><tr>
													<td class="info-course"><%= @project.name %></td>
												</tr>
												<tr><td align="center">
													<div id="join_in_course">
													<%if User.current.logged? %>
												<% if @course.teacher.id == User.current.id %>
													<%= link_to l(:label_course_modify_settings), {:controller => 'projects', :action => 'settings', :id => @project} %>
													<%= render :partial => 'courses/set_course_time', :locals => {:project => @project}%>
												<% else %>
										
													<%= join_in_course(@project, User.current) %>
												<% end %> 
												<% unless User.current.member_of?(@project) %>
												<!-- <%= image_tag "/images/fav.png" %> -->
												<div style="padding-right: 10px">
													<span class="icon-fav icon"></span><span>
												<%= watcher_link(@project, User.current) %></span></div>
												<% end %>
											<% end %>
											</div>
												</td></tr></table>
										  </td>
										</tr>
									</table>
								</div>

								<!--parameter-->
								<div class="user_fans">

									<table width="240" border="0">
										<tr align="center" width="80px">
											<% files_count = @project.attachments.count %>
											<% @project.versions.each do |version| %>
											<% files_count += version.attachments.count %>
											<% end %>

											<td class="font_index">
												<!-- %= link_to "#{@project.members.count}", project_member_path(@project) ,:course =>'1'% -->
												<!-- 1 教师； 2 学生；0 全部-->
												<%= link_to "#{teacherCount(@project)}", project_member_path(@project, :role => 1) ,:course =>'1'%>
											</td>
											<td class="font_index">
												<%= link_to "#{studentCount(@project)}", project_member_path(@project, :role => 2) ,:course =>'1'%>
											</td>
											<td class="font_index"><%= link_to files_count, project_files_path(@project) %></td>
										<tr class="font_aram">
											<td align="center" width="80px" id="teacherCount"> 
												<!-- %= l(:label_x_base_courses_member, :count => @project.members.count) % -->
												<%= l(:label_x_base_courses_teacher, :count => teacherCount(@project)) %>
											</td>
											<td align="center" width="80px" id="studentCount">
												<%= l(:label_x_base_courses_student, :count => studentCount(@project)) %>
												<!-- %= l(:label_x_course_data, :count => files_count) % -->
											</td>
											<td align="center" width="80px">
												<%= l(:label_x_course_data, :count => files_count) %>
											</td>

										</tr>
									</table>
									<div class="user_underline"></div>
								</div>
								<!--info-->

								<div class="inf_user_context">
									<table style="font-family:微软雅黑" >
  					
  										<!-- addedby bai 教师姓名加超链接、加入开课时间、结课时间与课时 -->
										<tr>
											<td valign="top" style="padding-left: 8px; width:60px"><%= l(:label_main_teacher) %> :</td><td class="font_lighter_sidebar"><%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher)) %></td>
										</tr>                                                                                                         
										
									    <tr class="hidden">
											<td valign="top" style="padding-left: 8px;"><%= l(:label_setup_time) %> :</td><td class="font_lighter_sidebar"><%= @course.setup_time %></td>
										</tr>
										
										<tr class="hidden">
											<td valign="top" style="padding-left: 8px;"><%= l(:label_endup_time) %> :</td><td class="font_lighter_sidebar"><%= @course.endup_time %></td>
										</tr>

									    <tr>
											<td valign="top" style="padding-left: 8px;"><%= l(:label_class_period) %> :</td><td class="font_lighter_sidebar"><%= @course.class_period %>&nbsp;<%= l(:label_class_hour)%></td>
										</tr>
									
										<tr>
											<td valign="top" style="padding-left: 8px;"><%= l(:label_main_term) %> :</td><td class="font_lighter_sidebar"><%= @course.time %>  <%= @course.term %></td>
										</tr>
										<!-- end -->

										<% unless @course.teacher.user_extensions.nil?%>
										<tr>
											<td valign="top" style="padding-left: 8px;"><%= l(:label_teacher_work_unit) %> :</td><td class="font_lighter_sidebar"><%= @course.teacher.user_extensions.occupation %></td>
										</tr>
										<% else %>
										<tr>
											<td valign="top" style="padding-left: 8px;"><%= l(:label_teacher_work_unit) %> :</td><td class="font_lighter_sidebar"><%= l(:field_course_un) %></td>
										</tr>
										<% end %>

									</table>

								</div>
								<div class="user_underline"></div>
								<!--description-->
								<div class="inf_user_context">
									<div class="font_title_left">
										<%= l(:label_project_overview) %>
									</div>

									<div style="padding-bottom: 8px">
										<% if @project.description.size>0 %>
										<div class="font_lighter_sidebar">

											<%= textilizable @project.description %>
										</div>
										<% else %>
										<div class="font_lighter_sidebar">
											<%= l(:label_course_description_no) %>
										</div>
										<% end %>
										<div class="created_on_project">
											<strong style="color: #068d9c"><%= l(:label_create_time) %>：</strong><%= format_time(@project.created_on) %>
										</div>
									</div>
									<div class="user_underline"></div>
								</div>
								<!--tags-->

								<div class="user_fans">
									<!-- added by william -for tag -->
									<div class="user_tags">
										<div id="tags">
											<%= render :partial => 'tags/tag', :locals => {:obj => @project,:object_flag => "2"}%>
										</div>
									</div>
								</div>

								<div class="user_underline"></div>
							</div>
						</div>
						<div id="content">
							<div class="tabs_new">
								<ul>
									<li>
										<%= link_to l(:label_course_overview), project_path(@project), :class => link_class(:overview) %>
									</li>
									<li>
										<%= link_to l(:label_homework), homework_project_path(@project), :class => link_class(:homework) ,:project_type => 1  %>
									</li>
									<li>
										<%= link_to l(:label_course_file), project_files_path(@project), :class => link_class(:files)%>
									</li>
									<li>
										<%= link_to l(:label_course_news), {:controller => 'news', :action => 'index', :project_id => @project}, :class => link_class(:news) %>
									</li>
									<li>
										<%= link_to l(:label_course_board), { :controller => 'boards', :action => 'index', :project_id => @project}, :class => link_class(:boards) %> 							
									</li>
									<li>
										<%= link_to l(:label_course_feedback), project_feedback_path(@project), :class => link_class(:feedback)%>
									</li>								 	
									<!-- <li><%= link_to(l(:label_course_repository), {:controller => 'repositories', :action => 'show', :id => @project, :repository_id => nil, :path => nil, :rev => nil, :course => 1 })%></li> -->
									<% if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.roles&Role.where('id = ? or id = ?', 7, 9)).size >0))%>

								<% end %>
								</ul>
							</div>
							<%= render_flash_messages %>
							<%= yield %>
							<%= call_hook :view_layouts_base_content %>
							<div style="clear:both;"></div>
							<!--gcm-->
							
						</div>
						<!--gcm move it mistakenly-->
						<%= render :partial => 'layouts/base_footer'%>
					</div>
					<div id="ajax-indicator" style="display:none;">
						<span><%= l(:label_loading) %></span>
					</div>		
					<div id="ajax-modal" style="display:none;"></div>
				</div>
			</div>
			<%= call_hook :view_layouts_base_body_bottom %>
	</body>
</html>