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)
|
||||
@attachment.container.init_journal(User.current)
|
||||
end
|
||||
if @attachment.container
|
||||
# Make sure association callbacks are called
|
||||
@attachment.container.attachments.delete(@attachment)
|
||||
else
|
||||
@attachment.destroy
|
||||
end
|
||||
@attachment.destroy
|
||||
|
||||
respond_to do |format|
|
||||
if !@attachment.container.nil? &&
|
||||
|
|
|
@ -39,13 +39,18 @@ class BoardsController < ApplicationController
|
|||
end
|
||||
render :layout => false if request.xhr?
|
||||
elsif @course
|
||||
@boards = @course.boards.includes(:last_message => :author).all
|
||||
@boards = [] << @boards[0] if @boards.any?
|
||||
if @boards.size == 1
|
||||
@board = @boards.first
|
||||
show and return
|
||||
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 = [] << @boards[0] if @boards.any?
|
||||
if @boards.size == 1
|
||||
@board = @boards.first
|
||||
show and return
|
||||
end
|
||||
render :layout => 'base_courses'
|
||||
else
|
||||
render_403
|
||||
end
|
||||
render :layout => 'base_courses'
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -217,10 +217,6 @@ class CoursesController < ApplicationController
|
|||
group.course_id = @course.id
|
||||
group.save
|
||||
end
|
||||
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
|
||||
@is_remote = true
|
||||
@members = searchStudent(@course)
|
||||
@membercount = @members.count
|
||||
@course_groups = @course.course_groups
|
||||
end
|
||||
|
||||
|
@ -233,8 +229,6 @@ class CoursesController < ApplicationController
|
|||
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
|
||||
@is_remote = true
|
||||
@course_groups = @course.course_groups
|
||||
@members = searchStudent(@course)
|
||||
@membercount = @members.count
|
||||
end
|
||||
def join_group
|
||||
group = CourseGroup.find(params[:object_id])
|
||||
|
@ -277,26 +271,34 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
def member
|
||||
## 有角色参数的才是课程,没有的就是项目
|
||||
@render_file = 'member_list'
|
||||
@teachers= searchTeacherAndAssistant(@course)
|
||||
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
|
||||
@role = params[:role]
|
||||
@course_groups = @course.course_groups if @course.course_groups
|
||||
@course_group_id = params[:@course_group_id] unless params[:@course_group_id].nil?
|
||||
case params[:role]
|
||||
when '1'
|
||||
@subPage_title = l :label_teacher_list
|
||||
@members = searchTeacherAndAssistant(@course)
|
||||
when '2'
|
||||
@subPage_title = l :label_student_list
|
||||
@members = searchStudent(@course)
|
||||
@membercount = @members.count
|
||||
else
|
||||
@subPage_title = ''
|
||||
@members = @course.member_principals.includes(:roles, :principal).all.sort
|
||||
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
|
||||
@render_file = 'member_list'
|
||||
@teachers= searchTeacherAndAssistant(@course)
|
||||
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
|
||||
@role = params[:role]
|
||||
@course_groups = @course.course_groups if @course.course_groups
|
||||
@course_group_id = params[:@course_group_id] unless params[:@course_group_id].nil?
|
||||
case params[:role]
|
||||
when '1'
|
||||
@subPage_title = l :label_teacher_list
|
||||
@members = searchTeacherAndAssistant(@course)
|
||||
when '2'
|
||||
@subPage_title = l :label_student_list
|
||||
if @course_group_id
|
||||
@members = search_student_in_group(@course, @course_group_id)
|
||||
else
|
||||
@members = searchStudent(@course)
|
||||
end
|
||||
else
|
||||
@subPage_title = ''
|
||||
@members = @course.member_principals.includes(:roles, :principal).all.sort
|
||||
end
|
||||
@members = paginateHelper @members
|
||||
render :layout => 'base_courses'
|
||||
else
|
||||
render_403
|
||||
end
|
||||
@members = paginateHelper @members
|
||||
render :layout => 'base_courses'
|
||||
|
||||
end
|
||||
|
||||
#判断指定用户是否为课程教师
|
||||
|
@ -746,24 +748,29 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
|
||||
def feedback
|
||||
page = params[:page]
|
||||
# Find the page of the requested reply
|
||||
@jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
@limit = 10
|
||||
if params[:r] && page.nil?
|
||||
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
|
||||
page = 1 + offset / @limit
|
||||
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
|
||||
page = params[:page]
|
||||
# Find the page of the requested reply
|
||||
@jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
@limit = 10
|
||||
if params[:r] && page.nil?
|
||||
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
|
||||
page = 1 + offset / @limit
|
||||
end
|
||||
|
||||
#@feedback_count = @jours.count
|
||||
#@feedback_pages = Paginator.new @feedback_count, @limit, page
|
||||
#@offset ||= @feedback_pages.offset
|
||||
@jour = paginateHelper @jours,10
|
||||
@state = false
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
format.api
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
|
||||
#@feedback_count = @jours.count
|
||||
#@feedback_pages = Paginator.new @feedback_count, @limit, page
|
||||
#@offset ||= @feedback_pages.offset
|
||||
@jour = paginateHelper @jours,10
|
||||
@state = false
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -65,23 +65,27 @@ class NewsController < ApplicationController
|
|||
format.atom { render_feed(@newss, :title => (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
|
||||
end
|
||||
elsif @course
|
||||
scope = @course ? @course.news.course_visible : News.course_visible
|
||||
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
|
||||
|
||||
@news_count = scope.count
|
||||
@news_pages = Paginator.new @news_count, @limit, params['page']
|
||||
@offset ||= @news_pages.offset
|
||||
@newss = scope.all(:include => [:author, :course],
|
||||
:order => "#{News.table_name}.created_on DESC",
|
||||
:offset => @offset,
|
||||
:limit => @limit)
|
||||
@news_count = scope.count
|
||||
@news_pages = Paginator.new @news_count, @limit, params['page']
|
||||
@offset ||= @news_pages.offset
|
||||
@newss = scope.all(:include => [:author, :course],
|
||||
:order => "#{News.table_name}.created_on DESC",
|
||||
:offset => @offset,
|
||||
:limit => @limit)
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@news = News.new
|
||||
render :layout => 'base_courses'
|
||||
}
|
||||
format.api
|
||||
format.atom { render_feed(@newss, :title => (@course ? @course.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@news = News.new
|
||||
render :layout => 'base_courses'
|
||||
}
|
||||
format.api
|
||||
format.atom { render_feed(@newss, :title => (@course ? @course.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -99,9 +99,9 @@ class ZipdownController < ApplicationController
|
|||
|
||||
zipfile.add(rename_file, filename)
|
||||
end
|
||||
zipfile.get_output_stream('ReadMe') do |os|
|
||||
os.write 'Homeworks'
|
||||
end
|
||||
#zipfile.get_output_stream('ReadMe') do |os|
|
||||
# os.write 'Homeworks'
|
||||
#end
|
||||
end
|
||||
zipfile_name
|
||||
rescue Errno => e
|
||||
|
|
|
@ -114,28 +114,13 @@ module CoursesHelper
|
|||
# 学生人数计算
|
||||
# add by nwb
|
||||
def studentCount course
|
||||
count = searchStudent(course).count#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
|
||||
searchStudent(course).count.to_s#course.student.count
|
||||
end
|
||||
|
||||
#课程成员数计算
|
||||
def memberCount course
|
||||
count = searchStudent(course).count + searchTeacherAndAssistant(course).count
|
||||
if count <= 5
|
||||
result = count.to_s
|
||||
elsif count < 10 && count > 5
|
||||
result = "5+"
|
||||
else
|
||||
result = (count-count % 10).to_s + "+"
|
||||
end
|
||||
result
|
||||
count.to_s
|
||||
end
|
||||
|
||||
def eventToLanguageCourse event_type, course
|
||||
|
|
|
@ -18,8 +18,12 @@
|
|||
<%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %>
|
||||
<table width="940px">
|
||||
<tr>
|
||||
<td class="info_font" style="width: 220px; color: #15bccf" ><%= l(:label_software_user ) %></td>
|
||||
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
|
||||
<td class="info_font" style="width: 220px; color: #15bccf" rowspan="2">
|
||||
<%= l(:label_software_user ) %>
|
||||
</td>
|
||||
<td class="location-list">
|
||||
<strong><%= l(:label_user_location) %> :</strong>
|
||||
</td>
|
||||
<td rowspan="2">
|
||||
</td>
|
||||
<td rowspan="2" >
|
||||
|
@ -35,8 +39,10 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><a><%= link_to request.host()+"/users", :controller => 'users', :action => 'index' %> </a></td>
|
||||
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_software_user), :controller => 'users', :action => 'index' %></td>
|
||||
<td >
|
||||
<%=link_to l(:field_homepage), home_path %> >
|
||||
<a><%= l(:label_software_user)%></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
|
|
|
@ -14,8 +14,12 @@
|
|||
<%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %>
|
||||
<table width="940px">
|
||||
<tr>
|
||||
<td class="info_font" style="width: 220px; color: #15bccf "><%= l(:label_software_user ) %></td>
|
||||
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
|
||||
<td class="info_font" style="width: 220px; color: #15bccf " rowspan="2">
|
||||
<%= l(:label_software_user ) %>
|
||||
</td>
|
||||
<td class="location-list">
|
||||
<strong><%= l(:label_user_location) %> :</strong>
|
||||
</td>
|
||||
<td rowspan="2">
|
||||
</td>
|
||||
<td rowspan="2" >
|
||||
|
@ -31,8 +35,10 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><a><%= link_to request.host()+"/users", :controller => 'users', :action => 'index' %> </a></td>
|
||||
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_software_user), :controller => 'users', :action => 'index' %></td>
|
||||
<td >
|
||||
<%=link_to l(:field_homepage), home_path %> >
|
||||
<a><%= l(:label_software_user)%></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -1,49 +1,51 @@
|
|||
<% 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">
|
||||
<% if show_name %>
|
||||
<%= image_tag url_to_avatar(reply.user) %>
|
||||
<% else %>
|
||||
<%= image_tag url_to_avatar(nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="recall_con">
|
||||
<% id = 'project_respond_form_'+ reply.id.to_s %>
|
||||
<%= link_to reply.user.name, user_path(reply.user) %>
|
||||
回复
|
||||
<% parent_jour = JournalsForMessage.find reply.m_reply_id %>
|
||||
<% if show_name && parent_jour %>
|
||||
<% parent_jour = JournalsForMessage.where("id = #{reply.m_reply_id}").first %>
|
||||
<% if parent_jour%>
|
||||
<% 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">
|
||||
<% if show_name %>
|
||||
<%= image_tag url_to_avatar(reply.user) %>
|
||||
<% else %>
|
||||
<%= image_tag url_to_avatar(nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="recall_con">
|
||||
<% id = 'project_respond_form_'+ reply.id.to_s %>
|
||||
<%= link_to reply.user.name, user_path(reply.user) %>
|
||||
回复
|
||||
<% if show_name %>
|
||||
<%= link_to parent_jour.user.name, user_path(parent_jour.user) %>
|
||||
<% else %>
|
||||
<% else %>
|
||||
<%= l(:label_anonymous) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<p>
|
||||
<span class="message-notes">
|
||||
<%= reply.notes %>
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
<span class="time">
|
||||
<%= format_time reply.created_on %>
|
||||
</span>
|
||||
<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},
|
||||
: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 %>
|
||||
<% if reply_allow %>
|
||||
<%= link_to l(:label_projects_feedback_respond),'',
|
||||
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %>
|
||||
<% end %> <!-- #{l(:label_reply_plural)} #{m_reply_id.user.name}: -->
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div id='<%=id%>' class="respond-form">
|
||||
</p>
|
||||
</div>
|
||||
<div id='<%=id%>' class="respond-form">
|
||||
<% if reply_allow %>
|
||||
<%= render :partial => "words/new_respond", :locals => {:journal => journal, :m_reply_id => m_reply_id,:show_name => show_name} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear: both;"></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