Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
sw 2014-05-20 08:49:00 +08:00
commit c141501085
3 changed files with 280 additions and 244 deletions

View File

@ -31,6 +31,31 @@ module CoursesHelper
# searchStudent(project).count # searchStudent(project).count
end end
# garble count 混淆数量
# alias projectCountOrigin projectCount
# def projectCount project
# count = projectCountOrigin project
# garble count
# end
alias teacherCountOrigin teacherCount
def teacherCount project
count = teacherCountOrigin project
garble count
end
alias studentCountOrigin studentCount
def studentCount project
count = studentCountOrigin project
garble count
end
def garble count
count = count.round( 1-count.to_s.size ).to_i
return count.to_s if count.to_s.size.eql?(1)
count.to_s << '+'
end
# ===================================================================================== # =====================================================================================
# return people list # return people list
def searchTeacherAndAssistant project def searchTeacherAndAssistant project

View File

@ -1,257 +1,270 @@
<% @nav_dispaly_course_label = 1 %> <% @nav_dispaly_course_label = 1 %>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title><%= h html_title %></title> <title><%= h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>" /> <meta name="description" content="<%= Redmine::Info.app_name %>"/>
<meta name="keywords" content="issue,bug,tracker" /> <meta name="keywords" content="issue,bug,tracker"/>
<%= csrf_meta_tag %> <%= csrf_meta_tag %>
<%= favicon %> <%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %> <%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" %> <%= javascript_include_tag "jquery.leanModal.min" %>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>
</head> </head>
<!--add by huang--> <!--add by huang-->
<body class="<%= h body_css_classes %>"> <body class="<%= h body_css_classes %>">
<div id="wrapper"> <div id="wrapper">
<div id="wrapper2"> <div id="wrapper2">
<div id="wrapper3"> <div id="wrapper3">
<%= render :partial => 'layouts/base_header'%> <%= render :partial => 'layouts/base_header' %>
<div id="main"> <div id="main">
<!--added by huang--> <!--added by huang-->
<div class="top-content"> <div class="top-content">
<% @project = Project.find_by_id(@project.id)%> <% @project = Project.find_by_id(@project.id) %>
<% @course = Course.find_by_extra(@project.identifier)%> <% @course = Course.find_by_extra(@project.identifier) %>
<table> <table>
<tr> <tr>
<td class="info_font" style="width: 240px; color: #15bccf">高校课程实践社区</td> <td class="info_font" style="width: 240px; color: #15bccf">高校课程实践社区</td>
<td style="color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td> <td style="color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
<td rowspan="2" width="250px"> <td rowspan="2" width="250px">
<div class="top-content-search"> <div class="top-content-search">
<%= form_tag(:controller => 'projects', :action => 'search', :method => :get) do %> <%= form_tag(:controller => 'projects', :action => 'search', :method => :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20 %> <%= text_field_tag 'name', params[:name], :size => 20 %>
<%= hidden_field_tag 'project_type', @project.project_type %> <%= hidden_field_tag 'project_type', @project.project_type %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %> <%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<% end %> <% end %>
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="padding-left: 8px"><%=link_to request.host()+"/course", :controller => 'projects', :action => 'course' %></td> <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> <td><p class="top-content-list"><%= link_to "主页", home_path %>
</tr> > <%= link_to l(:label_course_practice), :controller => 'projects', :action => 'course' %>
</table> > <%= link_to @project.name, nil %></p></td>
</div> </tr>
<!-- end --> </table>
<!--project page--> </div>
<div id="sidebar"> <!-- end -->
<div class="spaceleft"> <!--project page-->
<!--informations--> <div id="sidebar">
<div class="inf_user_image"> <div class="spaceleft">
<% @project = Project.find_by_id(@project.id) %> <!--informations-->
<% @course = Course.find_by_extra(@project.identifier) %> <div class="inf_user_image">
<table> <% @project = Project.find_by_id(@project.id) %>
<tr><td valign="top"> <% @course = Course.find_by_extra(@project.identifier) %>
<% if(@project.project_type==1) %> <table>
<% if get_avatar?(@project) %> <tr>
<%= image_tag(url_to_avatar(@project), :class => "avatar2") %> <td valign="top">
<% else %> <% if (@project.project_type==1) %>
<%= link_to image_tag('../images/avatars/Project/course.jpg', :class => "avatar2"), project_path(@project) %> <% if get_avatar?(@project) %>
<% end %> <%= image_tag(url_to_avatar(@project), :class => "avatar2") %>
<% else %> <% else %>
<%= image_tag(url_to_avatar(@project), :class => "avatar2") %> <%= link_to image_tag('../images/avatars/Project/course.jpg', :class => "avatar2"), project_path(@project) %>
<% end %> </td> <% end %>
<td> <% else %>
<table><tr> <%= image_tag(url_to_avatar(@project), :class => "avatar2") %>
<td class="info-course"><%= @project.name %></td> <% end %> </td>
</tr> <td>
<tr><td align="center"> <table>
<div id="join_in_course"> <tr>
<%if User.current.logged? %> <td class="info-course"><%= @project.name %></td>
<% if @course.teacher.id == User.current.id %> </tr>
<%= link_to l(:label_course_modify_settings), {:controller => 'projects', :action => 'settings', :id => @project} %> <tr>
<%= render :partial => 'courses/set_course_time', :locals => {:project => @project}%> <td align="center">
<% else %> <div id="join_in_course">
<% if User.current.logged? %>
<%= join_in_course(@project, User.current) %> <% if @course.teacher.id == User.current.id %>
<% end %> <%= link_to l(:label_course_modify_settings), {:controller => 'projects', :action => 'settings', :id => @project} %>
<% unless User.current.member_of?(@project) %> <%= render :partial => 'courses/set_course_time', :locals => {:project => @project} %>
<!-- <%= image_tag "/images/fav.png" %> --> <% else %>
<div style="padding-right: 10px">
<span class="icon-fav icon"></span><span> <%= 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> <%= watcher_link(@project, User.current) %></span></div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
</td></tr></table> </td>
</td> </tr>
</tr> </table>
</table> </td>
</div> </tr>
</table>
</div>
<!--parameter--> <!--parameter-->
<div class="user_fans"> <div class="user_fans">
<table width="240" border="0"> <table width="240" border="0">
<tr align="center" width="80px"> <tr align="center" width="80px">
<% files_count = @project.attachments.count %> <% files_count = @project.attachments.count %>
<% @project.versions.each do |version| %> <% @project.versions.each do |version| %>
<% files_count += version.attachments.count %> <% files_count += version.attachments.count %>
<% end %> <% end %>
<td class="font_index"> <td class="font_index">
<!-- %= link_to "#{@project.members.count}", project_member_path(@project) ,:course =>'1'% --> <!-- 1 教师; 2 学生0 全部-->
<!-- 1 教师; 2 学生0 全部--> <%= link_to "#{teacherCount(@project)}", project_member_path(@project, :role => 1), :course => '1' %>
<%= link_to "#{teacherCount(@project)}", project_member_path(@project, :role => 1) ,:course =>'1'%> </td>
</td> <td class="font_index">
<td class="font_index"> <%= link_to "#{studentCount(@project)}", project_member_path(@project, :role => 2), :course => '1' %>
<%= link_to "#{studentCount(@project)}", project_member_path(@project, :role => 2) ,:course =>'1'%> </td>
</td> <td class="font_index"><%= link_to files_count, project_files_path(@project) %></td>
<td class="font_index"><%= link_to files_count, project_files_path(@project) %></td> <tr class="font_aram">
<tr class="font_aram"> <td align="center" width="80px" id="teacherCount">
<td align="center" width="80px" id="teacherCount"> <!-- %= l(:label_x_base_courses_member, :count => @project.members.count) % -->
<!-- %= l(:label_x_base_courses_member, :count => @project.members.count) % --> <%= l(:label_x_base_courses_teacher, :count => teacherCount(@project)) %>
<%= l(:label_x_base_courses_teacher, :count => teacherCount(@project)) %> </td>
</td> <td align="center" width="80px" id="studentCount">
<td align="center" width="80px" id="studentCount"> <%= l(:label_x_base_courses_student, :count => studentCount(@project)) %>
<%= l(:label_x_base_courses_student, :count => studentCount(@project)) %> <!-- %= l(:label_x_course_data, :count => files_count) % -->
<!-- %= l(:label_x_course_data, :count => files_count) % --> </td>
</td> <td align="center" width="80px">
<td align="center" width="80px"> <%= l(:label_x_course_data, :count => files_count) %>
<%= l(:label_x_course_data, :count => files_count) %> </td>
</td>
</tr> </tr>
</table> </table>
<div class="user_underline"></div> <div class="user_underline"></div>
</div> </div>
<!--info--> <!--info-->
<div class="inf_user_context"> <div class="inf_user_context">
<table style="font-family:微软雅黑" > <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> <!-- addedby bai 教师姓名加超链接、加入开课时间、结课时间与课时 -->
<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; 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>
<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 class="hidden">
<tr> <td valign="top" style="padding-left: 8px;"><%= l(:label_setup_time) %> :</td>
<td valign="top" style="padding-left: 8px;"><%= l(:label_teacher_work_unit) %> :</td><td class="font_lighter_sidebar"><%= @course.teacher.user_extensions.school %></td> <td class="font_lighter_sidebar"><%= @course.setup_time %></td>
</tr> </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> <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>
</div> <tr>
<div class="user_underline"></div> <td valign="top" style="padding-left: 8px;"><%= l(:label_class_period) %> :</td>
<!--description--> <td class="font_lighter_sidebar"><%= @course.class_period %>&nbsp;<%= l(:label_class_hour) %></td>
<div class="inf_user_context"> </tr>
<div class="font_title_left">
<%= l(:label_project_overview) %>
</div>
<div style="padding-bottom: 8px"> <tr>
<% if @project.description.size>0 %> <td valign="top" style="padding-left: 8px;"><%= l(:label_main_term) %> :</td>
<div class="font_lighter_sidebar"> <td class="font_lighter_sidebar"><%= @course.time %> <%= @course.term %></td>
</tr>
<!-- end -->
<%= textilizable @project.description %> <% unless @course.teacher.user_extensions.nil? %>
</div> <tr>
<% else %> <td valign="top" style="padding-left: 8px;"><%= l(:label_teacher_work_unit) %> :</td>
<div class="font_lighter_sidebar"> <td class="font_lighter_sidebar"><%= @course.teacher.user_extensions.school %></td>
<%= l(:label_course_description_no) %> </tr>
</div> <% else %>
<% end %> <tr>
<div class="created_on_project"> <td valign="top" style="padding-left: 8px;"><%= l(:label_teacher_work_unit) %> :</td>
<strong style="color: #068d9c"><%= l(:label_create_time) %></strong><%= format_time(@project.created_on) %> <td class="font_lighter_sidebar"><%= l(:field_course_un) %></td>
</div> </tr>
</div> <% end %>
<div class="user_underline"></div>
</div>
<!--tags-->
<div class="user_fans"> </table>
<!-- 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 class="user_underline"></div>
</div> <!--description-->
<div id="content"> <div class="inf_user_context">
<div class="tabs_new"> <div class="font_title_left">
<ul> <%= l(:label_project_overview) %>
<li> </div>
<%= 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 %> <div style="padding-bottom: 8px">
</ul> <% if @project.description.size>0 %>
</div> <div class="font_lighter_sidebar">
<%= render_flash_messages %>
<%= yield %> <%= textilizable @project.description %>
<%= call_hook :view_layouts_base_content %> </div>
<div style="clear:both;"></div> <% else %>
<!--gcm--> <div class="font_lighter_sidebar">
<%= l(:label_course_description_no) %>
</div> </div>
<!--gcm move it mistakenly--> <% end %>
<%= render :partial => 'layouts/base_footer'%> <div class="created_on_project">
</div> <strong style="color: #068d9c"><%= l(:label_create_time) %></strong><%= format_time(@project.created_on) %>
<div id="ajax-indicator" style="display:none;"> </div>
<span><%= l(:label_loading) %></span> </div>
</div> <div class="user_underline"></div>
<div id="ajax-modal" style="display:none;"></div> </div>
</div> <!--tags-->
</div>
<%= call_hook :view_layouts_base_body_bottom %> <div class="user_fans">
</body> <!-- 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> </html>

View File

@ -109,7 +109,7 @@
<div class='desc_item text_nowrap' style="width: 310px;"> <div class='desc_item text_nowrap' style="width: 310px;">
[<%= get_course_term project %>] [<%= get_course_term project %>]
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
(<%= "#{studentCount(project)}人" %><%#= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>) (<%= "#{studentCount(project)}人" %>)
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %> <% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
(<%=link_to "#{files_count}份", project_files_path(project) %>资料) (<%=link_to "#{files_count}份", project_files_path(project) %>资料)
</div> </div>
@ -161,13 +161,11 @@
<div class='desc_item text_nowrap' style="width: 310px;"> <div class='desc_item text_nowrap' style="width: 310px;">
[<%= get_course_term project %>] [<%= get_course_term project %>]
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
(<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>) (<%= "#{studentCount(project)}人" %>)
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %> <% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
(<%=link_to "#{files_count}份", project_files_path(project) %>资料) (<%=link_to "#{files_count}份", project_files_path(project) %>资料)
</div> </div>
<!-- <div class='desc_item' style="">
<span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span>
</div> -->
<div class='join_course_link'> <div class='join_course_link'>
<% if !course_endTime_timeout?(project)%> <% if !course_endTime_timeout?(project)%>
<div > <div >
@ -207,7 +205,7 @@
<div class='desc_item text_nowrap' style="width: 310px;"> <div class='desc_item text_nowrap' style="width: 310px;">
[<%= get_course_term project %>] [<%= get_course_term project %>]
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
(<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>) <%= "#{studentCount(project)}人" %> )
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %> <% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
(<%=link_to "#{files_count}份", project_files_path(project) %>资料) (<%=link_to "#{files_count}份", project_files_path(project) %>资料)
</div> </div>