diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index c0322e0cb..d352cf11a 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -144,6 +144,36 @@ class AccountController < ApplicationController end end + #should_confirmation_password是否验证密码 + def create_and_save_user login,password,email,password_confirmation,should_confirmation_password + @user = User.new + @user.admin = false + @user.register + @user.login = login + @user.mail = email + if should_confirmation_password && !password.blank? && !password_confirmation.blank? + @user.password,@user.password_confirmation = password,password_confirmation + elsif !should_confirmation_password && !password.blank? + @user.password = password + else + @user.password = "" + end + case Setting.self_registration + when '1' + register_by_email_activation(@user) + when '3' + register_automatically(@user) + else + register_manually_by_administrator(@user) + end + if @user.id != nil + ue = @user.user_extensions ||= UserExtensions.new + ue.user_id = @user.id + ue.save + end + @user + end + # Token based account activation def activate (redirect_to(home_url); return) unless Setting.self_registration? && params[:token].present? diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 32cfefa9d..78ac4d208 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -309,7 +309,7 @@ class ApplicationController < ActionController::Base # Find project of id params[:id] def find_project - @project = Project.find_by_id(params[:id]) + @project = Project.find(params[:id]) rescue ActiveRecord::RecordNotFound render_404 end diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 89a96a836..952dcdf44 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -87,8 +87,9 @@ class AttachmentsController < ApplicationController 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 - candown = User.current.member_of_course?(@attachment.container.courses.first) || (course.is_public == 1 && @attachment.is_public == 1) + 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 @@ -204,7 +205,6 @@ class AttachmentsController < ApplicationController @attachment.container.init_journal(User.current) end if @attachment.container - # Make sure association callbacks are called @attachment.container.attachments.delete(@attachment) else @attachment.destroy @@ -351,8 +351,13 @@ class AttachmentsController < ApplicationController courses.each do |course| c = Course.find(course); if course_contains_attachment?(c,file) - @message += l(:label_course_prompt) + c.name + l(:label_contain_resource) + file.filename + l(:label_quote_resource_failed) - next + if @message && @message == "" + @message += l(:label_course_prompt) + c.name + l(:label_contain_resource) + file.filename + l(:label_quote_resource_failed) + next + else + @message += "
" + l(:label_course_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关联 @@ -366,6 +371,7 @@ class AttachmentsController < ApplicationController @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 @@ -378,6 +384,20 @@ class AttachmentsController < ApplicationController end end + def update_quotes attachment + if attachment.copy_from + attachments = Attachment.find_by_sql("select * from attachments where copy_from = #{attachment.copy_from} or id = #{attachment.copy_from}") + else + attachments = Attachment.find_by_sql("select * from attachments where copy_from = #{attachment.id} or id = #{attachment.copy_from}") + end + attachment.quotes = get_qute_number attachment + attachment.save + attachments.each do |att| + att.quotes = attachment.quotes + att.save + end + end + private def find_project @attachment = Attachment.find(params[:id]) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index c8ce6ec31..2997f4205 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -842,7 +842,7 @@ class BidsController < ApplicationController # 编辑作业 def edit @bid = Bid.find(params[:bid_id]) - if (User.current.admin?||User.current.id==@bid.author_id) + if (User.current.admin?||User.current.allowed_to?(:as_teacher,@bid.courses.first)) @course_id = params[:course_id] respond_to do |format| format.html { @@ -868,7 +868,7 @@ class BidsController < ApplicationController @bid.reward_type = 3 @bid.deadline = params[:bid][:deadline] @bid.budget = 0 - @bid.author_id = User.current.id + #@bid.author_id = User.current.id @bid.commit = 0 @bid.homework_type = 1 @bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) @@ -884,6 +884,7 @@ class BidsController < ApplicationController def new_submit_homework #render html to prepare create submit homework find_bid + find_bid render :layout => 'base_homework' end diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 56ed69c49..383da0bbe 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -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 diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index 627e1945b..6213b2315 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -37,7 +37,7 @@ class ContestsController < ApplicationController def index - render_404 + render_404 unless params[:name] # @contests = Contest.visible # @contests ||= [] @offset, @limit = api_offset_and_limit(:limit => 10) @@ -188,10 +188,10 @@ class ContestsController < ApplicationController # Added by Longjun def destroy_contest @contest = Contest.find(params[:id]) - if @contest.author_id == User.current.id + if @contest.author_id == User.current.id || User.current.admin? @contest.destroy - redirect_to action: 'index' + redirect_to welcome_contest_url else render_403 :message => :notice_not_contest_delete_authorized end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 564033627..2b0e51722 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -84,6 +84,8 @@ class CoursesController < ApplicationController end end + + def join_private_courses respond_to do |format| format.js @@ -150,62 +152,66 @@ class CoursesController < ApplicationController # 课程搜索 # add by nwb def search - #courses_all = Course.all_course - #name = params[:name] + courses_all = Course.all_course + name = params[:name] #(redirect_to courses_url, :notice => l(:label_sumbit_empty);return) if name.blank? - #@courses = courses_all.visible - #if params[:name].present? - # @courses_all = @courses.like(params[:name]) - #else - # @courses_all = @courses; - #end - cs = CoursesService.new - @courses_all = cs.search_course params - @course_count = @courses_all.count - @course_pages = Paginator.new @course_count, per_page_option, params['page'] - + if name.blank? + @courses = [] + @courses_all = [] + @course_count = 0 + @course_pages = Paginator.new @course_count, per_page_option, params['page'] + else + @courses = courses_all.visible + if params[:name].present? + @courses_all = @courses.like(params[:name]) + else + @courses_all = @courses; + end + @course_count = @courses_all.count + @course_pages = Paginator.new @course_count, per_page_option, params['page'] - # 课程的动态数 - @course_activity_count=Hash.new - @courses_all.each do |course| - @course_activity_count[course.id]=0 - end + # 课程的动态数 + @course_activity_count=Hash.new + @courses_all.each do |course| + @course_activity_count[course.id]=0 + end - case params[:course_sort_type] - when '0' - @courses = @courses_all.order("created_at desc") - @s_type = 0 - @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) + case params[:course_sort_type] + when '0' + @courses = @courses_all.order("created_at desc") + @s_type = 0 + @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) - @course_activity_count=get_course_activity @courses,@course_activity_count + @course_activity_count=get_course_activity @courses,@course_activity_count - when '1' - @courses = @courses_all.order("course_ac_para desc") - @s_type = 1 - @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) + when '1' + @courses = @courses_all.order("course_ac_para desc") + @s_type = 1 + @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) - @course_activity_count=get_course_activity @courses,@course_activity_count + @course_activity_count=get_course_activity @courses,@course_activity_count - when '2' - @courses = @courses_all.order("watchers_count desc") - @s_type = 2 - @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) + when '2' + @courses = @courses_all.order("watchers_count desc") + @s_type = 2 + @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) - @course_activity_count=get_course_activity @courses,@course_activity_count + @course_activity_count=get_course_activity @courses,@course_activity_count - when '3' - @course_activity_count=get_course_activity @courses_all,@course_activity_count_array - @courses=handle_course @courses_all,@course_activity_count - @s_type = 3 - @courses = @courses[@course_pages.offset, @course_pages.per_page] + when '3' + @course_activity_count=get_course_activity @courses_all,@course_activity_count_array + @courses=handle_course @courses_all,@course_activity_count + @s_type = 3 + @courses = @courses[@course_pages.offset, @course_pages.per_page] - else - @s_type = 0 - @courses = @courses_all.order("created_at desc") - @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) + else + @s_type = 0 + @courses = @courses_all.order("created_at desc") + @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) - @course_activity_count=get_course_activity @courses,@course_activity_count + @course_activity_count=get_course_activity @courses,@course_activity_count + end end respond_to do |format| @@ -228,11 +234,11 @@ class CoursesController < ApplicationController end end - def member - ## 有角色参数的才是课程,没有的就是项目 + def searchmembers + @subPage_title = l :label_student_list @render_file = 'member_list' - #@teachers= searchTeacherAndAssistant(@course) @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' + case params[:role] when '1' @subPage_title = l :label_teacher_list @@ -243,7 +249,18 @@ class CoursesController < ApplicationController else @subPage_title = '' #@members = @course.member_principals.includes(:roles, :principal).all.sort - end + @is_remote = true + q = "#{params[:name].strip}" + #(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank? + if params[:incourse] + @results = searchStudent_by_name(@course, q) + elsif params[:ingroup] + @group = CourseGroup.find(params[:search_group_id]) + @results = searchgroupstudent_by_name(@group, @course, q) + end + @result_count = @results.count + @results = paginateHelper @results + cs = CoursesService.new @members = cs.course_teacher_or_student_list(params,@course,User.current) @members = paginateHelper @members @@ -255,6 +272,125 @@ class CoursesController < ApplicationController end end + def addgroups + @subPage_title = l :label_student_list + if params[:group_name] + group = CourseGroup.new + group.name = params[:group_name] + 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 + + def deletegroup + CourseGroup.delete(params[:group_id]) + @subPage_title = l :label_student_list + @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' + @is_remote = true + @members = searchStudent(@course) + @membercount = @members.count + @course_groups = @course.course_groups + end + + def updategroupname + @subPage_title = l :label_student_list + if params[:group_name] + group = CourseGroup.find(params[:group_id]) + group.name = params[:group_name] + 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 + def join_group + @subPage_title = l :label_student_list + group = CourseGroup.find(params[:object_id]) + member = Member.where(:course_id => @course.id, :user_id => User.current.id).first + member.course_group_id = group.id + member.save + @group = group + @members = searchStudent(@course) + @course_groups = @course.course_groups + @membercount = @members.count + search_group_members group + end + def unjoin_group + @subPage_title = l :label_student_list + group = CourseGroup.find(params[:object_id]) + member = Member.where(:course_id => @course.id, :user_id => User.current.id).first + member.course_group_id = 0 + member.save + @group = group + @course_groups = @course.course_groups + @members = searchStudent(@course) + @membercount = @members.count + search_group_members group + end + def searchgroupmembers + @subPage_title = l :label_student_list + @render_file = 'member_list' + @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' + @is_remote = true + if params[:group_id] && params[:group_id] != "0" + @group = CourseGroup.find(params[:group_id]) + @results = searchStudent_by_group(@group, @course) + else + @results = searchStudent(@course) + end + @members = searchStudent(@course) + @membercount = @members.count + @results = paginateHelper @results + end + def search_group_members group + @subPage_title = l :label_student_list + @render_file = 'member_list' + @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' + @is_remote = true + @members = searchStudent(@course) + @membercount = @members.count + @results = searchStudent_by_group(group, @course) + @results = paginateHelper @results + end + def member + ## 有角色参数的才是课程,没有的就是项目 + 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? + @show_serch = params[:role] == '2' + 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 + end + @members = paginateHelper @members + render :layout => 'base_courses' + else + render_403 + end + + end + #判断指定用户是否为课程教师 def isCourseTeacher(id) result = false @@ -546,7 +682,7 @@ class CoursesController < ApplicationController end def homework - if @course.is_public != 0 || User.current.member_of_course?(@course) + if @course.is_public != 0 || User.current.member_of_course?(@course) || User.current.admin? @offset, @limit = api_offset_and_limit({:limit => 10}) @bids = @course.homeworks.order('deadline DESC') @bids = @bids.like(params[:name]) if params[:name].present? @@ -724,24 +860,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 - 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 + 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 + end diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index aa1c158e0..2f33ab554 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -45,37 +45,56 @@ class FilesController < ApplicationController end def search + 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 - @is_remote = true 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 - @result = visable_attachemnts @result + @result = find_public_attache q,sort + @result = visable_attachemnts_insite @result,@course @searched_attach = paginateHelper @result,10 else - @result = find_course_attache q,@course + @result = find_course_attache q,@course,sort @result = visable_attachemnts @result @searched_attach = paginateHelper @result,10 end - rescue Exception => e - #render 'stores' - redirect_to stores_url + #rescue Exception => e + # #render 'stores' + # redirect_to search_course_files_url end end - def find_course_attache keywords,course + def find_course_attache keywords,course,sort = "" + if sort == "" + sort = "created_on DESC" + end resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%"). - reorder("created_on DESC") + 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 + def find_public_attache keywords,sort = "" # StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map # 此时内容不多速度还可,但文件增长,每条判断多则进行3-4次表连接。 # 现在还木有思路 药丸 - resultSet = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE :like ", like: "%#{keywords}%"). - reorder("created_on DESC") + if sort == "" + sort = "created_on DESC" + end + resultSet = Attachment.where("attachments.container_type IS NOT NULL AND attachments.copy_from IS NULL AND filename LIKE :like ", like: "%#{keywords}%"). + reorder(sort) end def index @@ -114,9 +133,9 @@ class FilesController < ApplicationController end if order_by.count == 1 - sort += "#{Attachment.table_name}.#{attribute} asc " + sort += "#{Attachment.table_name}.#{attribute} asc " if attribute elsif order_by.count == 2 - sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " + sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " if attribute && order_by[1] end if sort_type != params[:sort].split(",").last sort += "," @@ -152,16 +171,21 @@ class FilesController < ApplicationController attribute = "downloads" when "created_on" attribute = "created_on" + when "quotes" + attribute = "quotes" end @sort = order_by[0] @order = order_by[1] - if order_by.count == 1 + if order_by.count == 1 && attribute sort += "#{Attachment.table_name}.#{attribute} asc " - elsif order_by.count == 2 + 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]} " - end - if sort_type != params[:sort].split(",").last - sort += "," + if sort_type != params[:sort].split(",").last + sort += "," + end end end end @@ -372,14 +396,14 @@ class FilesController < ApplicationController end end - # show_attachments @containers - # @attachtype = params[:type].to_i - # @contenttype = params[:contentType].to_s - # - # respond_to do |format| - # format.js - # format.html - # end + show_attachments @containers + @attachtype = params[:type].to_i + @contenttype = params[:contentType].to_s + + respond_to do |format| + format.js + format.html + end end end diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index ff6463036..72755dc6a 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -22,23 +22,10 @@ class HomeworkAttachController < ApplicationController #获取未批作业列表 def get_not_batch_homework sort, direction = params[:sort] || "s_socre", params[:direction] || "desc" - if sort == 't_socre' - order_by = "t_score #{direction}" - elsif sort == 's_socre' - order_by = "s_score #{direction}" - elsif sort == 'time' - order_by = "created_at #{direction}" - end teachers = find_course_teachers @course - all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score - FROM homework_attaches WHERE bid_id = #{@bid.id} - ORDER BY #{order_by}) AS table1 - WHERE table1.t_score IS NULL") + get_not_batch_homework_list sort,direction,teachers, @bid.id @cur_page = params[:page] || 1 @cur_type = 1 - @homework_list = paginateHelper all_homework_list,10 @direction = direction == 'asc'? 'desc' : 'asc' respond_to do |format| format.js @@ -57,8 +44,8 @@ class HomeworkAttachController < ApplicationController end teachers = find_course_teachers @course all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers} and stars IS NOT NULL) AS t_score, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers}) and stars IS NOT NULL) AS t_score, + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers})) AS s_score FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY #{order_by}) AS table1 WHERE table1.t_score IS NOT NULL") @@ -83,8 +70,8 @@ class HomeworkAttachController < ApplicationController end teachers = find_course_teachers @course all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id in #{teachers}) AS t_score, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id not in #{teachers}) AS s_score + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id in (#{teachers})) AS t_score, + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id not in (#{teachers})) AS s_score FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY #{order_by}") @cur_page = params[:page] || 1 @@ -101,8 +88,8 @@ class HomeworkAttachController < ApplicationController @is_student_batch_homework = true teachers = find_course_teachers @course all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score, + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers})) AS t_score, + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers})) AS s_score, (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id}) AS m_score FROM homework_attaches INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id @@ -120,15 +107,15 @@ class HomeworkAttachController < ApplicationController @is_my_homework = true teachers = find_course_teachers @course all_homework_list = HomeworkAttach.find_by_sql("SELECT homework_attaches.*, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers})) AS t_score, + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers})) AS s_score FROM homework_attaches WHERE homework_attaches.bid_id = #{@bid.id} AND homework_attaches.user_id = #{User.current.id}") #如果我没有创建过作业,就检索我是否参与了某个作业 if all_homework_list.empty? all_homework_list = HomeworkAttach.find_by_sql("SELECT homework_attaches.*, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers})) AS t_score, + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers})) AS s_score FROM homework_attaches INNER JOIN homework_users ON homework_users.homework_attach_id = homework_attaches.id WHERE homework_attaches.bid_id = #{@bid.id} AND homework_users.user_id = #{User.current.id}") @@ -297,11 +284,6 @@ class HomeworkAttachController < ApplicationController end end - #获取指定作业的所有成员 - def users_for_homework homework - homework.nil? ? [] : (homework.users + [homework.user]) - end - #获取可选成员列表 #homework:作业 #users:该作业所有成员 @@ -318,7 +300,8 @@ class HomeworkAttachController < ApplicationController end def edit - if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first) + bid = @homework.bid + if (bid.comment_status == 0 || bid.open_anonymous_evaluation == 0) && (User.current.admin? || User.current.member_of_course?(bid.courses.first)) get_homework_member @homework else render_403 :message => :notice_not_authorized @@ -350,7 +333,8 @@ class HomeworkAttachController < ApplicationController end def destroy - if User.current.admin? || User.current == @homework.user + bid = @homework.bid + if (bid.comment_status == 0 || bid.open_anonymous_evaluation == 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 } @@ -370,48 +354,21 @@ class HomeworkAttachController < ApplicationController #显示作业信息 def show - if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first) - # 打分统计 - stars_reates = @homework. rates(:quality) - #是否已经进行过评价 - temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{@homework.id} AND rater_id = #{User.current.id}").first - @m_score = temp.nil? ? 0:temp.stars - @has_evaluation = stars_reates.where("rater_id = ?",User.current).count > 0 - #@jours留言 is null条件用以兼容历史数据 - @jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC") + if User.current.admin? || User.current.member_of_course?(@course) + # 作业打分列表 + @stars_reates = @homework.rates(:quality) + #我的评分 + @has_evaluation = @stars_reates.where("rater_id = #{User.current.id}").first + @m_score = @has_evaluation.nil? ? 0 : @has_evaluation.stars + teachers = find_course_teachers(@course) + @teacher_stars = @stars_reates.where("rater_id in (#{teachers})") #老师评分列表 + @student_stars = @stars_reates.where("rater_id not in (#{teachers})") #学生评分列表 + @is_teacher = is_course_teacher User.current,@course + @is_anonymous_comments = @bid.comment_status == 1 && !@homework.users.include?(User.current) && @homework.user != User.current && !@is_teacher #判断是不是匿评(开启匿评,当前用户不是作业的创建者或者参与者,不是老师) + jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")#jours留言 is null条件用以兼容历史数据 + @jour = paginateHelper jours,5 #留言 @cur_page = params[:cur_page] || 1 @cur_type = params[:cur_type] || 5 - @jour = paginateHelper @jours,5 - - teachers = searchTeacherAndAssistant @course - @comprehensive_evaluation = [] - teachers.each do|teacher| - temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first - @comprehensive_evaluation << temp if temp - end - annymous_users = @homework.homework_evaluations.map(&:user) - unless annymous_users.nil? || annymous_users.count == 0 - @anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in #{convert_array(annymous_users)}").order("created_on DESC") - end - @totle_score = score_for_homework @homework - @teaher_score = teacher_score_for_homework @homework - - is_student = is_cur_course_student @homework.bid.courses.first - is_teacher = is_course_teacher User.current,@homework.bid.courses.first - @is_anonymous_comments = @homework.bid.comment_status == 1 #是否开启了匿评 - if !User.current.member_of_course?(@homework.bid.courses.first) - @is_comprehensive_evaluation = 3 #留言 - elsif is_student && @is_anonymous_comments && !@has_evaluation#是学生且开启了匿评且未进行评分 - @is_comprehensive_evaluation = 2 #匿评 - elsif is_student && @is_anonymous_comments && @has_evaluation #是学生且开启了匿评,但已评分 - @is_comprehensive_evaluation = 2 #匿评 - elsif is_student && !@is_anonymous_comments #是学生未开启匿评 - @is_comprehensive_evaluation = 3 #留言 - elsif is_teacher - @is_comprehensive_evaluation = 1 #教师评论 - else - @is_comprehensive_evaluation = 3 - end respond_to do |format| format.html @@ -424,30 +381,40 @@ class HomeworkAttachController < ApplicationController #删除留言 def destroy_jour - @homework = HomeworkAttach.find(params[:jour_id]) - @course=@homework.bid.courses.first + @homework = HomeworkAttach.find(params[:homework_id]) @journal_destroyed = JournalsForMessage.find(params[:object_id]) - @is_comprehensive_evaluation = @journal_destroyed.is_comprehensive_evaluation - @journal_destroyed.destroy - if @is_comprehensive_evaluation == 3 - @jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC") - @jour = paginateHelper @jours,5 - elsif @is_comprehensive_evaluation == 2 - annymous_users = @homework.homework_evaluations.map(&:user) - unless annymous_users.nil? || annymous_users.count == 0 - @anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in #{convert_array(annymous_users)}").order("created_on DESC") - end - elsif @is_comprehensive_evaluation == 1 - teachers = searchTeacherAndAssistant @course - @comprehensive_evaluation = [] - teachers.each do|teacher| - temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first - @comprehensive_evaluation << temp if temp - end + if @journal_destroyed.is_comprehensive_evaluation == 3 && @journal_destroyed.destroy + render_403 unless User.current == @journal_destroyed.user || User.current.admin? + teachers = find_course_teachers(@homework.bid.courses.first) + @stars_reates = @homework.rates(:quality) + @teacher_stars = @stars_reates.where("rater_id in (#{teachers})") #老师评分列表 + @student_stars = @stars_reates.where("rater_id not in (#{teachers})") #学生评分列表 + jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")#jours留言 is null条件用以兼容历史数据 + @jour = paginateHelper jours,5 #留言 + else + render_404 end - - + #@course=@homework.bid.courses.first + #@journal_destroyed = JournalsForMessage.find(params[:object_id]) + #@is_comprehensive_evaluation = @journal_destroyed.is_comprehensive_evaluation + #@journal_destroyed.destroy + #if @is_comprehensive_evaluation == 3 + # @jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC") + # @jour = paginateHelper @jours,5 + #elsif @is_comprehensive_evaluation == 2 + # annymous_users = @homework.homework_evaluations.map { |homework_evaluation| homework_evaluation.user.id}.join(',') + # unless annymous_users.nil? || annymous_users.count == "" + # @anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in (#{annymous_users})").order("created_on DESC") + # end + #elsif @is_comprehensive_evaluation == 1 + # teachers = searchTeacherAndAssistant @course + # @comprehensive_evaluation = [] + # teachers.each do|teacher| + # temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first + # @comprehensive_evaluation << temp if temp + # end + #end respond_to do |format| format.js end @@ -455,55 +422,49 @@ class HomeworkAttachController < ApplicationController #添加留言 def addjours - @homework = HomeworkAttach.find(params[:jour_id]) - @add_jour = @homework.addjours User.current.id, params[:new_form][:user_message],0,params[:is_comprehensive_evaluation] - if @add_jour.is_comprehensive_evaluation == 3 - @jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC") - @jour = paginateHelper @jours,5 - elsif @add_jour.is_comprehensive_evaluation == 2 - annymous_users = @homework.homework_evaluations.map(&:user) - unless annymous_users.nil? || annymous_users.count == 0 - @anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in #{convert_array(annymous_users)}").order("created_on DESC") - end - elsif @add_jour.is_comprehensive_evaluation == 1 - teachers = searchTeacherAndAssistant @homework.bid.courses.first - @comprehensive_evaluation = [] - teachers.each do|teacher| - temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first - @comprehensive_evaluation << temp if temp - end - end - + @is_teacher,@is_anonymous_comments,@m_score = params[:is_teacher]=="true",params[:is_anonymous_comments]=="true",params[:stars_value] + @cur_page,@cur_type = params[:cur_page] || 1,params[:cur_type] || 5 + @homework = HomeworkAttach.find(params[:homework_id]) + + #保存评分 + @homework.rate(@m_score.to_i,User.current.id,:quality) if @m_score + #保存评论 + @is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言 + if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" #有没有留言 + @homework.addjours User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation + end + + teachers = find_course_teachers(@homework.bid.courses.first) + @stars_reates = @homework.rates(:quality) + @teacher_stars = @stars_reates.where("rater_id in (#{teachers})") #老师评分列表 + @student_stars = @stars_reates.where("rater_id not in (#{teachers})") #学生评分列表 + jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")#jours留言 is null条件用以兼容历史数据 + @jour = paginateHelper jours,5 #留言 + + if @cur_type == "1" #如果当前是老师未批列表,需要刷新整个作业列表界面 + @bid = @homework.bid + get_not_batch_homework_list "s_socre","desc",teachers,@homework.bid_id + elsif @cur_type == "2" #老师已批列表 + @result_homework = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*, + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers}) and stars IS NOT NULL) AS t_score, + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers})) AS s_score + FROM homework_attaches WHERE id = #{@homework.id}").first + elsif @cur_type == "3" #全部作业列表 + @result_homework = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*, + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id in (#{teachers})) AS t_score, + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id not in (#{teachers})) AS s_score + FROM homework_attaches WHERE id = #{@homework.id}").first + elsif @cur_type == "4" #匿评作业列表 + @is_student_batch_homework = true + @result_homework = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*, + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers})) AS t_score, + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers})) AS s_score, + (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id}) AS m_score + FROM homework_attaches + WHERE homework_attaches.id = #{@homework.id}").first + else #其他的不用管 - #@limit = 10 - #@feedback_count = @jours.count - #@feedback_pages = Paginator.new @feedback_count, @limit, params['page'] - #@offset ||= @feedback_pages.offset - #@jour = @jours[@offset, @limit] - #@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation is not null").order("created_on DESC") - - @totle_score = score_for_homework @homework - @teaher_score = teacher_score_for_homework @homework - stars_reates = @homework. rates(:quality) - is_student = is_cur_course_student @homework.bid.courses.first - is_teacher = is_course_teacher User.current,@homework.bid.courses.first - @has_evaluation = stars_reates.where("rater_id = ?",User.current).count > 0 - @is_anonymous_comments = @homework.bid.comment_status == 1 #是否开启了匿评 - if !User.current.member_of_course?(@homework.bid.courses.first) - @is_comprehensive_evaluation = 3 #留言 - elsif is_student && @is_anonymous_comments && !@has_evaluation#是学生且开启了匿评且未进行评分 - @is_comprehensive_evaluation = 2 #匿评 - elsif is_student && @is_anonymous_comments && @has_evaluation #是学生且开启了匿评,但已评分 - @is_comprehensive_evaluation = 3 #留言 - elsif is_student && !@is_anonymous_comments #是学生未开启匿评 - @is_comprehensive_evaluation = 3 #留言 - elsif is_teacher - @is_comprehensive_evaluation = 1 #教师评论 - else - @is_comprehensive_evaluation = 3 end - - respond_to do |format| format.js end @@ -578,16 +539,7 @@ class HomeworkAttachController < ApplicationController #获取课程的老师列表 def find_course_teachers course - 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 - teachers + searchTeacherAndAssistant(course).map{|teacher| teacher.user_id}.join(",") end #获取作业教师评分所占比例 @@ -599,5 +551,27 @@ class HomeworkAttachController < ApplicationController end teacher_proportion end + + def get_not_batch_homework_list sort,direction,teachers,bid_id + if sort == 't_socre' + order_by = "t_score #{direction}" + elsif sort == 's_socre' + order_by = "s_score #{direction}" + elsif sort == 'time' + order_by = "created_at #{direction}" + end + all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*, + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers})) AS t_score, + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers})) AS s_score + FROM homework_attaches WHERE bid_id = #{bid_id} + ORDER BY #{order_by}) AS table1 + WHERE table1.t_score IS NULL") + @homework_list = paginateHelper all_homework_list,10 + end + + #获取指定作业的所有成员 + def users_for_homework homework + homework.nil? ? [] : (homework.users + [homework.user]) + end end diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index fa19a1a3d..867c2a302 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -217,6 +217,7 @@ class MembersController < ApplicationController joined.each do |join| join.delete end + @member.course_group_id = 0 end if role.allowed_to?(:is_manager) @courseInfo = CourseInfos.new(:user_id => @member.user_id, :course_id => @course.id) diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 868540b64..9eeddacf9 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -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 - - @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)}") } + 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) + + 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 diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index a7bf1edb8..008fe00fc 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -58,7 +58,7 @@ class SchoolController < ApplicationController options_s = "" school.each do |s| - options_s << "
  • #{s.name}
  • " + options_s << "
  • #{s.name}
  • " end res = Hash.new @@ -78,7 +78,7 @@ class SchoolController < ApplicationController @school.each do |s| #options << "" - options << "
  • #{s.name}
  • " + options << "
  • #{s.name}
  • " end @@ -91,7 +91,7 @@ class SchoolController < ApplicationController options = "" @school.each do |s| - options << "
  • #{s.name}
  • " + options << "
  • #{s.name}
  • " end render :text => options @@ -105,7 +105,7 @@ class SchoolController < ApplicationController options = "" @school.each do |s| - options << "
  • #{s.name}
  • " + options << "
  • #{s.name}
  • " end options = "
    #{l(:label_school_not_fount)}
    " if options.blank? diff --git a/app/controllers/stores_controller.rb b/app/controllers/stores_controller.rb index a68d12517..b1705c826 100644 --- a/app/controllers/stores_controller.rb +++ b/app/controllers/stores_controller.rb @@ -26,19 +26,19 @@ class StoresController < ApplicationController resultSet = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE :like ", like: "%#{keywords}%"). reorder("created_on DESC") - # result = resultSet.to_a.dup + result = resultSet.to_a.dup - # resultSet.to_a.map { |res| - # if(res.container.nil? || - # (res.container.class.to_s=="Project" && res.container.is_public == false) || - # (res.container.has_attribute?(:project) && res.container.project.is_public == false) || - # (res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) || - # false - # ) - # result.delete(res) - # end - # } - # result + resultSet.to_a.map { |res| + if(res.container.nil? || + (res.container.class.to_s=="Project" && res.container.is_public == false) || + (res.container.has_attribute?(:project) && res.container.project.is_public == false) || + (res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) || + false + ) || (res.container.is_a?(Course) && res.container.is_public == 0) + result.delete(res) + end + } + result end LIMIT = 12 unless const_defined?(:LIMIT) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 4e7768785..2fc4fef9a 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -47,7 +47,6 @@ class WordsController < ApplicationController # 删除留言功能要调用destroy,也记得在destroy.js中修改 # deny api. api useless - @show_real_name = params[:show_real_name] || false parent_id = params[:reference_id] author_id = User.current.id reply_user_id = params[:reference_user_id] @@ -256,7 +255,7 @@ class WordsController < ApplicationController elsif referer.match(/course/) obj = Course.find_by_id(obj_id) else - raise "create reply obj unknow type.#{referer}" + #raise "create reply obj unknow type.#{referer}" end obj end @@ -264,7 +263,8 @@ class WordsController < ApplicationController def add_reply_adapter options #modify by nwb #添加对课程留言的支持 - obj = obj_distinguish_url_origin + #留言回复应该不关系其所属的Class,而关心的是其所属的父留言 + obj = obj_distinguish_url_origin || User.find_by_id(2) if obj.kind_of? User obj.add_jour(nil, nil, nil, options) elsif obj.kind_of? Project diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 6cbe0dd95..3612bf7a4 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -44,7 +44,9 @@ class ZipdownController < ApplicationController if homework != nil unless homework.attachments.empty? zipfile = zip_homework_by_user homework - send_file zipfile, :filename => homework.name+".zip", :type => detect_content_type(zipfile) if(zipfile) + send_file zipfile, :filename => ((homework.user.user_extensions.nil? || homework.user.user_extensions.student_id.nil?) ? "" : homework.user.user_extensions.student_id) + + "_" + (homework.user.lastname.nil? ? "" : homework.user.lastname) + (homework.user.firstname.nil? ? "" : homework.user.firstname) + + "_" + homework.name + ".zip", :type => detect_content_type(zipfile) if(zipfile) else render file: 'public/no_file_found.html' end @@ -78,7 +80,7 @@ class ZipdownController < ApplicationController homeattach.attachments.each do |attach| homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1) end - zipping("#{homeattach.user.lastname}#{homeattach.user.firstname}_#{homeattach.user.user_extensions.student_id}_#{Time.now.to_i.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true) + zipping("#{homeattach.user.lastname}#{homeattach.user.firstname}_#{((homeattach.user.user_extensions.nil? || homeattach.user.user_extensions.student_id.nil?) ? "" : homeattach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true) end @@ -99,9 +101,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 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9c5d8c9b5..8c2542aa2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -251,7 +251,7 @@ module ApplicationHelper end def toggle_link(name, id, options={}) - onclick = "$('##{id}').toggle(); " + onclick = "$('##{id}').slideToggle(); " onclick << (options[:focus] ? "$('##{options[:focus]}').focus(); " : "this.blur(); ") onclick << "return false;" link_to(name, "#", :onclick => onclick) diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb index f631f56ff..50dd79a08 100644 --- a/app/helpers/attachments_helper.rb +++ b/app/helpers/attachments_helper.rb @@ -69,13 +69,26 @@ module AttachmentsHelper def course_contains_attachment? course,attachment course.attachments.each do |att| - if att.id == attachment.id || att.copy_from == attachment.copy_from || att.copy_from = attachment.id || att.id == attachment.copy_from + 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 + result = Attachment.find_by_sql("select count(*) as number from attachments where copy_from = #{attachment.copy_from}") + else + result = Attachment.find_by_sql("select count(*) as number from attachments where copy_from = #{attachment.id}") + end + if result.nil? || result.count <= 0 + return 0 + else + return result[0].number + end + end + private def deletable? container, user=User.current diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 04b5ad89d..a1199a55a 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -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 @@ -170,10 +155,51 @@ module CoursesHelper members end + def search_student_in_group(project, course_group_id) + #searchPeopleByRoles(project, StudentRoles) + members = [] + project.members.each do |m| + members << m if m && m.user && m.user.allowed_to?(:as_student,project) + end + members + end def searchStudent project + #searchPeopleByRoles(project, StudentRoles) + members = [] + project.members.each do |m| + members << m if m && m.user && m.user.allowed_to?(:as_student,project) + end + members + end + def searchStudent_by_name project, name #searchPeopleByRoles(project, StudentRoles) members = [] project.members.each do |m| + if m && m.user && m.user.allowed_to?(:as_student,project) + username = m.user[:lastname].to_s + m.user[:firstname].to_s + if(m.user[:login].to_s.include?(name) || m.user.user_extensions[:student_id].to_s.include?(name) || username.include?(name)) + members << m + end + end + end + members + end + def searchgroupstudent_by_name(group, project, name) + members = [] + group.members.each do |m| + if m && m.user && m.user.allowed_to?(:as_student,project) + username = m.user[:lastname].to_s + m.user[:firstname].to_s + if(m.user[:login].to_s.include?(name) || m.user.user_extensions[:student_id].to_s.include?(name) || username.include?(name)) + members << m + end + end + end + members + end + def searchStudent_by_group group, project + #searchPeopleByRoles(project, StudentRoles) + members = [] + group.members.each do |m| members << m if m && m.user && m.user.allowed_to?(:as_student,project) end members @@ -450,9 +476,9 @@ module CoursesHelper end #课程实践年份下拉框 - def course_time_option + def course_time_option year type = [] - now_year = Time.now.year + now_year = year.nil? ? Time.now.year : (Time.now.year <= year ? Time.now.year : year) for i in (now_year..now_year + 10) option = [] option << i diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index d51606d90..aace20e6c 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -1,5 +1,6 @@ # encoding: utf-8 module FilesHelper + include AttachmentsHelper def downloadAll containers paths = [] @@ -54,11 +55,11 @@ module FilesHelper s.html_safe end - #判断用户是否拥有课程,需用户在该课程中角色为教师 - def has_course? user + #判断用户是否拥有不包含当前资源的课程,需用户在该课程中角色为教师且该课程属于当前学期或下一学期 + def has_course? user,file result = false user.courses.each do |course| - if is_course_teacher(user,course) + if !course_contains_attachment?(course,file) && is_course_teacher(User.current,course) && course_in_current_or_next_term(course) return true end end @@ -86,23 +87,68 @@ module FilesHelper def visable_attachemnts attachments result = [] attachments.each do |attachment| - if attachment.is_public? || attachment.author_id == User.current.id + if attachment.is_public? || (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))|| attachment.author_id == User.current.id result << attachment end end result end - def get_qute_number attachment - if attachment.copy_from - result = Attachment.find_by_sql("select count(*) as number from attachments where copy_from = #{attachment.copy_from}") - else - result = Attachment.find_by_sql("select count(*) as number from attachments where copy_from = #{attachment.id}") + def visable_attachemnts_incourse attachments + 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 + end end - if result.nil? || result.count <= 0 - return 0 + 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 - return result[0].number + candown = (attachment.is_public == 1 || attachment.is_public == true) + end end + candown end + + + end \ No newline at end of file diff --git a/app/helpers/homework_attach_helper.rb b/app/helpers/homework_attach_helper.rb index 63332e564..4744df624 100644 --- a/app/helpers/homework_attach_helper.rb +++ b/app/helpers/homework_attach_helper.rb @@ -87,8 +87,13 @@ module HomeworkAttachHelper #获取用户对作业的评分 def get_homework_score user, homework - seems_rateable_rate = HomeworkAttach.find_by_sql("SELECT * FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id} AND rater_id = #{user.id}") - seems_rateable_rate.nil? || seems_rateable_rate.count == 0 ? 0:seems_rateable_rate[0].stars + temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id} AND rater_id = #{user.id}").first + @m_score = temp.nil? ? 0:temp.stars.to_i + end + + #获取评分对应的评论 + def get_homework_review homework,is_teacher,user + homework.journals_for_messages.where("is_comprehensive_evaluation = #{is_teacher ? 1 : 2} and user_id = #{user.id}").order("created_on DESC").first end def convert_array array diff --git a/app/helpers/stores_helper.rb b/app/helpers/stores_helper.rb index e987367ad..0ae91a644 100644 --- a/app/helpers/stores_helper.rb +++ b/app/helpers/stores_helper.rb @@ -156,11 +156,11 @@ module StoresHelper klass = project.class.to_s case klass when "Project" - project_list = link_to l(:label_project_plural), projects_path + project_list = "#{l(:label_project_plural)}" project_item = link_to project.to_s, project_path(project) [project_list, project_item] when "Course" - course_list = link_to l(:label_new_course), courses_path + course_list = "#{l(:label_new_course)}" course_item = link_to project.name, course_path(project) [course_list, course_item] else diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 6d916f43e..935fb440e 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -100,15 +100,45 @@ module WatchersHelper return '' if user.id == course.tea_id joined = user.member_of_course?(course) text = joined ? l(:label_exit_course) : l(:label_new_join) - url_t = join_path(:object_id => course.id) - url_f = try_join_path(:object_id => course.id) + url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id) method = joined ? 'delete' : 'post' if joined - link_to text, url_t, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options + link_to text, url, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options else - link_to text, url_f, :remote => true, :method => method, :id => "#{course.id}", :class => []+options + link_to text, url, :remote => true, :method => method, :id => "#{course.id}", :class => []+options end end + def join_in_course_group(coursegroups,group, user, options=[]) + return '' unless user && user.logged? + + @isjoin = false + coursegroups.each do |g| + g.members.each do |mem| + if mem.user_id == user.id + @isjoin = true + end + end + end + url_t = join_group_path(:object_id => group.id) + url_f = join_group_path(:object_id => group.id) + if @isjoin == true + joined = user.member_of_course_group?(group) + text = l(:label_exit_group) + + if joined + link_to text, {:controller => "courses", :action => "join_group", :object_id => "#{group.id}"}, + :remote => true, :method => 'delete', + :id => "#{group.id}", :style => "padding: 8px 8px 4px; ", + :confirm => l(:text_are_you_sure_out_group), :class => 'group_in' + + end + 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;" + end + end + end # 用户是否允许加入课程判断 # add by nwb @@ -125,7 +155,8 @@ module WatchersHelper if joined link_to text, url_t, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options else - link_to text, url_f, :remote => true, :method => method, :id => "#{course.id}", :class => []+options + + link_to text, url_f, :remote => true, :method => method, :id => "#{course.id}", :class => []+options end end diff --git a/app/models/course.rb b/app/models/course.rb index 6bb7a75d4..ef42d91e8 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -7,7 +7,7 @@ class Course < ActiveRecord::Base STATUS_ARCHIVED = 9 attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student - belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier + #belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher,该方法通过tea_id来调用User表 belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表 has_many :bid @@ -29,9 +29,11 @@ class Course < ActiveRecord::Base has_many :news, :dependent => :destroy, :include => :author has_one :course_status, :class_name => "CourseStatus", :dependent => :destroy + has_many :course_groups, :dependent => :destroy + acts_as_taggable acts_as_nested_set :order => 'name', :dependent => :destroy - acts_as_attachable :view_permission => :view_files, + acts_as_attachable :view_permission => :view_course_files, :delete_permission => :manage_files validates_presence_of :password, :term,:name,:description diff --git a/app/models/course_group.rb b/app/models/course_group.rb new file mode 100644 index 000000000..144c43c6e --- /dev/null +++ b/app/models/course_group.rb @@ -0,0 +1,22 @@ +class CourseGroup < ActiveRecord::Base + # attr_accessible :title, :body + belongs_to :course + has_many :members + has_many :memberships, :class_name => 'Member' + has_many :member_principals, :class_name => 'Member', + :include => :principal, + :conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE})" + has_many :principals, :through => :member_principals, :source => :principal + has_many :users, :through => :members + + before_destroy :set_member_nil + + attr_accessible :name + validates :name, :presence => true, :length => {:maximum => 20}, + :uniqueness => {case_sensitive: false} + def set_member_nil + if self.members && self.members.count > 0 + self.members.update_all("course_group_id = 0") + end + end +end diff --git a/app/models/member.rb b/app/models/member.rb index 46aefbd09..716f6a7c5 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -24,6 +24,7 @@ class Member < ActiveRecord::Base belongs_to :project belongs_to :course + belongs_to :course_group validates_presence_of :principal validates_uniqueness_of :user_id, :scope => [:project_id,:course_id] validate :validate_role diff --git a/app/models/principal.rb b/app/models/principal.rb index 024480635..5aa21768f 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -26,10 +26,11 @@ class Principal < ActiveRecord::Base has_many :members, :foreign_key => 'user_id', :dependent => :destroy has_many :memberships, :class_name => 'Member', :foreign_key => 'user_id', :include => [ :project, :roles ], :conditions => "#{Project.table_name}.status<>#{Project::STATUS_ARCHIVED}", :order => "#{Project.table_name}.name" - has_many :coursememberships, :class_name => 'Member', :foreign_key => 'user_id', :include => [ :course, :roles ], :conditions => "#{Course.table_name}.status<>#{Course::STATUS_ARCHIVED}", :order => "#{Course.table_name}.name" + has_many :coursememberships, :class_name => 'Member', :foreign_key => 'user_id', :include => [ :course, :roles ], :conditions => "#{Course.table_name}.status<>#{Course::STATUS_ARCHIVED}", :order => "#{Course.table_name}.name" has_many :projects, :through => :memberships #add by nwb has_many :courses, :through => :coursememberships + has_many :course_groups, :through => :members has_many :issue_categories, :foreign_key => 'assigned_to_id', :dependent => :nullify # Groups and active users diff --git a/app/models/user.rb b/app/models/user.rb index 29709519d..70e4e8187 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -690,6 +690,9 @@ class User < Principal courses.to_a.include?(course) end + def member_of_course_group?(course_group) + course_groups.to_a.include?(course_group) + end # Returns a hash of user's projects grouped by roles def projects_by_role return @projects_by_role if @projects_by_role diff --git a/app/views/attachments/add_exist_file_to_courses.js.erb b/app/views/attachments/add_exist_file_to_courses.js.erb index 761111cec..eec1e255a 100644 --- a/app/views/attachments/add_exist_file_to_courses.js.erb +++ b/app/views/attachments/add_exist_file_to_courses.js.erb @@ -1,7 +1,7 @@ <% if !@save_flag && @save_message %> $("#error_show").html("<%= @save_message.join(', ') %>"); -<% elsif @message || @message != "" %> - $("#error_show").html("<%= @message %>"); +<% elsif @message && @message != "" %> + $("#error_show").html("<%= @message.html_safe %>"); <% else %> closeModal(); <% end %> diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 630d7552c..e7b58fefc 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -68,7 +68,7 @@ <% end %> <% end %> - <% if (User.current.admin?||User.current.id==bid.author_id) %> + <% if (User.current.admin?||User.current.allowed_to?(:as_teacher,@course)) %> <% if bid.open_anonymous_evaluation == 1 && bid.homeworks.count >= 2%> <% case bid.comment_status %> diff --git a/app/views/bids/_homework.html.erb b/app/views/bids/_homework.html.erb index 7cde4f31d..db1f555d3 100644 --- a/app/views/bids/_homework.html.erb +++ b/app/views/bids/_homework.html.erb @@ -58,53 +58,53 @@ { hideModal($("#popbox")); // 评了分的则刷新列表 - switch (cur_type) - { - case 1: - $.ajax({ - type: "GET", - url: "<%= get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page, - data: 'text', - success: function (data) { - - } - }); - break; - case 2: - $.ajax({ - type: "GET", - url: "<%= get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page, - data: 'text', - success: function (data) { - - } - }); - break; - case 3: - $.ajax({ - type: "GET", - url: "<%= get_homeworks_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page, - data: 'text', - success: function (data) { - - } - }); - break; - case 4: - $.ajax({ - type: "GET", - url: "<%= get_student_batch_homework_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page, - data: 'text', - success: function (data) { - - } - }); - break; - case 5: - break; - default : - break; - } +// switch (cur_type) +// { +// case 1: +// $.ajax({ +// type: "GET", +// url: "<%#= get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page, +// data: 'text', +// success: function (data) { +// +// } +// }); +// break; +// case 2: +// $.ajax({ +// type: "GET", +// url: "<%#= get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page, +// data: 'text', +// success: function (data) { +// +// } +// }); +// break; +// case 3: +// $.ajax({ +// type: "GET", +// url: "<%#= get_homeworks_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page, +// data: 'text', +// success: function (data) { +// +// } +// }); +// break; +// case 4: +// $.ajax({ +// type: "GET", +// url: "<%#= get_student_batch_homework_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page, +// data: 'text', +// success: function (data) { +// +// } +// }); +// break; +// case 5: +// break; +// default : +// break; +// } } diff --git a/app/views/bids/_homework_form.html.erb b/app/views/bids/_homework_form.html.erb index 12393c558..ffe0fc1b9 100644 --- a/app/views/bids/_homework_form.html.erb +++ b/app/views/bids/_homework_form.html.erb @@ -43,13 +43,13 @@

    <%= f.select :proportion, proportion_option %>

    -

    +

    <%= f.check_box :open_anonymous_evaluation, :style => "margin-left:10px;" %> - 未开启匿评作业将直接进入众评点赞阶段 +

    <%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%> - 匿评分配数量不宜太大,否则会影响开启匿评速度 + 即每份作业被允许匿评的人数

    <%= hidden_field_tag 'course_id', @course.id %> diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index 23f7070b2..202a2ee91 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -22,7 +22,7 @@ <%= link_to "留言", get_homework_jours_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%> (<%= @jours_count %>) -

  • +
  • <%= link_to "作品打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), class: "tb_all" unless @bid.homeworks.empty? %>
  • diff --git a/app/views/bids/contest.html.erb b/app/views/bids/contest.html.erb index bd069c8c8..a5dcf8041 100644 --- a/app/views/bids/contest.html.erb +++ b/app/views/bids/contest.html.erb @@ -2,8 +2,14 @@ <%= form_tag(:controller => 'bids', :action => 'contest', :method => :get) do %> - - + + - - +
    <%= l(:label_contest_innovate) %><%= l(:label_user_location) %> : + + <%=l(:label_contest_innovate_community)%> + + + <%= l(:label_user_location) %> : + <% if User.current.logged? %> <% unless User.current.user_extensions.identity == 1 %> @@ -20,8 +26,10 @@
    <%= link_to request.host()+"/contest", :controller => 'bids', :action => 'index' %> <%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_contest_innovate), :controller => 'bids', :action => 'contest' %> + <%=link_to l(:field_homepage), home_path %> > + <%= l(:label_contest_innovate) %> +
    <% end %> diff --git a/app/views/bids/edit.html.erb b/app/views/bids/edit.html.erb index 0a2d17e7d..ee2142dd5 100644 --- a/app/views/bids/edit.html.erb +++ b/app/views/bids/edit.html.erb @@ -91,16 +91,19 @@ } }); }); - $(function(){ - if($("#bid_open_anonymous_evaluation").attr("checked") == "checked") - { - $("#evaluation_num_p").show(); - } - else - { - $("#evaluation_num_p").hide(); - } + $("#bid_open_anonymous_evaluation").click(function(){ + if($("#bid_open_anonymous_evaluation").attr("checked") == "checked") + { + $("#evaluation_num_p").slideDown(); + $("#open_anonymous_evaluation_span").slideUp(); + } + else + { + $("#evaluation_num_p").slideUp(); + $("#open_anonymous_evaluation_span").slideDown(); + } + }); }); function submitHomework(id) @@ -118,6 +121,9 @@
    <%#= render :partial => 'homework_form', :locals => { :f => f } %> <%= render :partial => 'homework_form', :locals => { :f => f } %> - + + + <%= l(:button_create)%> + <% end %>
    \ No newline at end of file diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index cde2019a1..7a7d001ed 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -19,8 +19,8 @@ <%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => false, :id => 'message-form'} do |f| %> <%= render :partial => 'messages/form', :locals => {:f => f} %>

    - - <%= l(:button_submit)%> + + <%= l(:button_submit)%> <%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;' ,:class => 'ButtonColor m3p10' %>

    <% end %> diff --git a/app/views/contests/index.html.erb b/app/views/contests/index.html.erb index 0c6b0e109..f966f149d 100644 --- a/app/views/contests/index.html.erb +++ b/app/views/contests/index.html.erb @@ -2,8 +2,14 @@ <%= form_tag({:controller => 'contests', :action => 'index'}, :method => :get) do %> - - + + diff --git a/app/views/courses/_course_form.html.erb b/app/views/courses/_course_form.html.erb index b722956e8..c48d24935 100644 --- a/app/views/courses/_course_form.html.erb +++ b/app/views/courses/_course_form.html.erb @@ -38,12 +38,13 @@
    <%= l(:label_contest_innovate) %><%= l(:label_user_location) %> : + + <%=l(:label_contest_innovate_community)%> + + + <%= l(:label_user_location) %> : + <% if User.current.logged? %> <% unless User.current.user_extensions.identity == 1 %> @@ -29,7 +35,7 @@ <%=link_to l(:field_homepage), home_path %> > - <%=link_to l(:label_contest_innovate), :controller => 'contests', :action => 'index' %> + <%= l(:label_contest_innovate) %>
    - <%= l(:label_class_period) %> - *   + + <%= l(:label_class_period) %> + *   + <%= text_field_tag :class_period, @course.class_period, :placeholder => "#{l(:lable_input_class)}", :maxlength => 5 %> -  <%= l(:label_class_hour) %>   <%= l(:label_class_hour) %> @@ -98,7 +99,7 @@ - <%= select_tag :time,options_for_select(course_time_option,@course.time), {} %> + <%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {} %> <%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %> diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index e1efe4f58..68b92c00e 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -14,11 +14,13 @@
    <%= form_for('new_form', :method => :post, :url => {:controller => 'words', :action => 'leave_course_message'}) do |f|%> - <%= f.text_area 'course_message', :rows => 3, :cols => 65, + <%= f.text_area 'course_message',:id => "leave_meassge", :rows => 3, :cols => 65, :placeholder => "#{l(:label_welcome_my_respond)}", :style => "resize: none; width: 98%", :class => 'noline',:maxlength => 250%> - <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "enterprise" , :style => "display: block; float: right; margin-right: 1%; margin-top: 1px;"%> + + <%= l(:button_leave_meassge)%> + <% end %>
    <% end %> diff --git a/app/views/courses/_groups_name.html.erb b/app/views/courses/_groups_name.html.erb new file mode 100644 index 000000000..ca0fed9c2 --- /dev/null +++ b/app/views/courses/_groups_name.html.erb @@ -0,0 +1,56 @@ + + + +
      +
    • + <% course_member_count = l(:label_all) + " ( " + @membercount.to_s + "人)" %> + <%= link_to course_member_count, searchgroupmembers_course_path(@course,:group_id => 0), :onclick => "checkclass('group_name_0')", method: 'get', remote: true,:style => " border:0px; color: #0d90c3; float:left;"%> +
    • + <% if course_groups.any? %> + <% course_groups.each do |group| %> + <% group_display = group.name + " ( " + group.members.count.to_s + "人)" %> +
    • + <%= link_to group_display, searchgroupmembers_course_path(@course,:group_id => group.id), method: 'get', remote: true, + :onclick => "checkclass('group_name_#{group.id}')",:style => " border:0px; color: #0d90c3; float:left;"%> + <% if @canShowCode && group.members.count == 0 %> + <%= link_to '', deletegroup_course_path(:group_id => group.id), :method => 'delete', :remote => true, + :data => {confirm: l(:label_delete_group)}, + :class => 'f_1', + :style => "width: 16px;height: 21px;margin-top:3px;margin-left:5px;background: url(/images/pic_del.gif) no-repeat 0 0;" + %> + <% end %> + <% if @canShowCode %> + 编辑班级 + <% end %> +
    • +
    • + <%= form_tag(updategroupname_course_path(@course,:group_id => group.id), method: 'get', remote:true, update: 'group_name') do %> + + <% end %> +
    • + <% end %> + <% end %> + <% if @canShowCode %> +
    • + +添加分班 +
    • +
    • + +
    • + <% end %> +
    + + + diff --git a/app/views/courses/_homework_form.html.erb b/app/views/courses/_homework_form.html.erb index 2d20ecf07..7e09e84fc 100644 --- a/app/views/courses/_homework_form.html.erb +++ b/app/views/courses/_homework_form.html.erb @@ -48,13 +48,13 @@

    <%= f.select :proportion, proportion_option %>

    -

    +

    <%= f.check_box :open_anonymous_evaluation, :style => "margin-left:10px;" %> - 未开启匿评作业将直接进入众评点赞阶段 +

    <%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%> - 匿评分配数量不宜太大,否则会影响开启匿评速度 + 即每份作业被允许匿评的人数

    <%= hidden_field_tag 'course_id', @course.id %> diff --git a/app/views/courses/_member_list.html.erb b/app/views/courses/_member_list.html.erb index a6ee0b9b4..58a0da0b2 100644 --- a/app/views/courses/_member_list.html.erb +++ b/app/views/courses/_member_list.html.erb @@ -1,4 +1,31 @@ +

    +<% if User.current.logged? && User.current.member_of_course?(@course) && @group %> + <% if !@canShowCode %> + <%= join_in_course_group(@course.course_groups,@group, User.current) %> + <% end %> + + <%= l(:label_current_group)%>:  + <%= @group.name %> + +<% end %> + <% if @subPage_title && @subPage_title == l(:label_student_list)%> + <%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:style => "margin-left: 5px; ",:remote=>true) do %> + <%= text_field_tag 'name', params[:name], name: "name", :class => 'f_1', :style => "height:15px"%> + <% if @group %> + <%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %> + <%= submit_tag l(:label_search_member_in_group), :name => "ingroup",:class => "f_2"%> + <% end %> + <%= submit_tag l(:label_search_member_in_course), :name => 'incourse',:onclick => "checkclass('group_name_0')",:class => "f_2"%> + <%#= link_to l(:label_search),'' , :class => 'f_2' %> + <% end %> + <% end %> + +
    +
    <% if members.any? %> + <% if @result_count %> +

    <%= l(:label_search_member_count) %><%= @result_count %><%= l(:label_member_people) %>

    + <% end %> <% members.each do |member| %>
    <% next if member.new_record? %> diff --git a/app/views/courses/_set_join.js.erb b/app/views/courses/_set_join.js.erb index 39e40d34e..f65d6e98b 100644 --- a/app/views/courses/_set_join.js.erb +++ b/app/views/courses/_set_join.js.erb @@ -1,5 +1,5 @@ <% if object_id%> - $("#<%=object_id%>").replaceWith('<%= escape_javascript join_in_course_for_list(course, user) %>'); + $("#<%=object_id%>").replaceWith('<%= escape_javascript join_in_course(course, user) %>'); <% end %> <% if @state %> <% if @state == 0 %> diff --git a/app/views/courses/addgroups.js.erb b/app/views/courses/addgroups.js.erb new file mode 100644 index 000000000..a6f6933b9 --- /dev/null +++ b/app/views/courses/addgroups.js.erb @@ -0,0 +1 @@ +$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>"); \ No newline at end of file diff --git a/app/views/courses/deletegroup.js.erb b/app/views/courses/deletegroup.js.erb new file mode 100644 index 000000000..a6f6933b9 --- /dev/null +++ b/app/views/courses/deletegroup.js.erb @@ -0,0 +1 @@ +$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>"); \ No newline at end of file diff --git a/app/views/courses/index.html.erb b/app/views/courses/index.html.erb index 6b75bee67..e7a4a29db 100644 --- a/app/views/courses/index.html.erb +++ b/app/views/courses/index.html.erb @@ -10,8 +10,14 @@ <%= form_tag(:controller => 'courses', :action => 'search', :method => :get) do %> - - + + - - +
    <%= l(:label_course_all) %><%= l(:label_user_location) %> : + + 高校课程实践社区 + + + <%= l(:label_user_location) %> : + <% if User.current.logged?%> <% if User.current.user_extensions.identity == 0 %> @@ -28,8 +34,12 @@
    <%= link_to request.host()+"/courses", :controller => 'courses', :action => 'index' %> <%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_course_all), :controller => 'courses', :action => 'index' %> + <%=link_to l(:field_homepage), home_path %> > + + <%=l(:label_courses_management_platform)%> + +
    <% end %> diff --git a/app/views/courses/join_group.js.erb b/app/views/courses/join_group.js.erb new file mode 100644 index 000000000..7bdefdb9f --- /dev/null +++ b/app/views/courses/join_group.js.erb @@ -0,0 +1,2 @@ +$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>"); +$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>"); \ No newline at end of file diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb index 3d3076bcc..b426e4a3e 100644 --- a/app/views/courses/member.html.erb +++ b/app/views/courses/member.html.erb @@ -1,10 +1,59 @@ -
    -

    - <%= @subPage_title %> -

    -
    -
    - <%= error_messages_for 'member' %> - <%= render :partial => @render_file, :locals => {:members => @members} %> + +<%= stylesheet_link_tag 'course_group', :media => 'all' %> + +
    + +
    + <% if @subPage_title == l(:label_student_list) %> +
    + <%= render :partial => 'groups_name', locals: {:course_groups => @course_groups} %> +
    + <% end %> + +
    + +
    + <%= error_messages_for 'member' %> + <%= render :partial => @render_file, :locals => {:members => @members} %> +
    diff --git a/app/views/courses/new_homework.html.erb b/app/views/courses/new_homework.html.erb index 7b6784243..2e0b35c6d 100644 --- a/app/views/courses/new_homework.html.erb +++ b/app/views/courses/new_homework.html.erb @@ -84,10 +84,12 @@ if($("#bid_open_anonymous_evaluation").attr("checked") == "checked") { $("#evaluation_num_p").slideDown(); + $("#open_anonymous_evaluation_span").slideUp(); } else { $("#evaluation_num_p").slideUp(); + $("#open_anonymous_evaluation_span").slideDown(); } }); }); @@ -106,7 +108,8 @@ <%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
    <%= render :partial => 'homework_form', :locals => { :f => f } %> - + + <%= l(:button_create)%> <%= javascript_tag "$('#bid_name').focus();" %> <% end %>
    \ No newline at end of file diff --git a/app/views/courses/search.html.erb b/app/views/courses/search.html.erb index a06e4a459..e2c701932 100644 --- a/app/views/courses/search.html.erb +++ b/app/views/courses/search.html.erb @@ -5,8 +5,14 @@ <%= form_tag(:controller => 'courses', :action => 'search', :method => :get) do %> - - + + - - +
    <%= l(:label_course_practice) %><%= l(:label_user_location) %> : + + 高校课程实践社区 + + + <%= l(:label_user_location) %> : + <% if User.current.logged?%> <% if User.current.user_extensions.identity == 0 %> @@ -22,8 +28,12 @@
    <%= link_to request.host() + "/courses", :controller => 'courses', :action => 'index'%> <%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_course_practice), :controller => 'courses', :action => 'index' %> + <%=link_to l(:field_homepage), home_path %> > + + <%=l(:label_courses_management_platform)%> + +
    <% end %> diff --git a/app/views/courses/searchgroupmembers.js.erb b/app/views/courses/searchgroupmembers.js.erb new file mode 100644 index 000000000..c6ff97164 --- /dev/null +++ b/app/views/courses/searchgroupmembers.js.erb @@ -0,0 +1,4 @@ +/** + * Created by Administrator on 2014/12/3. + */ +$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>"); \ No newline at end of file diff --git a/app/views/courses/searchmembers.js.erb b/app/views/courses/searchmembers.js.erb new file mode 100644 index 000000000..efe47a9c0 --- /dev/null +++ b/app/views/courses/searchmembers.js.erb @@ -0,0 +1,4 @@ +/** + * Created by Administrator on 2014/12/2. + */ +$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>"); \ No newline at end of file diff --git a/app/views/courses/unjoin_group.js.erb b/app/views/courses/unjoin_group.js.erb new file mode 100644 index 000000000..7bdefdb9f --- /dev/null +++ b/app/views/courses/unjoin_group.js.erb @@ -0,0 +1,2 @@ +$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>"); +$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>"); \ No newline at end of file diff --git a/app/views/courses/updategroupname.js.erb b/app/views/courses/updategroupname.js.erb new file mode 100644 index 000000000..8eb4e865c --- /dev/null +++ b/app/views/courses/updategroupname.js.erb @@ -0,0 +1,4 @@ +/** + * Created by Administrator on 2014/12/3. + */ +$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>"); \ No newline at end of file diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 04ce917c8..030b6cb24 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -4,55 +4,60 @@ <%= stylesheet_link_tag 'resource', :media => 'all' %>
    -
    -
    +
    +
    <%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %> <%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%> - <%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onclick => "presscss('incourse')"%> - <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onclick => "presscss('insite')" %> + <%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %> + <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %> <% end %> - <% if is_course_teacher(User.current,@course) %> - 上传资源 - <% end %> -
    -
    + <% if is_course_teacher(User.current,@course) %> + 上传资源 + <% end %> +
    +
    -
    -<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@curse_attachments} %> -
    +
    + <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@curse_attachments} %> +
    -
    +
    <% html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 93e39f73f..a006ef8ab 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -2,16 +2,15 @@

    共有 <%= 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 %>

    @@ -21,7 +20,7 @@ <%= 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" %> <% if User.current.logged? %> <% if is_course_teacher(User.current,@course) && file.author_id == User.current.id %> - <%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current) %> + <%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current,file) %> <% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %> @@ -31,7 +30,7 @@ <% end %> <% else %> - <%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current) %> + <%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current,file) %> <% end %> <% else %> <% end %> @@ -41,7 +40,7 @@

    文件大小:<%= 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 %>  |  引用<%= get_qute_number file %>

    +

    <%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>  |  下载<%= file.downloads %>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

    diff --git a/app/views/files/_upload_show.html.erb b/app/views/files/_upload_show.html.erb index a979715de..13bcd043e 100644 --- a/app/views/files/_upload_show.html.erb +++ b/app/views/files/_upload_show.html.erb @@ -8,7 +8,8 @@ <%= render :partial => 'attachement_list',:locals => {:course => course} %>
    - 上传资源取  消 + 确  认 + 取  消 <% end %>
    diff --git a/app/views/files/search.js.erb b/app/views/files/search.js.erb index 84c9a4707..50f46d2f5 100644 --- a/app/views/files/search.js.erb +++ b/app/views/files/search.js.erb @@ -1 +1 @@ -$("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:"create_on",order:"",curse_attachments:@searched_attach})%>"); \ No newline at end of file +$("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>"); \ No newline at end of file diff --git a/app/views/homework_attach/_addjour.html.erb b/app/views/homework_attach/_addjour.html.erb index 5b2889b57..48beebdf8 100644 --- a/app/views/homework_attach/_addjour.html.erb +++ b/app/views/homework_attach/_addjour.html.erb @@ -1,35 +1,4 @@ @@ -46,19 +47,22 @@
    - + -
    高校课程实践社区 + + 高校课程实践社区 + + <%= l(:label_user_location) %> :
    - <%= link_to request.host()+"/courses", :controller => 'courses', :action => 'index' %> -

    <%= link_to "主页", home_path %> > - <%= link_to l(:label_course_practice), :controller => 'courses', :action => 'index' %> + + <%=l(:label_course_practice) %> + > <%= link_to(course.name.to_s, homework_course_path(course)) if course %> @@ -115,7 +119,7 @@

    - <% if (User.current.admin?||User.current.id==@bid.author_id) %> + <% if (User.current.admin?||User.current.allowed_to?(:as_teacher,course)) %> ').attr('id', 'tr_'+fieldId).html( - '' + - '' + - '' - ); - filterTable.append(tr); - - select = tr.find('td.operator select'); - for (i=0;i').val(operators[i]).text(operatorLabels[operators[i]]); - if (operators[i] == operator) { option.attr('selected', true); } - select.append(option); - } - select.change(function(){ toggleOperator(field); }); - - switch (filterOptions['type']){ - case "list": - case "list_optional": - case "list_status": - case "list_subprojects": - tr.find('td.values').append( - '' + - ' 复选/multi-select' - ); - select = tr.find('td.values select'); - if (values.length > 1) { select.attr('multiple', true); } - for (i=0;i'); - if ($.isArray(filterValue)) { - option.val(filterValue[1]).text(filterValue[0]); - if ($.inArray(filterValue[1], values) > -1) {option.attr('selected', true);} - } else { - option.val(filterValue).text(filterValue); - if ($.inArray(filterValue, values) > -1) {option.attr('selected', true);} - } - select.append(option); - } - break; - case "date": - case "date_past": - tr.find('td.values').append( - '' + - ' ' + - ' '+labelDayPlural+'' - ); - $('#values_'+fieldId+'_1').val(values[0]).datepicker(datepickerOptions); - $('#values_'+fieldId+'_2').val(values[1]).datepicker(datepickerOptions); - $('#values_'+fieldId).val(values[0]); - break; - case "string": - case "text": - tr.find('td.values').append( - '' - ); - $('#values_'+fieldId).val(values[0]); - break; - case "relation": - tr.find('td.values').append( - '' + - '' - ); - $('#values_'+fieldId).val(values[0]); - select = tr.find('td.values select'); - for (i=0;i'); - option.val(filterValue[1]).text(filterValue[0]); - if (values[0] == filterValue[1]) { option.attr('selected', true); } - select.append(option); - } - case "integer": - case "float": - tr.find('td.values').append( - '' + - ' ' - ); - $('#values_'+fieldId+'_1').val(values[0]); - $('#values_'+fieldId+'_2').val(values[1]); - break; - } -} - -function toggleFilter(field) { - var fieldId = field.replace('.', '_'); - if ($('#cb_' + fieldId).is(':checked')) { - $("#operators_" + fieldId).show().removeAttr('disabled'); - toggleOperator(field); - } else { - $("#operators_" + fieldId).hide().attr('disabled', true); - enableValues(field, []); - } -} - -function enableValues(field, indexes) { - var fieldId = field.replace('.', '_'); - $('#tr_'+fieldId+' td.values .value').each(function(index) { - if ($.inArray(index, indexes) >= 0) { - $(this).removeAttr('disabled'); - $(this).parents('span').first().show(); - } else { - $(this).val(''); - $(this).attr('disabled', true); - $(this).parents('span').first().hide(); - } - - if ($(this).hasClass('group')) { - $(this).addClass('open'); - } else { - $(this).show(); - } - }); -} - -function toggleOperator(field) { - var fieldId = field.replace('.', '_'); - var operator = $("#operators_" + fieldId); - switch (operator.val()) { - case "!*": - case "*": - case "t": - case "ld": - case "w": - case "lw": - case "l2w": - case "m": - case "lm": - case "y": - case "o": - case "c": - enableValues(field, []); - break; - case "><": - enableValues(field, [0,1]); - break; - case "t+": - case ">t-": - case "0) { - lis.eq(i-1).show(); - } -} - -function displayTabsButtons() { - var lis; - var tabsWidth = 0; - var el; - $('div.tabs').each(function() { - el = $(this); - lis = el.find('ul').children(); - lis.each(function(){ - if ($(this).is(':visible')) { - tabsWidth += $(this).width() + 6; - } - }); - if ((tabsWidth < el.width() - 60) && (lis.first().is(':visible'))) { - el.find('div.tabs-buttons').hide(); - } else { - el.find('div.tabs-buttons').show(); - } - }); -} - -function setPredecessorFieldsVisibility() { - var relationType = $('#relation_relation_type'); - if (relationType.val() == "precedes" || relationType.val() == "follows") { - $('#predecessor_fields').show(); - } else { - $('#predecessor_fields').hide(); - } -} - -function showModal(id, width) { - var el = $('#'+id).first(); - if (el.length === 0 || el.is(':visible')) {return;} - var title = el.find('h3.title').text(); - el.dialog({ - width: width, - modal: true, - resizable: false, - dialogClass: 'modal', - title: title - }); - el.find("input[type=text], input[type=submit]").first().focus(); -} - -function hideModal(el) { - var modal; - if (el) { - modal = $(el).parents('.ui-dialog-content'); - } else { - modal = $('#ajax-modal'); - } - modal.dialog("close"); -} - -function submitPreview(url, form, target) { - $.ajax({ - url: url, - type: 'post', - beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}, - data: $('#'+form).serialize(), - success: function(data){ - $('#'+target).html(data); - } - }); -} - -function collapseScmEntry(id) { - $('.'+id).each(function() { - if ($(this).hasClass('open')) { - collapseScmEntry($(this).attr('id')); - } - $(this).hide(); - }); - $('#'+id).removeClass('open'); -} - -function expandScmEntry(id) { - $('.'+id).each(function() { - $(this).show(); - if ($(this).hasClass('loaded') && !$(this).hasClass('collapsed')) { - expandScmEntry($(this).attr('id')); - } - }); - $('#'+id).addClass('open'); -} - -function scmEntryClick(id, url) { - el = $('#'+id); - if (el.hasClass('open')) { - collapseScmEntry(id); - el.addClass('collapsed'); - return false; - } else if (el.hasClass('loaded')) { - expandScmEntry(id); - el.removeClass('collapsed'); - return false; - } - if (el.hasClass('loading')) { - return false; - } - el.addClass('loading'); - $.ajax({ - url: url, - success: function(data){ - el.after(data); - el.addClass('open').addClass('loaded').removeClass('loading'); - } - }); - return true; -} - -function randomKey(size) { - var chars = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); - var key = ''; - for (i = 0; i < size; i++) { - key += chars[Math.floor(Math.random() * chars.length)]; - } - return key; -} - -// Can't use Rails' remote select because we need the form data -function updateIssueFrom(url) { - $.ajax({ - url: url, - type: 'post', - data: $('#issue-form').serialize() - }); -} - -function updateBulkEditFrom(url) { - $.ajax({ - url: url, - type: 'post', - data: $('#bulk_edit_form').serialize() - }); -} - -function clearMessage(id) { - $('#'+id).val(""); -} - - -function observeAutocompleteField(fieldId, url, options) { - $(document).ready(function() { - $('#'+fieldId).autocomplete($.extend({ - source: url, - select: function(e,ui){self.location="/issues/"+ui.item.value;}, - minLength: 2, - search: function(){$('#'+fieldId).addClass('ajax-loading');}, - response: function(){$('#'+fieldId).removeClass('ajax-loading'); - } - }, options)); - $('#'+fieldId).addClass('autocomplete'); - - }); - -} - -function observeSearchfield(fieldId, targetId, url) { - $('#'+fieldId).each(function() { - var $this = $(this); - $this.addClass('autocomplete'); - $this.attr('data-value-was', $this.val()); - var check = function() { - var val = $this.val(); - if ($this.attr('data-value-was') != val){ - $this.attr('data-value-was', val); - $.ajax({ - url: url, - type: 'get', - data: {q: $this.val()}, - success: function(data){ if(targetId) $('#'+targetId).html(data); }, - beforeSend: function(){ $this.addClass('ajax-loading'); }, - complete: function(){ $this.removeClass('ajax-loading'); } - }); - } - }; - var reset = function() { - if (timer) { - clearInterval(timer); - timer = setInterval(check, 300); - } - }; - var timer = setInterval(check, 300); - $this.bind('keyup click mousemove', reset); - }); -} - -function observeProjectModules() { - var f = function() { - /* Hides trackers and issues custom fields on the new project form when issue_tracking module is disabled */ - if ($('#project_enabled_module_names_issue_tracking').attr('checked')) { - $('#project_trackers').show(); - }else{ - $('#project_trackers').hide(); - } - }; - - $(window).load(f); - $('#project_enabled_module_names_issue_tracking').change(f); -} - -function initMyPageSortable(list, url) { - $('#list-'+list).sortable({ - connectWith: '.block-receiver', - tolerance: 'pointer', - update: function(){ - $.ajax({ - url: url, - type: 'post', - data: {'blocks': $.map($('#list-'+list).children(), function(el){return $(el).attr('id');})} - }); - } - }); - $("#list-top, #list-left, #list-right").disableSelection(); -} - -var warnLeavingUnsavedMessage; -function warnLeavingUnsaved(message) { - warnLeavingUnsavedMessage = message; - - $('form').submit(function(){ - $('textarea').removeData('changed'); - }); - $('textarea').change(function(){ - $(this).data('changed', 'changed'); - }); - window.onbeforeunload = function(){ - var warn = false; - $('textarea').blur().each(function(){ - if ($(this).data('changed')) { - warn = true; - } - }); - if (warn) {return warnLeavingUnsavedMessage;} - }; -} - -function setupAjaxIndicator() { - - $('#ajax-indicator').bind('ajaxSend', function(event, xhr, settings) { - - if ($('.ajax-loading').length === 0 && settings.contentType != 'application/octet-stream') { - $('#ajax-indicator').show(); - } - }); - - $('#ajax-indicator').bind('ajaxStop', function() { - $('#ajax-indicator').hide(); - }); -} - -function hideOnLoad() { - $('.hol').hide(); -} - -function addFormObserversForDoubleSubmit() { - $('form[method=post]').each(function() { - if (!$(this).hasClass('multiple-submit')) { - $(this).submit(function(form_submission) { - if ($(form_submission.target).attr('data-submitted')) { - form_submission.preventDefault(); - } else { - $(form_submission.target).attr('data-submitted', true); - } - }); - } - }); -} - -function blockEventPropagation(event) { - event.stopPropagation(); - event.preventDefault(); -} - -function toggleAndSettingWordsVal(parent_widget, text_widget, value){ - text_widget.val(value) - parent_widget.slideToggle(400) -} -function transpotUrl (scope) { - $(scope).each(function(){ - var tmpContent = $(this).html(); - tmpContent = tmpContent.replace(/(^|[^\"\'])(http|ftp|mms|rstp|news|https)(\:\/\/[^<\s\+,,]+)/gi,"$1$2$3<\/a>"); - // tmpContent = tmpContent.replace(/(^|[^\/])(www\.[^<\s\+,,]+)/gi,"$1$2"); - $(this).html(tmpContent); - }); -} - -$(document).ready(setupAjaxIndicator); -$(document).ready(hideOnLoad); -$(document).ready(addFormObserversForDoubleSubmit); -$(document).ready(function(){ - $.ajaxSetup({ - headers: { - 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content') - } - }); - } -) - -function img_thumbnails() { - $('.thumbnails a').colorbox({rel:'nofollow'}); - $('.attachments').find('a').each(function(index, element) { - var href_value = $(element).attr('href'); - if (/\.(jpg|png|gif|bmp)$/.test(href_value)) { - $(element).colorbox({rel:'nofollow'}); - } - - }); -} -$(document).ready(img_thumbnails); - -function TimeClose(dateText, inst) { - if(inst.id=="issue_start_date"){ - time=dateText; - } -} -var time=new Date(); -function TimeBeforeShow(input){ - if(input.id=="issue_due_date"){ - //var minDate = $(input).datepicker('option', 'minDate'); - var tempdata=$("#issue_start_date").attr("value"); - - $(input).datepicker('option', 'minDate',new Date(tempdata.replace(/-/g, "/"))); - //$('.selector').datepicker('option', 'minDate', '12/25/2012'); - } -} - -function SetMinValue(){ - /// var tempdata=$("#issue_start_date").attr("value"); - //$('.selector').datepicker('option', 'minDate', '12/25/2012'); - //alert(tempdata); - //$("#issue_due_date").datepicker({ - // minDate: new Date(2014,08,23) - //var datepickerOptions= - //{dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}; - //alert( $('.issue_due_date').length); - //$('.selector')[1].datepicker('option', 'minDate', new Date(2014, 0 - 8, 23)); - //$("#issue_due_date").datepicker(datepickerOptions); - //$("##{issue_due_date}").datepicker(datepickerOptions); - //$("#issue_due_date").datepicker( - // {dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true} - //) - //}); -} -function PrecentChange(obj){ - var _v= obj; - if(_v==100) - { - //var select=$("select[id='issue_status_id']"); - $("select[id='issue_status_id']").find("option[value='3']").attr("selected","selected"); - } - else if(_v==0) - { - //alert(1); - $("select[id='issue_status_id']").find("option[value='1']").attr("selected","selected"); - } - else if(_v!=100&&_v!=0) - { - // alert(2); - $("select[id='issue_status_id']").find("option[value='2']").attr("selected","selected"); - } -} diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 5c21b200e..250ff49a4 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2044,7 +2044,7 @@ width:20%; font-weight:bold; text-align:center; padding:0.6em; -z-index:100; +z-index:100000; opacity: 0.5; } diff --git a/public/stylesheets/course_group.css b/public/stylesheets/course_group.css new file mode 100644 index 000000000..edfcb9091 --- /dev/null +++ b/public/stylesheets/course_group.css @@ -0,0 +1,98 @@ +body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;} +div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,textarea,form{ margin:0; padding:0;} +div,img,tr,td,textarea,form{ border:0;} +table,tr,td{border:0; cellspacing:0; cellpadding:0;} +ul,li{ list-style-type:none} +.cl{ clear:both; overflow:hidden; } +a{ text-decoration:none; } +a:hover{ } +/**** 常用***/ +.f_l{ float:left;} +.f_r{ float:right;} +.b_lblue{ background:#64bdd9;} +.b_dblue{ background:#55a1b9; cursor:pointer;} +.f_b{ font-weight: bold;} +.c_blue{ color:#64bdd9;} +.c_grey{ color:#999999;} +.c_grey02{ color:#666666;} +.f_14{ font-size:14px;} +.c_dblue{ color:#3e6d8e;} +.c_red{ color:#ec0016;} +.w90{width:90px;} +.ml10{margin-left:10px;} +input.f_2 { + width:60px !important; + height:24px !important; + color:#fff !important; + margin-right:5px !important; + border:none !important; + margin-left:0px !important; + box-shadow: none !important; + padding: 0px !important; + border-radius: 0 !important; + text-shadow: none !important; + border:1px solid #1c9ec7; + background:#1c9ec7; + +} +.container{ width:940px; margin:0 auto; font-size:12px;} + +.st_list{ width:688px; padding-left:5px; height:800px;} +.st_search{ margin:10px 0;} +.st_search span{ font-size:14px; font-weight:bold; color:#606060; margin-right:35px;} +.st_search input{ border:1px solid #1c9ec7; background:#fff; height:20px; color:#c4c4c4; width:200px;} +.st_search a:hover{ background:#048fbb; text-decoration:none;} +/*.st_search input.f_2{ background:#1c9ec7; padding: 3px; margin-left: 3px; color:#fff;border:1px solid #1c9ec7; text-align:center; display:block; width:45px; height:28px; font-size:12px; }*/ + +.classbox{ border:1px solid #f8df8c; background:#fffce6; color:#0d90c3; padding:0 3px; float:left; margin-left:15px;} +.st_addclass ul li.selected { border:1px solid #f8df8c; background:#f8df8c; color:#0d90c3; padding:0 3px; float:left; margin-left:15px;} +.st_addclass{ margin-top:5px;} +.st_addclass ul li{ margin-bottom:10px;} +.st_addclass ul li,.st_addclass a,.st_addclass img{ float:left;} +.st_addclass img{ margin-top:3px;} +.st_addclass a{ color:#0d90c3;} + +.st_box{ margin-top:10px; border-top:1px solid #CCC; padding-top:10px;} +.st_box ul li{ float:left;} +.st_box_top a{ font-weight:bold; color:#7a7a7a; float:left;} +.st_box_top a:hover{ color:#1c9ec7;} +.st_up{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 0 no-repeat; margin-top:5px; margin-left:3px;} +.st_down{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 -22px no-repeat; margin-top:5px; margin-left:3px;} +a.st_img { display:block;width:40px; height:40px; border:1px solid #CCC; padding:1px;} +a:hover.st_img { border:1px solid #1c9ec7; } +.st_boxlist{ border-bottom:1px dashed #CCC; height:53px; padding-top:10px; } +.st_boxlist a{ float:left;} +.st_boxlist ul{ float:left; width:200px; margin-left:10px;} +.st_boxlist ul li a{ color:#5d5d5d;} +.st_boxlist ul li a span{ color:#1c9ec7;} +.st_boxlist ul li a:hover span{ color:#ff8e15;} +.ml50{ margin-left:50px;} +.ml358{ margin-left:358px;} +.ml258{ margin-left:254px;} +.ml65{ margin-left:65px;} +a:hover.st_add{ color:#ff8e15;} + +/****翻页***/ +.wlist{ margin-top:15px; float:right;} +.wlist a{ float:left; border:1px solid #15bccf; padding:0 5px; margin-left:3px; color:#15bccf;} +.wlist a:hover{border:1px solid #15bccf; background-color:#15bccf; color:#fff;} +.wlist_select a { background-color:#64bdd9; color:#fff;} + +.submit{height:21px;border:0; cursor:pointer; background:url(../images/btn.png) no-repeat 0 0;width:42px; margin-top:2px; margin-left:3px; } +.submit_2{height:21px;border:0; cursor:pointer; background:url(../images/btn1.png) no-repeat 0 0;width:42px; margin-top:2px; margin-left:3px; } +.isTxt{background:#fbfbfb url(../images/inputBg.png) repeat-x left top;height:22px;line-height:22px;border:1px solid #c1c1c1;padding:0 5px;color:#666666;} +.group_in { + width:90px !important; + height:28px !important; + color:#1c9ec7!important; + margin-right:5px !important; + border:none !important; + font-size: 14px !important; + margin-left:0px !important; + box-shadow: none !important; + float: right; + border-radius: 0 !important; + text-shadow: none !important; + padding: 0px !important; + background:#ffffff !important; +} \ No newline at end of file diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index e49f2651f..b6d61c865 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -1,5 +1,5 @@ /* CSS Document */ -body{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; background:#fff; font-style:normal;} +body{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; line-height:1.9; background:#fff; font-style:normal;} div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,textarea{ margin:0; padding:0;} div,img,tr,td,textarea{ border:0;} table,tr,td{border:0; cellspacing:0; cellpadding:0;} @@ -15,7 +15,7 @@ a:hover{ text-decoration:underline;} /* TAB 切换效果 */ .tb_{ background-color: #eaeaea; height:40px; } .tb_ ul{height:40px; } -.tb_ li{float:left;height:30px;width: 90px;cursor:pointer; font-size:14px; padding-top:10px; text-align:center; } +.tb_ li{float:left;height:35px;width: 90px;cursor:pointer; font-size:14px; padding-top:5px; text-align:center; } a.tb_all{ margin-left:235px; font-size:12px; display:block; height:23px; padding-top:4px; width:90px; color:#7a7a7a; border:1px solid #cbcbcb; background:#fff; text-align: center;} a:hover.tb_all{ background:#eaeaea; text-decoration:none;} @@ -38,13 +38,13 @@ a:hover.tb_all{ background:#eaeaea; text-decoration:none;} .pic_head a{ text-align:center; width:42px; overflow:hidden;text-overflow:ellipsis; white-space:nowrap;} .pic_head img{ border:1px solid #fff;} .pic_head img:hover{border:1px solid #15bccf;} -.dis ul li.wname a{ width:260px; font-size:14px; color:#595959; padding:25px 0 0 15px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;} -.dis ul li.wdown a{padding-top:25px; color:#3d7ec2; margin-right:35px;} -.wscore{ padding-top:25px; color:#888888; width:96px;} +.dis ul li.wname a{ width:260px; font-size:14px; color:#595959; padding:15px 0 0 0px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;} +.dis ul li.wdown a{padding-top:22px; color:#3d7ec2; margin-right:35px;} +.wscore{ padding-top:22px; color:#888888; width:96px;} .dis ul li.wping{margin-left:12px; } -.dis ul li.wping a{ margin-top:18px; margin-bottom:3px; width:43px; height:23px; background:#15bccf; color:#fff; text-align:center; padding-top:8px;} +.dis ul li.wping a{ margin-top:18px; margin-bottom:3px; width:43px; height:23px; background:#15bccf; color:#fff; text-align:center; padding-top:3px;} .dis ul li.wping a:hover{ background-color:#03a1b3;} -ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px;line-height: 1.9; } +ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; } .wlist span{ border:1px solid #15bccf; padding:0 5px; margin-left:3px;} .wlist a{ border:1px solid #15bccf; padding:0 5px; margin-left:3px;} .wlist a:hover{ background:#15bccf; color:#fff; text-decoration:none;} @@ -55,7 +55,7 @@ ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px;line-hei .c_grey{ color:#999; font-weight:normal;} .dis ul li.wname02 a{ width:200px; font-size:14px; color:#595959; padding:20px 0 0 15px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;} .dis ul li.wmine{ margin:12px 0 0 10px;} -.dis ul li.wmine a{ color:#3d7ec2; text-align:center; width:50px; font-weight: bold;line-height: 1.9;} +.dis ul li.wmine a{ color:#3d7ec2; text-align:center; width:50px; font-weight: bold;} .wzan{ margin:15px 0 0 25px; width:32px; height:44px;} .wzan a{ display: block;text-align: center;} a.wzan_img{background:url(images/pic_zan.png) 0 -59px no-repeat; display:block; height:31px; width:30px; color:#fff;} @@ -80,11 +80,10 @@ a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;} .ping_con p{ color:#777777; font-size:12px; border-bottom:1px dashed #CCC; padding-bottom:5px;} .ping_con p span a{ color:#777777;} .ping_star{ width:160px; color:#333; font-weight:bold; margin-bottom:5px;} -.ping_star span a{ float:right; width:20px; height:20px; background:url(images/star.png) -2px 0 no-repeat; margin-right:3px;} -.ping_star span a:hover{background:url(images/star.png) -24px 0 no-repeat;} +.ping_star span a{ float:right; width:20px; height:20px; background:url(images/star.png);background-repeat: no-repeat; margin-right:3px;} .ping_con textarea{ height:76px; border:1px solid #15bccf; margin-bottom:5px; color:#666; font-size:12px;} -a.ping_sub{ float:right; height:22px; width:60px; margin-right:20px; background:#15bccf; color:#fff; text-align:center;padding-top: 5px;} -a.ping_sub1{ float:right; height:22px; width:60px; background:#15bccf; color:#fff; text-align:center;line-height: 1.9;} +a.ping_sub{ float:right; height:22px; width:60px; margin-right:20px; background:#15bccf; color:#fff; text-align:center;} +a.ping_sub1{ float:right; height:22px; width:60px; background:#15bccf; color:#fff; text-align:center;} a:hover.ping_sub{ background:#14a8b9;} .recall{ border-top:1px solid #CCC; padding:5px 0;} .recall_head{ float:left;} @@ -128,9 +127,9 @@ a:hover.ping_sub{ background:#14a8b9;} .w430{ width:430px;} .w350{ width:350px;} -.w620{ width:580px; height:160px; border:1px solid #CCC !important; padding-left: 3px !important;} +.w620{ width:580px; height:160px; border:1px solid #CCC;} .bo{height:26px; border:1px solid #CCC !important; padding: 0 !important;} -a.tijiao{ height:28px !important; display:block !important; width:80px !important; color:#fff !important; background:#15bccf !important; text-align:center !important; padding-top:4px !important; float:left !important; margin-right:10px !important;line-height: 1.9;} +a.tijiao{ height:28px !important; display:block !important; width:80px !important; color:#fff !important; background:#15bccf !important; text-align:center !important; padding-top:4px !important; float:left !important; margin-right:10px !important;} a:hover.tijiao{ background:#0f99a9 !important;} .members_left{ float:left; width:570px; margin-right:20px;} .members_left{} diff --git a/test/fixtures/course_groups.yml b/test/fixtures/course_groups.yml new file mode 100644 index 000000000..c63aac0b6 --- /dev/null +++ b/test/fixtures/course_groups.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/unit/course_group_test.rb b/test/unit/course_group_test.rb new file mode 100644 index 000000000..c08ede23f --- /dev/null +++ b/test/unit/course_group_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class CourseGroupTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end
    <% if @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2%> diff --git a/app/views/layouts/base_newcontest.html.erb b/app/views/layouts/base_newcontest.html.erb index 381a6a61d..c118078d0 100644 --- a/app/views/layouts/base_newcontest.html.erb +++ b/app/views/layouts/base_newcontest.html.erb @@ -27,8 +27,10 @@
    - -
    - <%=l(:label_contest_innovate_community)%> + + + <%=l(:label_contest_innovate_community)%> + <%= l(:label_user_location) %> : @@ -44,11 +46,8 @@
    - <%=link_to request.host()+"/contests", :controller=>'contests', :action=>'index' %> - <%=link_to l(:field_homepage), home_path %> > - <%=link_to l(:label_contest_innovate), :controller=>'contests', :action=>'index' %> > + <%= l(:label_contest_innovate) %> > <%= link_to h(truncate(@contest.name, length: 20, omission: '...')), show_contest_contest_path(@contest) %> diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index ee490c653..b6620b141 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -30,8 +30,14 @@
    - - + + - - +
    软件项目托管社区<%= l(:label_user_location) %> : + + 软件项目托管社区 + + + <%= l(:label_user_location) %> : +
    <%= link_to request.host()+"/projects", :controller => 'projects', :action => 'index', :project_type => 0 %>

    <%=link_to l(:label_home),home_path %> > <%=link_to @project, project_path(@project) %>

    +

    + <%=link_to l(:label_home),home_path %> > + <%=link_to @project, project_path(@project) %> +

    +
    @@ -54,7 +64,9 @@ <% @project = Project.find_by_id(@project.id)%> - + - - - + + + - - - + + +
    <%= image_tag(url_to_avatar(@project), :class => 'avatar2') %> + <%= image_tag(url_to_avatar(@project), :class => 'avatar2') %> +
    <%= link_to @project.name, project_path(@project)%> @@ -86,15 +98,26 @@ <% @project.versions.each do |version| %> <% files_count += version.attachments.count %> <% end %> -
    <%=link_to "#{@project.members.count}", project_member_path(@project) %><%=link_to @project.watcher_users.count, :controller=>"projects", :action=>"watcherlist", :id => @project %><%=link_to "#{@project.issues.count}", project_issues_path(@project) %> + <%=link_to "#{@project.members.count}", project_member_path(@project) %> + + <%=link_to @project.watcher_users.count, :controller=>"projects", :action=>"watcherlist", :id => @project %> + + <%=link_to "#{@project.issues.count}", project_issues_path(@project) %> +
    <%= l(:label_member) %><%= l(:label_user_watchered) %> <%= l(:label_project_issues) %> + <%= l(:label_member) %> + + <%= l(:label_user_watchered) %> + + <%= l(:label_project_issues) %> +
    @@ -109,7 +132,10 @@ <%= textilizable @project.description %>
    - <%= l(:label_create_time) %>:<%= format_time(@project.created_on) %> + + <%= l(:label_create_time) %>: + + <%= format_time(@project.created_on) %>
    diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index f3bbe0098..5276bcd01 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -101,8 +101,12 @@
    - - + + -
    <%= l(:label_user_home) %><%= l(:label_user_location) %> : + <%= l(:label_user_home) %> + + <%= l(:label_user_location) %> : +
    - <%=link_to request.host()+"/users" ,:controller => 'users', :action => 'index' %> - <%=link_to "主页", home_path %> > - <%=link_to @user.name, user_path %> + + <%=link_to @user.name, user_path %> +
    @@ -131,23 +134,28 @@
    - + +
    <%= image_tag(url_to_avatar(@user), :class => 'avatar2') %> + <%= image_tag(url_to_avatar(@user), :class => 'avatar2') %> + - + - + - - -
    <%= link_to h (@user.name) %> - <%= image_tag(gender_avatar_uri(@user), weight:"25px", height:"25px") if (@user.user_extensions && (@user.user_extensions.identity != 2) )%> + <%= link_to h (@user.name) %> + <%= image_tag(gender_avatar_uri(@user), weight:"25px", height:"25px") if (@user.user_extensions && (@user.user_extensions.identity != 2) )%> +
    <% unless User.current == @user %> - <%= watcher_link(@user, User.current) %> - <% else %> - <%= link_to(l(:label_user_edit), my_account_path(@user)) if User.current %> - <% end %> + <% unless User.current == @user %> + <%= watcher_link(@user, User.current) %> + <% else %> + <%= link_to(l(:label_user_edit), my_account_path(@user)) if User.current %> + <% end %> +
    @@ -156,8 +164,8 @@
    +
    @@ -181,7 +189,7 @@ @@ -327,7 +355,9 @@
    - <%= l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count) %> + + <%= l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count) %> + <% if show_more_fans?(@user) %>
    <%= link_to l(:label_more), :controller => "users", :action => "user_fanslist"%> @@ -337,7 +367,9 @@
    - +
    <%= show_fans_picture(@user) %> + <%= show_fans_picture(@user) %> +
    diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 6f13c28c7..00cbc17de 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -69,9 +69,9 @@ :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> <%= render :partial => 'course_form', :locals => { :f => f, :is_new => false } %> <%#= submit_tag l(:button_save) %> - <%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'whiteButton m3p10' %> + <%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'ButtonColor m3p10' %> <%#= preview_link preview_news_path(:course_id => @course, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %> - <%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'whiteButton m3p10' %> + <%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'ButtonColor m3p10' %> <% end %>
    diff --git a/app/views/tags/_show_projects.html.erb b/app/views/tags/_show_projects.html.erb index 2b6b42189..de8e10018 100644 --- a/app/views/tags/_show_projects.html.erb +++ b/app/views/tags/_show_projects.html.erb @@ -4,9 +4,15 @@ <% projects_results.each do |prj| %>

    - <%= l(:label_tags_project_name) %><%= link_to "#{prj.name}",:controller => "projects",:action => "show",:id => prj.id %> + + <%= l(:label_tags_project_name) %> + <%= link_to "#{prj.name}",:controller => "projects",:action => "show",:id => prj.id %> +
    - <%= l(:label_tags_project_description) %><%= textilizable prj.description %> + + <%= l(:label_tags_project_description) %> + + <%= textilizable prj.description %>

    diff --git a/app/views/tags/_tag.html.erb b/app/views/tags/_tag.html.erb index 3efd0cfab..06680d373 100644 --- a/app/views/tags/_tag.html.erb +++ b/app/views/tags/_tag.html.erb @@ -44,7 +44,7 @@ <%= link_to (image_tag "/images/sidebar/add.png"), 'javascript:void(0);', :class => "tags_icona", - :onclick=>"$('#put-tag-form-#{obj.class}-#{obj.id}').toggle(); readmore(this);" if User.current.logged? %> + :onclick=>"$('#put-tag-form-#{obj.class}-#{obj.id}').slideToggle(); readmore(this);" if User.current.logged? %> <%#= toggle_link (image_tag "/images/sidebar/add.png"), "put-tag-form-#{obj.class}-#{obj.id}", {:focus => "put-tag-form-#{obj.class}-#{obj.id} #name"} if User.current.logged? %>    @@ -72,7 +72,7 @@ <% end %> diff --git a/app/views/tags/_tag_search_results.html.erb b/app/views/tags/_tag_search_results.html.erb index 84a672617..591a86a70 100644 --- a/app/views/tags/_tag_search_results.html.erb +++ b/app/views/tags/_tag_search_results.html.erb @@ -2,32 +2,50 @@ <% unless show_flag.nil? %> <% case %> <% when show_flag == '1' %> - <%=l(:label_user)%>(<%= @results_count %>) + + <%=l(:label_user)%> + ( + <%= @results_count %> + ) + <%= render :partial => "show_users",:locals => {:users_results => users_results}%> <% when show_flag == '2'%> - <%=l(:label_project)%>(<%= @results_count %>) + + <%=l(:label_project)%>(<%= @results_count %>) + <%= render :partial => "show_projects",:locals => {:projects_results => projects_results }%> <% when show_flag == '3'%> <%=l(:label_issue)%>(<%= @results_count %>) <%= render :partial => "show_issues",:locals => {:issues_results => issues_results }%> <% when show_flag == '4'%> - <%= l(:label_requirement)%>(<%= @results_count %>) + + <%= l(:label_requirement)%>(<%= @results_count %>) + <%= render :partial => "show_bids",:locals => {:bids_results => bids_results}%> <% when show_flag == '5'%> - <%= l(:label_forum)%>(<%= @results_count %>) + + <%= l(:label_forum)%>(<%= @results_count %>) + <%= render :partial => "show_forums",:locals => {:forums_results => forums_results}%> <% when show_flag == '6'%> - <%= l(:label_attachment)%>(<%= @results_count %>) + + <%= l(:label_attachment)%>(<%= @results_count %>) + <%= render :partial => "show_attachments",:locals => {:attachments_results => attachments_results}%> <% when show_flag == '7'%> - <%= l(:label_contest_innovate)%>(<%= @results_count %>) + + <%= l(:label_contest_innovate)%>(<%= @results_count %>) + <%= render :partial => "show_contests",:locals => {:contests_results => contests_results}%> <% when show_flag == '8'%> <%#= l(:label_attachment)%> - 开源项目:(<%= @results_count %>) + 开源项目:(<%= @results_count %>) + <%= render :partial => "show_open_source_projects",:locals => {:projects_results => open_source_projects_results}%> <% when show_flag == '9'%> - <%= l(:label_course)%>(<%= @results_count %>) + + <%= l(:label_course)%>(<%= @results_count %>) + <%= render :partial => "show_courses",:locals => {:courses_results => courses_results}%> <% else %> <%= l(:label_tags_all_objects)%> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 65e1bf2f5..9b93c7f44 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -18,8 +18,12 @@ <%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %> - - + + - - +
    <%= l(:label_software_user ) %><%= l(:label_user_location) %> : + <%= l(:label_software_user ) %> + + <%= l(:label_user_location) %> : + @@ -35,8 +39,10 @@
    <%= link_to request.host()+"/users", :controller => 'users', :action => 'index' %> <%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_software_user), :controller => 'users', :action => 'index' %> + <%=link_to l(:field_homepage), home_path %> > + <%= l(:label_software_user)%> +
    <% end %> diff --git a/app/views/users/search.html.erb b/app/views/users/search.html.erb index f8d5a7cf3..8586e59c5 100644 --- a/app/views/users/search.html.erb +++ b/app/views/users/search.html.erb @@ -14,8 +14,12 @@ <%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %> - - + + - - +
    <%= l(:label_software_user ) %><%= l(:label_user_location) %> : + <%= l(:label_software_user ) %> + + <%= l(:label_user_location) %> : + @@ -31,8 +35,10 @@
    <%= link_to request.host()+"/users", :controller => 'users', :action => 'index' %> <%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_software_user), :controller => 'users', :action => 'index' %> + <%=link_to l(:field_homepage), home_path %> > + <%= l(:label_software_user)%> +
    diff --git a/app/views/welcome/_course_list.html.erb b/app/views/welcome/_course_list.html.erb index 8d0d6c40d..da6c0fbf0 100644 --- a/app/views/welcome/_course_list.html.erb +++ b/app/views/welcome/_course_list.html.erb @@ -25,8 +25,10 @@ <%= link_to course.school.name.try(:gsub, /(.+)$/, '\1'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %> <% end %> (<%= course.members.count %>人) - <%# files_count = course.attachments.count.to_s %> - (<%= link_to "#{course.attachments.count.to_s}份", course_files_path(course) %>资料) + <% files_count = course.attachments.count %> + <% if files_count > 0%> + (<%= link_to "#{files_count.to_s}份", course_files_path(course) %>资料) + <% end %>
    <% end %> diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index 40be02464..07696386f 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -153,7 +153,11 @@
    -

    <%=l(:label_current_hot_contest)%>

    +

    + + <%=l(:label_current_hot_contest)%> + +

    <% if User.current.logged? %> <% unless User.current.user_extensions.identity == 1 %> @@ -171,15 +175,26 @@
    <%= link_to(contest.name.truncate(50, omission: '...'), contest_contestnotifications_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %> <% if contest.id == 2 or contest.id == 3 or contest.id == 6 %> - (<%= link_to("#{contest.projects.where('is_public=1').count}"+l(:label_work_quantity), show_attendingcontest_contest_path(contest), :target => "_blank") %>) + ( + + <%= link_to("#{contest.projects.where('is_public=1').count}"+l(:label_work_quantity), show_attendingcontest_contest_path(contest), :target => "_blank") %> + ) + <% else %> - (<%= link_to("#{contest.contesting_softapplications.count}"+l(:label_work_quantity), show_attendingcontest_contest_path(contest), :target => "_blank") %>) + ( + + <%= link_to("#{contest.contesting_softapplications.count}"+l(:label_work_quantity), show_attendingcontest_contest_path(contest), :target => "_blank") %> + ) + <% end %>
    - <%=contest.description.truncate(100, omission: '...')%> -

    + + <%=contest.description.truncate(100, omission: '...')%> + +
    +
    <%=l(:label_release_time)%>: <%=format_time contest.created_on %> @@ -193,7 +208,9 @@

    - <%=l(:label_notification)%> + + <%=l(:label_notification)%> +

      @@ -204,13 +221,19 @@
    - <%= link_to_user(notification.author) %> + + <%= link_to_user(notification.author) %> + <%= l(:label_project_notice) %> <%= link_to notification.title.truncate(35, omission: '...'), contest_contestnotifications_path(notification.contest_id) %>
    -
    <%= notification.description.truncate(30, omission: '...') %>
    -
    <%=l(:label_release_time)%>: <%=format_time notification.created_at %>
    +
    + <%= notification.description.truncate(30, omission: '...') %>
    +
    + <%=l(:label_release_time)%>:  + <%=format_time notification.created_at %> +
    <% end %> @@ -239,10 +262,14 @@ <%=l(:label_question_sponsor)%>: <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %> - <%=l(:label_final_reply)%>: <% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %><%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%><% end %> + <% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %> + <%=l(:label_final_reply)%>:  + <%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%> + <% end %> - <%=l(:label_reply)%>(<%= link_to topic.try(:replies_count), topic.event_url %>) + <%=l(:label_reply)%> + (<%= link_to topic.try(:replies_count), topic.event_url %>)
    @@ -265,17 +292,21 @@
    <%= image_tag('/images/app1.png')%>
    -
    <%= link_to(softapplication.name, softapplication_path(softapplication.id), :class => "d-g-blue d-p-project-name", :title => "#{softapplication.name}", :target => "_blank") %>
    - ><%=softapplication.description.to_s.truncate(50, omission: '...')%> + > + <%=softapplication.description.to_s.truncate(50, omission: '...')%> +

    - <%=l(:label_release_time)%>: <%=format_time softapplication.created_at %> + + <%=l(:label_release_time)%>:  + <%=format_time softapplication.created_at %> +
    @@ -283,8 +314,9 @@
    <% else %> -

    <%= l(:label_no_ftapplication) %>

    - +

    + <%= l(:label_no_ftapplication) %> +

    <% end %> diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index f1b09cf54..5886f0525 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -153,8 +153,8 @@ <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %> - <%= l(:label_final_reply)%>: <% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %> + <%= l(:label_final_reply)%>: <%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%> <% end %> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 424d4eff0..4dd58641b 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -174,8 +174,8 @@ <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %> - <%= l(:label_final_reply)%>: <% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %> + <%= l(:label_final_reply)%>: <%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%> <% end %> diff --git a/app/views/words/_journal_reply.html.erb b/app/views/words/_journal_reply.html.erb index 2f823ebf6..39321394c 100644 --- a/app/views/words/_journal_reply.html.erb +++ b/app/views/words/_journal_reply.html.erb @@ -1,8 +1,7 @@ <% id = "journal_reply_ul_" + journal.id.to_s%> -<% show_real_name ||= false%>
    <% fetch_user_leaveWord_reply(journal).each do |reply|%> - <%= render :partial => "words/journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply,:show_name=> show_name, :show_real_name => show_real_name} %> + <%= render :partial => "words/journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply,:show_name=> show_name} %> <% end %>
    diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index 76359794c..fa69176a8 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -1,58 +1,51 @@ -<% show_real_name ||= false %> -<% reply_allow = JournalsForMessage.create_by_user? User.current %> -<% ids_r = 'reply_respond_form_'+ reply.id.to_s %> -
    -
    - <% if show_name %> - <%= image_tag url_to_avatar(reply.user) %> - <% else %> - <%= image_tag url_to_avatar(nil) %> - <% end %> -
    -
    - <% id = 'project_respond_form_'+ reply.id.to_s %> - <% if show_real_name%> - <%= link_to reply.user.lastname+reply.user.firstname, user_path(reply.user) %> - <% else %> - <%= link_to reply.user.name, user_path(reply.user) %> - <% end %> - 回复 - <% parent_jour = JournalsForMessage.find reply.m_reply_id %> - <% if show_name && parent_jour %> - <% if show_real_name%> - <%= link_to parent_jour.user.lastname+parent_jour.user.firstname, user_path(parent_jour.user) %> - <% else %> - <%= link_to parent_jour.user.name, user_path(parent_jour.user) %> - <% end %> - <% else %> +<% 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 %> +
    +
    + <% if show_name %> + <%= image_tag url_to_avatar(reply.user) %> + <% else %> + <%= image_tag url_to_avatar(nil) %> + <% end %> +
    +
    + <% 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 %> <%= l(:label_anonymous) %> - <% end %> + <% end %>

    <%= reply.notes %> -

    -

    +

    +

    <%= format_time reply.created_on %> -

    -
    -
    +

    +
    +
    <% if reply_allow %> - <%= render :partial => "words/new_respond", :locals => {:journal => journal, :m_reply_id => m_reply_id,:show_name => show_name, :show_real_name => show_real_name} %> + <%= render :partial => "words/new_respond", :locals => {:journal => journal, :m_reply_id => m_reply_id,:show_name => show_name} %> <% end %> -
    -
    -
    \ No newline at end of file +
    +
    +
    +<% end %> \ No newline at end of file diff --git a/app/views/words/_new_respond.html.erb b/app/views/words/_new_respond.html.erb index a4cad1a38..edb313bb5 100644 --- a/app/views/words/_new_respond.html.erb +++ b/app/views/words/_new_respond.html.erb @@ -1,5 +1,4 @@ -<% show_real_name ||= false%> -<%= form_tag(words_create_reply_path(:show_real_name=>show_real_name), :remote => true) do %> +<%= form_tag(words_create_reply_path, :remote => true) do %> <%= text_area_tag 'user_notes', "", :class => 'noline', :style => "resize: none;", :rows => 4, :placeholder => l(:label_projects_feedback_respond_content), diff --git a/app/views/words/create_reply.js.erb b/app/views/words/create_reply.js.erb index 04cbee26e..eeb4e3ef6 100644 --- a/app/views/words/create_reply.js.erb +++ b/app/views/words/create_reply.js.erb @@ -1,7 +1,7 @@ <% if @save_succ %> var pre_append = $('<%= j( render :partial => "words/journal_reply_items", - :locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm,:show_name => @show_name, :show_real_name=>@show_real_name} + :locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm,:show_name => @show_name} ) %>').hide(); $('#journal_reply_ul_<%=@jfm.m_parent_id%>').append(pre_append); pre_append.fadeIn(600); diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 0ec623217..236af39c1 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -570,6 +570,14 @@ zh: label_role_new: 新建角色 label_role_and_permissions: 角色和权限 label_member: 成员 + label_search_member_in_group: 班内搜索 + label_search_member_in_course: 课内搜索 + label_search_member_count: 共搜索到 + label_member_people: 人 + label_delete_group: 确定删除分班? + label_current_group: 当前分班 + label_limit_groupname: 组别名不能超出20字符 + label_limit_groupname_null: 组别名不能为空 label_member_new: 添加成员 label_member_plural: 成员 label_tracker: 跟踪标签 @@ -1120,6 +1128,7 @@ zh: text_workflow_edit: 选择角色和跟踪标签来编辑工作流程 text_are_you_sure: 您确定要删除吗? text_are_you_sure_out: 你确定要退出该课程吗? + text_are_you_sure_out_group: 你确定要退出该分班吗? text_journal_changed: "%{label} 从 %{old} 变更为 %{new}" text_journal_set_to: "%{label} 被设置为 %{value}" text_journal_deleted: "%{label} 已删除 (%{old})" @@ -1169,7 +1178,7 @@ zh: text_wiki_page_nullify_children: 将子页面保留为根页面 text_wiki_page_destroy_children: 删除子页面及其所有下级页面 text_wiki_page_reassign_children: 将子页面的上级页面设置为 - text_own_membership_delete_confirmation: 你正在删除你现有的某些或全部权限,如果这样做了你可能将会再也无法编辑该项目了。你确定要继续吗? + text_own_membership_delete_confirmation: 你正在删除你现有的某些或全部权限,如果这样做了你可能将会再也无法编辑该课程了。你确定要继续吗? text_zoom_in: 放大 text_zoom_out: 缩小 text_applied_project: "用户 %{id} 申请加入项目 %{project}" @@ -1373,7 +1382,7 @@ zh: label_activity_time: 发布时间 label_update_time: 更新时间 label_current_contributors: 位当前贡献者 - label_commit_limit: 作业提交时间已过! + label_commit_limit: 截止了,可补交 label_commit_ar: 作业提交截止时间快到了! lable_has_commit_homework: 您已提交过作业 #modify by men @@ -1723,6 +1732,7 @@ zh: label_user_create_project: 创建了 label_user_create_project_homework: 创建了作业 #added by bai + label_submit: 提交 label_identity: 身份 label_teacher: 教师 label_teacher_homework: 教师姓名 @@ -1898,9 +1908,11 @@ zh: other: 成员 label_bids_task_list: 作业列表 - label_join_course: 加入课程 + label_join_course: 加入 label_exit_course: 退出 + label_exit_group: 退出当前分班 label_new_join: 加入 + label_new_join_group: 加入当前分班 label_new_course_password: 课程密码 label_new_course_school: 开课学校 label_new_course_description: 课程描述 diff --git a/config/routes.rb b/config/routes.rb index 3d1fc4b81..1927566d8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -643,10 +643,17 @@ RedmineApp::Application.routes.draw do get 'member', :controller => 'courses', :action => 'member', :as => 'member' post 'finishcourse' post 'restartcourse' - + match "searchmembers", :controller => 'courses', :action => 'searchmembers', :via => [:post,:get] + match "searchgroupmembers", :via => [:post, :get] + match "updategroupname", :via => [:post, :get] + match "addgroups", :via => [:post, :get] + match 'deletegroup', :via => [:delete] + post 'join_in/join_group', :to => 'courses#join_group', :as => 'join_group' + delete 'join_in/join_group', :to => 'courses#unjoin_group' end collection do match 'join_private_courses', :via => [:get, :post] + end match '/member', :to => 'courses#member', :as => 'member', :via => :get @@ -739,6 +746,8 @@ RedmineApp::Application.routes.draw do post 'join_in/join', :to => 'courses#join', :as => 'join' delete 'join_in/join', :to => 'courses#unjoin' + post 'join_in/join_group', :to => 'courses#join_group', :as => 'join_group' + delete 'join_in/join_group', :to => 'courses#unjoin_group' post 'calls/:id/join_in_contest', :to => 'bids#join_in_contest', :as => 'join_in_contest' delete 'calls/:id/join_in_contest', :to => 'bids#unjoin_in_contest' match 'calls/:id/show_participator', :to => 'bids#show_participator' # bai @@ -747,6 +756,7 @@ RedmineApp::Application.routes.draw do delete 'attachment/:id', :to => 'attachments#delete_homework' match 'new_join', :to => 'courses#new_join', :as => 'try_join' + match 'new_join_group', :to => 'courses#new_join_group', :as => 'try_join_group' match 'new_join_in_contest', :to => 'bids#new_join', :as => 'try_join_in_contest' match 'projects/:id/respond', :to => 'projects#project_respond', :via => :post match 'calls/:id/manage',:to => 'bids#manage',:via => [:get,:post] diff --git a/db/migrate/20141126091207_create_course_groups.rb b/db/migrate/20141126091207_create_course_groups.rb new file mode 100644 index 000000000..2ee849b6f --- /dev/null +++ b/db/migrate/20141126091207_create_course_groups.rb @@ -0,0 +1,11 @@ +class CreateCourseGroups < ActiveRecord::Migration + def change + create_table :course_groups do |t| + t.string :name + t.integer :course_id + + + t.timestamps + end + end +end diff --git a/db/migrate/20141126091750_add_column_to_members.rb b/db/migrate/20141126091750_add_column_to_members.rb new file mode 100644 index 000000000..ce1ac7a75 --- /dev/null +++ b/db/migrate/20141126091750_add_column_to_members.rb @@ -0,0 +1,5 @@ +class AddColumnToMembers < ActiveRecord::Migration + def change + add_column :members, :course_group_id, :integer, default: 0 + end +end diff --git a/db/migrate/20141127072548_update_student_score.rb b/db/migrate/20141127072548_update_student_score.rb new file mode 100644 index 000000000..615e33541 --- /dev/null +++ b/db/migrate/20141127072548_update_student_score.rb @@ -0,0 +1,9 @@ +class UpdateStudentScore < ActiveRecord::Migration + def up + sql = ActiveRecord::Base.connection() + sql.update_sql("update seems_rateable_rates set stars = 5 where stars > 5") + end + + def down + end +end diff --git a/db/migrate/20141201085218_add_qutoes_to_attachments.rb b/db/migrate/20141201085218_add_qutoes_to_attachments.rb new file mode 100644 index 000000000..95a284ab6 --- /dev/null +++ b/db/migrate/20141201085218_add_qutoes_to_attachments.rb @@ -0,0 +1,5 @@ +class AddQutoesToAttachments < ActiveRecord::Migration + def change + add_column("attachments","quotes",:integer) + end +end diff --git a/db/migrate/20141210070327_change_student_score.rb b/db/migrate/20141210070327_change_student_score.rb new file mode 100644 index 000000000..192689229 --- /dev/null +++ b/db/migrate/20141210070327_change_student_score.rb @@ -0,0 +1,9 @@ +class ChangeStudentScore < ActiveRecord::Migration + def up + sql = ActiveRecord::Base.connection() + sql.update_sql("update seems_rateable_rates set stars = 5 where stars > 5") + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 8f168efba..f12d6ad0a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,1331 +1,1328 @@ -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20141127015431) do - - create_table "activities", :force => true do |t| - t.integer "act_id", :null => false - t.string "act_type", :null => false - t.integer "user_id", :null => false - end - - add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type" - add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" - add_index "activities", ["user_id"], :name => "index_activities_on_user_id" - - create_table "api_keys", :force => true do |t| - t.string "access_token" - t.datetime "expires_at" - t.integer "user_id" - t.boolean "active", :default => true - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" - add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" - - create_table "applied_projects", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - end - - create_table "apply_project_masters", :force => true do |t| - t.integer "user_id" - t.string "apply_type" - t.integer "apply_id" - t.integer "status" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "attachments", :force => true do |t| - t.integer "container_id" - t.string "container_type", :limit => 30 - t.string "filename", :default => "", :null => false - t.string "disk_filename", :default => "", :null => false - t.integer "filesize", :default => 0, :null => false - t.string "content_type", :default => "" - t.string "digest", :limit => 40, :default => "", :null => false - t.integer "downloads", :default => 0, :null => false - t.integer "author_id", :default => 0, :null => false - t.datetime "created_on" - t.string "description" - t.string "disk_directory" - t.integer "attachtype", :default => 1 - t.integer "is_public", :default => 1 - t.integer "copy_from" - end - - add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" - add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" - add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" - - create_table "attachmentstypes", :force => true do |t| - t.integer "typeId", :null => false - t.string "typeName", :limit => 50 - end - - create_table "auth_sources", :force => true do |t| - t.string "type", :limit => 30, :default => "", :null => false - t.string "name", :limit => 60, :default => "", :null => false - t.string "host", :limit => 60 - t.integer "port" - t.string "account" - t.string "account_password", :default => "" - t.string "base_dn" - t.string "attr_login", :limit => 30 - t.string "attr_firstname", :limit => 30 - t.string "attr_lastname", :limit => 30 - t.string "attr_mail", :limit => 30 - t.boolean "onthefly_register", :default => false, :null => false - t.boolean "tls", :default => false, :null => false - t.string "filter" - t.integer "timeout" - end - - add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" - - create_table "biding_projects", :force => true do |t| - t.integer "project_id" - t.integer "bid_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "bids", :force => true do |t| - t.string "name" - t.string "budget", :null => false - t.integer "author_id" - t.date "deadline" - t.text "description" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.integer "commit" - t.integer "reward_type" - t.integer "homework_type" - t.integer "parent_id" - t.string "password" - t.integer "is_evaluation" - t.integer "proportion", :default => 60 - t.integer "comment_status", :default => 0 - t.integer "evaluation_num", :default => 3 - t.integer "open_anonymous_evaluation", :default => 1 - end - - create_table "boards", :force => true do |t| - t.integer "project_id", :null => false - t.string "name", :default => "", :null => false - t.string "description" - t.integer "position", :default => 1 - t.integer "topics_count", :default => 0, :null => false - t.integer "messages_count", :default => 0, :null => false - t.integer "last_message_id" - t.integer "parent_id" - t.integer "course_id" - end - - add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" - add_index "boards", ["project_id"], :name => "boards_project_id" - - create_table "bug_to_osps", :force => true do |t| - t.integer "osp_id" - t.integer "relative_memo_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "changes", :force => true do |t| - t.integer "changeset_id", :null => false - t.string "action", :limit => 1, :default => "", :null => false - t.text "path", :null => false - t.text "from_path" - t.string "from_revision" - t.string "revision" - t.string "branch" - end - - add_index "changes", ["changeset_id"], :name => "changesets_changeset_id" - - create_table "changeset_parents", :id => false, :force => true do |t| - t.integer "changeset_id", :null => false - t.integer "parent_id", :null => false - end - - add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids" - add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" - - create_table "changesets", :force => true do |t| - t.integer "repository_id", :null => false - t.string "revision", :null => false - t.string "committer" - t.datetime "committed_on", :null => false - t.text "comments" - t.date "commit_date" - t.string "scmid" - t.integer "user_id" - end - - add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" - add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true - add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid" - add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id" - add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id" - - create_table "changesets_issues", :id => false, :force => true do |t| - t.integer "changeset_id", :null => false - t.integer "issue_id", :null => false - end - - add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true - - create_table "code_review_assignments", :force => true do |t| - t.integer "issue_id" - t.integer "change_id" - t.integer "attachment_id" - t.string "file_path" - t.string "rev" - t.string "rev_to" - t.string "action_type" - t.integer "changeset_id" - end - - create_table "code_review_project_settings", :force => true do |t| - t.integer "project_id" - t.integer "tracker_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "updated_by" - t.boolean "hide_code_review_tab", :default => false - t.integer "auto_relation", :default => 1 - t.integer "assignment_tracker_id" - t.text "auto_assign" - t.integer "lock_version", :default => 0, :null => false - t.boolean "tracker_in_review_dialog", :default => false - end - - create_table "code_review_user_settings", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.integer "mail_notification", :default => 0, :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "code_reviews", :force => true do |t| - t.integer "project_id" - t.integer "change_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "line" - t.integer "updated_by_id" - t.integer "lock_version", :default => 0, :null => false - t.integer "status_changed_from" - t.integer "status_changed_to" - t.integer "issue_id" - t.string "action_type" - t.string "file_path" - t.string "rev" - t.string "rev_to" - t.integer "attachment_id" - t.integer "file_count", :default => 0, :null => false - t.boolean "diff_all" - end - - create_table "comments", :force => true do |t| - t.string "commented_type", :limit => 30, :default => "", :null => false - t.integer "commented_id", :default => 0, :null => false - t.integer "author_id", :default => 0, :null => false - t.text "comments" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - add_index "comments", ["author_id"], :name => "index_comments_on_author_id" - add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" - - create_table "contest_notifications", :force => true do |t| - t.text "title" - t.text "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "contesting_projects", :force => true do |t| - t.integer "project_id" - t.string "contest_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "contesting_softapplications", :force => true do |t| - t.integer "softapplication_id" - t.integer "contest_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "contestnotifications", :force => true do |t| - t.integer "contest_id" - t.string "title" - t.string "summary" - t.text "description" - t.integer "author_id" - t.integer "notificationcomments_count" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "contests", :force => true do |t| - t.string "name" - t.string "budget", :default => "" - t.integer "author_id" - t.date "deadline" - t.string "description" - t.integer "commit" - t.string "password" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - create_table "course_attachments", :force => true do |t| - t.string "filename" - t.string "disk_filename" - t.integer "filesize" - t.string "content_type" - t.string "digest" - t.integer "downloads" - t.string "author_id" - t.string "integer" - t.string "description" - t.string "disk_directory" - t.integer "attachtype" - t.integer "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "container_id", :default => 0 - end - - create_table "course_infos", :force => true do |t| - t.integer "course_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "course_id" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "courses", :force => true do |t| - t.integer "tea_id" - t.string "name" - t.integer "state" - t.string "code" - t.integer "time" - t.string "extra" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "location" - t.string "term" - t.string "string" - t.string "password" - t.string "setup_time" - t.string "endup_time" - t.string "class_period" - t.integer "school_id" - t.text "description" - t.integer "status", :default => 1 - t.integer "attachmenttype", :default => 2 - t.integer "lft" - t.integer "rgt" - t.integer "is_public", :limit => 1, :default => 1 - t.integer "inherit_members", :limit => 1, :default => 1 - t.integer "open_student", :default => 0 - end - - create_table "custom_fields", :force => true do |t| - t.string "type", :limit => 30, :default => "", :null => false - t.string "name", :limit => 30, :default => "", :null => false - t.string "field_format", :limit => 30, :default => "", :null => false - t.text "possible_values" - t.string "regexp", :default => "" - t.integer "min_length", :default => 0, :null => false - t.integer "max_length", :default => 0, :null => false - t.boolean "is_required", :default => false, :null => false - t.boolean "is_for_all", :default => false, :null => false - t.boolean "is_filter", :default => false, :null => false - t.integer "position", :default => 1 - t.boolean "searchable", :default => false - t.text "default_value" - t.boolean "editable", :default => true - t.boolean "visible", :default => true, :null => false - t.boolean "multiple", :default => false - end - - add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type" - - create_table "custom_fields_projects", :id => false, :force => true do |t| - t.integer "custom_field_id", :default => 0, :null => false - t.integer "project_id", :default => 0, :null => false - end - - add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true - - create_table "custom_fields_trackers", :id => false, :force => true do |t| - t.integer "custom_field_id", :default => 0, :null => false - t.integer "tracker_id", :default => 0, :null => false - end - - add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true - - create_table "custom_values", :force => true do |t| - t.string "customized_type", :limit => 30, :default => "", :null => false - t.integer "customized_id", :default => 0, :null => false - t.integer "custom_field_id", :default => 0, :null => false - t.text "value" - end - - add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id" - add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized" - - create_table "documents", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.integer "category_id", :default => 0, :null => false - t.string "title", :limit => 60, :default => "", :null => false - t.text "description" - t.datetime "created_on" - t.integer "user_id", :default => 0 - t.integer "is_public", :default => 1 - end - - add_index "documents", ["category_id"], :name => "index_documents_on_category_id" - add_index "documents", ["created_on"], :name => "index_documents_on_created_on" - add_index "documents", ["project_id"], :name => "documents_project_id" - - create_table "enabled_modules", :force => true do |t| - t.integer "project_id" - t.string "name", :null => false - t.integer "course_id" - end - - add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id" - - create_table "enumerations", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "is_default", :default => false, :null => false - t.string "type" - t.boolean "active", :default => true, :null => false - t.integer "project_id" - t.integer "parent_id" - t.string "position_name", :limit => 30 - end - - add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" - add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" - - create_table "first_pages", :force => true do |t| - t.string "web_title" - t.string "title" - t.text "description" - t.string "page_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sort_type" - t.integer "image_width", :default => 107 - t.integer "image_height", :default => 63 - t.integer "show_course", :default => 1 - t.integer "show_contest", :default => 1 - end - - create_table "forums", :force => true do |t| - t.string "name", :null => false - t.text "description" - t.integer "topic_count", :default => 0 - t.integer "memo_count", :default => 0 - t.integer "last_memo_id", :default => 0 - t.integer "creator_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sticky" - t.integer "locked" - end - - create_table "groups_users", :id => false, :force => true do |t| - t.integer "group_id", :null => false - t.integer "user_id", :null => false - end - - add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true - - create_table "homework_attaches", :force => true do |t| - t.integer "bid_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - t.string "name" - t.text "description" - t.integer "state" - t.integer "project_id", :default => 0 - end - - create_table "homework_evaluations", :force => true do |t| - t.string "user_id" - t.string "homework_attach_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "homework_for_courses", :force => true do |t| - t.integer "course_id" - t.integer "bid_id" - end - - create_table "homework_users", :force => true do |t| - t.string "homework_attach_id" - t.string "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "issue_categories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "name", :limit => 30, :default => "", :null => false - t.integer "assigned_to_id" - end - - add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id" - add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" - - create_table "issue_relations", :force => true do |t| - t.integer "issue_from_id", :null => false - t.integer "issue_to_id", :null => false - t.string "relation_type", :default => "", :null => false - t.integer "delay" - end - - add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true - add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id" - add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id" - - create_table "issue_statuses", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.boolean "is_closed", :default => false, :null => false - t.boolean "is_default", :default => false, :null => false - t.integer "position", :default => 1 - t.integer "default_done_ratio" - end - - add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed" - add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default" - add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position" - - create_table "issues", :force => true do |t| - t.integer "tracker_id", :null => false - t.integer "project_id", :null => false - t.string "subject", :default => "", :null => false - t.text "description" - t.date "due_date" - t.integer "category_id" - t.integer "status_id", :null => false - t.integer "assigned_to_id" - t.integer "priority_id", :null => false - t.integer "fixed_version_id" - t.integer "author_id", :null => false - t.integer "lock_version", :default => 0, :null => false - t.datetime "created_on" - t.datetime "updated_on" - t.date "start_date" - t.integer "done_ratio", :default => 0, :null => false - t.float "estimated_hours" - t.integer "parent_id" - t.integer "root_id" - t.integer "lft" - t.integer "rgt" - t.boolean "is_private", :default => false, :null => false - t.datetime "closed_on" - end - - add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id" - add_index "issues", ["author_id"], :name => "index_issues_on_author_id" - add_index "issues", ["category_id"], :name => "index_issues_on_category_id" - add_index "issues", ["created_on"], :name => "index_issues_on_created_on" - add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id" - add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id" - add_index "issues", ["project_id"], :name => "issues_project_id" - add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt" - add_index "issues", ["status_id"], :name => "index_issues_on_status_id" - add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id" - - create_table "join_in_competitions", :force => true do |t| - t.integer "user_id" - t.integer "competition_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "join_in_contests", :force => true do |t| - t.integer "user_id" - t.integer "bid_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "journal_details", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - - create_table "journal_replies", :id => false, :force => true do |t| - t.integer "journal_id" - t.integer "user_id" - t.integer "reply_id" - end - - add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id" - add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id" - add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id" - - create_table "journals", :force => true do |t| - t.integer "journalized_id", :default => 0, :null => false - t.string "journalized_type", :limit => 30, :default => "", :null => false - t.integer "user_id", :default => 0, :null => false - t.text "notes" - t.datetime "created_on", :null => false - t.boolean "private_notes", :default => false, :null => false - end - - add_index "journals", ["created_on"], :name => "index_journals_on_created_on" - add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" - add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id" - add_index "journals", ["user_id"], :name => "index_journals_on_user_id" - - create_table "journals_for_messages", :force => true do |t| - t.integer "jour_id" - t.string "jour_type" - t.integer "user_id" - t.text "notes" - t.integer "status" - t.integer "reply_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.string "m_parent_id" - t.boolean "is_readed" - t.integer "m_reply_count" - t.integer "m_reply_id" - t.integer "is_comprehensive_evaluation" - end - - create_table "member_roles", :force => true do |t| - t.integer "member_id", :null => false - t.integer "role_id", :null => false - t.integer "inherited_from" - end - - add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" - add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id" - - create_table "members", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.integer "project_id", :default => 0 - t.datetime "created_on" - t.boolean "mail_notification", :default => false, :null => false - t.integer "course_id", :default => -1 - end - - add_index "members", ["project_id"], :name => "index_members_on_project_id" - add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true - add_index "members", ["user_id"], :name => "index_members_on_user_id" - - create_table "memos", :force => true do |t| - t.integer "forum_id", :null => false - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :null => false - t.integer "author_id", :null => false - t.integer "replies_count", :default => 0 - t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count", :default => 0 - end - - create_table "messages", :force => true do |t| - t.integer "board_id", :null => false - t.integer "parent_id" - t.string "subject", :default => "", :null => false - t.text "content" - t.integer "author_id" - t.integer "replies_count", :default => 0, :null => false - t.integer "last_reply_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - end - - add_index "messages", ["author_id"], :name => "index_messages_on_author_id" - add_index "messages", ["board_id"], :name => "messages_board_id" - add_index "messages", ["created_on"], :name => "index_messages_on_created_on" - add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" - add_index "messages", ["parent_id"], :name => "messages_parent_id" - - create_table "news", :force => true do |t| - t.integer "project_id" - t.string "title", :limit => 60, :default => "", :null => false - t.string "summary", :default => "" - t.text "description" - t.integer "author_id", :default => 0, :null => false - t.datetime "created_on" - t.integer "comments_count", :default => 0, :null => false - t.integer "course_id" - end - - add_index "news", ["author_id"], :name => "index_news_on_author_id" - add_index "news", ["created_on"], :name => "index_news_on_created_on" - add_index "news", ["project_id"], :name => "news_project_id" - - create_table "no_uses", :force => true do |t| - t.integer "user_id", :null => false - t.string "no_use_type" - t.integer "no_use_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "notificationcomments", :force => true do |t| - t.string "notificationcommented_type" - t.integer "notificationcommented_id" - t.integer "author_id" - t.text "notificationcomments" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "open_id_authentication_associations", :force => true do |t| - t.integer "issued" - t.integer "lifetime" - t.string "handle" - t.string "assoc_type" - t.binary "server_url" - t.binary "secret" - end - - create_table "open_id_authentication_nonces", :force => true do |t| - t.integer "timestamp", :null => false - t.string "server_url" - t.string "salt", :null => false - end - - create_table "open_source_projects", :force => true do |t| - t.string "name" - t.text "description" - t.integer "commit_count", :default => 0 - t.integer "code_line", :default => 0 - t.integer "users_count", :default => 0 - t.date "last_commit_time" - t.string "url" - t.date "date_collected" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "option_numbers", :force => true do |t| - t.integer "user_id" - t.integer "memo" - t.integer "messages_for_issues" - t.integer "issues_status" - t.integer "replay_for_message" - t.integer "replay_for_memo" - t.integer "follow" - t.integer "tread" - t.integer "praise_by_one" - t.integer "praise_by_two" - t.integer "praise_by_three" - t.integer "tread_by_one" - t.integer "tread_by_two" - t.integer "tread_by_three" - t.integer "changeset" - t.integer "document" - t.integer "attachment" - t.integer "issue_done_ratio" - t.integer "post_issue" - t.integer "score_type" - t.integer "total_score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - end - - create_table "praise_tread_caches", :force => true do |t| - t.integer "object_id", :null => false - t.string "object_type" - t.integer "praise_num" - t.integer "tread_num" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "praise_treads", :force => true do |t| - t.integer "user_id", :null => false - t.integer "praise_tread_object_id" - t.string "praise_tread_object_type" - t.integer "praise_or_tread" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "project_infos", :force => true do |t| - t.integer "project_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "project_scores", :force => true do |t| - t.string "project_id" - t.integer "score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "issue_num", :default => 0 - t.integer "issue_journal_num", :default => 0 - t.integer "news_num", :default => 0 - t.integer "documents_num", :default => 0 - t.integer "changeset_num", :default => 0 - t.integer "board_message_num", :default => 0 - end - - create_table "project_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "project_id" - t.integer "project_type" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 - end - - add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" - - create_table "projecting_softapplictions", :force => true do |t| - t.integer "user_id" - t.integer "softapplication_id" - t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "projects", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "description" - t.string "homepage", :default => "" - t.boolean "is_public", :default => true, :null => false - t.integer "parent_id" - t.datetime "created_on" - t.datetime "updated_on" - t.string "identifier" - t.integer "status", :default => 1, :null => false - t.integer "lft" - t.integer "rgt" - t.boolean "inherit_members", :default => false, :null => false - t.integer "project_type" - t.boolean "hidden_repo", :default => false, :null => false - t.integer "attachmenttype", :default => 1 - t.integer "user_id" - t.integer "dts_test", :default => 0 - end - - add_index "projects", ["lft"], :name => "index_projects_on_lft" - add_index "projects", ["rgt"], :name => "index_projects_on_rgt" - - create_table "projects_trackers", :id => false, :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.integer "tracker_id", :default => 0, :null => false - end - - add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true - add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" - - create_table "queries", :force => true do |t| - t.integer "project_id" - t.string "name", :default => "", :null => false - t.text "filters" - t.integer "user_id", :default => 0, :null => false - t.boolean "is_public", :default => false, :null => false - t.text "column_names" - t.text "sort_criteria" - t.string "group_by" - t.string "type" - end - - add_index "queries", ["project_id"], :name => "index_queries_on_project_id" - add_index "queries", ["user_id"], :name => "index_queries_on_user_id" - - create_table "relative_memo_to_open_source_projects", :force => true do |t| - t.integer "osp_id" - t.integer "relative_memo_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "relative_memos", :force => true do |t| - t.integer "osp_id" - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :limit => 16777215, :null => false - t.integer "author_id" - t.integer "replies_count", :default => 0 - t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.boolean "is_quote", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count_crawl", :default => 0 - t.integer "viewed_count_local", :default => 0 - t.string "url" - t.string "username" - t.string "userhomeurl" - t.date "date_collected" - t.string "topic_resource" - end - - create_table "repositories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "url", :default => "", :null => false - t.string "login", :limit => 60, :default => "" - t.string "password", :default => "" - t.string "root_url", :default => "" - t.string "type" - t.string "path_encoding", :limit => 64 - t.string "log_encoding", :limit => 64 - t.text "extra_info" - t.string "identifier" - t.boolean "is_default", :default => false - end - - add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" - - create_table "rich_rich_files", :force => true do |t| - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "rich_file_file_name" - t.string "rich_file_content_type" - t.integer "rich_file_file_size" - t.datetime "rich_file_updated_at" - t.string "owner_type" - t.integer "owner_id" - t.text "uri_cache" - t.string "simplified_type", :default => "file" - end - - create_table "roles", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "assignable", :default => true - t.integer "builtin", :default => 0, :null => false - t.text "permissions" - t.string "issues_visibility", :limit => 30, :default => "default", :null => false - end - - create_table "schools", :force => true do |t| - t.string "name" - t.string "province" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "logo_link" - end - - create_table "seems_rateable_cached_ratings", :force => true do |t| - t.integer "cacheable_id", :limit => 8 - t.string "cacheable_type" - t.float "avg", :null => false - t.integer "cnt", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "seems_rateable_rates", :force => true do |t| - t.integer "rater_id", :limit => 8 - t.integer "rateable_id" - t.string "rateable_type" - t.float "stars", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "settings", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "value" - t.datetime "updated_on" - end - - add_index "settings", ["name"], :name => "index_settings_on_name" - - create_table "shares", :force => true do |t| - t.date "created_on" - t.string "url" - t.string "title" - t.integer "share_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - t.integer "user_id" - t.string "description" - end - - create_table "softapplications", :force => true do |t| - t.string "name" - t.text "description" - t.integer "app_type_id" - t.string "app_type_name" - t.string "android_min_version_available" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "contest_id" - t.integer "softapplication_id" - t.integer "is_public" - t.string "application_developers" - t.string "deposit_project_url" - t.string "deposit_project" - t.integer "project_id" - end - - create_table "students_for_courses", :force => true do |t| - t.integer "student_id" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "taggings", :force => true do |t| - t.integer "tag_id" - t.integer "taggable_id" - t.string "taggable_type" - t.integer "tagger_id" - t.string "tagger_type" - t.string "context", :limit => 128 - t.datetime "created_at" - end - - add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" - add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" - add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type" - - create_table "tags", :force => true do |t| - t.string "name" - end - - create_table "teachers", :force => true do |t| - t.string "tea_name" - t.string "location" - t.integer "couurse_time" - t.integer "course_code" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "extra" - end - - create_table "time_entries", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - t.integer "issue_id" - t.float "hours", :null => false - t.string "comments" - t.integer "activity_id", :null => false - t.date "spent_on", :null => false - t.integer "tyear", :null => false - t.integer "tmonth", :null => false - t.integer "tweek", :null => false - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id" - add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on" - add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id" - add_index "time_entries", ["project_id"], :name => "time_entries_project_id" - add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" - - create_table "tokens", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.string "action", :limit => 30, :default => "", :null => false - t.string "value", :limit => 40, :default => "", :null => false - t.datetime "created_on", :null => false - end - - add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" - add_index "tokens", ["value"], :name => "tokens_value", :unique => true - - create_table "trackers", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.boolean "is_in_chlog", :default => false, :null => false - t.integer "position", :default => 1 - t.boolean "is_in_roadmap", :default => true, :null => false - t.integer "fields_bits", :default => 0 - end - - create_table "user_extensions", :force => true do |t| - t.integer "user_id", :null => false - t.date "birthday" - t.string "brief_introduction" - t.integer "gender" - t.string "location" - t.string "occupation" - t.integer "work_experience" - t.integer "zip_code" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "technical_title" - t.integer "identity" - t.string "student_id" - t.string "teacher_realname" - t.string "student_realname" - t.string "location_city" - t.integer "school_id" - end - - create_table "user_grades", :force => true do |t| - t.integer "user_id", :null => false - t.integer "project_id", :null => false - t.float "grade", :default => 0.0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade" - add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" - add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" - - create_table "user_levels", :force => true do |t| - t.integer "user_id" - t.integer "level" - end - - create_table "user_preferences", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.text "others" - t.boolean "hide_mail", :default => false - t.string "time_zone" - end - - add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" - - create_table "user_score_details", :force => true do |t| - t.integer "current_user_id" - t.integer "target_user_id" - t.string "score_type" - t.string "score_action" - t.integer "user_id" - t.integer "old_score" - t.integer "new_score" - t.integer "current_user_level" - t.integer "target_user_level" - t.integer "score_changeable_obj_id" - t.string "score_changeable_obj_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_scores", :force => true do |t| - t.integer "user_id", :null => false - t.integer "collaboration" - t.integer "influence" - t.integer "skill" - t.integer "active" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.float "grade", :default => 0.0 - end - - add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" - add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" - add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" - - create_table "users", :force => true do |t| - t.string "login", :default => "", :null => false - t.string "hashed_password", :limit => 40, :default => "", :null => false - t.string "firstname", :limit => 30, :default => "", :null => false - t.string "lastname", :default => "", :null => false - t.string "mail", :limit => 60, :default => "", :null => false - t.boolean "admin", :default => false, :null => false - t.integer "status", :default => 1, :null => false - t.datetime "last_login_on" - t.string "language", :limit => 5, :default => "" - t.integer "auth_source_id" - t.datetime "created_on" - t.datetime "updated_on" - t.string "type" - t.string "identity_url" - t.string "mail_notification", :default => "", :null => false - t.string "salt", :limit => 64 - end - - add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" - add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" - add_index "users", ["type"], :name => "index_users_on_type" - - create_table "versions", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "name", :default => "", :null => false - t.string "description", :default => "" - t.date "effective_date" - t.datetime "created_on" - t.datetime "updated_on" - t.string "wiki_page_title" - t.string "status", :default => "open" - t.string "sharing", :default => "none", :null => false - end - - add_index "versions", ["project_id"], :name => "versions_project_id" - add_index "versions", ["sharing"], :name => "index_versions_on_sharing" - - create_table "watchers", :force => true do |t| - t.string "watchable_type", :default => "", :null => false - t.integer "watchable_id", :default => 0, :null => false - t.integer "user_id" - end - - add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type" - add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id" - add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type" - - create_table "web_footer_companies", :force => true do |t| - t.string "name" - t.string "logo_size" - t.string "url" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "web_footer_oranizers", :force => true do |t| - t.string "name" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "wiki_content_versions", :force => true do |t| - t.integer "wiki_content_id", :null => false - t.integer "page_id", :null => false - t.integer "author_id" - t.binary "data", :limit => 2147483647 - t.string "compression", :limit => 6, :default => "" - t.string "comments", :default => "" - t.datetime "updated_on", :null => false - t.integer "version", :null => false - end - - add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on" - add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid" - - create_table "wiki_contents", :force => true do |t| - t.integer "page_id", :null => false - t.integer "author_id" - t.text "text", :limit => 2147483647 - t.string "comments", :default => "" - t.datetime "updated_on", :null => false - t.integer "version", :null => false - end - - add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id" - add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id" - - create_table "wiki_pages", :force => true do |t| - t.integer "wiki_id", :null => false - t.string "title", :null => false - t.datetime "created_on", :null => false - t.boolean "protected", :default => false, :null => false - t.integer "parent_id" - end - - add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id" - add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title" - add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id" - - create_table "wiki_redirects", :force => true do |t| - t.integer "wiki_id", :null => false - t.string "title" - t.string "redirects_to" - t.datetime "created_on", :null => false - end - - add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title" - add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id" - - create_table "wikis", :force => true do |t| - t.integer "project_id", :null => false - t.string "start_page", :null => false - t.integer "status", :default => 1, :null => false - end - - add_index "wikis", ["project_id"], :name => "wikis_project_id" - - create_table "workflows", :force => true do |t| - t.integer "tracker_id", :default => 0, :null => false - t.integer "old_status_id", :default => 0, :null => false - t.integer "new_status_id", :default => 0, :null => false - t.integer "role_id", :default => 0, :null => false - t.boolean "assignee", :default => false, :null => false - t.boolean "author", :default => false, :null => false - t.string "type", :limit => 30 - t.string "field_name", :limit => 30 - t.string "rule", :limit => 30 - end - - add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id" - add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id" - add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" - add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" - - create_table "works_categories", :force => true do |t| - t.string "category" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - -end +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20141201085218) do + + create_table "activities", :force => true do |t| + t.integer "act_id", :null => false + t.string "act_type", :null => false + t.integer "user_id", :null => false + end + + add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type" + add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" + add_index "activities", ["user_id"], :name => "index_activities_on_user_id" + + create_table "applied_projects", :force => true do |t| + t.integer "project_id", :null => false + t.integer "user_id", :null => false + end + + create_table "apply_project_masters", :force => true do |t| + t.integer "user_id" + t.string "apply_type" + t.integer "apply_id" + t.integer "status" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "attachments", :force => true do |t| + t.integer "container_id" + t.string "container_type", :limit => 30 + t.string "filename", :default => "", :null => false + t.string "disk_filename", :default => "", :null => false + t.integer "filesize", :default => 0, :null => false + t.string "content_type", :default => "" + t.string "digest", :limit => 40, :default => "", :null => false + t.integer "downloads", :default => 0, :null => false + t.integer "author_id", :default => 0, :null => false + t.datetime "created_on" + t.string "description" + t.string "disk_directory" + t.integer "attachtype", :default => 1 + t.integer "is_public", :default => 1 + t.integer "copy_from" + t.integer "quotes" + end + + add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" + add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" + add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" + + create_table "attachmentstypes", :force => true do |t| + t.integer "typeId", :null => false + t.string "typeName", :limit => 50 + end + + create_table "auth_sources", :force => true do |t| + t.string "type", :limit => 30, :default => "", :null => false + t.string "name", :limit => 60, :default => "", :null => false + t.string "host", :limit => 60 + t.integer "port" + t.string "account" + t.string "account_password", :default => "" + t.string "base_dn" + t.string "attr_login", :limit => 30 + t.string "attr_firstname", :limit => 30 + t.string "attr_lastname", :limit => 30 + t.string "attr_mail", :limit => 30 + t.boolean "onthefly_register", :default => false, :null => false + t.boolean "tls", :default => false, :null => false + t.string "filter" + t.integer "timeout" + end + + add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" + + create_table "biding_projects", :force => true do |t| + t.integer "project_id" + t.integer "bid_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "bids", :force => true do |t| + t.string "name" + t.string "budget", :null => false + t.integer "author_id" + t.date "deadline" + t.text "description" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.integer "commit" + t.integer "reward_type" + t.integer "homework_type" + t.integer "parent_id" + t.string "password" + t.integer "is_evaluation" + t.integer "proportion", :default => 60 + t.integer "comment_status", :default => 0 + t.integer "evaluation_num", :default => 3 + t.integer "open_anonymous_evaluation", :default => 1 + end + + create_table "boards", :force => true do |t| + t.integer "project_id", :null => false + t.string "name", :default => "", :null => false + t.string "description" + t.integer "position", :default => 1 + t.integer "topics_count", :default => 0, :null => false + t.integer "messages_count", :default => 0, :null => false + t.integer "last_message_id" + t.integer "parent_id" + t.integer "course_id" + end + + add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" + add_index "boards", ["project_id"], :name => "boards_project_id" + + create_table "bug_to_osps", :force => true do |t| + t.integer "osp_id" + t.integer "relative_memo_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "changes", :force => true do |t| + t.integer "changeset_id", :null => false + t.string "action", :limit => 1, :default => "", :null => false + t.text "path", :null => false + t.text "from_path" + t.string "from_revision" + t.string "revision" + t.string "branch" + end + + add_index "changes", ["changeset_id"], :name => "changesets_changeset_id" + + create_table "changeset_parents", :id => false, :force => true do |t| + t.integer "changeset_id", :null => false + t.integer "parent_id", :null => false + end + + add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids" + add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" + + create_table "changesets", :force => true do |t| + t.integer "repository_id", :null => false + t.string "revision", :null => false + t.string "committer" + t.datetime "committed_on", :null => false + t.text "comments" + t.date "commit_date" + t.string "scmid" + t.integer "user_id" + end + + add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" + add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true + add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid" + add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id" + add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id" + + create_table "changesets_issues", :id => false, :force => true do |t| + t.integer "changeset_id", :null => false + t.integer "issue_id", :null => false + end + + add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true + + create_table "code_review_assignments", :force => true do |t| + t.integer "issue_id" + t.integer "change_id" + t.integer "attachment_id" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.string "action_type" + t.integer "changeset_id" + end + + create_table "code_review_project_settings", :force => true do |t| + t.integer "project_id" + t.integer "tracker_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "updated_by" + t.boolean "hide_code_review_tab", :default => false + t.integer "auto_relation", :default => 1 + t.integer "assignment_tracker_id" + t.text "auto_assign" + t.integer "lock_version", :default => 0, :null => false + t.boolean "tracker_in_review_dialog", :default => false + end + + create_table "code_review_user_settings", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "mail_notification", :default => 0, :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "code_reviews", :force => true do |t| + t.integer "project_id" + t.integer "change_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "line" + t.integer "updated_by_id" + t.integer "lock_version", :default => 0, :null => false + t.integer "status_changed_from" + t.integer "status_changed_to" + t.integer "issue_id" + t.string "action_type" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.integer "attachment_id" + t.integer "file_count", :default => 0, :null => false + t.boolean "diff_all" + end + + create_table "comments", :force => true do |t| + t.string "commented_type", :limit => 30, :default => "", :null => false + t.integer "commented_id", :default => 0, :null => false + t.integer "author_id", :default => 0, :null => false + t.text "comments" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + add_index "comments", ["author_id"], :name => "index_comments_on_author_id" + add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" + + create_table "contest_notifications", :force => true do |t| + t.text "title" + t.text "content" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "contesting_projects", :force => true do |t| + t.integer "project_id" + t.string "contest_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "contesting_softapplications", :force => true do |t| + t.integer "softapplication_id" + t.integer "contest_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "contestnotifications", :force => true do |t| + t.integer "contest_id" + t.string "title" + t.string "summary" + t.text "description" + t.integer "author_id" + t.integer "notificationcomments_count" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "contests", :force => true do |t| + t.string "name" + t.string "budget", :default => "" + t.integer "author_id" + t.date "deadline" + t.string "description" + t.integer "commit" + t.string "password" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + create_table "course_attachments", :force => true do |t| + t.string "filename" + t.string "disk_filename" + t.integer "filesize" + t.string "content_type" + t.string "digest" + t.integer "downloads" + t.string "author_id" + t.string "integer" + t.string "description" + t.string "disk_directory" + t.integer "attachtype" + t.integer "is_public" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "container_id", :default => 0 + end + + create_table "course_groups", :force => true do |t| + t.string "name" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "course_infos", :force => true do |t| + t.integer "course_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "course_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "course_id" + t.float "grade", :default => 0.0 + t.integer "course_ac_para", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "courses", :force => true do |t| + t.integer "tea_id" + t.string "name" + t.integer "state" + t.string "code" + t.integer "time" + t.string "extra" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "location" + t.string "term" + t.string "string" + t.string "password" + t.string "setup_time" + t.string "endup_time" + t.string "class_period" + t.integer "school_id" + t.text "description" + t.integer "status", :default => 1 + t.integer "attachmenttype", :default => 2 + t.integer "lft" + t.integer "rgt" + t.integer "is_public", :limit => 1, :default => 1 + t.integer "inherit_members", :limit => 1, :default => 1 + t.integer "open_student", :default => 0 + end + + create_table "custom_fields", :force => true do |t| + t.string "type", :limit => 30, :default => "", :null => false + t.string "name", :limit => 30, :default => "", :null => false + t.string "field_format", :limit => 30, :default => "", :null => false + t.text "possible_values" + t.string "regexp", :default => "" + t.integer "min_length", :default => 0, :null => false + t.integer "max_length", :default => 0, :null => false + t.boolean "is_required", :default => false, :null => false + t.boolean "is_for_all", :default => false, :null => false + t.boolean "is_filter", :default => false, :null => false + t.integer "position", :default => 1 + t.boolean "searchable", :default => false + t.text "default_value" + t.boolean "editable", :default => true + t.boolean "visible", :default => true, :null => false + t.boolean "multiple", :default => false + end + + add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type" + + create_table "custom_fields_projects", :id => false, :force => true do |t| + t.integer "custom_field_id", :default => 0, :null => false + t.integer "project_id", :default => 0, :null => false + end + + add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true + + create_table "custom_fields_trackers", :id => false, :force => true do |t| + t.integer "custom_field_id", :default => 0, :null => false + t.integer "tracker_id", :default => 0, :null => false + end + + add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true + + create_table "custom_values", :force => true do |t| + t.string "customized_type", :limit => 30, :default => "", :null => false + t.integer "customized_id", :default => 0, :null => false + t.integer "custom_field_id", :default => 0, :null => false + t.text "value" + end + + add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id" + add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized" + + create_table "documents", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.integer "category_id", :default => 0, :null => false + t.string "title", :limit => 60, :default => "", :null => false + t.text "description" + t.datetime "created_on" + t.integer "user_id", :default => 0 + t.integer "is_public", :default => 1 + end + + add_index "documents", ["category_id"], :name => "index_documents_on_category_id" + add_index "documents", ["created_on"], :name => "index_documents_on_created_on" + add_index "documents", ["project_id"], :name => "documents_project_id" + + create_table "enabled_modules", :force => true do |t| + t.integer "project_id" + t.string "name", :null => false + t.integer "course_id" + end + + add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id" + + create_table "enumerations", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.integer "position", :default => 1 + t.boolean "is_default", :default => false, :null => false + t.string "type" + t.boolean "active", :default => true, :null => false + t.integer "project_id" + t.integer "parent_id" + t.string "position_name", :limit => 30 + end + + add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" + add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" + + create_table "first_pages", :force => true do |t| + t.string "web_title" + t.string "title" + t.text "description" + t.string "page_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sort_type" + t.integer "image_width", :default => 107 + t.integer "image_height", :default => 63 + t.integer "show_course", :default => 1 + t.integer "show_contest", :default => 1 + end + + create_table "forums", :force => true do |t| + t.string "name", :null => false + t.text "description" + t.integer "topic_count", :default => 0 + t.integer "memo_count", :default => 0 + t.integer "last_memo_id", :default => 0 + t.integer "creator_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sticky" + t.integer "locked" + end + + create_table "groups_users", :id => false, :force => true do |t| + t.integer "group_id", :null => false + t.integer "user_id", :null => false + end + + add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true + + create_table "homework_attaches", :force => true do |t| + t.integer "bid_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + t.string "name" + t.text "description" + t.integer "state" + t.integer "project_id", :default => 0 + end + + create_table "homework_evaluations", :force => true do |t| + t.string "user_id" + t.string "homework_attach_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "homework_for_courses", :force => true do |t| + t.integer "course_id" + t.integer "bid_id" + end + + create_table "homework_users", :force => true do |t| + t.string "homework_attach_id" + t.string "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "issue_categories", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "name", :limit => 30, :default => "", :null => false + t.integer "assigned_to_id" + end + + add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id" + add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" + + create_table "issue_relations", :force => true do |t| + t.integer "issue_from_id", :null => false + t.integer "issue_to_id", :null => false + t.string "relation_type", :default => "", :null => false + t.integer "delay" + end + + add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true + add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id" + add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id" + + create_table "issue_statuses", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.boolean "is_closed", :default => false, :null => false + t.boolean "is_default", :default => false, :null => false + t.integer "position", :default => 1 + t.integer "default_done_ratio" + end + + add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed" + add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default" + add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position" + + create_table "issues", :force => true do |t| + t.integer "tracker_id", :null => false + t.integer "project_id", :null => false + t.string "subject", :default => "", :null => false + t.text "description" + t.date "due_date" + t.integer "category_id" + t.integer "status_id", :null => false + t.integer "assigned_to_id" + t.integer "priority_id", :null => false + t.integer "fixed_version_id" + t.integer "author_id", :null => false + t.integer "lock_version", :default => 0, :null => false + t.datetime "created_on" + t.datetime "updated_on" + t.date "start_date" + t.integer "done_ratio", :default => 0, :null => false + t.float "estimated_hours" + t.integer "parent_id" + t.integer "root_id" + t.integer "lft" + t.integer "rgt" + t.boolean "is_private", :default => false, :null => false + t.datetime "closed_on" + end + + add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id" + add_index "issues", ["author_id"], :name => "index_issues_on_author_id" + add_index "issues", ["category_id"], :name => "index_issues_on_category_id" + add_index "issues", ["created_on"], :name => "index_issues_on_created_on" + add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id" + add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id" + add_index "issues", ["project_id"], :name => "issues_project_id" + add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt" + add_index "issues", ["status_id"], :name => "index_issues_on_status_id" + add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id" + + create_table "join_in_competitions", :force => true do |t| + t.integer "user_id" + t.integer "competition_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "join_in_contests", :force => true do |t| + t.integer "user_id" + t.integer "bid_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "journal_details", :force => true do |t| + t.integer "journal_id", :default => 0, :null => false + t.string "property", :limit => 30, :default => "", :null => false + t.string "prop_key", :limit => 30, :default => "", :null => false + t.text "old_value" + t.text "value" + end + + add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" + + create_table "journal_replies", :id => false, :force => true do |t| + t.integer "journal_id" + t.integer "user_id" + t.integer "reply_id" + end + + add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id" + add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id" + add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id" + + create_table "journals", :force => true do |t| + t.integer "journalized_id", :default => 0, :null => false + t.string "journalized_type", :limit => 30, :default => "", :null => false + t.integer "user_id", :default => 0, :null => false + t.text "notes" + t.datetime "created_on", :null => false + t.boolean "private_notes", :default => false, :null => false + end + + add_index "journals", ["created_on"], :name => "index_journals_on_created_on" + add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" + add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id" + add_index "journals", ["user_id"], :name => "index_journals_on_user_id" + + create_table "journals_for_messages", :force => true do |t| + t.integer "jour_id" + t.string "jour_type" + t.integer "user_id" + t.text "notes" + t.integer "status" + t.integer "reply_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.string "m_parent_id" + t.boolean "is_readed" + t.integer "m_reply_count" + t.integer "m_reply_id" + t.integer "is_comprehensive_evaluation" + end + + create_table "member_roles", :force => true do |t| + t.integer "member_id", :null => false + t.integer "role_id", :null => false + t.integer "inherited_from" + end + + add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" + add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id" + + create_table "members", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "project_id", :default => 0 + t.datetime "created_on" + t.boolean "mail_notification", :default => false, :null => false + t.integer "course_id", :default => -1 + t.integer "course_group_id", :default => 0 + end + + add_index "members", ["project_id"], :name => "index_members_on_project_id" + add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true + add_index "members", ["user_id"], :name => "index_members_on_user_id" + + create_table "memos", :force => true do |t| + t.integer "forum_id", :null => false + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :null => false + t.integer "author_id", :null => false + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count", :default => 0 + end + + create_table "messages", :force => true do |t| + t.integer "board_id", :null => false + t.integer "parent_id" + t.string "subject", :default => "", :null => false + t.text "content" + t.integer "author_id" + t.integer "replies_count", :default => 0, :null => false + t.integer "last_reply_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + end + + add_index "messages", ["author_id"], :name => "index_messages_on_author_id" + add_index "messages", ["board_id"], :name => "messages_board_id" + add_index "messages", ["created_on"], :name => "index_messages_on_created_on" + add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" + add_index "messages", ["parent_id"], :name => "messages_parent_id" + + create_table "news", :force => true do |t| + t.integer "project_id" + t.string "title", :limit => 60, :default => "", :null => false + t.string "summary", :default => "" + t.text "description" + t.integer "author_id", :default => 0, :null => false + t.datetime "created_on" + t.integer "comments_count", :default => 0, :null => false + t.integer "course_id" + end + + add_index "news", ["author_id"], :name => "index_news_on_author_id" + add_index "news", ["created_on"], :name => "index_news_on_created_on" + add_index "news", ["project_id"], :name => "news_project_id" + + create_table "no_uses", :force => true do |t| + t.integer "user_id", :null => false + t.string "no_use_type" + t.integer "no_use_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "notificationcomments", :force => true do |t| + t.string "notificationcommented_type" + t.integer "notificationcommented_id" + t.integer "author_id" + t.text "notificationcomments" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "open_id_authentication_associations", :force => true do |t| + t.integer "issued" + t.integer "lifetime" + t.string "handle" + t.string "assoc_type" + t.binary "server_url" + t.binary "secret" + end + + create_table "open_id_authentication_nonces", :force => true do |t| + t.integer "timestamp", :null => false + t.string "server_url" + t.string "salt", :null => false + end + + create_table "open_source_projects", :force => true do |t| + t.string "name" + t.text "description" + t.integer "commit_count", :default => 0 + t.integer "code_line", :default => 0 + t.integer "users_count", :default => 0 + t.date "last_commit_time" + t.string "url" + t.date "date_collected" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "option_numbers", :force => true do |t| + t.integer "user_id" + t.integer "memo" + t.integer "messages_for_issues" + t.integer "issues_status" + t.integer "replay_for_message" + t.integer "replay_for_memo" + t.integer "follow" + t.integer "tread" + t.integer "praise_by_one" + t.integer "praise_by_two" + t.integer "praise_by_three" + t.integer "tread_by_one" + t.integer "tread_by_two" + t.integer "tread_by_three" + t.integer "changeset" + t.integer "document" + t.integer "attachment" + t.integer "issue_done_ratio" + t.integer "post_issue" + t.integer "score_type" + t.integer "total_score" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "project_id" + end + + create_table "praise_tread_caches", :force => true do |t| + t.integer "object_id", :null => false + t.string "object_type" + t.integer "praise_num" + t.integer "tread_num" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "praise_treads", :force => true do |t| + t.integer "user_id", :null => false + t.integer "praise_tread_object_id" + t.string "praise_tread_object_type" + t.integer "praise_or_tread" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "project_infos", :force => true do |t| + t.integer "project_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "project_scores", :force => true do |t| + t.string "project_id" + t.integer "score" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "issue_num", :default => 0 + t.integer "issue_journal_num", :default => 0 + t.integer "news_num", :default => 0 + t.integer "documents_num", :default => 0 + t.integer "changeset_num", :default => 0 + t.integer "board_message_num", :default => 0 + end + + create_table "project_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "project_id" + t.integer "project_type" + t.float "grade", :default => 0.0 + t.integer "course_ac_para", :default => 0 + end + + add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" + + create_table "projecting_softapplictions", :force => true do |t| + t.integer "user_id" + t.integer "softapplication_id" + t.integer "project_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "projects", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "description" + t.string "homepage", :default => "" + t.boolean "is_public", :default => true, :null => false + t.integer "parent_id" + t.datetime "created_on" + t.datetime "updated_on" + t.string "identifier" + t.integer "status", :default => 1, :null => false + t.integer "lft" + t.integer "rgt" + t.boolean "inherit_members", :default => false, :null => false + t.integer "project_type" + t.boolean "hidden_repo", :default => false, :null => false + t.integer "attachmenttype", :default => 1 + t.integer "user_id" + t.integer "dts_test", :default => 0 + end + + add_index "projects", ["lft"], :name => "index_projects_on_lft" + add_index "projects", ["rgt"], :name => "index_projects_on_rgt" + + create_table "projects_trackers", :id => false, :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.integer "tracker_id", :default => 0, :null => false + end + + add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true + add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" + + create_table "queries", :force => true do |t| + t.integer "project_id" + t.string "name", :default => "", :null => false + t.text "filters" + t.integer "user_id", :default => 0, :null => false + t.boolean "is_public", :default => false, :null => false + t.text "column_names" + t.text "sort_criteria" + t.string "group_by" + t.string "type" + end + + add_index "queries", ["project_id"], :name => "index_queries_on_project_id" + add_index "queries", ["user_id"], :name => "index_queries_on_user_id" + + create_table "relative_memo_to_open_source_projects", :force => true do |t| + t.integer "osp_id" + t.integer "relative_memo_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "relative_memos", :force => true do |t| + t.integer "osp_id" + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :limit => 16777215, :null => false + t.integer "author_id" + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.boolean "is_quote", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count_crawl", :default => 0 + t.integer "viewed_count_local", :default => 0 + t.string "url" + t.string "username" + t.string "userhomeurl" + t.date "date_collected" + t.string "topic_resource" + end + + create_table "repositories", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "url", :default => "", :null => false + t.string "login", :limit => 60, :default => "" + t.string "password", :default => "" + t.string "root_url", :default => "" + t.string "type" + t.string "path_encoding", :limit => 64 + t.string "log_encoding", :limit => 64 + t.text "extra_info" + t.string "identifier" + t.boolean "is_default", :default => false + end + + add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" + + create_table "rich_rich_files", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "rich_file_file_name" + t.string "rich_file_content_type" + t.integer "rich_file_file_size" + t.datetime "rich_file_updated_at" + t.string "owner_type" + t.integer "owner_id" + t.text "uri_cache" + t.string "simplified_type", :default => "file" + end + + create_table "roles", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.integer "position", :default => 1 + t.boolean "assignable", :default => true + t.integer "builtin", :default => 0, :null => false + t.text "permissions" + t.string "issues_visibility", :limit => 30, :default => "default", :null => false + end + + create_table "schools", :force => true do |t| + t.string "name" + t.string "province" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "logo_link" + end + + create_table "seems_rateable_cached_ratings", :force => true do |t| + t.integer "cacheable_id", :limit => 8 + t.string "cacheable_type" + t.float "avg", :null => false + t.integer "cnt", :null => false + t.string "dimension" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "seems_rateable_rates", :force => true do |t| + t.integer "rater_id", :limit => 8 + t.integer "rateable_id" + t.string "rateable_type" + t.float "stars", :null => false + t.string "dimension" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "settings", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "value" + t.datetime "updated_on" + end + + add_index "settings", ["name"], :name => "index_settings_on_name" + + create_table "shares", :force => true do |t| + t.date "created_on" + t.string "url" + t.string "title" + t.integer "share_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "project_id" + t.integer "user_id" + t.string "description" + end + + create_table "softapplications", :force => true do |t| + t.string "name" + t.text "description" + t.integer "app_type_id" + t.string "app_type_name" + t.string "android_min_version_available" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "contest_id" + t.integer "softapplication_id" + t.integer "is_public" + t.string "application_developers" + t.string "deposit_project_url" + t.string "deposit_project" + t.integer "project_id" + end + + create_table "students_for_courses", :force => true do |t| + t.integer "student_id" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "taggings", :force => true do |t| + t.integer "tag_id" + t.integer "taggable_id" + t.string "taggable_type" + t.integer "tagger_id" + t.string "tagger_type" + t.string "context", :limit => 128 + t.datetime "created_at" + end + + add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" + add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" + add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type" + + create_table "tags", :force => true do |t| + t.string "name" + end + + create_table "teachers", :force => true do |t| + t.string "tea_name" + t.string "location" + t.integer "couurse_time" + t.integer "course_code" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "extra" + end + + create_table "time_entries", :force => true do |t| + t.integer "project_id", :null => false + t.integer "user_id", :null => false + t.integer "issue_id" + t.float "hours", :null => false + t.string "comments" + t.integer "activity_id", :null => false + t.date "spent_on", :null => false + t.integer "tyear", :null => false + t.integer "tmonth", :null => false + t.integer "tweek", :null => false + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id" + add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on" + add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id" + add_index "time_entries", ["project_id"], :name => "time_entries_project_id" + add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" + + create_table "tokens", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.string "action", :limit => 30, :default => "", :null => false + t.string "value", :limit => 40, :default => "", :null => false + t.datetime "created_on", :null => false + end + + add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" + add_index "tokens", ["value"], :name => "tokens_value", :unique => true + + create_table "trackers", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.boolean "is_in_chlog", :default => false, :null => false + t.integer "position", :default => 1 + t.boolean "is_in_roadmap", :default => true, :null => false + t.integer "fields_bits", :default => 0 + end + + create_table "user_extensions", :force => true do |t| + t.integer "user_id", :null => false + t.date "birthday" + t.string "brief_introduction" + t.integer "gender" + t.string "location" + t.string "occupation" + t.integer "work_experience" + t.integer "zip_code" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "technical_title" + t.integer "identity" + t.string "student_id" + t.string "teacher_realname" + t.string "student_realname" + t.string "location_city" + t.integer "school_id" + end + + create_table "user_grades", :force => true do |t| + t.integer "user_id", :null => false + t.integer "project_id", :null => false + t.float "grade", :default => 0.0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade" + add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" + add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" + + create_table "user_levels", :force => true do |t| + t.integer "user_id" + t.integer "level" + end + + create_table "user_preferences", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.text "others" + t.boolean "hide_mail", :default => false + t.string "time_zone" + end + + add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" + + create_table "user_score_details", :force => true do |t| + t.integer "current_user_id" + t.integer "target_user_id" + t.string "score_type" + t.string "score_action" + t.integer "user_id" + t.integer "old_score" + t.integer "new_score" + t.integer "current_user_level" + t.integer "target_user_level" + t.integer "score_changeable_obj_id" + t.string "score_changeable_obj_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_scores", :force => true do |t| + t.integer "user_id", :null => false + t.integer "collaboration" + t.integer "influence" + t.integer "skill" + t.integer "active" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.float "grade", :default => 0.0 + end + + add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" + add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" + add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" + + create_table "users", :force => true do |t| + t.string "login", :default => "", :null => false + t.string "hashed_password", :limit => 40, :default => "", :null => false + t.string "firstname", :limit => 30, :default => "", :null => false + t.string "lastname", :default => "", :null => false + t.string "mail", :limit => 60, :default => "", :null => false + t.boolean "admin", :default => false, :null => false + t.integer "status", :default => 1, :null => false + t.datetime "last_login_on" + t.string "language", :limit => 5, :default => "" + t.integer "auth_source_id" + t.datetime "created_on" + t.datetime "updated_on" + t.string "type" + t.string "identity_url" + t.string "mail_notification", :default => "", :null => false + t.string "salt", :limit => 64 + end + + add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" + add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" + add_index "users", ["type"], :name => "index_users_on_type" + + create_table "versions", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "name", :default => "", :null => false + t.string "description", :default => "" + t.date "effective_date" + t.datetime "created_on" + t.datetime "updated_on" + t.string "wiki_page_title" + t.string "status", :default => "open" + t.string "sharing", :default => "none", :null => false + end + + add_index "versions", ["project_id"], :name => "versions_project_id" + add_index "versions", ["sharing"], :name => "index_versions_on_sharing" + + create_table "watchers", :force => true do |t| + t.string "watchable_type", :default => "", :null => false + t.integer "watchable_id", :default => 0, :null => false + t.integer "user_id" + end + + add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type" + add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id" + add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type" + + create_table "web_footer_companies", :force => true do |t| + t.string "name" + t.string "logo_size" + t.string "url" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "web_footer_oranizers", :force => true do |t| + t.string "name" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "wiki_content_versions", :force => true do |t| + t.integer "wiki_content_id", :null => false + t.integer "page_id", :null => false + t.integer "author_id" + t.binary "data", :limit => 2147483647 + t.string "compression", :limit => 6, :default => "" + t.string "comments", :default => "" + t.datetime "updated_on", :null => false + t.integer "version", :null => false + end + + add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on" + add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid" + + create_table "wiki_contents", :force => true do |t| + t.integer "page_id", :null => false + t.integer "author_id" + t.text "text", :limit => 2147483647 + t.string "comments", :default => "" + t.datetime "updated_on", :null => false + t.integer "version", :null => false + end + + add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id" + add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id" + + create_table "wiki_pages", :force => true do |t| + t.integer "wiki_id", :null => false + t.string "title", :null => false + t.datetime "created_on", :null => false + t.boolean "protected", :default => false, :null => false + t.integer "parent_id" + end + + add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id" + add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title" + add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id" + + create_table "wiki_redirects", :force => true do |t| + t.integer "wiki_id", :null => false + t.string "title" + t.string "redirects_to" + t.datetime "created_on", :null => false + end + + add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title" + add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id" + + create_table "wikis", :force => true do |t| + t.integer "project_id", :null => false + t.string "start_page", :null => false + t.integer "status", :default => 1, :null => false + end + + add_index "wikis", ["project_id"], :name => "wikis_project_id" + + create_table "workflows", :force => true do |t| + t.integer "tracker_id", :default => 0, :null => false + t.integer "old_status_id", :default => 0, :null => false + t.integer "new_status_id", :default => 0, :null => false + t.integer "role_id", :default => 0, :null => false + t.boolean "assignee", :default => false, :null => false + t.boolean "author", :default => false, :null => false + t.string "type", :limit => 30 + t.string "field_name", :limit => 30 + t.string "rule", :limit => 30 + end + + add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id" + add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id" + add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" + add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" + + create_table "works_categories", :force => true do |t| + t.string "category" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + +end diff --git a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb index 609b35415..377f2b112 100644 --- a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb +++ b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb @@ -46,6 +46,9 @@ module Redmine if self.respond_to?(:project) (respond_to?(:visible?) ? visible?(user) : true) && user.allowed_to?(self.class.attachable_options[:view_permission], self.project) + elsif self.is_a?(Course) + (respond_to?(:visible?) ? visible?(user) : true) && + user.allowed_to?(self.class.attachable_options[:view_permission], self) else return true end diff --git a/lib/seems_rateable/lib/seems_rateable/model.rb b/lib/seems_rateable/lib/seems_rateable/model.rb index b4ebbb196..83d37d555 100644 --- a/lib/seems_rateable/lib/seems_rateable/model.rb +++ b/lib/seems_rateable/lib/seems_rateable/model.rb @@ -37,9 +37,9 @@ module SeemsRateable def update_users_rating(stars, user_id, dimension=nil) obj = rates(dimension).where(:rater_id => user_id).first - current_record = average(dimension) - current_record.avg = (current_record.avg*current_record.cnt - obj.stars + stars) / (current_record.cnt) - current_record.save! + #current_record = average(dimension) + #current_record.avg = (current_record.avg*current_record.cnt - obj.stars + stars) / (current_record.cnt) + #current_record.save! obj.stars = stars obj.save! end diff --git a/public/images/bid/star.png b/public/images/bid/star.png new file mode 100644 index 000000000..507e19020 Binary files /dev/null and b/public/images/bid/star.png differ diff --git a/public/images/btn.png b/public/images/btn.png new file mode 100644 index 000000000..85cea7f5c Binary files /dev/null and b/public/images/btn.png differ diff --git a/public/images/btn1.png b/public/images/btn1.png new file mode 100644 index 000000000..f7f7f1c77 Binary files /dev/null and b/public/images/btn1.png differ diff --git a/public/images/close2.png b/public/images/close2.png new file mode 100644 index 000000000..301ba5e85 Binary files /dev/null and b/public/images/close2.png differ diff --git a/public/images/inputBg.png b/public/images/inputBg.png new file mode 100644 index 000000000..243bbf7ec Binary files /dev/null and b/public/images/inputBg.png differ diff --git a/public/images/pic_del.gif b/public/images/pic_del.gif new file mode 100644 index 000000000..436fd1f92 Binary files /dev/null and b/public/images/pic_del.gif differ diff --git a/public/images/pic_edit.png b/public/images/pic_edit.png new file mode 100644 index 000000000..fc2f3ae13 Binary files /dev/null and b/public/images/pic_edit.png differ diff --git a/public/images/pic_up.png b/public/images/pic_up.png new file mode 100644 index 000000000..84401074a Binary files /dev/null and b/public/images/pic_up.png differ diff --git a/public/javascripts/application.js.bak b/public/javascripts/application.js.bak deleted file mode 100644 index 0c09ffb03..000000000 --- a/public/javascripts/application.js.bak +++ /dev/null @@ -1,696 +0,0 @@ -//= require_directory ./rateable -/* Redmine - project management software - Copyright (C) 2006-2013 Jean-Philippe Lang */ - -function cleanArray (actual){ - var newArray = new Array(); - for (var i = 0; i< actual.length; i++){ - if (actual[i]){ - newArray.push(actual[i]); - } - } - return newArray; -} - -function checkAll(id, checked) { - if (checked) { - $('#'+id).find('input[type=checkbox]').attr('checked', true); - } else { - $('#'+id).find('input[type=checkbox]').removeAttr('checked'); - } -} - -function toggleCheckboxesBySelector(selector) { - var all_checked = true; - $(selector).each(function(index) { - if (!$(this).is(':checked')) { all_checked = false; } - }); - $(selector).attr('checked', !all_checked); -} - -function showAndScrollTo(id, focus) { - $('#'+id).show(); - if (focus !== null) { - $('#'+focus).focus(); - } - $('html, body').animate({scrollTop: $('#'+id).offset().top}, 400); -} - -function toggleRowGroup(el) { - var tr = $(el).parents('tr').first(); - var n = tr.next(); - tr.toggleClass('open'); - while (n.length && !n.hasClass('group')) { - n.toggle(); - n = n.next('tr'); - } -} - -function collapseAllRowGroups(el) { - var tbody = $(el).parents('tbody').first(); - tbody.children('tr').each(function(index) { - if ($(this).hasClass('group')) { - $(this).removeClass('open'); - } else { - $(this).hide(); - } - }); -} - -function expandAllRowGroups(el) { - var tbody = $(el).parents('tbody').first(); - tbody.children('tr').each(function(index) { - if ($(this).hasClass('group')) { - $(this).addClass('open'); - } else { - $(this).show(); - } - }); -} - -function toggleAllRowGroups(el) { - var tr = $(el).parents('tr').first(); - if (tr.hasClass('open')) { - collapseAllRowGroups(el); - } else { - expandAllRowGroups(el); - } -} - -function toggleFieldset(el) { - var fieldset = $(el).parents('fieldset').first(); - fieldset.toggleClass('collapsed'); - fieldset.children('div').toggle(); -} - -function hideFieldset(el) { - var fieldset = $(el).parents('fieldset').first(); - fieldset.toggleClass('collapsed'); - fieldset.children('div').hide(); -} - -function initFilters(){ - $('#add_filter_select').change(function(){ - addFilter($(this).val(), '', []); - }); - $('#filters-table td.field input[type=checkbox]').each(function(){ - toggleFilter($(this).val()); - }); - $('#filters-table td.field input[type=checkbox]').live('click',function(){ - toggleFilter($(this).val()); - }); - $('#filters-table .toggle-multiselect').live('click',function(){ - toggleMultiSelect($(this).siblings('select')); - }); - $('#filters-table input[type=text]').live('keypress', function(e){ - if (e.keyCode == 13) submit_query_form("query_form"); - }); -} - -function addFilter(field, operator, values) { - var fieldId = field.replace('.', '_'); - var tr = $('#tr_'+fieldId); - if (tr.length > 0) { - tr.show(); - } else { - buildFilterRow(field, operator, values); - } - $('#cb_'+fieldId).attr('checked', true); - toggleFilter(field); - $('#add_filter_select').val('').children('option').each(function(){ - if ($(this).attr('value') == field) { - $(this).attr('disabled', true); - } - }); -} - -function buildFilterRow(field, operator, values) { - var fieldId = field.replace('.', '_'); - var filterTable = $("#filters-table"); - var filterOptions = availableFilters[field]; - var operators = operatorByType[filterOptions['type']]; - var filterValues = filterOptions['values']; - var i, select; - - var tr = $('