diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 279e89f13..686f70a11 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -101,33 +101,12 @@ class AccountController < ApplicationController # User self-registration def register - # @root_path="/home/pdl/redmine-2.3.2-0/apache2/" -# - #@cache_identityy = params[:identity]||"" #身份 - @cache_no = params[:no]||"" #学号 - @cache_technical_title = params[:technical_title]||"" #教师职称 - @cache_province = params[:province]||"" #省份 - @cache_city = params[:city]||"" #城市 - @cache_enterprise_name = params[:enterprise_name]||"" #企业 - - firstname_code = "" - lastname_code = "" (redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration] if request.get? session[:auth_source_registration] = nil @user = User.new(:language => current_language.to_s) else user_params = params[:user] || {} - @user = User.new - @user.safe_attributes = user_params - if params[:identity] == "2" # 2 企业 - firstname_code = @user.firstname - lastname_code = @user.lastname - @user.firstname = params[:enterprise_name] - @user.lastname = l(:field_enterprise) - end - @user.admin = false - @user.register if session[:auth_source_registration] @user.activate @user.login = session[:auth_source_registration][:login] @@ -139,36 +118,7 @@ class AccountController < ApplicationController redirect_to my_account_path end else - @user.login = params[:user][:login] - unless user_params[:identity_url].present? && user_params[:password].blank? && user_params[:password_confirmation].blank? - @user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation] - end - - - - case Setting.self_registration - when '1' - register_by_email_activation(@user) - when '3' - register_automatically(@user) - else - register_manually_by_administrator(@user) - end - - #added by bai - if @user.id != nil - ue = @user.user_extensions ||= UserExtensions.new - #ue = UserExtensions.create(:identity => params[:identity].to_i,:technical_title => params[:technical_title], :gender => params[:gender].to_i, :user_id => @user.id, :student_id => ) - ue.identity = params[:identity].to_i - ue.technical_title = params[:technical_title] - ue.gender = params[:gender].to_i - ue.user_id = @user.id - ue.student_id = params[:no] - ue.location = params[:province] if params[:province] != nil - ue.location_city = params[:city] if params[:city] != nil - ue.save - end - + create_and_save_user params[:user][:login],user_params[:password],user_params[:mail],user_params[:password_confirmation],true end end if params[:identity] == "2" @@ -177,6 +127,34 @@ 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 + 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/attachments_controller.rb b/app/controllers/attachments_controller.rb index 31463d691..111ec2cca 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -25,6 +25,7 @@ class AttachmentsController < ApplicationController #before_filter :login_without_softapplication, only: [:download] accept_api_auth :show, :download, :upload require 'iconv' + include AttachmentsHelper def show @@ -346,8 +347,18 @@ class AttachmentsController < ApplicationController def add_exist_file_to_courses file = Attachment.find(params[:file_id]) courses = params[:courses][:course] + @message = "" courses.each do |course| c = Course.find(course); + if course_contains_attachment?(c,file) + 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关联 attach_copied_obj.container = c @@ -360,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 @@ -372,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/contests_controller.rb b/app/controllers/contests_controller.rb index 627e1945b..af532cd87 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -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 12b733669..ccb02d939 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -514,7 +514,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? diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 251496e30..1ed40f691 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -28,6 +28,7 @@ class FilesController < ApplicationController include SortHelper include FilesHelper helper :project_score + include CoursesHelper def show_attachments obj @attachments = [] @@ -44,16 +45,28 @@ 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 @@ -64,17 +77,24 @@ class FilesController < ApplicationController 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 @@ -151,6 +171,8 @@ class FilesController < ApplicationController attribute = "downloads" when "created_on" attribute = "created_on" + when "quotes" + attribute = "quotes" end @sort = order_by[0] @order = order_by[1] @@ -371,14 +393,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 a9adc9ec6..6088e2294 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}") @@ -331,18 +318,9 @@ class HomeworkAttachController < ApplicationController if User.current.admin? || User.current.member_of_course?(course) name = params[:homework_name] description = params[:homework_description] - if params[:homework_attach] - if params[:homework_attach][:project_id] - project_id = params[:homework_attach][:project_id] - else - project_id = 0 - end - else - project_id = 0 - end @homework.name = name @homework.description = description - @homework.project_id = project_id + @homework.project_id = params[:project_id] || 0 if params[:attachments] @homework.save_attachments(params[:attachments]) end @@ -381,11 +359,11 @@ class HomeworkAttachController < ApplicationController def show if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first) # 打分统计 - stars_reates = @homework. rates(:quality) + #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 + @has_evaluation = @homework.has_rated?( User.current,:quality) #@jours留言 is null条件用以兼容历史数据 @jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC") @cur_page = params[:cur_page] || 1 @@ -394,30 +372,35 @@ class HomeworkAttachController < ApplicationController teachers = searchTeacherAndAssistant @course @comprehensive_evaluation = [] + #JourForMessage的is_comprehensive_evaluation字段: + #1:老师评价 + #2:学生评价 + #3 || null:学生留言 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") + annymous_users = @homework.homework_evaluations.map { |homework_evaluation| homework_evaluation.user.id}.join(',') + unless annymous_users.nil? || annymous_users == "" + @anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in (#{annymous_users})").order("created_on DESC") end - @totle_score = score_for_homework @homework - @teaher_score = teacher_score_for_homework @homework + #@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_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 #教师评论 + #@is_comprehensive_evaluation 1:教师评论,2:学生匿评,3:学生留言 + if User.current.member_of_course?(@homework.bid.courses.first) + if @is_teacher + @is_comprehensive_evaluation = 1 #教师评论 + else + if @is_anonymous_comments && !@has_evaluation #是学生且开启了匿评且未进行评分 + @is_comprehensive_evaluation = 2 #匿评 + else #是学生未开启匿评或者已经进行评分 + @is_comprehensive_evaluation = 3 #留言 + end + end else @is_comprehensive_evaluation = 3 end @@ -442,9 +425,9 @@ class HomeworkAttachController < ApplicationController @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") + 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 @@ -454,9 +437,6 @@ class HomeworkAttachController < ApplicationController @comprehensive_evaluation << temp if temp end end - - - respond_to do |format| format.js end @@ -465,17 +445,27 @@ 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 + #保存评分 + @homework.rate(params[:stars_value],User.current.id,:quality) if params[:stars_value] && params[:stars_value] != "0" + #保存评论 + @cur_is_comprehensive_evaluation = params[:is_comprehensive_evaluation] + 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,@cur_is_comprehensive_evaluation + end + + @cur_page = params[:cur_page] || 1 + @cur_type = params[:cur_type] || 5 + teachers = searchTeacherAndAssistant @homework.bid.courses.first + if @cur_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") + elsif @cur_is_comprehensive_evaluation == "2" + annymous_users = @homework.homework_evaluations.map { |homework_evaluation| homework_evaluation.user.id}.join(',') + unless annymous_users.nil? || annymous_users == "" + @anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in (#{annymous_users})").order("created_on DESC") end - elsif @add_jour.is_comprehensive_evaluation == 1 - teachers = searchTeacherAndAssistant @homework.bid.courses.first + @m_score = params[:stars_value].to_i + elsif @cur_is_comprehensive_evaluation == "1" @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 @@ -483,35 +473,49 @@ class HomeworkAttachController < ApplicationController end end - - #@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 #教师评论 + #@is_comprehensive_evaluation 1:教师评论,2:学生匿评,3:学生留言 + if User.current.member_of_course?(@homework.bid.courses.first) + if is_teacher + @is_comprehensive_evaluation = 1 #教师评论 + else + if @is_anonymous_comments && !@has_evaluation #是学生且开启了匿评且未进行评分 + @is_comprehensive_evaluation = 2 #匿评 + else #是学生未开启匿评或者已经进行评分 + @is_comprehensive_evaluation = 3 #留言 + end + end else @is_comprehensive_evaluation = 3 end + #teachers = find_course_teachers @homework.bid.courses.first + teachers_str = teachers.map{|teacher| teacher.user_id}.join(",") + if @cur_type == "1" #如果当前是老师未批列表,需要刷新整个作业列表界面 + @bid = @homework.bid + get_not_batch_homework_list "s_socre","desc",teachers_str,@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_str}) 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_str})) 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_str})) 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_str})) 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_str})) 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_str})) 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 #其他的不用管 + + end respond_to do |format| format.js @@ -587,16 +591,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 #获取作业教师评分所占比例 @@ -608,5 +603,22 @@ 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 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..89fa0e1dc 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] diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 6cbe0dd95..cee26ae32 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -44,7 +44,7 @@ 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.student_id + "_" + homework.user.lastname + homework.user.firstname + "_" + homework.name+".zip", :type => detect_content_type(zipfile) if(zipfile) else render file: 'public/no_file_found.html' end 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 3c882d393..50dd79a08 100644 --- a/app/helpers/attachments_helper.rb +++ b/app/helpers/attachments_helper.rb @@ -67,6 +67,28 @@ module AttachmentsHelper end end + def course_contains_attachment? course,attachment + course.attachments.each do |att| + if att.id == attachment.id || (!att.copy_from.nil? && !attachment.copy_from.nil? && att.copy_from == attachment.copy_from) || att.copy_from == attachment.id || att.id == attachment.copy_from + 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 9e18c9f54..ccca6be9d 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -471,9 +471,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 @@ -507,6 +507,20 @@ module CoursesHelper term end + def course_in_current_or_next_term course + is_current_term = false + is_next_term = false + if course.time == Time.now.year && course.term == cur_course_term + is_current_term = true + end + if cur_course_term == "秋季学期" && course.time == (Time.now.year + 1) && course.term == "春季学期" + is_next_term = true + elsif cur_course_term == "春季学期" && course.time == Time.now.year && course.term == "秋季学期" + is_next_term = true + end + is_current_term || is_next_term + end + #获取课程动态 def get_course_activity courses, activities @course_ids=activities.keys() diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index 399b7be1d..5683b9a05 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -47,18 +47,18 @@ module FilesHelper def courses_check_box_tags(name,courses,current_course,attachment) s = '' courses.each do |course| - if !(attachment.container_type && attachment.container_id == course.id) && is_course_teacher(User.current,course) - s << "
    " + if !(attachment.container_type && attachment.container_id == course.id) && is_course_teacher(User.current,course) && course_in_current_or_next_term(course) + s << " [#{get_course_term course}]
    " end end s.html_safe end - #判断用户是否拥有课程,需用户在该课程中角色为教师 - def has_course? user + #判断用户是否拥有除current_course以外的课程,需用户在该课程中角色为教师且该课程属于当前学期或下一学期 + def has_course? user,current_course result = false user.courses.each do |course| - if is_course_teacher(user,course) + if current_course.id != course.id && is_course_teacher(User.current,course) && course_in_current_or_next_term(course) return true end end @@ -86,17 +86,33 @@ 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.nil? - return 0 + 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 - count = Attachment.find_by_sql("select count(*) from attachments where copy_from = #{attachment.copy_from}") + result 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..1ab1cb928 100644 --- a/app/helpers/homework_attach_helper.rb +++ b/app/helpers/homework_attach_helper.rb @@ -87,8 +87,8 @@ 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 convert_array array diff --git a/app/models/course.rb b/app/models/course.rb index 099ae7ae5..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 @@ -33,7 +33,7 @@ class Course < ActiveRecord::Base 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/user.rb b/app/models/user.rb index 29709519d..ef327f47f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -930,7 +930,7 @@ class User < Principal def validate_password_length # Password length validation based on setting - if !password.nil? && password.size < Setting.password_min_length.to_i + if password.nil? || password.size < Setting.password_min_length.to_i errors.add(:password, :too_short, :count => Setting.password_min_length.to_i) end end 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 23761647f..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,5 +1,7 @@ -<% if !@save_flag%> +<% if !@save_flag && @save_message %> $("#error_show").html("<%= @save_message.join(', ') %>"); +<% 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_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..17e805fce 100644 --- a/app/views/bids/edit.html.erb +++ b/app/views/bids/edit.html.erb @@ -118,6 +118,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/new_homework.html.erb b/app/views/courses/new_homework.html.erb index 7b6784243..e3121c6ad 100644 --- a/app/views/courses/new_homework.html.erb +++ b/app/views/courses/new_homework.html.erb @@ -106,7 +106,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/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 6e434ed14..58fbcb2e9 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,@course) %> <% 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,@course) %> <% 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 %>  

    +

    <%= 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/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..79a7711c7 100644 --- a/app/views/homework_attach/_addjour.html.erb +++ b/app/views/homework_attach/_addjour.html.erb @@ -50,8 +50,10 @@ } } - function submit1(button) + function submit1(is_teacher) { + if($("#stars_value").val() == "0"){alert("您还没有打分");return;} + if(!is_teacher&&$("#new_form_user_message").val() == ""){alert("您还没有填写评语");return;} $('#jours_submit').parent().submit(); } @@ -61,7 +63,21 @@ :action => 'addjours', :jour_id => homework_attach.id, :is_comprehensive_evaluation => is_comprehensive_evaluation, + :cur_page => cur_page, + :cur_type => cur_type, :sta => sta}) do |f|%> + +
    + <% if @is_comprehensive_evaluation == 3 || User.current == homework_attach.user%> + + <% else @is_comprehensive_evaluation == 2 %> + + <%= l(:label_work_rating) %>: + <%= render :partial => 'show_star',:locals => {start_score:m_score} %> + <% end %> +
    +
    +
    <%= render :partial => 'words/pre_show', :locals => {:content => @content} %> @@ -74,8 +90,9 @@ %> <%= f.text_field :reference_user_id, :style=>"display:none"%> <% else %>
    diff --git a/app/views/homework_attach/_app_link.html.erb b/app/views/homework_attach/_app_link.html.erb index 1c089dbe0..97c2e2f37 100644 --- a/app/views/homework_attach/_app_link.html.erb +++ b/app/views/homework_attach/_app_link.html.erb @@ -1,6 +1,6 @@ <% for attachment in attachments %> <% if attachments.count > 1 && attachment != attachments.first%> -
                     +
                 <% end %> <%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true -%> <% if attachment.is_text? %> diff --git a/app/views/homework_attach/_histoey_new.html.erb b/app/views/homework_attach/_histoey_new.html.erb index 183eb067d..5912d04cb 100644 --- a/app/views/homework_attach/_histoey_new.html.erb +++ b/app/views/homework_attach/_histoey_new.html.erb @@ -14,7 +14,6 @@
    <%= render :partial => 'homework_attach/jour',:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true} %>
    -
    <%= render :partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false} %>
    diff --git a/app/views/homework_attach/_homework.html.erb b/app/views/homework_attach/_homework.html.erb index d11ea3333..802a021a4 100644 --- a/app/views/homework_attach/_homework.html.erb +++ b/app/views/homework_attach/_homework.html.erb @@ -1,4 +1,5 @@ -
  • +<% bid = homework.bid%> +
  • <% if is_student_batch_homework %> <%= image_tag(url_to_avatar("匿名"), :width => "40", :height => "40")%> @@ -19,6 +20,10 @@ <% homework_filename = homework.name %> <% end %> <%= link_to homework_filename , homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type), :title => homework_filename, :remote => true%> + + 提交时间: + <%= format_time homework.created_at%> +
  • <%= link_to "(#{homework.attachments.count.to_s}个附件)", zipdown_download_user_homework_path(:homework => homework)%> @@ -42,7 +47,7 @@
  • <%= link_to l(:label_work_rating),homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type),:remote => true %> - <% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %> + <% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>   迟交! <% end %>
  • @@ -50,8 +55,8 @@ <% if is_my_homework %> - <% if @bid.comment_status == 0 || @bid.open_anonymous_evaluation == 0 %> -
  • + <% if bid.comment_status == 0 || bid.open_anonymous_evaluation == 0 %> +
  • <%= link_to l(:button_edit), edit_homework_attach_path(homework) %> <% if homework.user == User.current || User.current.admin? %> @@ -81,21 +86,21 @@ <% end %> <% elsif is_student_batch_homework%> - <% if @bid.comment_status == 1 %> + <% if bid.comment_status == 1 %>
  • <%= link_to l(:label_anonymous_comments),homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type),:remote => true %> - <% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %> + <% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>   迟交! <% end %>
  • - <% elsif @bid.comment_status == 2%> + <% elsif bid.comment_status == 2%>
  • <%= l(:label_anonymous_comments) %> - <% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %> + <% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>   迟交! <% end %>
  • diff --git a/app/views/homework_attach/_jour.html.erb b/app/views/homework_attach/_jour.html.erb index 055e1a015..76bc15782 100644 --- a/app/views/homework_attach/_jour.html.erb +++ b/app/views/homework_attach/_jour.html.erb @@ -11,18 +11,22 @@
    <% if show_name %> - <%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%> + <%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:5px; background:none;", :target => "_blank"%> <% else%> - <%= l(:label_anonymous) %> + <%= l(:label_anonymous) %> <% end %> - <%= format_time(jour.created_on) %> - + <%= format_time(jour.created_on) %> + <% if show_score %> <%= l(:label_work_rating) %>: - <%= render :partial => 'homework_attach/show_score', locals: {:stars => get_homework_score(jour.user,@homework ) } %> +
    + <% star = get_homework_score(jour.user,@homework)%> + <%= render :partial => 'homework_attach/show_static_star', :locals => {:start_score => star } %> +
    + <% end %>
    @@ -31,7 +35,7 @@
    <% ids = 'project_respond_form_'+ jour.id.to_s%> - <% if (jour.user==User.current|| User.current.admin?) && show_name %> + <% if (jour.user==User.current|| User.current.admin?) && show_name && !show_score %> <%= link_to(l(:label_bid_respond_delete), {:controller => 'homework_attach', :action => 'destroy_jour', :object_id => jour, :user_id => jour.user,:jour_id =>@homework.id }, :remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %> <% end %> @@ -46,7 +50,7 @@
    - <%= render :partial => "words/journal_reply", :locals => {:journal => jour,:show_name=> show_name, :show_real_name => true } %> + <%= render :partial => "words/journal_reply", :locals => {:journal => jour,:show_name=> show_name} %>
    diff --git a/app/views/homework_attach/_journal_reply_items.html.erb b/app/views/homework_attach/_journal_reply_items.html.erb index dd09bd84f..ac60709ad 100644 --- a/app/views/homework_attach/_journal_reply_items.html.erb +++ b/app/views/homework_attach/_journal_reply_items.html.erb @@ -1,4 +1,3 @@ -<% show_real_name ||= false %> <% reply_allow = JournalsForMessage.create_by_user? User.current %> <% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
    @@ -15,11 +14,7 @@ 回复 <% 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 %> + <%= link_to parent_jour.user.name, user_path(parent_jour.user) %> <% else %> <%= l(:label_anonymous) %> <% end %> diff --git a/app/views/homework_attach/_show.html.erb b/app/views/homework_attach/_show.html.erb index bce3e4d03..937c068c1 100644 --- a/app/views/homework_attach/_show.html.erb +++ b/app/views/homework_attach/_show.html.erb @@ -1,52 +1,17 @@ -<% reply_allow = JournalsForMessage.create_by_user? User.current %> - - +<%# reply_allow = JournalsForMessage.create_by_user? User.current %> -<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>

    <%= @homework.name %>

    @@ -61,16 +26,24 @@ -
  • <%= l(:label_activity_time) %>:<%=format_time @homework.created_at %>
  • +
  • + <%= l(:label_activity_time) %>: + + <%=format_time @homework.created_at %> + +
  • <% if @homework.users.count > 0 %> -
    <%= l(:label_participation_person) %>: +
    + <%= l(:label_participation_person) %>: <% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %> <%= l(:label_anonymous) %> <%else%> <% @homework.users.each do |homework_user| %> - <%= link_to homework_user, user_path(homework_user)%> + + <%= link_to homework_user, user_path(homework_user)%> + <% if @homework.users.count > 1 && homework_user != @homework.users.last %> 、                 <% end %> @@ -84,25 +57,32 @@ <%= @homework.description %> <% else %>
    - <%= l(:label_homework_without_description) %> + + <%= l(:label_homework_without_description) %> +
    <% end %>

    -

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

    + + <%= l(:label_attachment) %>: - <% options = {:author => true } %> - <%= render :partial => 'app_link', :locals => {:attachments => @homework.attachments, :options => options} %> + <% if @homework.attachments.empty?%> + 尚未提交附件 + <% else%> + <% options = {:author => true } %> + <%= render :partial => 'app_link', :locals => {:attachments => @homework.attachments, :options => options} %> + <% end%>

    - -
    - <%= render :partial => 'show_star',:locals => {:is_comprehensive_evaluation => @is_comprehensive_evaluation,:totle_score => @totle_score,:has_evaluation => @has_evaluation , - :homework => @homework} %> -
    -
    - <%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation} %> + <%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, + :is_comprehensive_evaluation => @is_comprehensive_evaluation, + :m_score => @m_score, + :cur_page => @cur_page, + :cur_type => @cur_type, + :is_teacher => @is_teacher} %>
    diff --git a/app/views/homework_attach/_show_star.html.erb b/app/views/homework_attach/_show_star.html.erb index 0f842a1cd..33279c360 100644 --- a/app/views/homework_attach/_show_star.html.erb +++ b/app/views/homework_attach/_show_star.html.erb @@ -1,16 +1,6 @@ -<% if is_comprehensive_evaluation == 3 || User.current == homework.user%> - -<% elsif is_comprehensive_evaluation == 2 %> - <% if has_evaluation %> - <%= l(:label_work_rating) %>: - <%= rating_for homework, dimension: :quality,start_score: @m_score, class: 'rateable div_inline' %> - <% else %> - <%= l(:label_work_rating) %>: - <%= rating_for homework, dimension: :quality,start_score: 0, class: 'rateable div_inline' %> - <% end %> - -<% elsif @is_comprehensive_evaluation == 1%> - <%= l(:label_work_rating) %>: - <%= rating_for homework, dimension: :quality,start_score: @m_score, class: 'rateable div_inline' %> -<% end %> \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/app/views/homework_attach/_show_static_star.html.erb b/app/views/homework_attach/_show_static_star.html.erb new file mode 100644 index 000000000..7fe3edf22 --- /dev/null +++ b/app/views/homework_attach/_show_static_star.html.erb @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/views/homework_attach/add_jour_reply.js.erb b/app/views/homework_attach/add_jour_reply.js.erb index 34cec1cca..564229d81 100644 --- a/app/views/homework_attach/add_jour_reply.js.erb +++ b/app/views/homework_attach/add_jour_reply.js.erb @@ -1,7 +1,7 @@ <% if @save_succ %> var pre_append = $('<%= j( render :partial => "journal_reply_items", - :locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm, :show_real_name => true} + :locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm} ) %>').hide(); $('#journal_reply_ul_<%=@jfm.m_parent_id%>').append(pre_append); pre_append.fadeIn(600); diff --git a/app/views/homework_attach/addjours.js.erb b/app/views/homework_attach/addjours.js.erb index 9badfc109..8d32b10c1 100644 --- a/app/views/homework_attach/addjours.js.erb +++ b/app/views/homework_attach/addjours.js.erb @@ -1,19 +1,35 @@ //教师评论 -<% if @add_jour.is_comprehensive_evaluation == 1 %> - HoverLi(4); - $('#jour_count_4').html('<%= @comprehensive_evaluation.count %>'); - $('#tbc_04').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false})) %>'); +<% if @cur_is_comprehensive_evaluation == "1" %> + HoverLi(4); + $('#jour_count_4').html('<%= @comprehensive_evaluation.count %>'); + $('#tbc_04').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false})) %>'); //匿评 -<% elsif @add_jour.is_comprehensive_evaluation == 2 %> - $('#add_jour').html('<%= escape_javascript(render(:partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation})) %>'); - HoverLi(5); - $('#jour_count_5').html('<%= @anonymous_comments.count %>'); - $('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false})) %>'); +<% elsif @cur_is_comprehensive_evaluation == "2" %> + $('#add_jour').html('<%= escape_javascript(render(:partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, + :is_comprehensive_evaluation => @is_comprehensive_evaluation, + :cur_type => @cur_type, :cur_page => @cur_page, :m_score => @m_score, :is_teacher => false})) %>'); + HoverLi(5); + $('#jour_count_5').html('<%= @anonymous_comments.count %>'); + $('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false})) %>'); //留言 <% else %> - HoverLi(3); - $('#jour_count_3').html('<%= @jours.count %>'); - $('#tbc_03').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true})) %>'); + HoverLi(3); + $('#jour_count_3').html('<%= @jours.count %>'); + $('#tbc_03').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true})) %>'); <% end %> + $('#new_form_user_message').val(""); -$('#new_form_reference_user_id').val(""); \ No newline at end of file +$('#new_form_reference_user_id').val(""); + +<% if @cur_is_comprehensive_evaluation == "1" || @cur_is_comprehensive_evaluation == "2" %> + <% if @cur_type == "1" %> + $("#tbc_01").html('<%= escape_javascript(render(:partial => 'homework_attach/homeworks_list',:locals => {:homeworks => @homework_list, + :homework_count => @obj_count, + :remote => false,:is_student_batch_homework => false})) %>'); + <% elsif @cur_type == "2" || @cur_type == "3" || @cur_type == "4" %> + <% is_teacher = is_course_teacher(User.current,@homework.bid.courses.first) %> + $("#homework_li_<%= @homework.id%>").html('<%= escape_javascript(render(:partial => 'homework_attach/homework',:locals => {:homework => @result_homework || @homework, + :is_student_batch_homework => @is_student_batch_homework || false, + :is_my_homework => false, :is_teacher => is_teacher})) %>'); + <% end %> +<% end %> diff --git a/app/views/homework_attach/edit.html.erb b/app/views/homework_attach/edit.html.erb index 92a72acd4..d88285385 100644 --- a/app/views/homework_attach/edit.html.erb +++ b/app/views/homework_attach/edit.html.erb @@ -60,22 +60,26 @@
    <%= form_for(@homework) do |f|%>

    - + <%= f.text_field :name, :required => true, :name => "homework_name", :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称", :onblur => "regexName();"%>

    -

    - - <%#= render :partial => 'attachments/form' %> + <% unless @homework.attachments.empty?%>

    <% options = {:author => true, :deletable => attach_delete(@homework)} %> diff --git a/app/views/homework_attach/new.html.erb b/app/views/homework_attach/new.html.erb index 5a512c800..877cb6d18 100644 --- a/app/views/homework_attach/new.html.erb +++ b/app/views/homework_attach/new.html.erb @@ -72,19 +72,20 @@

    -

    - - <%#= render :partial => 'attachments/form' %> +

    <%= render :partial => 'attachments/form' %>

    diff --git a/app/views/homework_attach/show.js.erb b/app/views/homework_attach/show.js.erb index d63b5fb8f..3f8efb44c 100644 --- a/app/views/homework_attach/show.js.erb +++ b/app/views/homework_attach/show.js.erb @@ -1,11 +1,9 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show',:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score}) %>'); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show') %>'); showModal('ajax-modal', '513px'); $('#ajax-modal').css('height','569px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + - ""); + ""); $('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().addClass("alert_box"); diff --git a/app/views/layouts/_base_softapplication_index_top_content.html.erb b/app/views/layouts/_base_softapplication_index_top_content.html.erb index ff897a866..f5daa020e 100644 --- a/app/views/layouts/_base_softapplication_index_top_content.html.erb +++ b/app/views/layouts/_base_softapplication_index_top_content.html.erb @@ -13,8 +13,14 @@
    - - + + - -
    <%=l(:label_contest_innovate_community)%><%= l(:label_user_location) %> : + + <%=l(:label_contest_innovate_community)%> + + + <%= l(:label_user_location) %> : +
    <%=link_to request.host()+"/softapplications", :controller=>'softapplications', :action=>'index' %><%=link_to l(:field_homepage), home_path %> > - <%=link_to l(:label_contest_work), :controller=>'softapplications', :action=>'index' %> + + <%=link_to l(:field_homepage), home_path %> > + <%=link_to l(:label_contest_work), :controller=>'softapplications', :action=>'index' %>
    diff --git a/app/views/layouts/_base_softapplication_top_content.html.erb b/app/views/layouts/_base_softapplication_top_content.html.erb index 71c708d63..afa2e1d29 100644 --- a/app/views/layouts/_base_softapplication_top_content.html.erb +++ b/app/views/layouts/_base_softapplication_top_content.html.erb @@ -1,18 +1,24 @@
    - - + + - - diff --git a/app/views/layouts/_tag.html.erb b/app/views/layouts/_tag.html.erb index e0e2b49fd..898d9b580 100644 --- a/app/views/layouts/_tag.html.erb +++ b/app/views/layouts/_tag.html.erb @@ -11,12 +11,12 @@ @@ -29,12 +29,12 @@ diff --git a/app/views/layouts/base_bids.html.erb b/app/views/layouts/base_bids.html.erb index d7d9e3924..e04889d2a 100644 --- a/app/views/layouts/base_bids.html.erb +++ b/app/views/layouts/base_bids.html.erb @@ -34,27 +34,42 @@
    -
    <%=l(:label_contest_innovate_community)%><%= l(:label_user_location) %> : + + <%=l(:label_contest_innovate_community)%> + + + <%= l(:label_user_location) %> : +
    <%=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' %> > - - <% contest = @softapplication.contests.first %><%= contest ? link_to(contest.name, show_contest_contest_path(contest)) : '尚未加入竞赛'%> - + + <%=link_to l(:field_homepage), home_path %> > + <%= l(:label_contest_innovate) %> + + <% contest = @softapplication.contests.first %><%= contest ? link_to(contest.name, show_contest_contest_path(contest)) : '尚未加入竞赛'%> +
    - - - - - - - - - -
    企业众包社区<%= l(:label_user_location) %> : - -
    <%= link_to request.host()+"/calls", :controller => 'bids', :action => 'index' %> <%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_requirement_enterprise), :controller => 'bids', :action => 'index' %> > - <%=link_to @bid.name ,bid_path %>
    + + + + + + + + + + +
    + 企业众包社区 + + + <%= l(:label_user_location) %> : + + +
    + + + + + <%=link_to l(:field_homepage), home_path %> > + <%=link_to l(:label_requirement_enterprise), :controller => 'bids', :action => 'index' %> > + + <%=link_to @bid.name ,bid_path %> + +
    @@ -66,50 +81,98 @@
    <%= image_tag(url_to_avatar(@user), :class => "avatar2") %> - - - - - - <% if User.current.login? %> - - - - - - - <% end %> -
    <%= link_to @bid.name,bid_path %>
    <%= link_to(l(:label_fork_homework_new), fork_path(@bid)) %>
    <%= watcher_link(@bid, User.current) %>
    + + + + <% if User.current.login? %> + + + + + + + <% end %> +
    + <%= link_to @bid.name,bid_path %> +
    + <%= link_to(l(:label_fork_homework_new), fork_path(@bid)) %> +
    + + + <%= watcher_link(@bid, User.current) %> + +
    + - + <% if @bid.reward_type.nil? or @bid.reward_type == 1%> - + <% elsif @bid.reward_type == 2%> - - <% else %> - + + <% else %> + <% end %> - + - + - - - + + + +
    <%= l(:label_investor) %><%= link_to(@user, user_path(@user))%> + <%= l(:label_investor) %> + <%= link_to(@user, user_path(@user))%> +
    <%= l(:label_bids_reward_method) %><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %><%= @bid.budget%> + <%= l(:label_bids_reward_method) %> + + <%= l(:label_call_bonus) %>  + <%= l(:label_RMB_sign) %> + <%= @bid.budget%> + + <%= l(:label_bids_reward_method) %><%= @bid.budget%><%= l(:label_bids_reward_method) %><%= l(:label_bids_credit) %> <%= @bid.budget%> <%= l(:label_bids_credit_number) %> + <%= l(:label_bids_reward_method) %> + <%= @bid.budget%> + + <%= l(:label_bids_reward_method) %> + <%= l(:label_bids_credit) %>  + <%= @bid.budget%>  + <%= l(:label_bids_credit_number) %> +
    <%= l(:label_investment_time_limit) %><%= @bid.deadline%> + <%= l(:label_investment_time_limit) %> + <%= @bid.deadline%> +
    被 <%= link_to(Bid.where('parent_id = ?', @bid.id).count, show_course_path(@bid)) %>  - 个高校课程引用为作业!
    +
    被  + + <%= link_to(Bid.where('parent_id = ?', @bid.id).count, show_course_path(@bid)) %> +   + 个高校课程引用为作业! +
    +
    有 <%= link_to(count_bid_project, show_bid_project_path(@bid)) %>  - 个项目正在实现该需求!
    有 <%= link_to(count_bid_user, show_bid_user_path(@bid)) %>  - 个高校用户正在努力完成此需求!
    +
    + 有  + <%= link_to(count_bid_project, show_bid_project_path(@bid)) %>  + 个项目正在实现该需求! +
    +
    +
    + 有  + <%= link_to(count_bid_user, show_bid_user_path(@bid)) %>  + 个高校用户正在努力完成此需求! +
    +
    <%= link_to l(:label_x_followers, :count => @bid.watcher_users.count)+"("+@bid.watcher_users.count.to_s+")", respond_path(@bid) %>   @@ -121,10 +184,12 @@
    - <%= l(:label_tag) %> + + <%= l(:label_tag) %> +
    - +
    @@ -177,10 +243,7 @@
    <%= render :partial => 'tags/tag', :locals => {:obj => @bid, :object_flag => "4"}%> @@ -144,11 +209,12 @@ <% if @bid.watcher_users.size>0 %> <% for user in @bid.watcher_users%> - <%= link_to image_tag(url_to_avatar(user), :class => "avatar", :title => user.name ),user_path(user) %> <% end %> <% else %> -

    <%= l(:label_project_no_follow) %>

    +

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

    <% end%>
    - - - @@ -190,7 +253,6 @@ <%= render_menu :bid_menu %> <% end %> - <%= yield %> <%= call_hook :view_layouts_base_content %>
    @@ -199,12 +261,10 @@ - - <%= call_hook :view_layouts_base_body_bottom %> diff --git a/app/views/layouts/base_contest.html.erb b/app/views/layouts/base_contest.html.erb index cf8b7d475..6e980957b 100644 --- a/app/views/layouts/base_contest.html.erb +++ b/app/views/layouts/base_contest.html.erb @@ -29,8 +29,16 @@
    - - + + - - +
    <%=l(:label_contest_innovate_community)%><%= l(:label_user_location) %> : + + <%=l(:label_contest_innovate_community)%> + + + + <%= l(:label_user_location) %> : + +
    <%=link_to request.host()+"/contest", :controller => 'bids', :action => 'contest' %><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_contest_innovate), :controller => 'bids', :action => 'contest' %> > - <%= link_to @bid.name, bid_path %> + <%=link_to l(:field_homepage), home_path %> > + <%= l(:label_contest_innovate)%> > + + <%= link_to @bid.name, bid_path %> + +
    @@ -58,27 +70,29 @@ <%= image_tag(url_to_avatar(@user), :class => "avatar2") %> - + - - - - - <% if User.current.login? %> - - + <% if User.current.login? %> + + + + <% end %> +
    <%= h @bid.name %>
    - - <%= join_in_contest(@bid, User.current)%> - - - - <%= watcher_link(@bid, User.current) %> - + + + - - <% end %> -
    + <%= h @bid.name %>
    - +
    + + <%= join_in_contest(@bid, User.current)%> + + + + <%= watcher_link(@bid, User.current) %> + +
    + <% if User.current.logged? %> <% if @bid.author.id == User.current.id %> <%= link_to l(:label_contest_modify_settings), {:controller => 'bids', :action => 'settings', :id => @bid} %> @@ -100,8 +114,12 @@ :action => 'show_project' %> - <%= l(:label_participator) %> - <%= l(:label_bidding_project) %> + + <%= l(:label_participator) %> + + + <%= l(:label_bidding_project) %> +
    @@ -110,14 +128,22 @@
    - + - - + - +
    <%= l(:lable_contest_user) %><%= link_to(@user.name, user_path(@user))%> + <%= l(:lable_contest_user) %> + <%= link_to(@user.name, user_path(@user))%> +
    <%= l(:label_bids_reward_method) %><%= @bid.budget%> + <%= l(:label_bids_reward_method) %> + <%= @bid.budget%> +
    <%= l(:label_limit_time) %> : <%= @bid.deadline%> + <%= l(:label_limit_time) %> : + <%= @bid.deadline%> +
    @@ -130,7 +156,6 @@
    <% if @bid.description.size>0 %>
    - <%= textilizable @bid.description %>
    <% else %> @@ -139,7 +164,10 @@
    <% end %>
    - <%= l(:label_create_time) %>:<%= format_time(@bid.created_on) %> + + <%= l(:label_create_time) %>: + + <%= format_time(@bid.created_on) %>
    @@ -158,9 +186,13 @@
    - <%= l(:label_x_followers, :count => @bid.watcher_users.count) %> + + <%= l(:label_x_followers, :count => @bid.watcher_users.count) %> + <% if show_more_fans?(@bid) %> - <%= link_to l(:label_more), :controller => 'bids', :action => 'show_bid_user'%> + + <%= link_to l(:label_more), :controller => 'bids', :action => 'show_bid_user'%> + <% end %>
    @@ -177,9 +209,13 @@
    - <%= l(:label_bidding_project) %> + + <%= l(:label_bidding_project) %> + <% if show_more_bid_project?(@bid) %> - <%= link_to l(:label_more), :controller => 'bids', :action => 'show_project'%> + + <%= link_to l(:label_more), :controller => 'bids', :action => 'show_project'%> + <% end %>
    @@ -200,7 +236,9 @@
    - <%= l(:label_x_join_in_contest, :count => @bid.join_in_contests.count) %> + + <%= l(:label_x_join_in_contest, :count => @bid.join_in_contests.count) %> + <% if show_more_participate?(@bid) %> <%= link_to l(:label_more), :controller => "bids", :action => "show_participator"%> @@ -210,7 +248,9 @@
    - +
    <%= show_participate_picture(@bid) %> + <%= show_participate_picture(@bid) %> +
    @@ -234,7 +274,9 @@
    diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 6de46d2fe..beb3291d0 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -34,7 +34,11 @@
    - + - + diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 9e615eaec..7c40173a0 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -29,7 +29,8 @@ background: #15bccf; color: #fff; text-align: center; - padding: 5px !important; + padding-left: 5px !important; + padding-right: 5px !important; } .span_wping a:hover{ background-color:#03a1b3;} @@ -46,15 +47,16 @@
    高校课程实践社区 + + 高校课程实践社区 + + <%= l(:label_user_location) %> : @@ -50,14 +54,16 @@
    - <%= link_to request.host()+"/course", :controller => 'courses', :action => 'index' %> -

    <%= link_to "主页", home_path %> - > <%=l(:label_courses_management_platform)%> - > <%= link_to @course.name, nil %> + > + + <%=l(:label_courses_management_platform)%> + + > + <%= link_to @course.name, nil %>

    - + -
    高校课程实践社区 + + 高校课程实践社区 + + <%= l(:label_user_location) %> :
    - <%= link_to request.host()+"/courses", :controller => 'courses', :action => 'index' %> -

    <%= link_to "主页", home_path %> > @@ -115,7 +117,7 @@

    - <% 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%> 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/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/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/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..1b20ce45b 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -1,4 +1,3 @@ -<% show_real_name ||= false %> <% reply_allow = JournalsForMessage.create_by_user? User.current %> <% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
    @@ -11,19 +10,11 @@
    <% 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 %> + <%= link_to reply.user.name, user_path(reply.user) %> 回复 <% 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 %> + <%= link_to parent_jour.user.name, user_path(parent_jour.user) %> <% else %> <%= l(:label_anonymous) %> <% end %> @@ -51,7 +42,7 @@
    <% 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 %>
    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 7d6cc85b2..5aedd93a7 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1169,7 +1169,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}" @@ -1723,6 +1723,7 @@ zh: label_user_create_project: 创建了 label_user_create_project_homework: 创建了作业 #added by bai + label_submit: 提交 label_identity: 身份 label_teacher: 教师 label_teacher_homework: 教师姓名 @@ -2205,3 +2206,7 @@ zh: label_my_score: 我的评分 field_open_anonymous_evaluation: 是否使用匿评 label_course_empty_select: 尚未选择课程! + label_course_prompt: 课程: + label_contain_resource: 已包含资源: + label_quote_resource_failed: ",此资源引用失败! " + 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/schema.rb b/db/schema.rb index 36fcb15cf..6e335db19 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,6 +11,1326 @@ # # 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_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 => 20141126091750) do create_table "activities", :force => true do |t| 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/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/css.css b/public/stylesheets/css.css index b382b6d46..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,7 +127,7 @@ 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;} a:hover.tijiao{ background:#0f99a9 !important;}