diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index d371ed4cb..664dc4cf5 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -438,6 +438,46 @@ class AttachmentsController < ApplicationController end end + def add_exist_file_to_org_subfield + file = Attachment.find(params[:file_id]) + org_subfields = params[:org_subfields][:org_subfield] + @message = "" + org_subfields.each do |org_subfield| + s = OrgSubfield.find(org_subfield) + if s.attachments.include?file + if @message && @message == "" + @message += l(:label_resource_subfield_prompt) + c.name + l(:label_contain_resource) + file.filename + l(:label_quote_resource_failed) + next + else + @message += "
" + l(:label_resource_subfield_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 = s + attach_copied_obj.created_on = Time.now + attach_copied_obj.author_id = User.current.id + attach_copied_obj.copy_from = file.copy_from.nil? ? file.id : file.copy_from + if attach_copied_obj.attachtype == nil + attach_copied_obj.attachtype = 4 + end + @obj = s + @save_flag = attach_copied_obj.save + @save_message = attach_copied_obj.errors.full_messages + update_quotes attach_copied_obj + end + respond_to do |format| + format.js + end + rescue NoMethodError + @save_flag = false + @save_message = [] << l(:label_resource_subfield_empty_select) + respond_to do |format| + format.js + 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}") diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index b92223edc..7c09e2cdf 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -118,6 +118,7 @@ class BlogCommentsController < ApplicationController @blogComment.content = @quote + @blogComment.content @blogComment.title = "RE: #{@article.title}" unless params[:blog_comment][:title] @article.children << @blogComment + @article.save @user_activity_id = params[:user_activity_id] user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first if user_activity diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 1b0ead141..aa0e1596f 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -36,17 +36,18 @@ class CoursesController < ApplicationController if !params[:name].nil? condition = "%#{params[:name].strip}%".gsub(" ","") end + limit = 15 course_org_ids = OrgCourse.find_by_sql("select distinct organization_id from org_courses where course_id = #{params[:id]}").map(&:organization_id) if course_org_ids.empty? - @orgs_not_in_course = Organization.where("(is_public or creator_id =?) and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(10) + @orgs_not_in_course = Organization.where("(is_public or creator_id =?) and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(limit) @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count else course_org_ids = "(" + course_org_ids.join(',') + ")" - @orgs_not_in_course = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(10) + @orgs_not_in_course = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(limit) @org_count = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count end # @course_count = Project.course_entities.visible.like(params[:name]).page(params[:page]).count - @orgs_page = Paginator.new @org_count, 10,params[:page] + @orgs_page = Paginator.new @org_count, limit,params[:page] @hint_flag = params[:hint_flag] #render :json => {:orgs => @orgs_not_in_course, :count => @org_count}.to_json respond_to do |format| diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 2a75d0580..8fa90ea46 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -1,8 +1,10 @@ class ExerciseController < ApplicationController layout "base_courses" - before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy, :commit_exercise, :commit_answer,:publish_exercise,:republish_exercise,:show_student_result] - before_filter :find_course, :only => [:index,:new,:create,:student_exercise_list] + before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy, + :commit_exercise, :commit_answer,:publish_exercise,:republish_exercise, + :show_student_result,:student_exercise_list] + before_filter :find_course, :only => [:index,:new,:create] include ExerciseHelper def index @@ -27,7 +29,7 @@ class ExerciseController < ApplicationController if @is_teacher || User.current.admin? exercises = @course.exercises.order("created_at asc") else - exercises = @course.exercises.where(:exercise_status => 2).order("created_at asc") + exercises = @course.exercises.where("exercise_status <> 1").order("created_at asc") end @exercises = paginateHelper exercises,20 #分页 respond_to do |format| @@ -54,41 +56,26 @@ class ExerciseController < ApplicationController end @exercise = Exercise.find params[:id] @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? - if @exercise.exercise_status != 2 && (!(User.current.allowed_to?(:as_teacher,@course) || User.current.admin?)) - render_403 - return - end exercise_end = @exercise.end_time > Time.now if @exercise.time == -1 @can_edit_excercise = exercise_end else - @can_edit_excercise = (!has_commit_exercise?(@exercise.id,User.current.id)&& exercise_end) || User.current.admin? + @can_edit_excercise = !has_commit_exercise?(@exercise.id,User.current.id)&& exercise_end end - @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first - # 学生点击的时候即创建关联,自动保存 - #eu = ExerciseUser.create(:user_id => User.current, :exercise_id => @exercise.id, :start_at => Time.now, :status => false) - - # 已提交问卷的用户不能再访问该界面 -=begin - if has_commit_exercise?(@exercise.id, User.current.id) && (!User.current.admin?) - respond_to do |format| - format.html {render :layout => 'base_courses'} - end - else -=end - if !@is_teacher && !has_click_exercise?(@exercise.id, User.current.id) + unless @is_teacher + @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first + if @exercise_user.nil? eu = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false) @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first end - # @percent = get_percent(@exercise,User.current) - exercise_questions = @exercise.exercise_questions - @exercise_questions = paginateHelper exercise_questions,5 #分页 score = calculate_student_score(@exercise, User.current) - eu = get_exercise_user(@exercise.id, User.current.id) - eu.update_attributes(:score => score) - respond_to do |format| - format.html {render :layout => 'base_courses'} - end + @exercise_user.update_attributes(:score => score) + end + # @percent = get_percent(@exercise,User.current) + @exercise_questions = @exercise.exercise_questions + respond_to do |format| + format.html {render :layout => 'base_courses'} + end #end end @@ -369,8 +356,20 @@ class ExerciseController < ApplicationController end def student_exercise_list +=begin + if @exercise.end_time <= Time.now + @course.student.each do |student| + if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,@exercise.id).empty? + ExerciseUser.create(:user_id => student.student_id, :exercise_id => @exercise.id, :start_at => @exercise.end_time, :status => true,:score=>0) + end + + s_score = calculate_student_score(@exercise, student.student) + exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", student.student_id, @exercise.id).first + exercise_user.update_attributes(:score => s_score) + end + end +=end @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? - @exercise = Exercise.find params[:id] @all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc") @exercise_count = @exercise.exercise_users.where('score is not NULL').count if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id).empty? && @exercise.end_time <= Time.now) @@ -537,12 +536,9 @@ class ExerciseController < ApplicationController # @score = 100 if @uncomplete_question.count < 1 # 查看是否有已提交记录 - eu = get_exercise_user(@exercise.id, User.current.id) - eu.user_id = User.current.id - eu.exercise_id = @exercise.id - eu.score = @score - if eu.save - #redirect_to poll_index_path(:polls_group_id => @course.id,:polls_type => 'Course') + cur_exercise_user.score = @score + if cur_exercise_user.save + #redirect_to poll_index_path(:polls_group_id => @course.id,:polls_type => 'Course') @status = 0 #提交成功 else @status = 2 #未知错误 @@ -550,6 +546,7 @@ class ExerciseController < ApplicationController else @status = 1 #有未做得必答题 end + @save = params[:save].to_i if params[:save] respond_to do |format| format.js end @@ -560,11 +557,11 @@ class ExerciseController < ApplicationController def show_student_result @user = User.find params[:user_id] @can_edit_excercise = false - @exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first @exercise_questions = @exercise.exercise_questions score = calculate_student_score(@exercise, @user) eu = get_exercise_user(@exercise.id, @user.id) eu.update_attributes(:score => score) + @exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first respond_to do |format| format.html {render :layout => 'base_courses'} end @@ -582,15 +579,15 @@ class ExerciseController < ApplicationController standard_answer = get_user_standard_answer(question, user) unless answer.empty? # 问答题有多个答案 - if question.question_type == 3 + if question.question_type == 3 && !standard_answer.empty? if standard_answer.include?(answer.first.answer_text) score1 = score1+ question.question_score unless question.question_score.nil? end - elsif question.question_type == 1 + elsif question.question_type == 1 && !standard_answer.nil? if answer.first.exercise_choice.choice_position == standard_answer.exercise_choice_id score2 = score2 + question.question_score unless question.question_score.nil? end - else + elsif question.question_type == 2 && !standard_answer.nil? arr = get_mulscore(question, user) if arr.to_i == standard_answer.exercise_choice_id score3 = score3 + question.question_score unless question.question_score.nil? diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 328446fbb..68f7cc9cb 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -131,6 +131,45 @@ class FilesController < ApplicationController end end + def search_files_in_subfield + sort = "" + @sort = "" + @order = "" + @is_remote = true + @q = params[:name].strip + 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 + # show_attachments [@course] + begin + q = "%#{params[:name].strip}%" + #(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank? + if params[:insite] + if q == "%%" + @result = [] + @searched_attach = paginateHelper @result,10 + else + @result = find_public_attache q,sort + @result = visable_attachemnts_insite @result,@org_subfield + @searched_attach = paginateHelper @result,10 + end + else + @result = find_org_subfield_attache q,@org_subfield,sort + @result = visable_attachemnts @result + @searched_attach = paginateHelper @result,10 + @tag_list = attachment_tag_list @result + end + #rescue Exception => e + # #render 'stores' + # redirect_to search_course_files_url + end + end + def find_course_attache keywords,course,sort = "" if sort == "" sort = "created_on DESC" @@ -144,6 +183,19 @@ class FilesController < ApplicationController #resultSet = Attachment.find_by_sql("SELECT `attachments`.* FROM `attachments` LEFT OUTER JOIN `homework_attaches` ON `attachments`.container_type = 'HomeworkAttach' AND `attachments`.container_id = `homework_attaches`.id LEFT OUTER JOIN `homework_for_courses` ON `homework_attaches`.bid_id = `homework_for_courses`.bid_id LEFT OUTER JOIN `homework_for_courses` AS H_C ON `attachments`.container_type = 'Bid' AND `attachments`.container_id = H_C.bid_id WHERE (`homework_for_courses`.course_id = 117 OR H_C.course_id = 117 OR (`attachments`.container_type = 'Course' AND `attachments`.container_id = 117)) AND `attachments`.filename LIKE '%#{keywords}%'").reorder("created_on DESC") end + def find_org_subfield_attache keywords,org_subfield,sort = "" + if sort == "" + sort = "created_on DESC" + end + if keywords != "%%" + resultSet = Attachment.where("attachments.container_type = 'OrgSubfield' And attachments.container_id = '#{org_subfield.id}' AND filename LIKE :like ", like: "%#{keywords}%"). + reorder(sort) + else + resultSet = Attachment.where("attachments.container_type = 'OrgSubfield' And attachments.container_id = '#{org_subfield.id}' "). reorder(sort) + end + #resultSet = Attachment.find_by_sql("SELECT `attachments`.* FROM `attachments` LEFT OUTER JOIN `homework_attaches` ON `attachments`.container_type = 'HomeworkAttach' AND `attachments`.container_id = `homework_attaches`.id LEFT OUTER JOIN `homework_for_courses` ON `homework_attaches`.bid_id = `homework_for_courses`.bid_id LEFT OUTER JOIN `homework_for_courses` AS H_C ON `attachments`.container_type = 'Bid' AND `attachments`.container_id = H_C.bid_id WHERE (`homework_for_courses`.course_id = 117 OR H_C.course_id = 117 OR (`attachments`.container_type = 'Course' AND `attachments`.container_id = 117)) AND `attachments`.filename LIKE '%#{keywords}%'").reorder("created_on DESC") + end + def find_project_attache keywords,project,sort = "" if sort == "" sort = "created_on DESC" @@ -298,10 +350,52 @@ class FilesController < ApplicationController render :layout => 'base_courses' elsif params[:org_subfield_id] + if params[:sort] + params[:sort].split(",").each do |sort_type| + order_by = sort_type.split(":") + + case order_by[0] + when "filename" + attribute = "filename" + when "size" + attribute = "filesize" + when "attach_type" + attribute = "attachtype" + when "content_type" + attribute = "created_on" + when "field_file_dense" + attribute = "is_public" + when "downloads" + attribute = "downloads" + when "created_on" + attribute = "created_on" + when "quotes" + attribute = "quotes" + else + attribute = "created_on" + end + @sort = order_by[0] + @order = order_by[1] + if order_by.count == 1 && attribute + sort += "#{Attachment.table_name}.#{attribute} asc " + if sort_type != params[:sort].split(",").last + sort += "," + end + elsif order_by.count == 2 && order_by[1] + sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " + if sort_type != params[:sort].split(",").last + sort += "," + end + end + end + else + sort = "#{Attachment.table_name}.created_on desc" + end @container_type = 2 - @organization = Organization.find(params[:organization_id]) @containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)] + @organization = Organization.find(@containers.first.organization_id) show_attachments @containers + @tag_list = attachment_tag_list @all_attachments render :layout => 'base_org' # @subfield = params[:org_subfield_id] end @@ -318,6 +412,12 @@ class FilesController < ApplicationController @can_quote = attachment_candown @file end + def quote_resource_show_org_subfield + @file = Attachment.find(params[:id]) + @org_subfield = OrgSubfield.find(params[:org_subfield_id]) + @can_quote = attachment_candown @file + end + def new @versions = @project.versions.sort @course_tag = @project.project_type @@ -430,14 +530,29 @@ class FilesController < ApplicationController end elsif @org_subfield @addTag=false - # if params[:in_org_subfield_toolbar] - # @in_org_subfield_toolbar = params[:in_org_subfield_toolbar] - # end attachments = Attachment.attach_filesex(@org_subfield, params[:attachments], params[:org_subfield_attachment_type]) - # if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') - # Mailer.run.attachments_added(attachments[:files]) - # end + if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type].is_a?(Array) + params[:org_subfield_attachment_type].each do |type| + tag_name = get_tag_name_by_type_number type + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.save + end + end + end + else + if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type] != "5" + tag_name = get_tag_name_by_type_number params[:org_subfield_attachment_type] + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.save + end + end + end + end # TODO: 临时用 nyan sort_init 'created_on', 'desc' @@ -446,19 +561,18 @@ class FilesController < ApplicationController 'size' => "#{Attachment.table_name}.filesize", 'downloads' => "#{Attachment.table_name}.downloads" - @containers = [OrgSubfield.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@org_subfield.id)] #modify by Long Jun - # @containers += @org_subfield.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort + @containers = [OrgSubfield.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@org_subfield.id)] show_attachments @containers - + @tag_list = attachment_tag_list @all_attachments @attachtype = 0 @contenttype = 0 respond_to do |format| format.js - format.html { - redirect_to org_subfield_files_url(@org_subfield) - } + # format.html { + # redirect_to org_subfield_files_url(@org_subfield) + # } end end end @@ -640,4 +754,34 @@ class FilesController < ApplicationController # format.html end end + + #搜索资源栏目的指定TAG的资源列表 + def search_org_subfield_tag_attachment + @q,@tag_name,@order = params[:q],params[:tag_name] + @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 + + q = "%#{@q.strip}%" + @result = find_org_subfield_attache q,@org_subfield,sort + @result = visable_attachemnts @result + @result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank? + @searched_attach = paginateHelper @result,10 + @tag_list = get_org_subfield_tag_list @org_subfield + + respond_to do |format| + format.js + # format.html + end + end + + def subfield_upload_file + @org_subfield = OrgSubfield.find(params[:org_subfield_id]) + end end diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index efbb4ffab..3332f1207 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -147,8 +147,8 @@ class ForumsController < ApplicationController order = "#{Memo.table_name}.updated_at #{params[:reorder_time]}" @order_str = "reorder_time="+params[:reorder_time] else - order = "last_replies_memos.created_at desc, #{Memo.table_name}.created_at desc" - @order_str = "reorder_complex=desc" + order = "#{Memo.table_name}.updated_at desc" + @order_str = "reorder_time=desc" end @memo = Memo.new(:forum => @forum) @topic_count = @forum.topics.count diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index a8d6dfe8f..a83534ad7 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -84,9 +84,20 @@ class HomeworkCommonController < ApplicationController end end + #分组作业 + if @homework.homework_type == 3 + @homework.homework_detail_group ||= HomeworkDetailGroup.new + @homework_detail_group = @homework.homework_detail_group + @homework_detail_group.min_num = params[:min_num].to_i + @homework_detail_group.max_num = params[:max_num].to_i + @homework_detail_group.base_on_project = params[:base_on_project].to_i + end + if @homework.save @homework_detail_manual.save if @homework_detail_manual @homework_detail_programing.save if @homework_detail_programing + @homework_detail_group.save if @homework_detail_group + if params[:is_in_course] == "1" redirect_to homework_common_index_path(:course => @course.id) elsif params[:is_in_course] == "0" diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 7cdc838e2..2c1f78de8 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -81,12 +81,15 @@ class IssuesController < ApplicationController @status_id = params[:status_id] @subject = params[:subject] @issue_count = @query.issue_count - @issue_pages = Paginator.new @issue_count, @limit, params['page'] + @issue_pages = Paginator.new @issue_count, @limit, params['page'].to_i + 1 @offset ||= @issue_pages.offset @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], :order => sort_clause, :offset => @offset, :limit => @limit) + if params[:set_filter] + @set_filter = params[:set_filter] + end @issue_count_by_group = @query.issue_count_by_group respond_to do |format| format.js @@ -216,7 +219,7 @@ class IssuesController < ApplicationController @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads])) saved = false begin - saved = @issue.save_issue_with_child_records(params, @time_entry) + @saved = @issue.save_issue_with_child_records(params, @time_entry) rescue ActiveRecord::StaleObjectError @conflict = true if params[:last_journal_id] @@ -225,7 +228,7 @@ class IssuesController < ApplicationController end end - if saved + if @saved #修改界面增加跟踪者 watcherlist = @issue.watcher_users select_users = [] @@ -254,13 +257,16 @@ class IssuesController < ApplicationController if reply_id > 0 JournalReply.add_reply(@issue.current_journal.id, reply_id, User.current.id) end - flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? + #flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? 去掉这个notice,因为现在更新都是ajax操作 respond_to do |format| + format.js format.html { redirect_to issue_url(@issue.id) } format.api { render_api_ok } end else respond_to do |format| + + format.js format.html { render :action => 'edit' } format.api { render_validation_errors(@issue) } end @@ -398,6 +404,9 @@ class IssuesController < ApplicationController user_activity.updated_at = jour.created_on user_activity.save @user_activity_id = params[:user_activity_id] + if params[:issue_id] + @issue_id = params[:issue_id] + end respond_to do |format| format.js end @@ -421,6 +430,43 @@ class IssuesController < ApplicationController end end + #对某个journ回复,显示回复框 + def reply + @issue = Issue.find(params[:id]) + @jour = Journal.find(params[:journal_id]) + @tempContent = "
#{ll(Setting.default_language, :text_user_wrote, @jour.user.realname.blank? ? @jour.user.login: @jour.user.realname)}
#{@jour.notes.html_safe}
".html_safe + respond_to do |format| + format.js + end + end + + #给issue添加journ。回复内容包含 对某个被回复的journ的内容 + def add_reply + if User.current.logged? + jour = Journal.new + jour.user_id = User.current.id + jour.notes = params[:quote]+params[:notes] + @issue = Issue.find params[:id] + jour.journalized = @issue + jour.save + user_activity = UserActivity.where("act_type='Issue' and act_id =#{@issue.id}").first + user_activity.updated_at = jour.created_on + user_activity.save + respond_to do |format| + format.js + end + end + end + + # + def delete_journal + @issue = Issue.find(params[:id]) + Journal.destroy(params[:journal_id]) + respond_to do |format| + format.js + end + end + private def find_project diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index 2d2c058d4..a47ddf787 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -159,7 +159,8 @@ class MemosController < ApplicationController @memo.update_column(:content, params[:memo][:content]) && @memo.update_column(:sticky, params[:memo][:sticky]) && @memo.update_column(:lock, params[:memo][:lock]) && - @memo.update_column(:subject,params[:memo][:subject])) + @memo.update_column(:subject,params[:memo][:subject]) && + @memo.update_column(:updated_at,Time.now)) @memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads])) @flag = @memo.save # @memo.root.update_attribute(:updated_at, @memo.updated_at) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index ab2cfa2ba..ccebdccfa 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -75,17 +75,18 @@ class ProjectsController < ApplicationController if !params[:name].nil? condition = "%#{params[:name].strip}%".gsub(" ","") end + limit = 15 project_org_ids = OrgProject.find_by_sql("select distinct organization_id from org_projects where project_id = #{params[:id]}").map(&:organization_id) if project_org_ids.empty? - @orgs_not_in_project = Organization.where("(is_public or creator_id =?) = 1 and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(10) + @orgs_not_in_project = Organization.where("(is_public or creator_id =?) = 1 and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(limit) @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count else project_org_ids = "(" + project_org_ids.join(',') + ")" - @orgs_not_in_project = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(10) + @orgs_not_in_project = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(limit) @org_count = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count end # @project_count = Project.project_entities.visible.like(params[:name]).page(params[:page]).count - @orgs_page = Paginator.new @org_count, 10,params[:page] + @orgs_page = Paginator.new @org_count, limit,params[:page] @no_roll_hint = params[:hint_flag] #render :json => {:orgs => @orgs_not_in_project, :count => @org_count}.to_json respond_to do |format| diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index b79adda2d..5cb646c8e 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -215,7 +215,6 @@ class StudentWorkController < ApplicationController student_work ||= StudentWork.new student_work.name = params[:student_work][:name] student_work.description = params[:student_work][:description] - student_work.project_id = params[:student_work][:project_id] student_work.homework_common_id = @homework.id student_work.user_id = User.current.id student_work.save_attachments(params[:attachments]) @@ -305,15 +304,28 @@ class StudentWorkController < ApplicationController @work.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@work) if @work.save + if @homework.homework_type == 3 + @student_work_project = @homework.student_work_projects.where("user_id=?",User.current.id).first + student_work_projects = @homework.student_work_projects.where("student_work_id=? and is_leader =?",@work.id,0) + student_work_projects.delete_all + members = params[:group_member_ids].split(',') + for i in 1 .. members.count-1 + stu_project = StudentWorkProject.new + stu_project.homework_common_id = @homework.id + stu_project.student_work_id = @work.id + if @homework.homework_detail_group.base_on_project == 1 + stu_project.project_id = @student_work_project.project_id + else @homework.homework_detail_group.base_on_project == 0 + stu_project.project_id = -1 + end + stu_project.user_id = members[i].to_i + stu_project.is_leader = 0 + stu_project.save + end + end + course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"edit",:course_message_id=>@work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录 course_message.save -=begin - respond_to do |format| - format.html { - flash[:notice] = l(:notice_successful_edit) - redirect_to student_work_index_url(:homework => @homework.id) - } -=end @student_work = @work respond_to do |format| format.js @@ -689,7 +701,12 @@ class StudentWorkController < ApplicationController unless params[:name].nil? name = params[:name] end - all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")" + if @homework.homework_detail_group.base_on_project == 0 + all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")" + else + pro = Project.find @homework.student_work_projects.where("user_id=?",User.current.id).first.project_id + all_student_ids = "(" + pro.members.map{|member| member.user_id}.join(",") + ")" + end all_students = User.where("id in #{all_student_ids}") @commit_student_ids = @homework.student_work_projects.map{|student| student.user_id} @users = searchstudent_by_name all_students,name diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index cb61177f5..d40bc7c7c 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -227,6 +227,12 @@ class TagsController < ApplicationController @tag_list = get_course_tag_list @course @select_tag_name = params[:select_tag_name] end + + if @obj && @object_flag == '6' && @obj.container.kind_of?(OrgSubfield) + @org_subfield = @obj.container + @tag_list = get_org_subfield_tag_list @org_subfield + @select_tag_name = params[:select_tag_name] + end # end end end @@ -314,6 +320,86 @@ class TagsController < ApplicationController end end + def update_org_subfield_tag_name + @tag_name = params[:tagName] + @rename_tag_name = params[:renameName] + @taggable_id = params[:taggableId] + @taggable_type = numbers_to_object_type(params[:taggableType]) + @rename_tag = (ActsAsTaggableOn::Tag.find_by_name(@rename_tag_name)) #查找重命名后的tag + @tag_id = (ActsAsTaggableOn::Tag.find_by_name(@tag_name)).id #重命名前的tag_id + @taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type) unless @taggable_id.blank? + @obj = get_object(@taggable_id,params[:taggableType]) unless @taggable_id.blank? + if @taggable_id.blank? #如果没有传tag_id,那么直接更新tag_name就好了。但是要防止 重命名后的tag存在。 + if params[:org_subfield_id] + org_subfield = OrgSubfield.find params[:org_subfield_id] + if org_subfield + org_subfield.attachments.each do |attachment| + taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,attachment.id,attachment.class) + if taggings + taggings.delete + attachment.tag_list.add(@rename_tag_name.split(",")) + attachment.save + end + end + end + end + else + if(@rename_tag.nil?) #这次命名的是新的tag + + # 是否还有其他记录 引用了 tag_id + @tagging = ActsAsTaggableOn::Tagging.where("tag_id = #{@tag_id}") + # 如果taggings表中记录为 1 ,那么改变@tag_id对应的tag的名字 + if @tagging.count == 1 + @tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id) + @tag.update_attributes({:name=>@rename_tag_name}) + else #如果tagging表中的记录大于1,那么就要新增tag记录 + + unless @obj.nil? + @obj.tag_list.add(@rename_tag_name.split(",")) + @obj.save + end + #删除原来的对应的taggings的记录 + unless @taggings.nil? + @taggings.delete + end + end + else #这是已有的tag + # 更改taggings记录里的tag_id + unless @taggings.nil? + @taggings.update_attributes({:tag_id=>@rename_tag.id}) + end + end + end + + @obj_flag = params[:taggableType] + if @obj && @obj_flag == '6' && @obj.container.kind_of?(OrgSubfield) + @org_subfield = @obj.container + @tag_list = @tag_list = get_org_subfield_tag_list @org_subfield + elsif params[:org_subfield_id] + @org_subfield = OrgSubfield.find(params[:org_subfield_id]) + @tag_list = get_org_subfield_tag_list @org_subfield + + #这里要引用FilesController里的逻辑了。将资源库当前的文件列表刷新一遍。 + @flag = params[:flag] || false + sort = "" + @sort = "" + @order = "" + @is_remote = false + @isproject = false + + sort = "#{Attachment.table_name}.created_on desc" + + @containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)] + + show_attachments @containers + elsif @obj && @obj_flag == '5' + @forum = @obj + end + respond_to do |format| + format.js + end + end + def show_attachments obj @attachments = [] obj.each do |container| @@ -372,6 +458,10 @@ class TagsController < ApplicationController @course = @obj.container @tag_list = @tag_list = get_course_tag_list @course end + if @obj && @obj_flag == '6' && @obj.container.kind_of?(OrgSubfield) + @org_subfield = @obj.container + @tag_list = @tag_list = get_org_subfield_tag_list @org_subfield + end respond_to do |format| format.js format.html diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b6d336547..281b8b7e0 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -415,6 +415,7 @@ class UsersController < ApplicationController def user_select_homework homework = HomeworkCommon.find_by_id params[:checkMenu] homework_detail_programing = homework.homework_detail_programing + homework_detail_group = homework.homework_detail_group @homework = HomeworkCommon.new @select_course = params[:select_course] || 0 if homework @@ -444,6 +445,14 @@ class UsersController < ApplicationController ) end end + + if homework_detail_group + @homework.homework_detail_group = HomeworkDetailGroup.new + @homework_detail_group = @homework.homework_detail_group + @homework_detail_group.min_num = homework_detail_group.min_num + @homework_detail_group.max_num = homework_detail_group.max_num + @homework_detail_group.base_on_project = homework_detail_group.base_on_project + end end respond_to do |format| format.js @@ -1432,7 +1441,8 @@ class UsersController < ApplicationController def search_user_course @user = User.current if !params[:search].nil? - @course = @user.courses.where(" #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like '%#{params[:search.to_s]}%'") + search = "%#{params[:search].to_s.strip.downcase}%" + @course = @user.courses.where(" #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search) .select { |course| @user.allowed_to?(:as_teacher,course)} else @course = @user.courses @@ -1451,7 +1461,8 @@ class UsersController < ApplicationController def search_user_project @user = User.current if !params[:search].nil? - @projects = @user.projects.where(" #{Project.table_name}.id = #{params[:search].to_i } or #{Project.table_name}.name like '%#{params[:search.to_s]}%'") + search = "%#{params[:search].to_s.strip.downcase}%" + @projects = @user.projects.where(" #{Project.table_name}.id = #{params[:search].to_i } or #{Project.table_name}.name like :p",:p=>search) else @projects = @user.projects end @@ -1866,46 +1877,46 @@ class UsersController < ApplicationController # 根据资源关键字进行搜索 def resource_search - search = params[:search].to_s.strip.downcase + search = "%#{params[:search].strip.downcase}%" if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部 if User.current.id.to_i == params[:id].to_i user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 取交集并查询 @attachments = Attachment.where("((author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ - " or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))) and (filename like '%#{search}%') ").order("created_on desc") + " or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))) and (filename like :p) ",:p=>search).order("created_on desc") else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 @attachments = Attachment.where("((author_id = #{params[:id]} and is_public = 1 and container_type in" + " ('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon'))"+ " or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) )" + - " and (filename like '%#{search}%') ").order("created_on desc") + " and (filename like :p) ",:p=>search).order("created_on desc") end elsif params[:type] == "2" #课程资源 if User.current.id.to_i == params[:id].to_i user_course_ids = User.current.courses.map { |c| c.id} - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) and (filename like '%#{search}%') ").order("created_on desc") + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) and (filename like :p) ",:p=>search).order("created_on desc") else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 @attachments = Attachment.where("((author_id = #{params[:id]} and is_public = 1 and container_type = 'Course') "+ "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) )"+ - " and (filename like '%#{search}%') ").order("created_on desc") + " and (filename like :p) ",:p=>search).order("created_on desc") end elsif params[:type] == "3" #项目资源 if User.current.id.to_i == params[:id].to_i - @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project' and (filename like '%#{search}%')").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project' and (filename like :p)",:p=>search).order("created_on desc") else - @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' and (filename like '%#{search}%') ").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' and (filename like :p) ",:p=>search).order("created_on desc") end elsif params[:type] == "4" #附件 if User.current.id.to_i == params[:id].to_i - @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%')").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like :p)",:p=>search).order("created_on desc") else - @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%')").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like :p)",:p=>search).order("created_on desc") end elsif params[:type] == "5" #用户资源 if User.current.id.to_i == params[:id].to_i - @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Principal' and (filename like '%#{search}%')").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Principal' and (filename like :p)",:p=>search).order("created_on desc") else - @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Principal' and (filename like '%#{search}%')").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Principal' and (filename like :p)",:p=>search).order("created_on desc") end end @type = params[:type] diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5a9563b73..ce4c07c55 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1924,6 +1924,8 @@ module ApplicationHelper elsif attachment.container.is_a?(Course) course = attachment.container candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1) + elsif attachment.container.is_a?(OrgSubfield) + candown = true elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board && attachment.container.board.course course = attachment.container.board.course @@ -1934,7 +1936,9 @@ module ApplicationHelper candown = true elsif attachment.container.class.to_s=="StudentWork" candown = true - elsif attachment.container.class.to_s=="BlogComment" + elsif attachment.container.class.to_s=="BlogComment" #博客资源允许下载 + candown = true + elsif attachment.container.class.to_s=="Memo" #论坛资源允许下载 candown = true elsif attachment.container.class.to_s == "User" candown = (attachment.is_public == 1 || attachment.is_public == true || attachment.author_id == User.current.id) @@ -2378,6 +2382,15 @@ module ApplicationHelper tag_list end + def get_org_subfield_tag_list org_subfield + all_attachments = org_subfield.attachments.select{|attachment| attachment.is_public? || + (attachment.container_type == "OrgSubfield" && User.current.member_of_org?(org_subfield.organization))|| + attachment.author_id == User.current.id + } + tag_list = attachment_tag_list all_attachments + tag_list + end + #获取匿评相关连接代码 def homework_anonymous_comment (homework, is_in_course, user_activity_id = -1, course_activity = -1) if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") diff --git a/app/helpers/exercise_helper.rb b/app/helpers/exercise_helper.rb index b0d0118e5..aba2fb58e 100644 --- a/app/helpers/exercise_helper.rb +++ b/app/helpers/exercise_helper.rb @@ -43,8 +43,9 @@ module ExerciseHelper ecs.each do |ec| arr << ec.exercise_choice.choice_position end - arr.sort - arr = arr.join("") + #arr = arr.sort + str = arr.sort.join("") + return str end # 判断用户是否已经提交了问卷 diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index cf9cbcc32..bd023f6d0 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -67,6 +67,17 @@ module FilesHelper s.html_safe end + #带勾选框的组织资源栏目列表 + def org_subfields_check_box_tags(name,org_subfields,attachment) + s = '' + org_subfields.each do |org_subfield| + if !org_subfield.attachments.include?attachment + s << "
" + end + end + s.html_safe + end + #判断用户是否拥有不包含当前资源的课程,需用户在该课程中角色为教师且该课程属于当前学期或下一学期 def has_course? user,file result = false @@ -141,6 +152,12 @@ module FilesHelper result << attachment end end + elsif obj.is_a?(OrgSubfield) + attachments.each do |attachment| + if attachment.is_public? || (attachment.container_type == "OrgSubfield" && attachment.container_id == obj.id )|| attachment.author_id == User.current.id + result << attachment + end + end end end result diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 51d1846d8..afc6cb1d9 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -19,6 +19,7 @@ include AvatarHelper include StudentWorkHelper +include ApiHelper module ProjectsHelper def link_to_version(version, options = {}) return '' unless version && version.is_a?(Version) diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index ec6390408..396133c7a 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -267,7 +267,7 @@ class JournalsForMessage < ActiveRecord::Base # 课程成员得分(英雄榜) def act_as_student_score - unless self.user.allowed_to?(:as_teacher, self.jour) + if !self.user.allowed_to?(:as_teacher, self.jour) && self.jour_type == "Course" course_member_score(self.jour_id, self.user_id, "JournalForMessage") end end diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index ab8b80dcb..aac365a15 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -7,8 +7,10 @@ <% if defined?(container) && container && container.saved_attachments %> <% container.attachments.each_with_index do |attachment, i| %> - <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly => 'readonly') %><%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %><%= l(:field_is_public) %>: - <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %> + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly', :readonly => 'readonly') %> + <%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %> + + <%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %> <%= if attachment.id.nil? #待补充代码 else @@ -21,24 +23,7 @@
<% end %> - <% container.saved_attachments.each_with_index do |attachment, i| %> - - <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly => 'readonly') %> - <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %> - <%= l(:field_is_public) %>: - <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %> - <%= if attachment.id.nil? - #待补充代码 - else - link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') - end - %> - <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> - <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> - -
- <% end %> <% end %> <% project = project %> diff --git a/app/views/attachments/add_exist_file_to_org_subfield.js.erb b/app/views/attachments/add_exist_file_to_org_subfield.js.erb new file mode 100644 index 000000000..4c4208f76 --- /dev/null +++ b/app/views/attachments/add_exist_file_to_org_subfield.js.erb @@ -0,0 +1,8 @@ +<% if !@save_flag && @save_message %> + $("#error_show").html("<%= @save_message.join(', ') %>"); +<% elsif @message && @message != "" %> + $("#error_show").html("<%= @message.html_safe %>"); +<% else %> + closeModal(); + location.reload(); +<% end %> \ No newline at end of file diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index 7b6b44c69..ce775da4d 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -1,22 +1,18 @@ -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> -<% end %> - - +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor" %> @@ -24,11 +20,11 @@

<%= l(:label_leave_message) %>

<% if !User.current.logged?%> -
- <%= l(:label_user_login_tips) %> - <%= link_to l(:label_user_login_new), signin_path %> -
-
+
+ <%= l(:label_user_login_tips) %> + <%= link_to l(:label_user_login_new), signin_path %> +
+
<% else %>
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_course_message'}, :html=>{:id => "course_feedback_new"},:method => "post") do |f|%> @@ -59,37 +55,37 @@ $("#submit_feedback_course").one('click',function() { $("#course_feedback_new").submit(); }); - KindEditor.ready(function(K){ - $("a[nhname='reply_btn']").live('click',function(){ - var params = {}; - params.kindutil = K; - params.container = $(this).parent('div').parent('div'); - params.div_form = $(">.respond-form",params.container); - params.form = $("form",params.div_form); - params.textarea = $("textarea[name='user_notes']",params.div_form); - params.contentmsg = $("p[nhname='contentmsg']",params.div_form); - params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); - params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form); - params.height = 55; - if(params.textarea.data('init') == undefined){ - params.editor = init_editor(params); - init_form(params); - params.cancel_btn.click(function(){ - nh_reset_form(params); - }); - } - params.cancel_btn.click(); - toggleAndSettingWordsVal(params.div_form, params.textarea); - setTimeout(function(){ - if(!params.div_form.is(':hidden')){ - params.textarea.show(); - params.textarea.focus(); - params.textarea.hide(); - } - },300); - params.textarea.data('init',1); - }); + KindEditor.ready(function(K){ + $("a[nhname='reply_btn']").live('click',function(){ + var params = {}; + params.kindutil = K; + params.container = $(this).parent('div').parent('div'); + params.div_form = $(">.respond-form",params.container); + params.form = $("form",params.div_form); + params.textarea = $("textarea[name='user_notes']",params.div_form); + params.contentmsg = $("p[nhname='contentmsg']",params.div_form); + params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); + params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form); + params.height = 55; + if(params.textarea.data('init') == undefined){ + params.editor = init_editor(params); + init_form(params); + params.cancel_btn.click(function(){ + nh_reset_form(params); + }); + } + params.cancel_btn.click(); + toggleAndSettingWordsVal(params.div_form, params.textarea); + setTimeout(function(){ + if(!params.div_form.is(':hidden')){ + params.textarea.show(); + params.textarea.focus(); + params.textarea.hide(); + } + },300); + params.textarea.data('init',1); + }); + }); }); - }); diff --git a/app/views/courses/search_public_orgs_not_in_course.js.erb b/app/views/courses/search_public_orgs_not_in_course.js.erb index 2669f8a0f..ebd0c58a7 100644 --- a/app/views/courses/search_public_orgs_not_in_course.js.erb +++ b/app/views/courses/search_public_orgs_not_in_course.js.erb @@ -11,7 +11,7 @@ $("#search_orgs_result_list").append('') -<% if @org_count > 10 %> +<% if @org_count > 15 %> $("#paginator").html(' <%= pagination_links_full @orgs_page, @org_count ,:per_page_links => true,:remote =>true,:flag=>true%>'); $("#paginator").css("display", "block"); <% else %> diff --git a/app/views/exercise/_commit_alert.html.erb b/app/views/exercise/_commit_alert.html.erb index e9c3ebf57..bed7b6d82 100644 --- a/app/views/exercise/_commit_alert.html.erb +++ b/app/views/exercise/_commit_alert.html.erb @@ -1,12 +1,15 @@
- <% if status == 0 && exercise.time != -1%> + <% if @save == 1 %> +

保存成功,测验日期截止前您还可以继续答题。

+ <%= link_to "确定", exercise_index_path(:course_id => @course.id),:class => 'commit'%> + <% elsif status == 0 && exercise.time != -1%>

提交成功!您的分数是:<%=@score %>分。

<%= link_to "确定", exercise_path(),:class => 'commit'%> <% elsif status == 0 && Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") > Time.now.strftime("%Y-%m-%d %H:%M:%S") %> -

提交成功!

+

提交成功,测验日期截止前您还可以修改,祝您考高分。

<%= link_to "确定", exercise_index_path(:course_id => @course.id),:class => 'commit'%> <% elsif status == 1 && Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") > Time.now.strftime("%Y-%m-%d %H:%M:%S")%> -

保存成功!

+

提交成功,您还有未完成的题目,测验日期截止前您还可以继续答题,祝您考高分。

<%= link_to "确定",exercise_index_path(:course_id => @course.id),:class => 'commit'%> <% elsif status == 1 && Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") <= Time.now.strftime("%Y-%m-%d %H:%M:%S")%>

时间已到!

diff --git a/app/views/exercise/_exercise.html.erb b/app/views/exercise/_exercise.html.erb index db412672c..19bc520d4 100644 --- a/app/views/exercise/_exercise.html.erb +++ b/app/views/exercise/_exercise.html.erb @@ -24,11 +24,11 @@ <%# end%> <% if exercise.exercise_status == 1 %> -
  • 发布试卷
  • +
  • 发布试卷
  • <% elsif exercise.exercise_status == 2%> -
  • 取消发布
  • +
  • 取消发布
  • <% else%> -
  • 发布试卷
  • +
  • 发布试卷
  • <% end%> <% if exercise.exercise_status == 1%> @@ -42,18 +42,24 @@ <% if exercise.exercise_status == 1 %>
  • <%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "polls_de fr ml10"%>
  • <%=exercise.publish_time.nil? ? "未发布" : "将于"+format_time(exercise.publish_time.to_s)+"发布"%>
  • - <% else%> + <% elsif exercise.exercise_status == 2 %>
  • 编辑
  • 已发布
  • + <% else %> +
  • 编辑
  • +
  • 已截止
  • <% end%> <% else%> - <% if exercise.exercise_status == 2%> + <% if exercise.exercise_status != 1%> <%# if has_commit%> <%#else%> - <%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%> + <%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%> + <% if exercise.end_time <= Time.now && has_commit_exercise?(exercise.id, User.current.id) %> +
  • 已答
  • + <% end %> <%#end%> <% end%>
  • 截止时间:<%= format_time(exercise.end_time.to_s)%>
  • diff --git a/app/views/exercise/_exercise_student.html.erb b/app/views/exercise/_exercise_student.html.erb index adaab5021..8a1f3dbd6 100644 --- a/app/views/exercise/_exercise_student.html.erb +++ b/app/views/exercise/_exercise_student.html.erb @@ -3,10 +3,6 @@ $("#RSide").removeAttr("id"); $("#homework_page_right").css("min-height",$("#LSide").height()-30); $("#Container").css("width","1000px"); - <%uncomplete_question =get_uncomplete_question(exercise, User.current) %>; - <% if (uncomplete_question.count < 1) %> - $("#exercise_submit_btn").html("提交"); - <% end %> var end_time = <%=exercise.end_time.to_i%>; getTime(end_time); /*start_time = new Date(); @@ -104,11 +100,6 @@ { obj.checked = false; } - if(dataObj.complete == 1) { - $("#exercise_submit_btn").html("提交"); - } else { - $("#exercise_submit_btn").html("保存"); - } } }); } @@ -163,11 +154,6 @@ { obj.checked = false; } - if(dataObj.complete == 1) { - $("#exercise_submit_btn").html("提交"); - } else { - $("#exercise_submit_btn").html("保存"); - } } }); } @@ -210,11 +196,6 @@ success: function (data) { var dataObj = eval(data); obj.value = dataObj.text; - if(dataObj.complete == 1) { - $("#exercise_submit_btn").html("提交"); - } else { - $("#exercise_submit_btn").html("保存"); - } } }); @@ -228,7 +209,8 @@ <% end %>
    - <%= link_to "保存",commit_exercise_exercise_path(exercise),:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:80px;",:format => 'js',:remote=>true %> + <%= link_to "保存",commit_exercise_exercise_path(exercise,:save => 1),:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:format => 'js',:remote=>true %> + <%= link_to "提交",commit_exercise_exercise_path(exercise), :data => {:confirm => "您确定要提交吗?"},:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:20px;",:format => 'js',:remote=>true %>
    diff --git a/app/views/exercise/_exercise_student_result.html.erb b/app/views/exercise/_exercise_student_result.html.erb index 529a73da3..58ebcaf20 100644 --- a/app/views/exercise/_exercise_student_result.html.erb +++ b/app/views/exercise/_exercise_student_result.html.erb @@ -78,7 +78,7 @@ <% else %> × <% end %>
    - 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> + 标准答案:<%= convert_to_char(standard_answer.first.exercise_choice_id.to_s) if !standard_answer.empty? %>
    diff --git a/app/views/exercise/_exercise_teacher.html.erb b/app/views/exercise/_exercise_teacher.html.erb index 24687d28b..586c033a1 100644 --- a/app/views/exercise/_exercise_teacher.html.erb +++ b/app/views/exercise/_exercise_teacher.html.erb @@ -32,7 +32,7 @@
    第<%= list_index+1%>题:<%= exercise_question.question_title %>  (<%= exercise_question.question_score %>分)
    - 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> + 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) if exercise_question.exercise_standard_answers.first %>
    @@ -64,7 +64,7 @@
    第<%= list_index+1%>题:<%= exercise_question.question_title %>  (<%= exercise_question.question_score %>分)
    - 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> + 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) if exercise_question.exercise_standard_answers.first%>
    diff --git a/app/views/exercise/_student_exercise.html.erb b/app/views/exercise/_student_exercise.html.erb index 9c9916e60..bbbe9026d 100644 --- a/app/views/exercise/_student_exercise.html.erb +++ b/app/views/exercise/_student_exercise.html.erb @@ -35,17 +35,19 @@ }); $(function(){ <% if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %> - $("#show_student_result_div").on('click',show_result); + $("#show_student_result_div_<%= exercise.id%>").on('click',function() { + window.location.href = '<%=show_student_result_exercise_path(@exercise,:user_id => exercise.user_id) %>'; + }); <% else %> - $("#show_student_result_div").attr("title","截止日期未到,暂不能查看学生答题结果"); - $("#student_name_id").attr("title","截止日期未到,暂不能查看学生答题结果"); - $("#student_id_id").attr("title","截止日期未到,暂不能查看学生答题结果"); - $("#student_class_id").attr("title","截止日期未到,暂不能查看学生答题结果"); + $("#show_student_result_div_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果"); + $("#student_name_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果"); + $("#student_id_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果"); + $("#student_class_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果"); <% end %> }); - function show_result() { - window.location.href = '<%=show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %>'; - } + /*function show_result(id) { + window.location.href = '<%#=show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %>'; + }*/
    • @@ -53,16 +55,16 @@
    • <%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40"),user_activities_path(exercise.user)) %>
    • -
      +
      • -
      • +
      • <%=exercise.user.show_name %>
      • -
      • +
      • <%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%>
      • -
      • +
      • --
      diff --git a/app/views/exercise/commit_exercise.js.erb b/app/views/exercise/commit_exercise.js.erb index 5ede8a951..ac8c242d1 100644 --- a/app/views/exercise/commit_exercise.js.erb +++ b/app/views/exercise/commit_exercise.js.erb @@ -1,6 +1,5 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status,:exercise =>@exercise}) %>'); showModal('ajax-modal', '270px'); -$('#ajax-modal').css('height','110px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); diff --git a/app/views/exercise/edit.html.erb b/app/views/exercise/edit.html.erb index 0b20dc90e..48d307c78 100644 --- a/app/views/exercise/edit.html.erb +++ b/app/views/exercise/edit.html.erb @@ -1 +1,9 @@ -<%= render :partial => 'exercise_form'%> \ No newline at end of file +<%= render :partial => 'exercise_form'%> + diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb index a8aa13458..029570047 100644 --- a/app/views/files/_org_subfield_list.html.erb +++ b/app/views/files/_org_subfield_list.html.erb @@ -14,10 +14,9 @@

    • - - - - +
      + <%= render :partial => "files/subfield_tags", :locals => {:tag_list => @tag_list,:org_subfield => @org_subfield,:tag_name => @tag_name}%> +
      @@ -29,6 +28,11 @@ download_named_attachment_path(file.id, file.filename), :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 !@org_subfield.attachments.all.include?file %> + <%= link_to("选入栏目",quote_resource_show_org_subfield_org_subfield_file_path(:org_subfield_id => @org_subfield.id, :id => file.id),:class => "f_l re_select c_lorange",:remote => true) %> + <% else %> + <%= link_to("选入组织其他栏目",quote_resource_show_org_subfield_org_subfield_file_path(:org_subfield_id => @org_subfield.id, :id => file.id),:class => "f_l re_select c_lorange",:remote => true) %> + <% end %> <%= file_preview_tag(file, class: 'f_l re_open', style:'text-align: center;') %> <% end %>
      @@ -40,11 +44,10 @@

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

      - - - - - +
      + <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %> + <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %> +
    <% end %> diff --git a/app/views/files/_show_quote_resource_org_subfield.html.erb b/app/views/files/_show_quote_resource_org_subfield.html.erb new file mode 100644 index 000000000..ab2eb318d --- /dev/null +++ b/app/views/files/_show_quote_resource_org_subfield.html.erb @@ -0,0 +1,31 @@ +
    +
    +

    将此资源引入组织资源栏目

    + <% if error == '403' %> +
    +
    您没有权限引用此资源
    +
    + <% else %> +
    +
    + <%= form_tag attachments_add_exist_file_to_org_subfield_path, + method: :post, + remote: true, + id: "relation_file_form" do %> + <%= hidden_field_tag(:file_id, file.id) %> + <%= content_tag('div', org_subfields_check_box_tags('org_subfields[org_subfield][]',org_subfield.organization.org_subfields.where("field_type='Resource'"),file), :id => 'org_subfields')%> + 引  用取  消 + <% end -%> +
    + <% end %> + + +
    +
    + + \ No newline at end of file diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb index ea408c7a6..09f74d3cd 100644 --- a/app/views/files/_subfield_files.html.erb +++ b/app/views/files/_subfield_files.html.erb @@ -15,9 +15,9 @@ { switch(obj) { - case 1: - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>'); - break; +// case 1: +// $('#ajax-modal').html('<%#= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>'); +// break; case 2: $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 2}) %>'); break; @@ -27,9 +27,9 @@ case 4: $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 4}) %>'); break; - case 6: - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 6}) %>'); - break; +// case 6: +// $('#ajax-modal').html('<%#= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 6}) %>'); +// break; default: $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 5}) %>'); } @@ -68,27 +68,27 @@
    - <%= form_tag( search_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search f_l",:remote=>true) do %> + <%= form_tag( search_files_in_subfield_org_subfield_files_path(@org_subfield), 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 => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %> + <%= submit_tag "栏目内搜索", :class => "re_schbtn b_lblue",:style => 'width:72px;',:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %> <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %> <% end %> <%# if is_org_subfield_teacher(User.current,@org_subfield) || (@org_subfield.publish_resource==1 && User.current.member_of_org_subfield?(@org_subfield) ) %>

    上传: - 课件 |  + 软件 |  媒体 |  代码 |  - 论文 |  + 其他

    <%# end %>
    -
    +
    <%= render :partial => 'org_subfield_list',:locals => {org_subfield: @org_subfield,all_attachments: @all_attachments,sort:@sort,order:@order,org_subfield_attachments:@obj_attachments} %>
    diff --git a/app/views/files/_subfield_tags.html.erb b/app/views/files/_subfield_tags.html.erb new file mode 100644 index 000000000..ed7ad660e --- /dev/null +++ b/app/views/files/_subfield_tags.html.erb @@ -0,0 +1,45 @@ +<% if org_subfield %> + + 全部 +<% end %> +<% unless tag_list.nil?%> + <% tag_list.each do |k,v|%> + <% if tag_name && tag_name == k%> + + <%= k%>(<%= v%>) + <% else%> + + <%= k%>(<%= v%>) + <% end%> + <% end%> +<% end%> + + \ No newline at end of file diff --git a/app/views/files/_upload_subfield_file.html.erb b/app/views/files/_upload_subfield_file.html.erb index c3ca72ecd..7137e14e7 100644 --- a/app/views/files/_upload_subfield_file.html.erb +++ b/app/views/files/_upload_subfield_file.html.erb @@ -6,11 +6,19 @@ <%= error_messages_for 'attachment' %> - <%= form_tag(org_subfield_files_path(org_subfield), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %> - - - - <%= render :partial => 'files/attachement_list',:locals => {:org_subfield => org_subfield} %> + <%= form_tag(org_subfield_files_path(org_subfield, :in_org => params[:in_org]), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %> + <% if params[:in_org] %> +
    + 软件 |  + 媒体 |  + 代码 |  + 其他 +
    + <% else %> + + <% end %> + + <%= render :partial => 'files/attachement_list'%>
    <%= l(:button_cancel)%> <%= l(:button_confirm)%> @@ -18,9 +26,7 @@
    - <% content_for :header_tags do %> - <%= javascript_include_tag 'attachments' %> - <% end %> +
    diff --git a/app/views/files/quote_resource_show_org_subfield.js.erb b/app/views/files/quote_resource_show_org_subfield.js.erb new file mode 100644 index 000000000..fe34e9624 --- /dev/null +++ b/app/views/files/quote_resource_show_org_subfield.js.erb @@ -0,0 +1,11 @@ +<% if @can_quote %> +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => ''}) %>'); +<% else %> +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => '403'}) %>'); +<% end %> + +showModal('ajax-modal', '513px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().addClass("popbox_polls"); \ No newline at end of file diff --git a/app/views/files/search_files_in_subfield.js.erb b/app/views/files/search_files_in_subfield.js.erb new file mode 100644 index 000000000..deed2d5d3 --- /dev/null +++ b/app/views/files/search_files_in_subfield.js.erb @@ -0,0 +1,2 @@ +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'org_subfield_list', + :locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>"); \ No newline at end of file diff --git a/app/views/files/search_org_subfield_tag_attachment.js.erb b/app/views/files/search_org_subfield_tag_attachment.js.erb new file mode 100644 index 000000000..deed2d5d3 --- /dev/null +++ b/app/views/files/search_org_subfield_tag_attachment.js.erb @@ -0,0 +1,2 @@ +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'org_subfield_list', + :locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>"); \ No newline at end of file diff --git a/app/views/files/subfield_upload_file.js.erb b/app/views/files/subfield_upload_file.js.erb new file mode 100644 index 000000000..fc3afc0ff --- /dev/null +++ b/app/views/files/subfield_upload_file.js.erb @@ -0,0 +1,6 @@ +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>'); +showModal('ajax-modal', '513px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().addClass("popbox_polls"); \ No newline at end of file diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index 2a7a02e57..b0ed5a60c 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -30,9 +30,11 @@ <% end %>
    diff --git a/app/views/issues/_action_menu.html.erb b/app/views/issues/_action_menu.html.erb index ae2a848e0..97e95d4a9 100644 --- a/app/views/issues/_action_menu.html.erb +++ b/app/views/issues/_action_menu.html.erb @@ -2,5 +2,5 @@ <%#= watcher_link_issue(@issue, User.current) %> <%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'talk_edit fr' if User.current.allowed_to?(:add_issues, @project) %> <%= link_to l(:button_delete), issue_path(@issue.id), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'talk_edit fr' if User.current.allowed_to?(:delete_issues, @project) %> -<%= link_to l(:button_edit), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("all_attributes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %> -<%= link_to l(:label_user_newfeedback), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("update", "issue_journal_kind_reply"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:add_issue_notes, @project) %> +<%= link_to l(:button_edit), 'javascript:void(0);', :onclick => 'issueEditShow();', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %> +<%#= link_to l(:label_user_newfeedback), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("update", "issue_journal_kind_reply"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:add_issue_notes, @project) %> diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb index 54cb85212..1b6bebb01 100644 --- a/app/views/issues/_attributes.html.erb +++ b/app/views/issues/_attributes.html.erb @@ -1,7 +1,6 @@ <%= labelled_fields_for :issue, @issue do |f| %>
    -
    - <%= l(:label_change_properties) %> +
    • @@ -54,7 +53,7 @@
    -
      +
      • <% if @issue.safe_attribute? 'start_date' %> diff --git a/app/views/issues/_attributes_show.html.erb b/app/views/issues/_attributes_show.html.erb index 7b9e2bedf..15160facb 100644 --- a/app/views/issues/_attributes_show.html.erb +++ b/app/views/issues/_attributes_show.html.erb @@ -1,5 +1,5 @@ -
        +
        <%= issue_fields_rows do |rows| %>
        •  状态  : 

          <%= @issue.status.name %>

          diff --git a/app/views/issues/_detail.html.erb b/app/views/issues/_detail.html.erb new file mode 100644 index 000000000..b175bd417 --- /dev/null +++ b/app/views/issues/_detail.html.erb @@ -0,0 +1,38 @@ +
          +
          + <%= link_to image_tag(url_to_avatar(@issue.author), :width => 46, :height => 46), user_path(@issue.author), :class => "ping_dispic" %> +
          +
          +

          <%= @issue.subject %> + <%= get_issue_priority(@issue.priority_id)[1] %>

          +
          +
          + 由<%= @issue.author %>添加于 <%= format_time(@issue.created_on).html_safe %> +
          + + + +<%= render :partial => 'action_menu' %> +
          +<% if @issue.description? || @issue.attachments.any? -%> +
          + <% if @issue.description? %> + <%#= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %> + <%= textAreailizable @issue, :description, :attachments => @issue.attachments %> + <% end %> +
          +<% end -%> +<% if @issue.attachments.any? %> +
          + + + <%= link_to_attachment_project @issue, :thumbnails => true %>
          + <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> +
          +
          +<% end %> + + +<%= render :partial => 'issues/attributes_show' %> +
          +
          \ No newline at end of file diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index b8f362429..2879c9592 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -1,46 +1,29 @@ +
        • diff --git a/app/views/student_work/_new_student_work_alert.html.erb b/app/views/student_work/_new_student_work_alert.html.erb index 8e0c8a954..42a891d60 100644 --- a/app/views/student_work/_new_student_work_alert.html.erb +++ b/app/views/student_work/_new_student_work_alert.html.erb @@ -2,7 +2,11 @@

          当前作业 - 已开启匿评 + <% if @homework.homework_detail_manual.comment_status == 2 %> + 已开启匿评 + <% elsif @homework.homework_detail_manual.comment_status == 3 %> + 已关闭匿评 + <% end %> 您提交作品后将 不会收到任何匿评作品, 您的作品也 diff --git a/app/views/student_work/_relate_project.html.erb b/app/views/student_work/_relate_project.html.erb index 43f59c9c9..9a1fcead5 100644 --- a/app/views/student_work/_relate_project.html.erb +++ b/app/views/student_work/_relate_project.html.erb @@ -4,7 +4,7 @@ <%=form_tag url_for(:controller=>'student_work',:action=>'student_work_project',:homework=>@homework.id,:user_activity_id=>@user_activity_id,:is_in_course=>@is_in_course,:course_activity =>@course_activity),:id =>'student_work_relate_project',:class=>'resourcesSearchBox',:remote => true do %>

          - +

            diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 801c252cb..f92614e10 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -46,7 +46,12 @@ <% if @homework.homework_detail_group.base_on_project == 1 %>
          • 关联项目: - <%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> + <% if work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %> + <%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> + <% else %> + <%=work.project.name %> + <% end %> + <%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> (综合评分:<%=work.project.project_score.score.to_i %>)
          • <% end %> diff --git a/app/views/student_work/edit.html.erb b/app/views/student_work/edit.html.erb index bfdf8c316..c7c572cff 100644 --- a/app/views/student_work/edit.html.erb +++ b/app/views/student_work/edit.html.erb @@ -7,7 +7,7 @@
            -
            + @@ -31,7 +31,11 @@ 提示:作品名称和描述中不要出现真实的姓名信息
            - + <% if @homework.homework_type == 3 %> + + + <%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %> + <% end %>
            @@ -51,6 +55,12 @@ <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @work, :has_program=>false,:has_group=>false} %>
            + <% if @homework.homework_type == 3 %> + + <% end %> +
            确定 @@ -61,14 +71,44 @@
            \ No newline at end of file diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index c3a61d4c8..bd13fb7c1 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -11,6 +11,11 @@ $('#ajax-modal').parent().addClass("anonymos_work"); }); <% end%> + <% if @homework.homework_detail_group %> + $(function(){ + $('span.group_detail_info').text('分组人数:<%=@homework.homework_detail_group.min_num %>-<%=@homework.homework_detail_group.max_num %> 人'); + }); + <% end %> //快速创建项目的弹框 function new_project(){ @@ -83,7 +88,7 @@
            -
            + diff --git a/app/views/student_work/search_course_students.js.erb b/app/views/student_work/search_course_students.js.erb index 1cea9f27e..c7aa982b9 100644 --- a/app/views/student_work/search_course_students.js.erb +++ b/app/views/student_work/search_course_students.js.erb @@ -18,7 +18,7 @@ $("#all_students_list").empty(); } } } - <% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? %> + <% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? && user.member_of_course?(@course) %> if (str.indexOf(<%=user.id.to_s %>) < 0) { $("#student_<%=user.id %>").one("click",function choose_student() { var li = "
          • + if (str.indexOf(<%=user.id.to_s %>) < 0) { + $("#student_<%=user.id %>").attr("title","该项目成员不是本课程的学生"); + } <% else %> if (str.indexOf(<%=user.id.to_s %>) < 0) { $("#student_<%=user.id %>").attr("title","该学生已加入其它分组"); diff --git a/app/views/tags/_tag_list.html.erb b/app/views/tags/_tag_list.html.erb index 14b6a0597..de8c0a4d2 100644 --- a/app/views/tags/_tag_list.html.erb +++ b/app/views/tags/_tag_list.html.erb @@ -2,7 +2,7 @@ <% if @tags.size > 0 %> <% @tags.each do |tag| %> - <%#= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> + <%#= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> <%= tag %> <% case object_flag %> diff --git a/app/views/tags/remove_tag_new.js.erb b/app/views/tags/remove_tag_new.js.erb index 9a43dd9b4..879155aa7 100644 --- a/app/views/tags/remove_tag_new.js.erb +++ b/app/views/tags/remove_tag_new.js.erb @@ -3,8 +3,12 @@ $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag,:select_tag_name => @select_tag_name}) %>'); +<% if @org_subfield %> + $("#files_tag").html("<%= escape_javascript(render :partial => "files/subfield_tags", :locals => {:tag_list => @tag_list,:org_subfield => @org_subfield,:tag_name => @tag_name})%>"); +<% else %> + $("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @select_tag_name}) %>"); +<% end %> -$("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @select_tag_name}) %>"); <% end %> <% if @object_flag == "10"%> $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); diff --git a/app/views/tags/tag_save.js.erb b/app/views/tags/tag_save.js.erb index f6ada82eb..bd0c3b16b 100644 --- a/app/views/tags/tag_save.js.erb +++ b/app/views/tags/tag_save.js.erb @@ -18,9 +18,13 @@ $('#tags_name2').val(""); $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list', :locals => {:obj => @obj,:object_flag => @obj_flag,:select_tag_name => @select_tag_name}) %>'); $("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @select_tag_name}) %>"); - <%else%> + <%elsif @project%> $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").replaceWith('<%= escape_javascript(render :partial => 'tags/tag_new', :locals => {:obj => @obj, :object_flag => "6"}) %>'); + <% else %> + $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); + $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").replaceWith('<%= escape_javascript(render :partial => 'tags/tag_new', :locals => {:obj => @obj, :object_flag => "6"}) %>'); + $("#files_tag").html("<%= escape_javascript(render :partial => "files/subfield_tags", :locals => {:tag_list => @tag_list,:org_subfield => @org_subfield,:tag_name => @tag_name})%>"); //render :partial => 'tags/course_attachment_tag_name', //:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) <%end%> diff --git a/app/views/tags/update_org_subfield_tag_name.js.erb b/app/views/tags/update_org_subfield_tag_name.js.erb new file mode 100644 index 000000000..4fabc1afd --- /dev/null +++ b/app/views/tags/update_org_subfield_tag_name.js.erb @@ -0,0 +1,11 @@ +<% if @obj %> + $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); + $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list', + :locals => {:obj => @obj,:object_flag => @obj_flag}) %>'); + $("#tags_name_<%=@obj.id%>").val(""); + $("#add_tag_<%=@obj.id%>").hide(); + $("#files_tag").html("<%= escape_javascript(render :partial => "files/subfield_tags", :locals => {:tag_list => @tag_list,:org_subfield => @org_subfield,:tag_name => @select_tag_name}) %>"); +<% else %> + $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'files/org_subfield_list', + :locals => {org_subfield: @org_subfield,all_attachments: @all_attachments,sort:@sort,order:@order,org_subfield_attachments:@obj_attachments}) %>"); +<% end %> diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index b38a17bea..60b8e6728 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -13,7 +13,7 @@ <% end %> TO <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%>
          • -
            @@ -93,25 +97,49 @@
            +
            +
            + 匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%> 00:00 +
            +
            + 匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%> 23:59 +
            +
            +
            <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => activity.attachments} %>
            - <% if activity.homework_type == 3 && !activity.student_work_projects.empty? && activity.homework_detail_group.base_on_project == 1 %> + <% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
            + <% projects = activity.student_work_projects.where("is_leader = 1") %>
            - - 已关联项目: + 已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
            - <% activity.student_work_projects.where("is_leader = 1").each do |pro| %> -
            - <% project = Project.find pro.project_id || User.current.member_of?(project) || User.current.admin? %> - <% if project.is_public || project.user_id == User.current.id %> - <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:alt =>"项目头像" %> + <% projects.each do |pro| %> + <% project = Project.find pro.project_id %> + +
            + <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> + <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s,:alt =>"项目头像" %> <% else %> - <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius") %> + <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s,:alt =>"项目头像") %> <% end %> -

            <%=project.project_score.score.to_i %>

            +
            + 项目名称:<%=project.name %>
            + 创建者:<%=(User.find project.user_id).show_name %>(组长)
            + <% time=project.updated_on %> + <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> + 更新时间:<%=time_from_now time %> +
            <% end %>
            diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index c5b777286..88b880ada 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -1,152 +1,152 @@ -
            -
            -
            - <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> -
            -
            -
            - <% if activity.try(:author).try(:realname) == ' ' %> - <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> - <% else %> - <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> - <% end %> TO - <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%> -
            -
            - <%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey" %> - - <%= get_issue_priority(activity.priority_id)[1] %> - -
            -
            -
            指派给   - <% unless activity.assigned_to_id.nil? %> - <% if activity.try(:assigned_to).try(:realname) == ' ' %> - <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> - <% else %> - <%= link_to activity.try(:assigned_to).try(:realname), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> - <% end %> - <% end %> -
            -
            - 时间: - <%=format_time(activity.created_on) %> -
            -
            -
            -
            - <% if activity.description? %> - <%= textAreailizable activity, :description, :attachments => activity.attachments %> - <% end %> -
            -
            -
            - - -
            -
            - <% if activity.attachments.any? %> - <% activity.attachments.each do |attachment| %> -
            - - - <%= link_to_short_attachment attachment,:length=> 58, :class => 'link_file_a fl newsBlue', :download => true -%> - - <% if attachment.is_text? %> - <%= link_to image_tag('magnifier.png'), - :controller => 'attachments', - :action => 'show', - :id => attachment, - :class => 'fl', - :filename => attachment.filename %> - <% end %> - - ( - <%= number_to_human_size attachment.filesize %>) - - - <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "c_orange" %>, - <%= format_time(attachment.created_on) %> - -
            - <% end %> - <% end %> -
            -
            -
            -
            - <% count = activity.journals.count %> -
            -
            -
            -
            回复(<%= count %>)
            -
            <%#= format_date(activity.updated_on) %>
            - <% if count > 3 %> - - <% end %> -
            - - <% replies_all_i = 0 %> - <% if count > 0 %> -
            -
              - <% activity.journals.reorder("created_on desc").each do |reply| %> - - <% replies_all_i=replies_all_i + 1 %> -
            • -
              - <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %> -
              -
              -
              - <% if reply.try(:user).try(:realname) == ' ' %> - <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> - <% end %> - <%= format_time(reply.created_on) %> -
              -
              - <% if reply.details.any? %> - <% details_to_strings(reply.details).each do |string| %> -

              <%= string %>

              - <% end %> - <% end %> -

              <%= reply.notes.html_safe %>

              -
              -
              -
              -
            • - <% end %> -
            -
            - <% end %> - -
            -
            <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
            -
            -
            - <%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f|%> - - -
            - -
            -

            - <% end%> -
            -
            -
            -
            -
            - -
            -
            +
            +
            +
            + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> +
            +
            +
            + <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> TO + <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%> +
            +
            + <%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey" %> + + <%= get_issue_priority(activity.priority_id)[1] %> + +
            +
            +
            指派给   + <% unless activity.assigned_to_id.nil? %> + <% if activity.try(:assigned_to).try(:realname) == ' ' %> + <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:assigned_to).try(:realname), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> + <% end %> + <% end %> +
            +
            + 时间: + <%=format_time(activity.created_on) %> +
            +
            +
            +
            + <% if activity.description? %> + <%= textAreailizable activity, :description, :attachments => activity.attachments %> + <% end %> +
            +
            +
            + + +
            +
            + <% if activity.attachments.any? %> + <% activity.attachments.each do |attachment| %> +
            + + + <%= link_to_short_attachment attachment,:length=> 58, :class => 'link_file_a fl newsBlue', :download => true -%> + + <% if attachment.is_text? %> + <%= link_to image_tag('magnifier.png'), + :controller => 'attachments', + :action => 'show', + :id => attachment, + :class => 'fl', + :filename => attachment.filename %> + <% end %> + + ( + <%= number_to_human_size attachment.filesize %>) + + + <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "c_orange" %>, + <%= format_time(attachment.created_on) %> + +
            + <% end %> + <% end %> +
            +
            +
            +
            + <% count = activity.journals.count %> +
            +
            +
            +
            回复(<%= count %>)
            +
            <%#= format_date(activity.updated_on) %>
            + <% if count > 3 %> + + <% end %> +
            + + <% replies_all_i = 0 %> + <% if count > 0 %> +
            +
              + <% activity.journals.reorder("created_on desc").each do |reply| %> + + <% replies_all_i=replies_all_i + 1 %> +
            • +
              + <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %> +
              +
              +
              + <% if reply.try(:user).try(:realname) == ' ' %> + <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(reply.created_on) %> +
              +
              + <% if reply.details.any? %> + <% details_to_strings(reply.details).each do |string| %> +

              <%= string %>

              + <% end %> + <% end %> +

              <%= reply.notes.html_safe %>

              +
              +
              +
              +
            • + <% end %> +
            +
            + <% end %> + +
            +
            <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
            +
            +
            + <%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f|%> + + +
            + +
            +

            + <% end%> +
            +
            +
            +
            +
            + +
            +
            diff --git a/app/views/users/_user_group_attr.html.erb b/app/views/users/_user_group_attr.html.erb index aa8166a04..652cb723a 100644 --- a/app/views/users/_user_group_attr.html.erb +++ b/app/views/users/_user_group_attr.html.erb @@ -11,7 +11,7 @@

            提醒:勾选后各小组必须在Trustie平台创建项目,教师可随时观察平台对各小组最新进展的实时统计。

            diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index bba7627b1..5f4cb4a8e 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -48,10 +48,12 @@
            <% if @homework && @homework.homework_type == 3 %> - - 合作成员:<%=User.current.show_name %>(组长) - - + <% unless defined?(show_member) && show_member %> + + 合作成员:<%=User.current.show_name %>(组长) + + + <% end %> <% end %>
            diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 57fe57c07..d9421f5ea 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -10,7 +10,7 @@ TO <%= link_to homework_common.course.name, course_path(homework_common.course_id), :class => "newsBlue ml15"%>
            -
        • @@ -34,7 +37,11 @@
        • <%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description %>
        • -
        • 教师:<%= User.find(item.tea_id).realname %>授课时间:<%= item.time.to_s + item.term%><%= User.find(item.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(item.tea_id).user_extensions.occupation : ''%>
        • +
        • + 教师:<%= User.find(item.tea_id).realname %> + 授课时间:<%= item.time.to_s + item.term%> + 更新时间:<%= format_date(item.updated_at)%> + <%= User.find(item.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(item.tea_id).user_extensions.occupation : ''%>
        @@ -51,7 +58,9 @@
      • 发布者:<%= User.find(item.author_id).login%>(<%= User.find(item.author_id).realname%>) - 发布时间:<%= format_date(item.created_on)%>
      • + 发布时间:<%= format_date(item.created_on)%> + 下载次数:<%= item.downloads%>次 +
      @@ -67,7 +76,7 @@
    • <%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description%>
    • -
    • 管理人员:<%= item.user_id ? User.find(item.user_id).login : '无' %>创建时间:<%= date_format_local( Project.find(item.id).created_on) %>
    • +
    • 管理人员:<%= item.user_id ? User.find(item.user_id).login : '无' %>更新时间:<%= date_format_local( Project.find(item.id).updated_on) %>
    • @@ -83,7 +92,7 @@
    • <%= item.try(:highlight).try(:content) ? item.highlight.content[0].html_safe : item.content.html_safe%>
    • -
    • 发帖人:<%= item.author_id ? User.find(item.author_id).login : '无' %>创建时间:<%= format_date( item.created_at) %>
    • +
    • 发帖人:<%= item.author_id ? User.find(item.author_id).login : '无' %>更新时间:<%= format_date( item.updated_at) %>
    • diff --git a/app/views/welcome/_search_attachment_results.html.erb b/app/views/welcome/_search_attachment_results.html.erb index 36c4fcbab..21ba68336 100644 --- a/app/views/welcome/_search_attachment_results.html.erb +++ b/app/views/welcome/_search_attachment_results.html.erb @@ -12,7 +12,9 @@
    • 发布者:<%= User.find(attachment.author_id).login%>(<%= User.find(attachment.author_id).realname%>) - 发布时间:<%= format_date(attachment.created_on)%>
    • + 发布时间:<%= format_date(attachment.created_on)%> + 下载次数:<%= attachment.downloads%>次 +
      diff --git a/app/views/welcome/_search_course_results.html.erb b/app/views/welcome/_search_course_results.html.erb index 89567063d..e51452ada 100644 --- a/app/views/welcome/_search_course_results.html.erb +++ b/app/views/welcome/_search_course_results.html.erb @@ -12,7 +12,11 @@
    • <%= course.try(:highlight).try(:description) ? course.highlight.description[0].html_safe : (course.description.present? ? course.description : '暂时没有该课程描述') %>
    • -
    • 教师:<%= User.find(course.tea_id).realname %>授课时间:<%= course.time.to_s + course.term%><%= User.find(course.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(course.tea_id).user_extensions.occupation : ''%>
    • +
    • + 教师:<%= User.find(course.tea_id).realname %> + 授课时间:<%= course.time.to_s + course.term%> + 更新时间:<%= format_date(course.updated_at)%> + <%= User.find(course.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(course.tea_id).user_extensions.occupation : ''%>
    • diff --git a/app/views/welcome/_search_memo_results.html.erb b/app/views/welcome/_search_memo_results.html.erb index c5fe9cc72..98f9ae7f0 100644 --- a/app/views/welcome/_search_memo_results.html.erb +++ b/app/views/welcome/_search_memo_results.html.erb @@ -12,7 +12,7 @@
    • <%= memo.try(:highlight).try(:content) ? memo.highlight.content[0].html_safe : memo.content.html_safe%>
    • -
    • 发帖人:<%= memo.author_id ? User.find(memo.author_id).login : '无' %>创建时间:<%= format_date( memo.created_at) %>
    • +
    • 发帖人:<%= memo.author_id ? User.find(memo.author_id).login : '无' %>更新时间:<%= format_date( memo.updated_at) %>
    • diff --git a/app/views/welcome/_search_project_results.html.erb b/app/views/welcome/_search_project_results.html.erb index b3ed44654..5775a939d 100644 --- a/app/views/welcome/_search_project_results.html.erb +++ b/app/views/welcome/_search_project_results.html.erb @@ -12,7 +12,7 @@
    • <%= project.try(:highlight).try(:description) ? project.highlight.description[0].html_safe : project.description%>
    • -
    • 管理人员:<%= project.user_id ? User.find(project.user_id).login : '无' %>创建时间:<%= date_format_local( Project.find(project.id).created_on) %>
    • +
    • 管理人员:<%= project.user_id ? User.find(project.user_id).login : '无' %>更新时间:<%= date_format_local( Project.find(project.id).updated_on) %>
    • diff --git a/app/views/welcome/_search_user_results.html.erb b/app/views/welcome/_search_user_results.html.erb index 459d3a27b..d1c8c2393 100644 --- a/app/views/welcome/_search_user_results.html.erb +++ b/app/views/welcome/_search_user_results.html.erb @@ -12,7 +12,9 @@
    • <%= User.find(user.id).user_extensions && User.find(user.id).user_extensions.brief_introduction.present? ? User.find(user.id).user_extensions.brief_introduction : '这位童鞋很懒,什么也没有留下~'%>
    • -
    • 加入时间:<%= format_date( User.find(user.id).created_on)%><%= User.find(user.id).user_extensions.occupation.present? ? '单位:'+User.find(user.id).user_extensions.occupation : ''%>
    • +
    • 加入时间:<%= format_date( User.find(user.id).created_on)%> + 最后登陆时间:<%= format_date( User.find(user.id).last_login_on)%> + <%= User.find(user.id).user_extensions.occupation.present? ? '单位:'+User.find(user.id).user_extensions.occupation : ''%>
    • diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 81b20a67e..03424bd5a 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1969,9 +1969,11 @@ zh: label_my_score: 我的评分 field_open_anonymous_evaluation: 是否使用匿评 label_course_empty_select: 尚未选择课程! + label_resource_subfield_empty_select: 尚未选择资源栏目! label_project_empty_select: 尚未选择项目! label_course_prompt: 课程: label_project_prompt: 项目: + label_resource_subfield_prompt: 资源栏目: label_contain_resource: 已包含资源: label_quote_resource_failed: ",此资源引用失败! " label_file_lost: 以下无法成功下载,请联系相关人员重新上传: diff --git a/config/routes.rb b/config/routes.rb index 52fa393ad..efce89e62 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -75,12 +75,13 @@ RedmineApp::Application.routes.draw do resources :files, :only => [:index, :new, :create] do collection do match "getattachtype", :via => [:get, :post] - match "search",:via => [:post,:get] + match "search_files_in_subfield",:via => [:post,:get] match "searchone4reload",:via => [:post,:get] - match "search_tag_attachment", :via => [:post,:get] + match "search_org_subfield_tag_attachment", :via => [:post,:get] + match "subfield_upload_file", :via => :post end member do - match "quote_resource_show", :via => [:get] + match "quote_resource_show_org_subfield", :via => [:get] end end end @@ -705,6 +706,9 @@ RedmineApp::Application.routes.draw do member do post 'add_journal' post 'add_journal_in_org' + get 'delete_journal' + get 'reply' + post 'add_reply' end resources :time_entries, :controller => 'timelog' do collection do @@ -806,6 +810,7 @@ RedmineApp::Application.routes.draw do post 'attachments/relationfiles', to: 'attachments#add_exist_file_to_projects', as: 'attach_relations' post 'attachments/courserelationfile', to: 'attachments#add_exist_file_to_course', as: 'course_attach_relation' post 'attachments/courserelationfiles', to: 'attachments#add_exist_file_to_courses', as: 'course_attach_relations' + match 'attachments/add_exist_file_to_org_subfield' get 'attachments/renderTag/:attchmentId', :to => 'attachments#renderTag', :attchmentId => /\d+/ resources :attachments, :only => [:show, :destroy] do collection do @@ -1046,6 +1051,7 @@ RedmineApp::Application.routes.draw do match 'tags/remove_tag_new', :as=>"remove_tag_new" match 'tags/tag_save', :as => "save_tag" match 'tags/update_tag_name',:as => "update_tag_name" + match 'tags/update_org_subfield_tag_name' match 'words/add_brief_introdution' diff --git a/db/migrate/20151215070238_delete_validate_course_contributor.rb b/db/migrate/20151215070238_delete_validate_course_contributor.rb new file mode 100644 index 000000000..704ca893d --- /dev/null +++ b/db/migrate/20151215070238_delete_validate_course_contributor.rb @@ -0,0 +1,13 @@ +class DeleteValidateCourseContributor < ActiveRecord::Migration + def up + course_contributors = CourseContributorScore.where("course_id>? and created_at 20151209085942) do +ActiveRecord::Schema.define(:version => 20151215112107) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -544,26 +544,23 @@ ActiveRecord::Schema.define(:version => 20151209085942) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :primary_key => "Num", :force => true do |t| - t.string "Defect", :limit => 50 - t.string "Category", :limit => 50 - t.string "File" - t.string "Method" - t.string "Module", :limit => 20 - t.string "Variable", :limit => 50 - t.integer "StartLine" - t.integer "IPLine" - t.string "IPLineCode", :limit => 200 - t.string "Judge", :limit => 15 - t.integer "Review", :limit => 1 + create_table "dts", :force => true do |t| + t.string "IPLineCode" t.string "Description" - t.text "PreConditions", :limit => 2147483647 - t.text "TraceInfo", :limit => 2147483647 - t.text "Code", :limit => 2147483647 + t.string "Num" + t.string "Variable" + t.string "TraceInfo" + t.string "Method" + t.string "File" + t.string "IPLine" + t.string "Review" + t.string "Category" + t.string "Defect" + t.string "PreConditions" + t.string "StartLine" t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "editor_of_documents", :force => true do |t| @@ -912,6 +909,16 @@ ActiveRecord::Schema.define(:version => 20151209085942) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_details_copy", :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_copy", ["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" @@ -1619,6 +1626,10 @@ ActiveRecord::Schema.define(:version => 20151209085942) do t.string "extra" end + create_table "temp", :id => false, :force => true do |t| + t.integer "id", :default => 0, :null => false + end + create_table "time_entries", :force => true do |t| t.integer "project_id", :null => false t.integer "user_id", :null => false diff --git a/plugins/redmine_ckeditor/app/views/issues/update_form.js.erb b/plugins/redmine_ckeditor/app/views/issues/update_form.js.erb index e7d3e2ad2..23bd5108b 100644 --- a/plugins/redmine_ckeditor/app/views/issues/update_form.js.erb +++ b/plugins/redmine_ckeditor/app/views/issues/update_form.js.erb @@ -9,3 +9,15 @@ $('#all_attributes').html('<%= escape_javascript(render :partial => 'form') %>') <% else %> $('#log_time').hide(); <% end %> +issue_desc_editor = KindEditor.create('#issue_description', + {"width":"85%", + "resizeType":0, + "no_label":true, + "autoHeightMode":true, + "afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);} if(typeof enableAt ==='function'){enableAt(self);} this.loadPlugin(\"autoheight\"),$(this.toolbar.div).hide();})", + "afterFocus":"eval(function(){$(this.toolbar.div).show();})", + "afterBlur":"eval(function(){$(this.toolbar.div).hide();})", + "emotionsBasePath":"http://localhost:3000", + "height":300,"allowFileManager":true, + "uploadJson":"/kindeditor/upload", + "fileManagerJson":"/kindeditor/filemanager"}); \ No newline at end of file diff --git a/public/assets/kindeditor/plugins/autoheight/autoheight.js b/public/assets/kindeditor/plugins/autoheight/autoheight.js index 3c25fe49e..b63dc7062 100644 --- a/public/assets/kindeditor/plugins/autoheight/autoheight.js +++ b/public/assets/kindeditor/plugins/autoheight/autoheight.js @@ -29,7 +29,7 @@ KindEditor.plugin('autoheight', function(K) { edit.iframe.height(minHeight); self.resize(null, Math.max( (K.IE ? body.scrollHeight : body.offsetHeight) - + 76, minHeight)); + + 33, minHeight)); } function init() { @@ -42,7 +42,7 @@ KindEditor.plugin('autoheight', function(K) { edit.iframe.height(minHeight); self.resize(null, Math.max( ((K.IE ? body.scrollHeight : body.offsetHeight) > 500 ? 500 : (K.IE ? body.scrollHeight : body.offsetHeight)) //限制初始化太高的情况 - + 76, minHeight)); + + 33, minHeight)); } if (self.isCreated) { diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 50f271a8a..901e302d3 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -590,7 +590,11 @@ function setupAjaxIndicator() { $('#ajax-indicator').hide(); if(MathJax && MathJax.Hub) MathJax.Hub.Queue(['Typeset', MathJax.Hub]); //如果是ajax刷新页面的话,手动执行MathJax的公式显示 + try{ + prettyPrint(); //如果刷新出来的页面如果存在代码行的话,也需要美化 + }catch (e){ + } }); } @@ -965,6 +969,7 @@ function showNormalImage(id) { var element=$("").attr("href",image.attr('src')); image.wrap(element); } + $('#'+id+' a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); //有图片才将链接变为弹出框 } - $('#'+id+' a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); + } diff --git a/public/javascripts/course.js b/public/javascripts/course.js index b3618cda4..c147850ef 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -598,11 +598,11 @@ function regex_evaluation_end(){ } var evaluation_start_time = new Date(evaluation_start); var evaluation_end_time = new Date(evaluation_end); - if(evaluation_end_time > evaluation_start_time){ + if(evaluation_end_time >= evaluation_start_time){ $("#homework_evaluation_end_time").text(""); return true; }else{ - $("#homework_evaluation_end_time").text("关闭匿评日期必须大于开启匿评日期"); + $("#homework_evaluation_end_time").text("关闭匿评日期不能小于开启匿评日期"); return false; } } @@ -1387,4 +1387,4 @@ function submit_course_feedback() { $("#course_feedback_new").submit(); var flag = true } -} +} diff --git a/public/javascripts/create_kindeditor.js b/public/javascripts/create_kindeditor.js new file mode 100644 index 000000000..3f555ac88 --- /dev/null +++ b/public/javascripts/create_kindeditor.js @@ -0,0 +1,173 @@ +//需求:表情栏可以隐藏显示,高度只要一点高 +function sd_create_editor(params){ + // var minHeight; //最小高度 + var paramsHeight = params.height; //设定的高度 + var id = arguments[1] ? arguments[1] : undefined; + var paramsWidth = params.width == undefined ? "100%" : params.width; + + var editor = params.kindutil.create(params.textarea, { + resizeType : 1,minWidth:"1px",width:"94%", + height:"33px",// == undefined ? "30px":paramsHeight+"px", + minHeight:"33px",// == undefined ? "30px":paramsHeight+"px", + items:['emoticons','fontname', + 'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|', + 'formatblock', 'fontsize', '|','indent', 'outdent', + '|','imagedirectupload'], + afterChange:function(){//按键事件 + + var edit = this.edit; + var body = edit.doc.body; + edit.iframe.height(paramsHeight); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : (params.kindutil.GECKO ? body.offsetHeight+26:body.offsetHeight)) , paramsHeight)); + }, + afterBlur:function(){ + //params.toolbar_container.hide(); + sd_check_editor_form_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); + if(this.isEmpty()) { + this.edit.html("我要回复"); + } + //params.toolbar_container.hide(); + $('#reply_image_' + id).addClass('imageFuzzy'); + if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html())){ + params.submit_btn.hide(); + params.toolbar_container.hide(); + this.resize("100%", null); + }else if(this.edit.html().trim() != ""){ + params.submit_btn.show(); + params.toolbar_container.show(); + } + + //params.submit_btn.css("display","none"); + }, + afterFocus: function(){ + var edit = this.edit; + var body = edit.doc.body; + if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(edit.html())){ + edit.html(''); + } + params.submit_btn.show(); + params.contentmsg.hide(); + params.toolbar_container.show(); + // params.toolbar_container.show(); + $('#reply_image_' + id).removeClass('imageFuzzy'); + //edit.iframe.width(paramsWidth); + this.resize(paramsWidth, null); + //params.submit_btn.show(); + }, + + afterCreate:function(){ + //params.submit_btn.hide(); + var toolbar = $("div[class='ke-toolbar']",params.div_form); + toolbar.css('display','inline'); + toolbar.css('padding',0); + $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情'); + params.toolbar_container.append(toolbar); + params.toolbar_container.hide(); + //init + var edit = this.edit; + var body = edit.doc.body; + edit.iframe[0].scroll = 'no'; + body.style.overflowY = 'hidden'; + //reset height + paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight; + edit.iframe.height(paramsHeight); + edit.html("我要回复"); + this.resize(null,paramsHeight);// Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ paramsHeight , paramsHeight) + // params.toolbar_container.hide(); + + } + }).loadPlugin('paste'); + return editor; +} + +function sd_check_editor_form_field(params){ + var result=true; + if(params.content!=undefined){ + if(params.content.isEmpty()){ + result=false; + } + if(params.content.html()!=params.textarea.html() || params.issubmit==true){ + params.textarea.html(params.content.html()); + params.content.sync(); + if(params.content.isEmpty() || /^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(params.textarea.html())){ + params.contentmsg.html('内容不能为空'); + params.contentmsg.css({color:'#ff0000'}); + }else{ + params.contentmsg.html('填写正确'); + params.contentmsg.css({color:'#008000'}); + } + params.contentmsg.show(); + } + } + return result; +} +function sd_create_form(params){ + params.form.submit(function(){ + var flag = false; + if(params.form.attr('data-remote') != undefined ){ + flag = true + } + var is_checked = sd_check_editor_form_field({ + issubmit:true, + content:params.editor, + contentmsg:params.contentmsg, + textarea:params.textarea + }); + if(is_checked){ + if(flag){ + return true; + }else{ + $(this)[0].submit(); + return false; + } + } + return false; + }); +} +function sd_reset_editor_form(params){ + params.form[0].reset(); + params.textarea.empty(); + if(params.editor != undefined){ + params.editor.html(params.textarea.html()); + } + params.contentmsg.hide(); +} +//第二个参数是高度,可以传,可以不传 +function sd_create_editor_from_data(id){ + var height = arguments[1] ? arguments[1] : undefined; + var width = arguments[2] ? arguments[2] : undefined; + KindEditor.ready(function (K) { + $("div[nhname='new_message_" + id + "']").each(function () { + var params = {}; + params.kindutil = K; + params.div_form = $(this); + params.form = $("form", params.div_form); + if (params.form == undefined || params.form.length == 0) { + return; + } + params.textarea = $("textarea[nhname='new_message_textarea_" + id + "']", params.div_form); + params.contentmsg = $("span[nhname='contentmsg_" + id + "']", params.div_form); + params.toolbar_container = $("div[nhname='toolbar_container_" + id + "']", params.div_form); + params.cancel_btn = $("#new_message_cancel_btn_" + id); + params.submit_btn = $("#new_message_submit_btn_" + id); + params.height = height; + params.width = width; + if (params.textarea.data('init') == undefined) { + params.editor = sd_create_editor(params,id); + sd_create_form(params); + params.cancel_btn.click(function () { + sd_reset_editor_form(params); + }); + params.submit_btn.click(function () { + params.form.submit(); + }); + params.textarea.data('init', 1); + $(this).show(); + } + }); + }); + + div_form = $("div[nhname='new_message_" + id + "']"); + $(".ke-edit", div_form).css("height","33px"); + $(".ke-edit-iframe",div_form).css("height","33px"); +} \ No newline at end of file diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index d375a90ee..65741adc8 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -213,11 +213,11 @@ function regex_evaluation_end(){ } var evaluation_start_time = new Date(evaluation_start); var evaluation_end_time = new Date(evaluation_end); - if(evaluation_end_time > evaluation_start_time){ + if(evaluation_end_time >= evaluation_start_time){ $("#homework_evaluation_end_time").text(""); return true; }else{ - $("#homework_evaluation_end_time").text("关闭匿评日期必须大于开启匿评日期"); + $("#homework_evaluation_end_time").text("关闭匿评日期不能小于开启匿评日期"); return false; } } @@ -267,8 +267,15 @@ function edit_student_work(id) { if(regexStudentWorkName()&®exStudentWorkDescription()) { - $("#edit_student_work_" + id).submit(); - $("#ajax-indicator").hide(); + if($("#group_member_ids").length > 0) { + if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) { + $("#edit_student_work_" + id).submit(); + $("#ajax-indicator").hide(); + } + } else { + $("#edit_student_work_" + id).submit(); + $("#ajax-indicator").hide(); + } } } diff --git a/public/javascripts/project.js b/public/javascripts/project.js index f3e6b76ce..a7bf954a0 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -541,4 +541,14 @@ function cancel_relation(orgId,projectId){ }); } }); +} + +function issueEditShow(){ + $("#issue_detail").hide(); + $("#issue_edit").show(); +} + +function issueDetailShow(){ + $("#issue_edit").hide(); + $("#issue_detail").show(); } \ No newline at end of file diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 25d0d6a32..6a6c3a7e7 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -41,7 +41,7 @@ a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;} .pingBoxTit{ float:left; width:625px; margin-left:10px;} .pingText{border:1px solid #CCCCCC; margin:5px; padding:5px; width:610px; height:20px; } .pingBackTit{ float:left; width:573px; margin-left:10px; } -.hworkUl{ height:30px; border-bottom:1px solid #eaeaea; line-height:30px; vertical-align:middle; background-color: #f6f6f6;} +.hworkUl{ height:30px;width:720px; border-bottom:1px solid #eaeaea; line-height:30px; vertical-align:middle; background-color: #f6f6f6;} .hworkH30 {height:30px !important; line-height:30px !important;} .hworkListRow {height:65px; border-bottom:1px dashed #eaeaea; line-height:65px; vertical-align:middle; position: relative;} .hworkListRow:hover {background-color:#f6f6f7;} @@ -1209,6 +1209,7 @@ a:hover.blueCir{ background:#3598db; color:#fff;} .proHelp {background:url(/images/course/hwork_icon.png) -5px -124px no-repeat; display:inline-block; width:15px; height:15px; display:inline-block;} .hworkPrName {width:110px; max-width:110px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;} .mr150 {margin-right:150px;} +.relatePInfo {position:absolute; background-color:#ffffff; padding:3px 8px; white-space:nowrap; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); z-index:999; color:#585858; cursor:pointer; display:none;} /*上传资源弹窗*/ .resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;} @@ -1229,4 +1230,4 @@ div.disable_link {background-color: #c1c1c1 !important;} /*新课程资源库*/ .reCon{ margin:5px; width:710px;} -.reTop{width:710px; height:40px; background:#eaeaea; padding:5px;} +.reTop{width:710px; height:40px; background:#eaeaea; padding:5px;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 0ed4df627..005f771a3 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1328,7 +1328,7 @@ a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; c .ul_normal_color li {list-style-position:inside; padding-left:1px; list-style-image:url('../images/news_dot.png')} span.author { font-size: 0.9em; color: #888; } .ReplyToMessageInputContainer {width: 582px;float: left;} - +.ReplyToMessageContainer {border-bottom:1px solid #e3e3e3; width:632px; margin:0px auto; margin-top:15px; min-height:60px;} /*全站搜索*/ .blocks {padding:15px; background-color:#ffffff; border:1px solid #dddddd;} #searchBanner {border-bottom:1px solid #d0d0d0;} @@ -1381,3 +1381,5 @@ a:hover.blueCir{ background:#3598db; color:#fff;} .proHelp {background:url(/images/course/hwork_icon.png) -5px -124px no-repeat; display:inline-block; width:15px; height:15px; display:inline-block;} .hworkPrName {width:110px; max-width:110px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;} .mr150 {margin-right:150px;} +.relatePInfo {position:absolute; background-color:#ffffff; padding:3px 8px; white-space:nowrap; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); z-index:999; color:#585858; cursor:pointer; display:none;} + diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css index 584f1bafa..44dcc70e3 100644 --- a/public/stylesheets/org.css +++ b/public/stylesheets/org.css @@ -83,4 +83,6 @@ a.linkGrey8:hover {color:#585858;} .re_con{ margin:5px; width:665px;} .re_con_top{color:#494949; } .re_con_top span{ color:#999999; font-weight:bold;} -ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; } \ No newline at end of file +ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; } + +.popbox_polls{width:300px;height:100px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} \ No newline at end of file diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css index cfc3b1b4a..bcace8cf2 100644 --- a/public/stylesheets/polls.css +++ b/public/stylesheets/polls.css @@ -145,7 +145,7 @@ a:hover.btn_pu{ background:#3cb761;} /*问卷提交时弹出框*/ .alert_box{width:250px;height:180px;position:fixed !important;z-index:100;left:60%;top:65%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} -.commit{height: 28px;display: block;width: 80px;color: #fff !important;background: #15bccf;text-align: center;padding-top: 4px;margin-left: 60px;margin-top: 4px;margin-right: 10px;} +.commit{font-size: 1.2em;height: 28px;display: block;width: 80px;color: #fff !important;background: #15bccf;text-align: center;padding-top: 4px;margin-left: 70px;margin-top: 4px;margin-right: 10px;} /******确定弹框***********/ .poll_alert_form{width:140px;height:180px;position:fixed;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} .polls_alert_btn_box{width: 100%;margin: 0 auto;padding-left: 45px;} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index b1367b882..1663df30f 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -161,9 +161,9 @@ a:hover.invi_search_btn{ background:#0da1b2; border:1px solid #0da1b2;} /*问题跟踪*/ .problem_top{ margin:10px 0 ;} -.problem_search_input{ border:1px solid #64bdd9; width:180px; height:24px; color:#9b9b9b; padding-left:5px; margin-bottom:5px;} -a.problem_search_btn{ background:#64bdd9; color:#fff; text-align: center; width:40px; height:22px;border:1px solid #64bdd9; padding-top:2px; cursor:pointer;} -a:hover.problem_search_btn{ background:#3da1c1; border:1px solid #3da1c1;} +.problem_search_input{ border:1px solid #dddddd; width:180px; height:24px; color:#9b9b9b; padding-left:5px; margin-bottom:5px;} +a.problem_search_btn{ background:#269ac9; color:#fff; text-align: center; width:40px; height:22px;border:1px solid #64bdd9; padding-top:2px; cursor:pointer;} +a:hover.problem_search_btn{ background:#269ac9; border:1px solid #3da1c1;} a.problem_new_btn{ margin-left:10px; border:1px solid #ff7143; color:#ff7143; width:60px; height:21px; font-size:12px; text-align:center; padding-top:3px;} a:hover.problem_new_btn{ background:#ff7143; color:#fff;} .problem_p{ color:#535252; margin-top:5px;} @@ -1065,4 +1065,23 @@ a.homepagePostTypeQuiz { padding-left: 23px; } -.loadMore {font-size:14px;width:748px; text-align:center; display:block; border:1px solid #dddddd; background-color:#ffffff; float:right;padding:5px 0; letter-spacing: 1px;} \ No newline at end of file +.loadMore {font-size:14px;width:748px; text-align:center; display:block; border:1px solid #dddddd; background-color:#ffffff; float:right;padding:5px 0; letter-spacing: 1px;} + +img.date-trigger { + display:block; + cursor: pointer; + vertical-align: middle; + float:left; + border:1px solid #dddddd; + padding:1px 2px 2px 2px; + border-left:none; +} +.proInfoBox{ margin-left:60px; border:1px solid #dddddd; height:45px; padding:10px 0; background-color:#f1f1f1;} +.proInfoBox ul li{ height:24px;} +.proInfoP{color:#000000 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } + +a.link_file_a{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; } +a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;} +.imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;} +.ReplyToMessageInputContainer {width: 582px;float: left;} +.ReplyToMessageContainer {border-bottom:1px solid #e3e3e3; width:632px; margin:0px auto; margin-top:15px; min-height:60px;} \ No newline at end of file diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index fa1767ad7..13362dd19 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -12,7 +12,7 @@ textarea {resize: none;} .pInline {margin:0px; padding:0px; display:inline-block;} /*常用*/ -select,input,textarea{ border:1px solid #269ac9; background:#fff; color:#000; padding-left:5px} +select,input,textarea{ border:1px solid #dddddd; background:#fff; color:#000; padding-left:5px} .sub_btn{ cursor:pointer; -moz-border-radius:3px; -webkit-border-radius:3px; border:1px solid #707070; color:#000; border-radius:3px; padding:1px 10px; margin-bottom:10px; background:#dbdbdb;} .sub_btn:hover{ background:#b5e2fa; color:#000; border:1px solid #3c7fb1;} table{ background:#fff;} @@ -73,6 +73,7 @@ h4{ font-size:14px; color:#3b3b3b;} .ml30{ margin-left:30px;} .ml38{ margin-left:38px;} .ml60{ margin-left:60px;} +.ml160 {margin-left:160px;} .ml80{ margin-left:80px;} .ml90{ margin-left:90px;} .ml100{ margin-left:100px;} @@ -86,6 +87,7 @@ h4{ font-size:14px; color:#3b3b3b;} .mr55{ margin-right:55px;} .mr10{ margin-right:10px;} .mr15 {margin-right:15px;} +.mr18 {margin-right:15px;} .mr20{ margin-right:20px;} .mr25 {margin-right:25px;} .mr30{ margin-right:30px;} @@ -145,7 +147,8 @@ h4{ font-size:14px; color:#3b3b3b;} .w583{ width:583px;} .w350{ width:350px;} .w610{ width:610px;} -.w600{ width:600px !important;} +.w60{ width:600px !important;} +.w606{ width:606px } .h20{height: 20px;} .h22{ height:22px;} .h26{ height:26px;}