diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index d458b73e4..d880ebe35 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -27,7 +27,7 @@ class AttachmentsController < ApplicationController
accept_api_auth :show, :download, :upload
require 'iconv'
include AttachmentsHelper
-
+ include ApplicationHelper
def show
respond_to do |format|
@@ -65,36 +65,7 @@ class AttachmentsController < ApplicationController
def download
# modify by nwb
# 下载添加权限设置
- candown = false
- if @attachment.container.class.to_s != "HomeworkAttach" && (@attachment.container.has_attribute?(:project) || @attachment.container.has_attribute?(:project_id)) && @attachment.container.project
- project = @attachment.container.project
- candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
- elsif @attachment.container.is_a?(Project)
- project = @attachment.container
- candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
- elsif (@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) && @attachment.container.board &&
- @attachment.container.board.project
- project = @attachment.container.board.project
- candown = User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
- elsif (@attachment.container.has_attribute?(:course) ||@attachment.container.has_attribute?(:course_id) ) && @attachment.container.course
- course = @attachment.container.course
- candown = User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)
- elsif @attachment.container.is_a?(Course)
- course = @attachment.container
- candown= User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)
- elsif (@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) && @attachment.container.board &&
- @attachment.container.board.course
- course = @attachment.container.board.course
- candown= User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)
- elsif @attachment.container.class.to_s=="HomeworkAttach" && @attachment.container.bid.reward_type == 3
- candown = true
- elsif @attachment.container_type == "Bid" && @attachment.container && @attachment.container.courses.first
- course = @attachment.container.courses.first
- candown = User.current.member_of_course?(course) || (course.is_public == 1 && @attachment.is_public == 1)
- else
-
- candown = @attachment.is_public == 1
- end
+ candown = attachment_candown @attachment
if candown || User.current.admin? || User.current.id == @attachment.author_id
@attachment.increment_download
if stale?(:etag => @attachment.digest)
@@ -349,6 +320,46 @@ class AttachmentsController < ApplicationController
end
end
+ def add_exist_file_to_projects
+ file = Attachment.find(params[:file_id])
+ projects = params[:projects][:project]
+ @message = ""
+ projects.each do |project|
+ c = Project.find(project);
+ if project_contains_attachment?(c,file)
+ if @message && @message == ""
+ @message += l(:label_project_prompt) + c.name + l(:label_contain_resource) + file.filename + l(:label_quote_resource_failed)
+ next
+ else
+ @message += "
" + l(:label_project_prompt) + c.name + l(:label_contain_resource) + file.filename + l(:label_quote_resource_failed)
+ next
+ end
+ end
+ attach_copied_obj = file.copy
+ attach_copied_obj.tag_list.add(file.tag_list) # tag关联
+ attach_copied_obj.container = c
+ attach_copied_obj.created_on = Time.now
+ attach_copied_obj.author_id = User.current.id
+ attach_copied_obj.copy_from = file.copy_from.nil? ? file.id : file.copy_from
+ if attach_copied_obj.attachtype == nil
+ attach_copied_obj.attachtype = 4
+ end
+ @obj = c
+ @save_flag = attach_copied_obj.save
+ @save_message = attach_copied_obj.errors.full_messages
+ update_quotes attach_copied_obj
+ end
+ respond_to do |format|
+ format.js
+ end
+ rescue NoMethodError
+ @save_flag = false
+ @save_message = [] << l(:label_course_empty_select)
+ respond_to do |format|
+ format.js
+ end
+ end
+
def add_exist_file_to_courses
file = Attachment.find(params[:file_id])
courses = params[:courses][:course]
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index ebdb18c08..581005bf7 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -30,19 +30,19 @@ class CoursesController < ApplicationController
def join
if User.current.logged?
cs = CoursesService.new
- join = cs.join_course params,User.current
+ user = User.current
+ join = cs.join_course params,user
@state = join[:state]
course = join[:course]
else
@state = 5 #未登录
end
respond_to do |format|
- format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => course, :object_id => params[:object_id]} }
+ format.js { render :partial => 'set_join', :locals => {:user => user, :course => course, :object_id => params[:object_id]} }
end
rescue Exception => e
@state = 4 #已经加入了课程
respond_to do |format|
- # format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => nil, :object_id => nil} }
end
end
@@ -323,6 +323,7 @@ class CoursesController < ApplicationController
end
respond_to do |format|
if params[:page]
+ format.html {render :layout => 'base_courses'}
format.js
else
format.html {render :layout => 'base_courses'}
@@ -402,6 +403,9 @@ class CoursesController < ApplicationController
@issue_category ||= IssueCategory.new
@member ||= @course.members.new
@trackers = Tracker.sorted.all
+
+ @roles = Role.givable.all[3..5]
+ @members = @course.member_principals.includes(:roles, :principal).all.sort
else
render_403
end
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 0575294d5..1ca3e2fcf 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -23,13 +23,14 @@ class FilesController < ApplicationController
before_filter :auth_login1, :only => [:index]
before_filter :logged_user_by_apptoken,:only => [:index]
before_filter :find_project_by_project_id#, :except => [:getattachtype]
- before_filter :authorize, :except => [:getattachtype,:quote_resource_show,:search]
+ before_filter :authorize, :except => [:getattachtype,:quote_resource_show,:search,:search_project,:quote_resource_show_project]
helper :sort
include SortHelper
include FilesHelper
helper :project_score
include CoursesHelper
+ include ApplicationHelper
def show_attachments obj
@attachments = []
@@ -41,8 +42,8 @@ class FilesController < ApplicationController
@feedback_count = @all_attachments.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
- @curse_attachments_all = @all_attachments[@offset, @limit]
- @curse_attachments = paginateHelper @all_attachments,10
+ #@curse_attachments_all = @all_attachments[@offset, @limit]
+ @obj_attachments = paginateHelper @all_attachments,10
end
def search
@@ -78,6 +79,39 @@ class FilesController < ApplicationController
end
end
+ def search_project
+ sort = ""
+ @sort = ""
+ @order = ""
+ @is_remote = true
+ if params[:sort]
+ order_by = params[:sort].split(":")
+ @sort = order_by[0]
+ if order_by.count > 1
+ @order = order_by[1]
+ end
+ sort = "#{@sort} #{@order}"
+ end
+
+ begin
+ q = "%#{params[:name].strip}%"
+ #(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
+ if params[:insite]
+ @result = find_public_attache q,sort
+ @result = visable_attachemnts_insite @result,@project
+ @searched_attach = paginateHelper @result,10
+ else
+ @result = find_project_attache q,@project,sort
+ @result = visable_attachemnts @result
+ @searched_attach = paginateHelper @result,10
+ end
+
+ #rescue Exception => e
+ # #render 'stores'
+ # redirect_to search_course_files_url
+ end
+ end
+
def find_course_attache keywords,course,sort = ""
if sort == ""
sort = "created_on DESC"
@@ -87,6 +121,26 @@ class FilesController < ApplicationController
#resultSet = Attachment.find_by_sql("SELECT `attachments`.* FROM `attachments` LEFT OUTER JOIN `homework_attaches` ON `attachments`.container_type = 'HomeworkAttach' AND `attachments`.container_id = `homework_attaches`.id LEFT OUTER JOIN `homework_for_courses` ON `homework_attaches`.bid_id = `homework_for_courses`.bid_id LEFT OUTER JOIN `homework_for_courses` AS H_C ON `attachments`.container_type = 'Bid' AND `attachments`.container_id = H_C.bid_id WHERE (`homework_for_courses`.course_id = 117 OR H_C.course_id = 117 OR (`attachments`.container_type = 'Course' AND `attachments`.container_id = 117)) AND `attachments`.filename LIKE '%#{keywords}%'").reorder("created_on DESC")
end
+ def find_project_attache keywords,project,sort = ""
+ if sort == ""
+ sort = "created_on DESC"
+ end
+ ids = ""
+ len = 0
+ count = project.versions.count
+ project.versions.each do |version|
+ len = len + 1
+ if len != count
+ ids += version.id.to_s + ','
+ else
+ ids += version.id.to_s
+ end
+ end
+ resultSet = Attachment.where("((attachments.container_type = 'Project' And attachments.container_id = '#{project.id}') OR (container_type = 'Version' AND container_id IN (#{ids}))) AND filename LIKE :like ", like: "%#{keywords}%").
+ reorder(sort)
+ #resultSet = Attachment.find_by_sql("SELECT `attachments`.* FROM `attachments` LEFT OUTER JOIN `homework_attaches` ON `attachments`.container_type = 'HomeworkAttach' AND `attachments`.container_id = `homework_attaches`.id LEFT OUTER JOIN `homework_for_courses` ON `homework_attaches`.bid_id = `homework_for_courses`.bid_id LEFT OUTER JOIN `homework_for_courses` AS H_C ON `attachments`.container_type = 'Bid' AND `attachments`.container_id = H_C.bid_id WHERE (`homework_for_courses`.course_id = 117 OR H_C.course_id = 117 OR (`attachments`.container_type = 'Course' AND `attachments`.container_id = 117)) AND `attachments`.filename LIKE '%#{keywords}%'").reorder("created_on DESC")
+ end
+
def find_public_attache keywords,sort = ""
# StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map
# 此时内容不多速度还可,但文件增长,每条判断多则进行3-4次表连接。
@@ -132,17 +186,27 @@ class FilesController < ApplicationController
attribute = "downloads"
when "created_on"
attribute = "created_on"
+ when "quotes"
+ attribute = "quotes"
+ else
+ attribute = "created_on"
end
-
- if order_by.count == 1
- sort += "#{Attachment.table_name}.#{attribute} asc " if attribute
- elsif order_by.count == 2
- sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " if attribute && order_by[1]
- end
- if sort_type != params[:sort].split(",").last
- sort += ","
+ @sort = order_by[0]
+ @order = order_by[1]
+ if order_by.count == 1 && attribute
+ sort += "#{Attachment.table_name}.#{attribute} asc "
+ if sort_type != params[:sort].split(",").last
+ sort += ","
+ end
+ elsif order_by.count == 2 && order_by[1]
+ sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
+ if sort_type != params[:sort].split(",").last
+ sort += ","
+ end
end
end
+ else
+ sort = "#{Attachment.table_name}.created_on desc"
end
@containers = [ Project.includes(:attachments).find(@project.id)]
@@ -184,6 +248,8 @@ class FilesController < ApplicationController
attribute = "created_on"
when "quotes"
attribute = "quotes"
+ else
+ attribute = "created_on"
end
@sort = order_by[0]
@order = order_by[1]
@@ -199,6 +265,8 @@ class FilesController < ApplicationController
end
end
end
+ else
+ sort = "#{Attachment.table_name}.created_on desc"
end
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
@@ -215,6 +283,11 @@ class FilesController < ApplicationController
@can_quote = attachment_candown @file
end
+ def quote_resource_show_project
+ @file = Attachment.find(params[:id])
+ @can_quote = attachment_candown @file
+ end
+
def new
@versions = @project.versions.sort
@course_tag = @project.project_type
diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb
index aaaa4484d..fc243741a 100644
--- a/app/controllers/members_controller.rb
+++ b/app/controllers/members_controller.rb
@@ -133,6 +133,9 @@ class MembersController < ApplicationController
elsif @course
course_info = []
if params[:membership]
+ @create_member_error_messages = "角色不能留空" unless params[:membership][:role_ids]
+ @create_member_error_messages = "用户不能留空" unless params[:membership][:user_ids]
+
if params[:membership][:user_ids]
attrs = params[:membership].dup
user_ids = attrs.delete(:user_ids)
@@ -140,7 +143,7 @@ class MembersController < ApplicationController
member = Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id)
role = Role.find_by_id(params[:membership][:role_ids])
# 这里的判断只能通过角色名,可以弄成常量
- if role.name == "学生" || role.name == "Student"
+ if role && (role.name == "学生" || role.name == "Student")
StudentsForCourse.create(:student_id => user_id, :course_id =>@course.id)
end
members << member
@@ -159,6 +162,11 @@ class MembersController < ApplicationController
end
@course.members << members
@course.course_infos << course_info
+
+ @roles = Role.givable.all[3..5]
+ members = @course.member_principals.includes(:roles, :principal).all.sort
+ else
+ @create_member_error_messages = l(:label_user_role_null)
end
respond_to do |format|
format.html { redirect_to_settings_in_courses }
@@ -242,6 +250,9 @@ class MembersController < ApplicationController
end
end
end
+ @roles = Role.givable.all[3..5]
+ @members = @course.member_principals.includes(:roles, :principal).all.sort
+ @member = @course.members.new
end
saved = @member.save
@@ -304,7 +315,8 @@ class MembersController < ApplicationController
joined.each do |join|
join.delete
end
-
+ @roles = Role.givable.all[3..5]
+ @members = @course.member_principals.includes(:roles, :principal).all.sort
end
respond_to do |format|
format.html { redirect_to_settings_in_courses }
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index c8168455c..fd567c1fa 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1676,6 +1676,42 @@ module ApplicationHelper
courses_doing
end
+
+ def attachment_candown attachment
+ candown = false
+ if attachment.container
+ if attachment.container.class.to_s != "HomeworkAttach" && (attachment.container.has_attribute?(:project) || attachment.container.has_attribute?(:project_id)) && attachment.container.project
+ project = attachment.container.project
+ candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
+ elsif attachment.container.is_a?(Project)
+ project = attachment.container
+ candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
+ elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board &&
+ attachment.container.board.project
+ project = attachment.container.board.project
+ candown = User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
+ elsif (attachment.container.has_attribute?(:course) ||attachment.container.has_attribute?(:course_id) ) && attachment.container.course
+ course = attachment.container.course
+ candown = User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
+ elsif attachment.container.is_a?(Course)
+ course = attachment.container
+ candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
+ elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board &&
+ attachment.container.board.course
+ course = attachment.container.board.course
+ candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
+ elsif attachment.container.class.to_s=="HomeworkAttach" && attachment.container.bid.reward_type == 3
+ candown = true
+ elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses
+ course = attachment.container.courses.first
+ candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1)
+ else
+ candown = (attachment.is_public == 1 || attachment.is_public == true)
+ end
+ end
+ candown
+ end
+
private
def wiki_helper
diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb
index 2e07421f8..8843b1a76 100644
--- a/app/helpers/attachments_helper.rb
+++ b/app/helpers/attachments_helper.rb
@@ -77,6 +77,7 @@ module AttachmentsHelper
end
end
+ #判断课程course中是否包含课件attachment,course中引用了attachment也算作包含
def course_contains_attachment? course,attachment
course.attachments.each do |att|
if att.id == attachment.id || (!att.copy_from.nil? && !attachment.copy_from.nil? && att.copy_from == attachment.copy_from) || att.copy_from == attachment.id || att.id == attachment.copy_from
@@ -85,6 +86,15 @@ module AttachmentsHelper
end
false
end
+ #判断项目project中是否包含课件attachment,project中引用了attachment也算作包含
+ def project_contains_attachment? project,attachment
+ project.attachments.each do |att|
+ if att.id == attachment.id || (!att.copy_from.nil? && !attachment.copy_from.nil? && att.copy_from == attachment.copy_from) || att.copy_from == attachment.id || att.id == attachment.copy_from
+ return true
+ end
+ end
+ false
+ end
def get_qute_number attachment
if attachment.copy_from
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index 384fcaa9b..f4ba5040e 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -677,7 +677,7 @@ module CoursesHelper
#加入课程、退出课程按钮
def join_in_course_header(course, user, options=[])
if user.logged?
- joined = user.member_of_course? course
+ joined = course.members.map{|member| member.user_id}.include? user.id
text = joined ? ("".html_safe + l(:label_course_exit_student)) : ("".html_safe + l(:label_course_join_student))
url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id)
method = joined ? 'delete' : 'post'
@@ -736,4 +736,14 @@ module CoursesHelper
"未启用匿评".html_safe
end
end
+
+ def visable_attachemnts_incourse course
+ result = []
+ course.attachments.each do |attachment|
+ if attachment.is_public? || User.current.member_of_course?(course)
+ result << attachment
+ end
+ end
+ result
+ end
end
diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb
index 884ebc2eb..3c8ed63d4 100644
--- a/app/helpers/files_helper.rb
+++ b/app/helpers/files_helper.rb
@@ -45,6 +45,7 @@ module FilesHelper
File.new(zipfile_name,'w+')
end
+ #带勾选框的课程列表
def courses_check_box_tags(name,courses,current_course,attachment)
s = ''
courses.each do |course|
@@ -55,6 +56,17 @@ module FilesHelper
s.html_safe
end
+ #带勾选框的项目列表
+ def projects_check_box_tags(name,projects,current_project,attachment)
+ s = ''
+ projects.each do |project|
+ if !project_contains_attachment?(project,attachment) && User.current.allowed_to?(:manage_files, project)
+ s << ""
+ end
+ end
+ s.html_safe
+ end
+
#判断用户是否拥有不包含当前资源的课程,需用户在该课程中角色为教师且该课程属于当前学期或下一学期
def has_course? user,file
result = false
@@ -66,6 +78,17 @@ module FilesHelper
result
end
+ #判断用户是否拥有不包含当前资源的项目,需用户在该项目中有资源管理相关资源
+ def has_project? user,file
+ result = false
+ user.projects.each do |project|
+ if !project_contains_attachment?(project,file) && User.current.allowed_to?(:manage_files, project)
+ return true
+ end
+ end
+ result
+ end
+
# 判断指定的资源时候符合类型
def isTypeOk(attachment, type, contentType)
result = false
@@ -97,59 +120,23 @@ module FilesHelper
result
end
- def visable_attachemnts_incourse attachments
+ def visable_attachemnts_insite attachments,obj
result = []
- attachments.each do |attachment|
- if attachment.is_public? || (attachment.author.member_of_course?(Course.find(attachment.container_id)))|| attachment.author_id == User.current.id
- result << attachment
- end
- end
- result
- end
-
- def visable_attachemnts_insite attachments,course
- result = []
- attachments.each do |attachment|
- if attachment.is_public? || (attachment.container_type == "Course" && attachment.container_id == course.id && User.current.member_of_course?(Course.find(attachment.container_id)))|| attachment.author_id == User.current.id
- result << attachment
+ if obj.is_a?(Course)
+ attachments.each do |attachment|
+ if attachment.is_public? || (attachment.container_type == "Course" && attachment.container_id == obj.id && User.current.member_of_course?(Course.find(attachment.container_id)))|| attachment.author_id == User.current.id
+ result << attachment
+ end
end
+ else if obj.is_a?(Project)
+ attachments.each do |attachment|
+ if attachment.is_public? || (attachment.container_type == "Project" && attachment.container_id == obj.id && User.current.member_of_course?(Project.find(attachment.container_id)))|| attachment.author_id == User.current.id
+ result << attachment
+ end
+ end
end
- result
end
-
- def attachment_candown attachment
- candown = false
- if attachment.container
- if attachment.container.class.to_s != "HomeworkAttach" && (attachment.container.has_attribute?(:project) || attachment.container.has_attribute?(:project_id)) && attachment.container.project
- project = attachment.container.project
- candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
- elsif attachment.container.is_a?(Project)
- project = attachment.container
- candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
- elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board &&
- attachment.container.board.project
- project = attachment.container.board.project
- candown = User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
- elsif (attachment.container.has_attribute?(:course) ||attachment.container.has_attribute?(:course_id) ) && attachment.container.course
- course = attachment.container.course
- candown = User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
- elsif attachment.container.is_a?(Course)
- course = attachment.container
- candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
- elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board &&
- attachment.container.board.course
- course = attachment.container.board.course
- candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
- elsif attachment.container.class.to_s=="HomeworkAttach" && attachment.container.bid.reward_type == 3
- candown = true
- elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses
- course = attachment.container.courses.first
- candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1)
- else
- candown = (attachment.is_public == 1 || attachment.is_public == true)
- end
- end
- candown
+ result
end
diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb
index ed18b7ae4..29ba94924 100644
--- a/app/helpers/members_helper.rb
+++ b/app/helpers/members_helper.rb
@@ -45,17 +45,14 @@ module MembersHelper
# 课程可添加的成员列表
def render_principals_for_new_course_members(course)
scope = Principal.active.sorted.not_member_of_course(course).like(params[:q])
- principal_count = scope.count
- principal_pages = Redmine::Pagination::Paginator.new principal_count, 10, params['page']
- principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all
-
- s = content_tag('div', principals_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals')
+ principals = paginateHelper scope,10
+ s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals')
- links = pagination_links_full(principal_pages, principal_count, :per_page_links => false) {|text, parameters, options|
+ links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true) {|text, parameters, options|
link_to text, autocomplete_course_memberships_path(course, parameters.merge(:q => params[:q], :format => 'js')), :remote => true
}
- s + content_tag('div', content_tag('ul', links), :class => 'pagination_new')
+ s + content_tag('ul', links,:class => 'wlist',:id => "course_member_pagination_links")
end
diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb
index 8974a52d3..7995d7e68 100644
--- a/app/helpers/watchers_helper.rb
+++ b/app/helpers/watchers_helper.rb
@@ -155,7 +155,7 @@ module WatchersHelper
else
text = l(:label_new_join_group)
form_tag({:controller => "courses", :action => "join_group", :object_id => "#{group.id}"}, :remote => true, :method => 'post') do
- submit_tag text, class: "group_in", style: "width: 43px;height: 21px;"
+ submit_tag text, class: "group_in", style: "width: 90px;height: 21px;"
end
end
end
diff --git a/app/views/attachments/add_exist_file_to_projects.js.erb b/app/views/attachments/add_exist_file_to_projects.js.erb
new file mode 100644
index 000000000..88f45e2cf
--- /dev/null
+++ b/app/views/attachments/add_exist_file_to_projects.js.erb
@@ -0,0 +1,7 @@
+<% if !@save_flag && @save_message %>
+$("#error_show").html("<%= @save_message.join(', ') %>");
+<% elsif @message && @message != "" %>
+$("#error_show").html("<%= @message.html_safe %>");
+<% else %>
+closeModal();
+<% end %>
\ No newline at end of file
diff --git a/app/views/bids/_new_homework_form.html.erb b/app/views/bids/_new_homework_form.html.erb
index 210d96891..9f3bf30c7 100644
--- a/app/views/bids/_new_homework_form.html.erb
+++ b/app/views/bids/_new_homework_form.html.erb
@@ -33,8 +33,9 @@
添加成员
+ <%= form_for(@member, {:as => :membership, :url => course_memberships_path(@course), :remote => true, :method => :post}) do |f| %> +共有 <%= all_attachments.count%> 个资源
++ <% if order == "asc" %> + 按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> / + <%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> / + <%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 + <% else %> + 按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> / + <%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> / + <%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 + <% end %> +
+文件大小:<%= 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 manage_allowed && file.container_id == project.id && file.container_type == "Project"%> +<%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
+- | - -