diff --git a/app/api/mobile/entities/user.rb b/app/api/mobile/entities/user.rb
index 9112e7ec5..6b0064036 100644
--- a/app/api/mobile/entities/user.rb
+++ b/app/api/mobile/entities/user.rb
@@ -34,6 +34,8 @@ module Mobile
user_expose :img_url
#昵称
expose :nickname
+ #真名
+ expose :realname
#性别
user_expose :gender
#我的二维码
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 8710b624e..c0e99d546 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -418,12 +418,27 @@ class CoursesController < ApplicationController
end
+ def search_member
+ if User.current.allowed_to?(:as_teacher,@course) || User.current.admin
+ q = "#{params[:name].strip}"
+ @roles = Role.givable.all[3..5]
+ if q.nil? || q == ""
+ @members = @course.member_principals.includes(:roles, :principal).all.sort
+ else
+ @members = searchmember_by_name(@course.member_principals.includes(:roles, :principal).all.sort,q)
+ end
+
+ else
+ render_403
+ end
+ end
+
def create
cs = CoursesService.new
@course = cs.create_course(params,User.current)[:course]
if @course.new_record?
respond_to do |format|
- format.html { render :action => 'new', :layout => 'base' } #Added by young
+ format.html { render :action => 'new', :layout => 'new_base' } #Added by young
format.api { render_validation_errors(@course) }
end
else
@@ -493,7 +508,7 @@ class CoursesController < ApplicationController
respond_to do |format|
format.html {
- render :layout => 'base'
+ render :layout => 'new_base'
}
format.api {
}
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 12d1f6856..8b1c8ba32 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -79,7 +79,8 @@ class FilesController < ApplicationController
@result = find_course_attache q,@course,sort
@result = visable_attachemnts @result
@searched_attach = paginateHelper @result,10
- @tag_list = attachment_tag_list @result
+
+ @tag_list = get_course_tag_list @course
end
#rescue Exception => e
# #render 'stores'
@@ -387,6 +388,7 @@ class FilesController < ApplicationController
@containers = [Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)]
show_attachments @containers
+ @tag_list = attachment_tag_list @all_attachments
@attachtype = 0
@contenttype = 0
@@ -540,7 +542,7 @@ class FilesController < ApplicationController
@result = visable_attachemnts @result
@result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)}
@searched_attach = paginateHelper @result,10
- @tag_list = attachment_tag_list @result
+ @tag_list = get_course_tag_list @course
respond_to do |format|
format.js
diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb
index c90d078e2..a589ce144 100644
--- a/app/controllers/homework_attach_controller.rb
+++ b/app/controllers/homework_attach_controller.rb
@@ -314,7 +314,7 @@ class HomeworkAttachController < ApplicationController
def edit
bid = @homework.bid
- if (bid.comment_status == 0 || bid.open_anonymous_evaluation == 0) && (User.current.admin? || User.current.member_of_course?(bid.courses.first))
+ if (bid.comment_status == 0 || bid.open_anonymous_evaluation == 0 || bid.comment_status == 2) && (User.current.admin? || User.current.member_of_course?(bid.courses.first))
get_homework_member @homework
else
render_403 :message => :notice_not_authorized
@@ -347,7 +347,7 @@ class HomeworkAttachController < ApplicationController
def destroy
bid = @homework.bid
- if (bid.comment_status == 0 || bid.open_anonymous_evaluation == 0) && (User.current.admin? || User.current == @homework.user)
+ if (bid.comment_status == 0 || bid.open_anonymous_evaluation == 0 || bid.comment_status == 0) && (User.current.admin? || User.current == @homework.user)
if @homework.destroy
#respond_to do |format|
# format.html { redirect_to course_for_bid_url @homework.bid }
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index e26901320..253faa2b1 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -220,11 +220,18 @@ class TagsController < ApplicationController
@tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id)
@tag.delete unless @tag.nil?
end
+
+ if @obj && @object_flag == '6' && @obj.container.kind_of?(Course)
+ @course = @obj.container
+ @tag_list = get_course_tag_list @course
+ @select_tag_name = params[:select_tag_name]
+ end
# end
end
end
def tag_save
+ @select_tag_name = params[:tag_for_save][:tag_name]
@tags = params[:tag_for_save][:name]
@obj_id = params[:tag_for_save][:object_id]
@obj_flag = params[:tag_for_save][:object_flag]
@@ -263,6 +270,10 @@ class TagsController < ApplicationController
else
logger.error "#{__FILE__}:#{__LINE__} ===> #{@obj.errors.try(:full_messages)}"
end
+ if @obj && @obj_flag == '6' && @obj.container.kind_of?(Course)
+ @course = @obj.container
+ @tag_list = @tag_list = get_course_tag_list @course
+ end
respond_to do |format|
format.js
format.html
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 9afd67001..0163c8dd8 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -2156,48 +2156,48 @@ module ApplicationHelper
def anonymous_comment_link(bid, course)
link = case bid.comment_status
- when 0
- confirm_info = "开启匿评后学生将不能对作业进行提交、修改、删除等操作\n"
- confirm_info += anonymous_comment_notice(bid,course)
- confirm_info += '是否确定开启匿评?'
- link_to '启动匿评', start_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, :confirm => confirm_info, disable_with: '加载中...'
- when 1
- confirm_info = "关闭匿评后所有同学将不能继续进行匿评,且将公开已提交作业列表\n"
- confirm_info += anonymous_comment_notice(bid,course)
- confirm_info += '是否确定关闭匿评?'
- link_to '关闭匿评', stop_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true, :confirm => confirm_info
- when 2
- '匿评结束'
- end
+ when 0
+ confirm_info = "开启匿评后学生将不能对作品进行提交、修改、删除等操作\n"
+ confirm_info += anonymous_comment_notice(bid,course)
+ confirm_info += '是否确定开启匿评?'
+ link_to '启动匿评', start_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, :confirm => confirm_info, disable_with: '加载中...'
+ when 1
+ confirm_info = "关闭匿评后所有同学将不能继续进行匿评,且将公开已提交作品列表\n"
+ confirm_info += anonymous_comment_notice(bid,course)
+ confirm_info += '是否确定关闭匿评?'
+ link_to '关闭匿评', stop_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true, :confirm => confirm_info
+ when 2
+ '匿评结束'
+ end
content_tag('span', link, id: "#{bid.id}_anonymous_comment")
end
def anonymous_comment_notice(bid, course)
- case bid.comment_status
- when 0
- @student_size ||= searchStudent(course).size
- @homework_size = bid.homeworks.size
- percent = @homework_size.to_f / (@student_size == 0 ? 1 : @student_size)
- confirm_info = "目前#{@student_size}个学生,总共提交了#{@homework_size}份作业,占#{number_to_percentage(percent * 100, precision: 1)}\n"
- when 1
- @homework_evaluations = 0
- bid.homeworks.map { |homework| @homework_evaluations += homework.homework_evaluations.count}
- teachers = "("
- teacher_members = searchTeacherAndAssistant(course)
- teacher_members.each do |member|
- if member == teacher_members.last
- teachers += member.user_id.to_s + ")"
- else
- teachers += member.user_id.to_s + ","
- end
- end
- @has_evaluations = 0
- bid.homeworks.map { |homework| @has_evaluations += homework.rates(:quality).where("seems_rateable_rates.rater_id not in #{teachers}").count}
-
- percent = @has_evaluations.to_f / (@homework_evaluations == 0 ? 1 : @homework_evaluations)
- confirm_info = "目前总共分配了#{@homework_evaluations}份匿评作业,已评价#{@has_evaluations}份作业,占#{number_to_percentage(percent * 100, precision: 1)}\n"
- end
- confirm_info
+ case bid.comment_status
+ when 0
+ @student_size ||= searchStudent(course).size
+ @homework_size = bid.homeworks.size
+ percent = @homework_size.to_f / (@student_size == 0 ? 1 : @student_size)
+ confirm_info = "目前#{@student_size}个学生,总共提交了#{@homework_size}份作品,占#{number_to_percentage(percent * 100, precision: 1)}\n"
+ when 1
+ @homework_evaluations = 0
+ bid.homeworks.map { |homework| @homework_evaluations += homework.homework_evaluations.count}
+ teachers = "("
+ teacher_members = searchTeacherAndAssistant(course)
+ teacher_members.each do |member|
+ if member == teacher_members.last
+ teachers += member.user_id.to_s + ")"
+ else
+ teachers += member.user_id.to_s + ","
+ end
+ end
+ @has_evaluations = 0
+ bid.homeworks.map { |homework| @has_evaluations += homework.rates(:quality).where("seems_rateable_rates.rater_id not in #{teachers}").count}
+
+ percent = @has_evaluations.to_f / (@homework_evaluations == 0 ? 1 : @homework_evaluations)
+ confirm_info = "目前总共分配了#{@homework_evaluations}份匿评作品,已评价#{@has_evaluations}份作品,占#{number_to_percentage(percent * 100, precision: 1)}\n"
+ end
+ confirm_info
end
def get_technical_title user
@@ -2218,4 +2218,23 @@ module ApplicationHelper
request.env["HTTP_USER_AGENT"] =~ /MSIE 8.0/
end
+
+ #获取指定资源列表的TAG的集合以及每个TAG的数量,降序排序
+ def attachment_tag_list attachments
+ tag_list = Hash.new
+ attachments.each do |attachment|
+ attachment.tag_list.map{|tag| tag_list.has_key?(tag) ? tag_list[tag] = tag_list[tag] + 1 : tag_list[tag] = 1}
+ end
+ tag_list.sort {|a,b| b[1]<=>a[1]}
+ end
+
+ #获取课程资源的TAG云
+ def get_course_tag_list course
+ all_attachments = course.attachments.select{|attachment| attachment.is_public? ||
+ (attachment.container_type == "Course" && User.current.member_of_course?(course))||
+ attachment.author_id == User.current.id
+ }
+ tag_list = attachment_tag_list all_attachments
+ tag_list
+ end
end
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index 5b311acd7..2e06e3a43 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -762,7 +762,11 @@ module CoursesHelper
if user_homework && user_homework.empty?
link_to l(:label_commit_homework), new_exercise_book_path(bid),:class => 'fr mr10 work_edit'
else
- "作业已交".html_safe
+ if bid.comment_status == 1 && bid.open_anonymous_evaluation == 1
+ "#{l(:label_edit_homework)}".html_safe
+ else
+ link_to l(:label_edit_homework), edit_homework_attach_path(user_homework.first.id),:class => 'fr mr10 work_edit'
+ end
end
end
diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb
index 04363653f..9a1765ddc 100644
--- a/app/helpers/files_helper.rb
+++ b/app/helpers/files_helper.rb
@@ -120,14 +120,6 @@ module FilesHelper
result
end
- def attachment_tag_list attachments
- tag_list = Hash.new
- attachments.each do |attachment|
- attachment.tag_list.map{|tag| tag_list.has_key?(tag) ? tag_list[tag] = tag_list[tag] + 1 : tag_list[tag] = 1}
- end
- tag_list.sort {|a,b| b[1]<=>a[1]}
- end
-
def get_attachments_by_tag attachments,tag
attachments.each do |attachment|
attachment.tag_list.include?(tag)
diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb
index aa216d755..e91883bee 100644
--- a/app/services/courses_service.rb
+++ b/app/services/courses_service.rb
@@ -40,9 +40,9 @@ class CoursesService
end
@courses = courses_all.visible(current_user)
if params[:name].present?
- @courses_all = @courses.like(params[:name])
+ @courses_all = @courses.like(params[:name]).order("created_at desc")
else
- @courses_all = @courses;
+ @courses_all = @courses.order("created_at desc");
end
@courses_all
course_list = []
@@ -198,7 +198,7 @@ class CoursesService
@course.school_id = current_user.user_extensions.school_id
@course.setup_time = params[:setup_time]
@course.endup_time = params[:endup_time]
- @course.class_period = params[:class_period]
+ @course.class_period = params[:class_period].to_i
params[:course][:is_public] ? @course.is_public = 1 : @course.is_public = 0
params[:course][:open_student] ? @course.open_student = 1 : @course.open_student = 0
end
@@ -245,7 +245,7 @@ class CoursesService
#course.safe_attributes = params[:course]
course.time = params[:time]
course.term = params[:term]
- course.class_period = params[:class_period]
+ course.class_period = params[:class_period].to_i
params[:course][:is_public] ? course.is_public = 1 : course.is_public = 0
params[:course][:open_student] ? course.open_student = 1 : course.open_student = 0
if course.save
diff --git a/app/services/users_service.rb b/app/services/users_service.rb
index 63dd725cd..c1f716fd1 100644
--- a/app/services/users_service.rb
+++ b/app/services/users_service.rb
@@ -77,7 +77,7 @@ class UsersService
gender = @user.user_extensions.gender.nil? ? 0 : @user.user_extensions.gender
work_unit = get_user_work_unit @user
location = get_user_location @user
- {:id => @user.id, :img_url => img_url, :nickname => @user.login, :gender => gender, :work_unit => work_unit, :mail => @user.mail, :location => location, :brief_introduction => @user.user_extensions.brief_introduction}
+ {:id => @user.id, :img_url => img_url,:realname => @user.realname, :nickname => @user.login, :gender => gender, :work_unit => work_unit, :mail => @user.mail, :location => location, :brief_introduction => @user.user_extensions.brief_introduction}
end
#忘记密码
diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb
index a7e337a60..c0ae219a5 100644
--- a/app/views/bids/_homework_list.html.erb
+++ b/app/views/bids/_homework_list.html.erb
@@ -70,7 +70,7 @@
diff --git a/app/views/courses/_course.html.erb b/app/views/courses/_course.html.erb
index abcbbfe5b..8974c3089 100644
--- a/app/views/courses/_course.html.erb
+++ b/app/views/courses/_course.html.erb
@@ -33,6 +33,15 @@
<% end %>
+
+ <%= content_tag "span","#{l(:label_duration_time)}:", :class => "course-font"%>
+ <%= get_course_term @course %>
+
+
+ <%= content_tag "span", "#{l(:label_course_brief_introduction)}:", :class => "course-font" %>
+ <%= content_tag "div", course.short_description, :class => "brief_introduction", :title => course.short_description %>
+
+
@@ -71,15 +80,13 @@
-
- <%= content_tag "span","#{l(:label_duration_time)}:", :class => "course-font"%>
- <%= get_course_term @course %>
-
+ <%= content_tag "span","#{l(:label_duration_time)}:", :class => "course-font"%>
+ <%= get_course_term @course %>
- <%= content_tag "span", "#{l(:label_course_brief_introduction)}:", :class => "course-font" %>
- <%= content_tag "div", course.short_description, :class => "brief_introduction", :title => course.short_description %>
+ <%= content_tag "span", "#{l(:label_course_brief_introduction)}:", :class => "course-font" %>
+ <%= content_tag "div", course.short_description, :class => "brief_introduction", :title => course.short_description %>
-
- <% unless @tag_list.nil?%>
- <% @tag_list.each do |k,v|%>
-
<%= k%>(<%= v%>)
- <% end%>
- <% end%>
+
+ <%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%>
@@ -29,35 +25,35 @@
<% if file.is_public? || User.current.member_of_course?(course) %>
- <%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
+ <%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s,:class => "c_dblue f_14 f_b f_l hiddent" %>
<% if User.current.logged? %>
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
- <%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current,file) %>
+ <%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
<% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
- <%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open",:method => :post %>
+ <%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %>
<% else %>
<% end %>
<% else %>
- <%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current,file) %>
+ <%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
<% end %>
<% else %>
<% end %>
-
文件大小:<%= number_to_human_size(file.filesize) %>
+
文件大小:<%= number_to_human_size(file.filesize) %>
<%= link_to( l(:button_delete), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%>
<%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
- <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %>
- <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %>
+ <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
+ <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
diff --git a/app/views/files/_tag_yun.html.erb b/app/views/files/_tag_yun.html.erb
new file mode 100644
index 000000000..9db34ece4
--- /dev/null
+++ b/app/views/files/_tag_yun.html.erb
@@ -0,0 +1,9 @@
+<% unless tag_list.nil?%>
+ <% tag_list.each do |k,v|%>
+ <% if tag_name && tag_name == k%>
+
<%= k%>×<%= v%>
+ <% else%>
+
<%= k%>×<%= v%>
+ <% end%>
+ <% end%>
+<% end%>
\ No newline at end of file
diff --git a/app/views/homework_attach/_homework.html.erb b/app/views/homework_attach/_homework.html.erb
index a7d803f86..466444528 100644
--- a/app/views/homework_attach/_homework.html.erb
+++ b/app/views/homework_attach/_homework.html.erb
@@ -15,7 +15,7 @@
<% if homework.name == nil || homework.name == "" %>
- <% homework_filename = homework.user.name + "提交的作业" %>
+ <% homework_filename = homework.user.name + "提交的作品" %>
<% else %>
<% homework_filename = homework.name %>
<% end %>
@@ -55,7 +55,7 @@
<% if is_my_homework %>
- <% if bid.comment_status == 0 || bid.open_anonymous_evaluation == 0 %>
+ <% if bid.comment_status == 0 || bid.open_anonymous_evaluation == 0 || bid.comment_status == 2 %>
<%= link_to l(:button_edit), edit_homework_attach_path(homework) %>
<% if homework.user == User.current || User.current.admin? %>
@@ -69,7 +69,7 @@
<% end %>
<% else %>
-
+
<%= l(:button_edit) %>
<% if homework.user == User.current || User.current.admin? %>
diff --git a/app/views/homework_attach/_homeworks_list.html.erb b/app/views/homework_attach/_homeworks_list.html.erb
index d2121c85f..4f15b9204 100644
--- a/app/views/homework_attach/_homeworks_list.html.erb
+++ b/app/views/homework_attach/_homeworks_list.html.erb
@@ -47,9 +47,9 @@
<%= link_to User.current.login, user_path(User.current), :title => User.current.login%>
-
您还没交作业,请创建作业!
+
您还没交作品,请创建作品
- <%= link_to "提交作业", new_exercise_book_path(@bid), :style => "width:80px; margin:20px 0 0 350px;" %>
+ <%= link_to "提交作品", new_exercise_book_path(@bid), :style => "width:80px; margin:20px 0 0 350px;" %>
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb
index dec4a5f4d..dc384834c 100644
--- a/app/views/layouts/base_courses.html.erb
+++ b/app/views/layouts/base_courses.html.erb
@@ -35,7 +35,7 @@
<%= l(:label_courses_community)%>
-
+
<%= l(:label_user_location) %> :
<%= link_to l(:field_homepage), home_path %>
>
@@ -80,7 +80,7 @@
-
+
<%= @course.name %>
<% if @course.is_public == 0%>
diff --git a/app/views/tags/_tag_add.html.erb b/app/views/tags/_tag_add.html.erb
index f8cac7c0d..ad97cd693 100644
--- a/app/views/tags/_tag_add.html.erb
+++ b/app/views/tags/_tag_add.html.erb
@@ -9,6 +9,8 @@
<%= f.text_field :name ,:id => "tags_name_#{obj.id}",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:class => "isTxt w90 f_l" %>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
+ <% tag_name ||= ""%>
+ <%= f.text_field :tag_name,:value=> tag_name,:style=>"display:none"%>
<%= f.submit "",:class => "submit f_l" %>
<% end %>
diff --git a/app/views/tags/_tag_list.html.erb b/app/views/tags/_tag_list.html.erb
index e18dafd7d..b512f1ef3 100644
--- a/app/views/tags/_tag_list.html.erb
+++ b/app/views/tags/_tag_list.html.erb
@@ -12,8 +12,9 @@
<% end %>
<% when '6' %>
<% if obj.author_id == User.current.id || User.current.admin?%>
+ <% select_tag_name ||= ""%>
<%= link_to 'x', :controller => "tags", :action => "remove_tag_new", :remote => true, :tag_name => tag,
- :taggable_id => obj.id, :taggable_type => object_flag %>
+ :taggable_id => obj.id, :taggable_type => object_flag, :select_tag_name => select_tag_name %>
<% end %>
<% end %>
diff --git a/app/views/tags/_tag_new.html.erb b/app/views/tags/_tag_new.html.erb
index 0d5d371e3..bbedaff78 100644
--- a/app/views/tags/_tag_new.html.erb
+++ b/app/views/tags/_tag_new.html.erb
@@ -21,7 +21,8 @@
<% elsif object_flag == '6' %>
- <%= render :partial => "tags/tag_list",:locals => {:obj => obj,:object_flag => object_flag} %>
+ <% tag_name ||= ""%>
+ <%= render :partial => "tags/tag_list",:locals => {:obj => obj,:object_flag => object_flag,:select_tag_name => tag_name} %>
<%= render :partial => "courses/course_resources_html", :locals => {:obj => obj ,:object_flag => object_flag } %>
diff --git a/app/views/tags/remove_tag_new.js.erb b/app/views/tags/remove_tag_new.js.erb
index 01edf3e1c..9a43dd9b4 100644
--- a/app/views/tags/remove_tag_new.js.erb
+++ b/app/views/tags/remove_tag_new.js.erb
@@ -2,7 +2,9 @@
<% if @object_flag == "6"%>
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list',
- :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>');
+ :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag,:select_tag_name => @select_tag_name}) %>');
+
+$("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @select_tag_name}) %>");
<% end %>
<% if @object_flag == "10"%>
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
diff --git a/app/views/tags/tag_save.js.erb b/app/views/tags/tag_save.js.erb
index c7dbec65d..74a38c99d 100644
--- a/app/views/tags/tag_save.js.erb
+++ b/app/views/tags/tag_save.js.erb
@@ -5,11 +5,19 @@ $('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_n
//$('#put-tag-form-issue').hide();
$('#name-issue').val("");
<% elsif @obj_flag == '6'%>
-$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
-$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/course_attachment_tag_name',
+ <%if @course%>
+ $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
+ $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list',
+ :locals => {:obj => @obj,:object_flag => @obj_flag,:select_tag_name => @select_tag_name}) %>');
+ $("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @select_tag_name}) %>");
+ <%else%>
+ $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
+ $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/course_attachment_tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
-$("#tags_name_<%=@obj.id%>").val("");
-$("#add_tag_<%=@obj.id%>").hide();
+ <%end%>
+
+ $("#tags_name_<%=@obj.id%>").val("");
+ $("#add_tag_<%=@obj.id%>").hide();
<% elsif @obj_flag == '9'%>
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/new_tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb
index a764c6eb8..5c57a5ba1 100644
--- a/app/views/welcome/course.html.erb
+++ b/app/views/welcome/course.html.erb
@@ -39,21 +39,12 @@
+ <% if User.current.login? %>
- <% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %>
- ,
-
- <%= l(:label_welcome_trustie_course_description) %>
-
- <% else %>
- <% if @school_id == "0" %>
-
+ <% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %>
<% else %>
+ <% if @school_id == "0" %>
+ <% else %>
<% if @school_id.nil? %>
<%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course', :school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school', :method => 'get'} %>
@@ -61,10 +52,20 @@
<%= link_to School.find(@school_id).name, options={:action => 'course', :school_id => @school_id}, html_options={:class => 'font_welcome_school', :method => 'get'} %>
<% end %>
+ <% end %>
<% end %>
- <% end %>
- <% unless @course_page.nil? %>
+
+
+ <%= l(:label_welcome_trustie_course) %>
+
+ <% else %>
+ <% unless @course_page.nil? %>
<%= l(:label_welcome_trustie_course) %>
-
+ ,
+
+ <%= l(:label_welcome_trustie_course_description) %>
+
+ <% end %>
<% end %>
+
<%= render :partial => "search_project", :locals => {:project_type => Project::ProjectType_course} %>
diff --git a/config/locales/courses/zh.yml b/config/locales/courses/zh.yml
index 30144bf1d..e0a39f51d 100644
--- a/config/locales/courses/zh.yml
+++ b/config/locales/courses/zh.yml
@@ -86,4 +86,8 @@ zh:
#boards
label_course_momes_count: "个帖子"
- #boards count
\ No newline at end of file
+ #boards count
+
+ #setting
+ label_user_name: "用户名称"
+ #setting end
\ No newline at end of file
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 02e4da65e..ac08928ab 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -497,14 +497,14 @@ zh:
label_teacher_list: 教师列表
label_student_list: 学生列表
label_limit_time: 截止日期
- label_commit_homework: 提交作业
+ label_commit_homework: 提交作品
+ label_edit_homework: 修改作品
label_course_homework: 对应课程
label_course_doing: 进行中
label_course_done: 已结束
label_homework_response: 作业咨询
- label_bidding_homework: 提交作业
+ label_bidding_homework: 提交作品
label_add_homework: 添加作业
- label_edit_homework: 修改作业
label_delete_homework: 删除作业
label_new_homework: 创建作业
diff --git a/config/routes.rb b/config/routes.rb
index f7ac2b1cc..ffab908bd 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -678,6 +678,7 @@ RedmineApp::Application.routes.draw do
resources :courses do
member do
get 'settings(/:tab)', :action => 'settings', :as => 'settings'
+ get 'search_member', :action => 'search_member'
get 'homework', :action => 'homework', :as => 'homework'
get 'new_homework', :action => 'new_homework', :as => 'new_homework'
get 'file', :action => 'file', :as => 'file'
diff --git a/lib/redmine.rb b/lib/redmine.rb
index b8284ddc5..ad73c2db1 100644
--- a/lib/redmine.rb
+++ b/lib/redmine.rb
@@ -110,7 +110,7 @@ Redmine::AccessControl.map do |map|
map.permission :view_course, {:courses => [:show], :activities => [:index]}, :public => true, :read => true
map.permission :search_course, {:search => :index}, :public => true, :read => true
map.permission :add_course, {:courses => [:new, :create]}, :require => :loggedin ,:belong_to_course => true
- map.permission :edit_course, {:courses => [:settings, :edit, :update]}, :require => :member ,:belong_to_course => true
+ map.permission :edit_course, {:courses => [:settings, :edit, :update,:search_member]}, :require => :member ,:belong_to_course => true
map.permission :close_course, {:courses => [:close, :reopen]}, :require => :member, :read => true ,:belong_to_course => true
map.permission :select_course_modules, {:courses => :modules}, :require => :member ,:belong_to_course => true
map.permission :view_course_journals_for_messages, {:courses => :feedback}, :require => :member,:read => true ,:belong_to_course => true
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index cb969e3c9..daceb235b 100644
--- a/public/javascripts/course.js
+++ b/public/javascripts/course.js
@@ -80,9 +80,18 @@ function regex_course_class_period()
return false;
}
else if (regex.test(class_period)) {
- $("#course_class_period_notice").html("");
- $("#course_class_period_notice").hide();
- return true;
+ if(parseInt(class_period) > 0)
+ {
+ $("#course_class_period_notice").html("");
+ $("#course_class_period_notice").hide();
+ return true;
+ }
+ else
+ {
+ $("#course_class_period_notice").html("学时总数必须大于0");
+ $("#course_class_period_notice").show();
+ return false;
+ }
}
else
{
@@ -91,10 +100,33 @@ function regex_course_class_period()
return false;
}
}
+//验证密码
+function regex_course_password()
+{
+ var class_period = $.trim($("#course_course_password").val());
+ var regex = /^\w+$/;
+ if(class_period.length == 0)
+ {
+ $("#course_course_password_notice").html("课程密码不能为空");
+ $("#course_course_password_notice").show();
+ return false;
+ }
+ else if (regex.test(class_period)) {
+ $("#course_course_password_notice").html("");
+ $("#course_course_password_notice").hide();
+ return true;
+ }
+ else
+ {
+ $("#course_course_password_notice").html("课程密码有非法字符");
+ $("#course_course_password_notice").show();
+ return false;
+ }
+}
//提交新建课程
function submit_new_course()
{
- if(regex_course_name()&®ex_course_class_period())
+ if(regex_course_name()&®ex_course_class_period()&®ex_course_password())
{
$("#new_course").submit();
}
@@ -102,7 +134,7 @@ function submit_new_course()
function submit_edit_course(id)
{
- if(regex_course_name()&®ex_course_class_period())
+ if(regex_course_name()&®ex_course_class_period()&®ex_course_password())
{
$("#edit_course_"+id).submit();
}
@@ -268,6 +300,31 @@ function submitSerch(content)
{
if(regexName(content)){$("#course_search_form").submit();}
}
+
+//验证搜索时输入名字
+function regexQ(content)
+{
+ var name = $.trim($("#q").val());
+ if(name.length == 0)
+ {
+ $("#course_member_name_span").text(content);
+ $("#course_member_name_span").css('color','#ff0000');
+ $("#course_member_name_span").focus();
+ return false;
+ }
+ else
+ {
+ $("#course_member_name_span").text("");
+ return true;
+ }
+}
+//提交课程成员搜索
+function submitMemberSerch(content)
+{
+ //if(regexQ(content)){$("#course_member_search_form").submit();}
+ $("#course_member_search_form").submit();
+}
+
//课程描述显示更多信息
function show_more_msg()
{
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index b42efdabd..4b6b681c7 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -641,7 +641,6 @@ span.forums-avatar-right{
/*added by bai*/
.user_underlinescore{
margin: 1px;
- padding: 1px;
width:700px;
height:1px;
background-color:#15bccf;
@@ -1106,7 +1105,6 @@ ul.user_course_sort li{list-style-type:none;
}
.user_underline{
margin:1px;
- padding:1px;
width:240px;
height:1px;
background-color:#15bccf;
@@ -1126,7 +1124,6 @@ ul.user_course_sort li{list-style-type:none;
.user_underline2{
margin:1px;
- padding:1px;
width:240px;
height:1px;
background-color:#c6e9fe;
@@ -1134,7 +1131,6 @@ ul.user_course_sort li{list-style-type:none;
}
.user_underline3{
margin: 1px;
- padding:1px;
width:120px;
height:1px;
background-color:#c6e9fe;
@@ -1143,7 +1139,6 @@ ul.user_course_sort li{list-style-type:none;
}
.homepage_underline{
margin:1px;
- padding:1px;
width:240px;
height:1px;
background-color:#c6e9fe;
@@ -3063,7 +3058,6 @@ div.repos_explain{
/* new linchun compitition */
.contest_underline{
margin:1px;
- padding:1px;
width:900px;
height:0.5px;
background-color:#aaa;
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index 47a4fb01a..1fed23fc1 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -117,9 +117,9 @@ a:hover.re_fabu{background:#55a1b9;}
.re_con{ margin:5px; width:665px;}
.re_con_top{color:#494949; }
.re_con_top span{ color:#999999; font-weight:bold;}
-a.re_select{ display:block; height:20px; border:1px solid #ff9900; color:#ff9900; margin-left:10px; padding:2px 5px 1px;}
+a.re_select{ display:block; border:1px solid #ff9900; color:#ff9900; margin-left:10px; padding:1px 5px;}
a:hover.re_select{ background:#ff9900; color:#fff; text-decoration:none;}
-a.re_open{display:block; width:46px; height:19px; border:1px solid #64bdd9; color:#64bdd9; margin-left:10px;padding-top:3px;}
+a.re_open{display:block; width:46px; border:1px solid #64bdd9; color:#64bdd9; margin-left:10px;padding:1px 5px;}
a:hover.re_open{ background:#64bdd9; color:#fff; text-decoration:none;}
a.re_de{ color:#6883b6; margin-left:15px;}
.re_con_box{ border-bottom:1px dashed #dadada; padding-bottom:10px; margin-bottom:10px;}
@@ -273,6 +273,8 @@ a:hover.tijiao{ background:#0f99a9;}
a.member_btn{ padding: 3px 5px; background:#15bccf; color:#fff;}
a:hover.member_btn{ background:#329cbd;}
.hol{display: none;}
+.search_course{margin-top:8px;margin-left:8px;}
+.search_form_course{margin-top:8px;margin-left:8px;}
/* 新建项目 */
.pro_new{ }
@@ -467,6 +469,8 @@ blockquote {
font-family: "Microsoft YaHei";
background: url('../images/requirements/reference.jpg');
}
+a.member_search_edit {width: 43px;background: #15bccf;color: #fff;text-align: center;text-decoration: none;padding: 2px;}
+.min_search_edit {width: 150px;height: 20px;border: 1px solid #d0d0d0 !important;color: #666;}
a.link_file{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; color:#64bdd9; }
a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
@@ -521,8 +525,13 @@ a.wzan_visited{background:url(../images/new_project/public_icon.png) 0px -503px
.vi_zan{color:#28be6c;}
.newwork_btn a{background:#64bdd9;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; display:block; text-align:center; float:right;}
.newwork_btn a:hover{ background:#329cbd;}
-a.files_tag_icon{ background:#dcdcdc; color:#fff; border:1px solid #c8c8c8; padding:1px 10px; float:left; margin-right:10px; margin-bottom:10px;}
-a:hover.files_tag_icon{ background:#64bdd9; color:#fff; border:1px solid #54aeca; }
+.files_tag{ width:670px; height:22px; overflow:hidden; margin-bottom:10px;}
+a.files_tag_icon{ background:#e2f3f9; color:#54aeca; border:1px solid #bbe2ef; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px; }
+a.files_tag_select{ background:#64bdd9; color:#fff; border:1px solid #64bdd9; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px;}
+
+
+
+
diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css
index 2b820381e..8f43077f4 100644
--- a/public/stylesheets/css.css
+++ b/public/stylesheets/css.css
@@ -167,23 +167,8 @@ a:hover.tijiao{ background:#0f99a9 !important;}
.c_grey{ color:#A7A7A7;}
/*新增*/
-.min_search {
- width: 150px;
- height: 15px;
- border: 1px solid #d0d0d0 !important;
- color: #666;
- /*background: url(../images/course/public_icon.png) 135px -193px no-repeat;*/
- /*cursor: pointer;*/
-}
-a.member_search {
- width: 43px;
- height: 22px;
- background: #15bccf;
- color: #fff;
- text-align: center;
- padding: 4px 6px;
- text-decoration: none;
-}
+.min_search {width: 150px;height: 15px;border: 1px solid #d0d0d0 !important;color: #666;}
+a.member_search {width: 43px;height: 22px;background: #15bccf;color: #fff;text-align: center;padding: 4px 6px;text-decoration: none;}
/*上传图片处理*/
.upload_img img{max-width: 100%;}
diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css
index 9ff4985cc..28a6f2b02 100644
--- a/public/stylesheets/public.css
+++ b/public/stylesheets/public.css
@@ -285,6 +285,7 @@ a:hover.close_btn {background-position:-66px 0;}
.msgserver a {color:#15bccf; }
+.hiddent{ overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
.break_word_firefox{white-space: pre-wrap;word-break: break-all;}
diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css
index 6d4cc658e..1e50e41ca 100644
--- a/public/themes/redpenny-master/stylesheets/application.css
+++ b/public/themes/redpenny-master/stylesheets/application.css
@@ -1057,7 +1057,7 @@ display: block;
float: left;
margin-left: 20px;
margin-top: 10px;
-width: 470px;
+width: 540px;
font-family: '微软雅黑'; /*modify by men*/
color: rgb(0, 0, 0);
font-size: 13px;
@@ -1085,7 +1085,7 @@ float: left;
}*/
.information_for_course {
margin-top: 20px;
- margin-left: 507px;
+ margin-left: 550px;
float: left;
height: auto;
width: 300px;
@@ -2008,10 +2008,10 @@ div.tableline{
text-align: justify;
}
.brief_introduction {
- margin-top: -18px;
+ margin-top: -30px;
margin-left: 60px;
/*display: inline-block;*/
- width: 500px;
+ width: 480px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;