Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into szzh
Conflicts: app/controllers/courses_controller.rb
This commit is contained in:
commit
a51d0e88dc
|
@ -203,12 +203,7 @@ class AttachmentsController < ApplicationController
|
||||||
if @attachment.container.respond_to?(:init_journal)
|
if @attachment.container.respond_to?(:init_journal)
|
||||||
@attachment.container.init_journal(User.current)
|
@attachment.container.init_journal(User.current)
|
||||||
end
|
end
|
||||||
if @attachment.container
|
|
||||||
# Make sure association callbacks are called
|
|
||||||
@attachment.container.attachments.delete(@attachment)
|
|
||||||
else
|
|
||||||
@attachment.destroy
|
@attachment.destroy
|
||||||
end
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if !@attachment.container.nil? &&
|
if !@attachment.container.nil? &&
|
||||||
|
|
|
@ -39,6 +39,7 @@ class BoardsController < ApplicationController
|
||||||
end
|
end
|
||||||
render :layout => false if request.xhr?
|
render :layout => false if request.xhr?
|
||||||
elsif @course
|
elsif @course
|
||||||
|
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
|
||||||
@boards = @course.boards.includes(:last_message => :author).all
|
@boards = @course.boards.includes(:last_message => :author).all
|
||||||
@boards = [] << @boards[0] if @boards.any?
|
@boards = [] << @boards[0] if @boards.any?
|
||||||
if @boards.size == 1
|
if @boards.size == 1
|
||||||
|
@ -46,6 +47,10 @@ class BoardsController < ApplicationController
|
||||||
show and return
|
show and return
|
||||||
end
|
end
|
||||||
render :layout => 'base_courses'
|
render :layout => 'base_courses'
|
||||||
|
else
|
||||||
|
render_403
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -217,10 +217,6 @@ class CoursesController < ApplicationController
|
||||||
group.course_id = @course.id
|
group.course_id = @course.id
|
||||||
group.save
|
group.save
|
||||||
end
|
end
|
||||||
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
|
|
||||||
@is_remote = true
|
|
||||||
@members = searchStudent(@course)
|
|
||||||
@membercount = @members.count
|
|
||||||
@course_groups = @course.course_groups
|
@course_groups = @course.course_groups
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -233,8 +229,6 @@ class CoursesController < ApplicationController
|
||||||
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
|
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
|
||||||
@is_remote = true
|
@is_remote = true
|
||||||
@course_groups = @course.course_groups
|
@course_groups = @course.course_groups
|
||||||
@members = searchStudent(@course)
|
|
||||||
@membercount = @members.count
|
|
||||||
end
|
end
|
||||||
def join_group
|
def join_group
|
||||||
group = CourseGroup.find(params[:object_id])
|
group = CourseGroup.find(params[:object_id])
|
||||||
|
@ -277,6 +271,7 @@ class CoursesController < ApplicationController
|
||||||
end
|
end
|
||||||
def member
|
def member
|
||||||
## 有角色参数的才是课程,没有的就是项目
|
## 有角色参数的才是课程,没有的就是项目
|
||||||
|
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
|
||||||
@render_file = 'member_list'
|
@render_file = 'member_list'
|
||||||
@teachers= searchTeacherAndAssistant(@course)
|
@teachers= searchTeacherAndAssistant(@course)
|
||||||
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
|
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
|
||||||
|
@ -289,14 +284,21 @@ class CoursesController < ApplicationController
|
||||||
@members = searchTeacherAndAssistant(@course)
|
@members = searchTeacherAndAssistant(@course)
|
||||||
when '2'
|
when '2'
|
||||||
@subPage_title = l :label_student_list
|
@subPage_title = l :label_student_list
|
||||||
|
if @course_group_id
|
||||||
|
@members = search_student_in_group(@course, @course_group_id)
|
||||||
|
else
|
||||||
@members = searchStudent(@course)
|
@members = searchStudent(@course)
|
||||||
@membercount = @members.count
|
end
|
||||||
else
|
else
|
||||||
@subPage_title = ''
|
@subPage_title = ''
|
||||||
@members = @course.member_principals.includes(:roles, :principal).all.sort
|
@members = @course.member_principals.includes(:roles, :principal).all.sort
|
||||||
end
|
end
|
||||||
@members = paginateHelper @members
|
@members = paginateHelper @members
|
||||||
render :layout => 'base_courses'
|
render :layout => 'base_courses'
|
||||||
|
else
|
||||||
|
render_403
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#判断指定用户是否为课程教师
|
#判断指定用户是否为课程教师
|
||||||
|
@ -746,6 +748,7 @@ class CoursesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def feedback
|
def feedback
|
||||||
|
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
|
||||||
page = params[:page]
|
page = params[:page]
|
||||||
# Find the page of the requested reply
|
# Find the page of the requested reply
|
||||||
@jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
@jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||||
|
@ -764,6 +767,10 @@ class CoursesController < ApplicationController
|
||||||
format.html{render :layout => 'base_courses'}
|
format.html{render :layout => 'base_courses'}
|
||||||
format.api
|
format.api
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
render_403
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,7 @@ class NewsController < ApplicationController
|
||||||
format.atom { render_feed(@newss, :title => (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
|
format.atom { render_feed(@newss, :title => (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
|
||||||
end
|
end
|
||||||
elsif @course
|
elsif @course
|
||||||
|
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
|
||||||
scope = @course ? @course.news.course_visible : News.course_visible
|
scope = @course ? @course.news.course_visible : News.course_visible
|
||||||
|
|
||||||
@news_count = scope.count
|
@news_count = scope.count
|
||||||
|
@ -83,6 +84,9 @@ class NewsController < ApplicationController
|
||||||
format.api
|
format.api
|
||||||
format.atom { render_feed(@newss, :title => (@course ? @course.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
|
format.atom { render_feed(@newss, :title => (@course ? @course.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
render_403
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -99,9 +99,9 @@ class ZipdownController < ApplicationController
|
||||||
|
|
||||||
zipfile.add(rename_file, filename)
|
zipfile.add(rename_file, filename)
|
||||||
end
|
end
|
||||||
zipfile.get_output_stream('ReadMe') do |os|
|
#zipfile.get_output_stream('ReadMe') do |os|
|
||||||
os.write 'Homeworks'
|
# os.write 'Homeworks'
|
||||||
end
|
#end
|
||||||
end
|
end
|
||||||
zipfile_name
|
zipfile_name
|
||||||
rescue Errno => e
|
rescue Errno => e
|
||||||
|
|
|
@ -114,28 +114,13 @@ module CoursesHelper
|
||||||
# 学生人数计算
|
# 学生人数计算
|
||||||
# add by nwb
|
# add by nwb
|
||||||
def studentCount course
|
def studentCount course
|
||||||
count = searchStudent(course).count#course.student.count
|
searchStudent(course).count.to_s#course.student.count
|
||||||
if count <= 5
|
|
||||||
result = count.to_s
|
|
||||||
elsif count < 10 && count > 5
|
|
||||||
result = "5+"
|
|
||||||
else
|
|
||||||
result = (count-count % 10).to_s + "+"
|
|
||||||
end
|
|
||||||
result
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#课程成员数计算
|
#课程成员数计算
|
||||||
def memberCount course
|
def memberCount course
|
||||||
count = searchStudent(course).count + searchTeacherAndAssistant(course).count
|
count = searchStudent(course).count + searchTeacherAndAssistant(course).count
|
||||||
if count <= 5
|
count.to_s
|
||||||
result = count.to_s
|
|
||||||
elsif count < 10 && count > 5
|
|
||||||
result = "5+"
|
|
||||||
else
|
|
||||||
result = (count-count % 10).to_s + "+"
|
|
||||||
end
|
|
||||||
result
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def eventToLanguageCourse event_type, course
|
def eventToLanguageCourse event_type, course
|
||||||
|
|
|
@ -18,8 +18,12 @@
|
||||||
<%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %>
|
<%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %>
|
||||||
<table width="940px">
|
<table width="940px">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="info_font" style="width: 220px; color: #15bccf" ><%= l(:label_software_user ) %></td>
|
<td class="info_font" style="width: 220px; color: #15bccf" rowspan="2">
|
||||||
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
|
<%= l(:label_software_user ) %>
|
||||||
|
</td>
|
||||||
|
<td class="location-list">
|
||||||
|
<strong><%= l(:label_user_location) %> :</strong>
|
||||||
|
</td>
|
||||||
<td rowspan="2">
|
<td rowspan="2">
|
||||||
</td>
|
</td>
|
||||||
<td rowspan="2" >
|
<td rowspan="2" >
|
||||||
|
@ -35,8 +39,10 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding-left: 8px"><a><%= link_to request.host()+"/users", :controller => 'users', :action => 'index' %> </a></td>
|
<td >
|
||||||
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_software_user), :controller => 'users', :action => 'index' %></td>
|
<%=link_to l(:field_homepage), home_path %> >
|
||||||
|
<a><%= l(:label_software_user)%></a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -14,8 +14,12 @@
|
||||||
<%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %>
|
<%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %>
|
||||||
<table width="940px">
|
<table width="940px">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="info_font" style="width: 220px; color: #15bccf "><%= l(:label_software_user ) %></td>
|
<td class="info_font" style="width: 220px; color: #15bccf " rowspan="2">
|
||||||
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
|
<%= l(:label_software_user ) %>
|
||||||
|
</td>
|
||||||
|
<td class="location-list">
|
||||||
|
<strong><%= l(:label_user_location) %> :</strong>
|
||||||
|
</td>
|
||||||
<td rowspan="2">
|
<td rowspan="2">
|
||||||
</td>
|
</td>
|
||||||
<td rowspan="2" >
|
<td rowspan="2" >
|
||||||
|
@ -31,8 +35,10 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding-left: 8px"><a><%= link_to request.host()+"/users", :controller => 'users', :action => 'index' %> </a></td>
|
<td >
|
||||||
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_software_user), :controller => 'users', :action => 'index' %></td>
|
<%=link_to l(:field_homepage), home_path %> >
|
||||||
|
<a><%= l(:label_software_user)%></a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
<% parent_jour = JournalsForMessage.where("id = #{reply.m_reply_id}").first %>
|
||||||
<% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
|
<% if parent_jour%>
|
||||||
<div class="recall" id='word_li_<%=reply.id.to_s%>' onmouseover="$('#<%= ids_r %>').show()" onmouseout="$('#<%= ids_r %>').hide()">
|
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
||||||
|
<% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
|
||||||
|
<div class="recall" id='word_li_<%=reply.id.to_s%>' onmouseover="$('#<%= ids_r %>').show()" onmouseout="$('#<%= ids_r %>').hide()">
|
||||||
<div class="recall_head">
|
<div class="recall_head">
|
||||||
<% if show_name %>
|
<% if show_name %>
|
||||||
<%= image_tag url_to_avatar(reply.user) %>
|
<%= image_tag url_to_avatar(reply.user) %>
|
||||||
|
@ -12,8 +14,7 @@
|
||||||
<% id = 'project_respond_form_'+ reply.id.to_s %>
|
<% id = 'project_respond_form_'+ reply.id.to_s %>
|
||||||
<%= link_to reply.user.name, user_path(reply.user) %>
|
<%= link_to reply.user.name, user_path(reply.user) %>
|
||||||
回复
|
回复
|
||||||
<% parent_jour = JournalsForMessage.find reply.m_reply_id %>
|
<% if show_name %>
|
||||||
<% if show_name && parent_jour %>
|
|
||||||
<%= link_to parent_jour.user.name, user_path(parent_jour.user) %>
|
<%= link_to parent_jour.user.name, user_path(parent_jour.user) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= l(:label_anonymous) %>
|
<%= l(:label_anonymous) %>
|
||||||
|
@ -29,7 +30,7 @@
|
||||||
<%= format_time reply.created_on %>
|
<%= format_time reply.created_on %>
|
||||||
</span>
|
</span>
|
||||||
<span class="ping_disfoot" style="display: none; margin-left: 4px;" id='<%=ids_r%>' >
|
<span class="ping_disfoot" style="display: none; margin-left: 4px;" id='<%=ids_r%>' >
|
||||||
<% if @user == User.current || User.current.admin? || reply.user.id == User.current.id %>
|
<% if User.current.admin? || reply.user.id == User.current.id%>
|
||||||
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => reply, :user_id => reply.user},
|
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => reply, :user_id => reply.user},
|
||||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
|
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -46,4 +47,5 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
1319
db/schema.rb
1319
db/schema.rb
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue