diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 086ecfb7f..a44b58789 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -337,6 +337,19 @@ class AdminController < ApplicationController format.html end end + + #学校列表 + def schools + @school_name = params[:school_name] + if @school_name + @schools = School.where("name like '%#{@school_name}%'") + else + @schools = School.all + end + respond_to do |format| + format.html + end + end #移动端版本管理 def mobile_version @versions = PhoneAppVersion.reorder('created_at desc') diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a1c7ae875..71715035e 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -39,9 +39,14 @@ class CoursesController < ApplicationController else @state = 5 #未登录 end - respond_to do |format| - format.js { render :partial => 'set_join', :locals => {:user => user, :course => course, :object_id => params[:object_id]} } - end + # if @state == 1 || @state == 3 + # respond_to course_path(course.id) + # else + respond_to do |format| + format.js { render :partial => 'set_join', :locals => {:user => user, :course => course, :object_id => params[:object_id]} } + end + #end + rescue Exception => e @state = 4 #已经加入了课程 respond_to do |format| @@ -119,47 +124,47 @@ class CoursesController < ApplicationController @course_pages = Paginator.new @course_count, per_page_option, params['page'] # 课程的动态数 - @course_activity_count=Hash.new - @courses_all.each do |course| - @course_activity_count[course.id]=0 - end - - case params[:course_sort_type] - when '0' - @courses = @courses_all.order("created_at desc") - @s_type = 0 - @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) - - @course_activity_count=get_course_activity @courses,@course_activity_count - - when '1' - @courses = @courses_all.order("course_ac_para desc") - @s_type = 1 - @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) - - @course_activity_count=get_course_activity @courses,@course_activity_count - - when '2' - @courses = @courses_all.order("watchers_count desc") - @s_type = 2 - @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) - - @course_activity_count=get_course_activity @courses,@course_activity_count - - when '3' - @course_activity_count=get_course_activity @courses_all,@course_activity_count_array - @courses=handle_course @courses_all,@course_activity_count - @s_type = 3 - @courses = @courses[@course_pages.offset, @course_pages.per_page] - - else - @s_type = 0 - @courses = @courses_all.order("created_at desc") - @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) - - @course_activity_count=get_course_activity @courses,@course_activity_count - - end + # @course_activity_count=Hash.new + # @courses_all.each do |course| + # @course_activity_count[course.id]=0 + # end + # + # case params[:course_sort_type] + # when '0' + # @courses = @courses_all.order("created_at desc") + # @s_type = 0 + # @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) + # + # @course_activity_count=get_course_activity @courses,@course_activity_count + # + # when '1' + # @courses = @courses_all.order("course_ac_para desc") + # @s_type = 1 + # @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) + # + # @course_activity_count=get_course_activity @courses,@course_activity_count + # + # when '2' + # @courses = @courses_all.order("watchers_count desc") + # @s_type = 2 + # @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) + # + # @course_activity_count=get_course_activity @courses,@course_activity_count + # + # when '3' + # @course_activity_count=get_course_activity @courses_all,@course_activity_count_array + # @courses=handle_course @courses_all,@course_activity_count + # @s_type = 3 + # @courses = @courses[@course_pages.offset, @course_pages.per_page] + # + # else + # @s_type = 0 + # @courses = @courses_all.order("created_at desc") + # @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) + # + # @course_activity_count=get_course_activity @courses,@course_activity_count + # + # end end respond_to do |format| @@ -604,7 +609,7 @@ class CoursesController < ApplicationController def toggleCourse @course_prefs = Course.find_by_extra(@course.extra) - unless (@course_prefs.student != User.current || User.current.admin?) + unless (User.current.allowed_to?(:as_teacher,@course_prefs) || User.current.admin?) render_403 end end @@ -658,92 +663,9 @@ class CoursesController < ApplicationController end def show - if params[:jump] && redirect_to_course_menu_item(@course, params[:jump]) - return - end - @users_by_role = @course.users_by_role - if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id))) - @user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id) - end - @key = User.current.rss_key - #新增内容 - @days = Setting.activity_days_default.to_i - if params[:from] - begin; @date_to = params[:from].to_date + 1; rescue; end - end - has = { - "show_course_files" => true, - "show_course_news" => true, - "show_course_messages" => true, - #"show_course_journals_for_messages" => true, - # "show_bids" => true, - # "show_homeworks" => true, - "show_polls" => true - } - @date_to ||= Date.today + 1 - @date_from = (@date_to - @days) > @course.created_at.to_date ? (@date_to - @days) : @course.created_at.to_date - @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id])) - if @author.nil? - # 显示老师和助教的活动 - # @authors = searchTeacherAndAssistant(@course) - @authors = course_all_member(@course) - events = [] - key = "course_events_#{@course.id}".to_sym - if Rails.env.production? && Setting.course_cahce_enabled? - events = Rails.cache.read(key) || [] - end - if events.empty? - @authors.each do |author| - @activity = Redmine::Activity::Fetcher.new(User.current, :course => @course, - :with_subprojects => false, - :author => author.user) - - @activity.scope_select {|t| has["show_#{t}"]} - # modify by nwb - # 添加私密性判断 - if User.current.member_of_course?(@course)|| User.current.admin? - events += @activity.events(@days, @course.created_at) - else - events += @activity.events(@days, @course.created_at, :is_public => 1) - end - end - Rails.cache.write(key, events) if Rails.env.production? && Setting.course_cahce_enabled? - end - else - # @author = @course.teacher - @activity = Redmine::Activity::Fetcher.new(User.current, :course => @course, - :with_subprojects => false, - :author => @author) - - @activity.scope_select {|t| has["show_#{t}"]} - # modify by nwb - # 添加私密性判断 - if User.current.member_of_course?(@course)|| User.current.admin? - events = @activity.events(@days, @course.created_at) - else - events = @activity.events(@days, @course.created_at, :is_public => 1) - end - end - - # 无新动态时,显示老动态 - if events.count == 0 - if User.current.member_of_course?(@course)|| User.current.admin? - events = @activity.events - else - events = @activity.events(:is_public => 1) - end - end - @sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category' - if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id))) - @user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id) - end - - sorted_events = sort_activity_events_course(events) - events = paginateHelper sorted_events,10 - @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)} - # documents - - + course_activities = @course.course_activities.order("created_at desc") + @canShowRealName = User.current.member_of_course? @course + @course_activities = paginateHelper course_activities,10 respond_to do |format| format.html{render :layout => 'base_courses'} format.api diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 19c1214e2..7b81d12db 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -177,11 +177,11 @@ class FilesController < ApplicationController def index @flag = params[:flag] || false #sort_init 'filename', 'asc' - sort_init 'created_on', 'desc' - sort_update 'created_on' => "#{Attachment.table_name}.created_on", - 'filename' => "#{Attachment.table_name}.filename", - 'size' => "#{Attachment.table_name}.filesize", - 'downloads' => "#{Attachment.table_name}.downloads" + # sort_init 'created_on', 'desc' + # sort_update 'created_on' => "#{Attachment.table_name}.created_on", + # 'filename' => "#{Attachment.table_name}.filename", + # 'size' => "#{Attachment.table_name}.filesize", + # 'downloads' => "#{Attachment.table_name}.downloads" sort = "" @sort = "" @order = "" diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 0a33ef87a..21f781a1a 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -1,6 +1,7 @@ class HomeworkCommonController < ApplicationController require 'net/http' require 'json' + require "base64" layout "base_courses" before_filter :find_course, :only => [:index,:new,:create,:next_step] before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy] @@ -22,7 +23,7 @@ class HomeworkCommonController < ApplicationController # # @homework = HomeworkCommon.new # @homework.safe_attributes = params[:homework_common] - # @homework.late_penalty = 0 + # @homework.late_penalty = 2 # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') # @homework.publish_time = Time.now.strftime('%Y-%m-%d') # @@ -30,7 +31,7 @@ class HomeworkCommonController < ApplicationController # #匿评作业相关属性 # @homework_detail_manual = HomeworkDetailManual.new # @homework_detail_manual.ta_proportion = 0.6 - # @homework_detail_manual.absence_penalty = 0 + # @homework_detail_manual.absence_penalty = 2 # @homework_detail_manual.evaluation_num = 3 # @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') # @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') @@ -40,9 +41,9 @@ class HomeworkCommonController < ApplicationController # @homework_detail_programing = HomeworkDetailPrograming.new # @homework.homework_detail_programing = @homework_detail_programing # end - # respond_to do |format| - # format.html - # end + respond_to do |format| + format.html + end end #新建作业下一步 @@ -51,7 +52,7 @@ class HomeworkCommonController < ApplicationController @homework = HomeworkCommon.new @homework.safe_attributes = params[:homework_common] - @homework.late_penalty = 0 + @homework.late_penalty = 2 @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') @homework.publish_time = Time.now.strftime('%Y-%m-%d') @@ -59,7 +60,7 @@ class HomeworkCommonController < ApplicationController #匿评作业相关属性 @homework_detail_manual = HomeworkDetailManual.new @homework_detail_manual.ta_proportion = 0.6 - @homework_detail_manual.absence_penalty = 0 + @homework_detail_manual.absence_penalty = 2 @homework_detail_manual.evaluation_num = 3 @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') @@ -99,12 +100,14 @@ class HomeworkCommonController < ApplicationController question = {title:homework.name,content:homework.description} question[:input] = [] question[:output] = [] - if params[:input] && params[:output] + if params[:input] && params[:output] && params[:result] params[:input].each do |k,v| if params[:output].include? k homework_test = HomeworkTest.new homework_test.input = v homework_test.output = params[:output][k] + homework_test.result = params[:result][k] + homework_test.error_msg = params[:error_msg] homework.homework_tests << homework_test question[:input] << homework_test.input question[:output] << homework_test.output @@ -221,17 +224,21 @@ class HomeworkCommonController < ApplicationController homework_test = HomeworkTest.find id homework_test.destroy if homework_test end - if params[:input] && params[:output] + if params[:input] && params[:output] && params[:result] params[:input].each do |k,v| if params[:output].include? k homework_test = HomeworkTest.find_by_id k if homework_test #已存在的测试,修改 homework_test.input = v homework_test.output = params[:output][k] + homework_test.result = params[:result][k] + homework_test.error_msg = params[:error_msg] else #不存在的测试,增加 homework_test = HomeworkTest.new homework_test.input = v homework_test.output = params[:output][k] + homework_test.result = params[:result][k] + homework_test.error_msg = params[:error_msg] homework_test.homework_common = @homework end homework_test.save @@ -351,6 +358,24 @@ class HomeworkCommonController < ApplicationController end end + def programing_test + test = {language:params[:language],src:Base64.encode64(params[:src]),input:[params[:input]],output:[params[:output]]} + @index = params[:index] + uri = URI('http://192.168.80.21:8080/api/realtime.json') + body = test.to_json + res = Net::HTTP.new(uri.host, uri.port).start do |client| + request = Net::HTTP::Post.new(uri.path) + request.body = body + request["Content-Type"] = "application/json" + client.request(request) + end + result = JSON.parse(res.body) + @err_msg = result["compile_error_msg"] + result["results"].each do |re| + @result = re["status"] + end + end + private #获取课程 def find_course diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 185e7128e..1a8e75b54 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -72,7 +72,7 @@ class NewsController < ApplicationController @news_count = scope.count @q = params[:subject] - if params[:subject].nil? + if params[:subject].nil? || params[:subject].blank? scope_order = scope.all(:include => [:author, :course], :order => "#{News.table_name}.created_on DESC") else diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 758747e02..edf8c2259 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -1,3 +1,4 @@ +#encoding utf-8 class PollController < ApplicationController before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll] before_filter :find_container, :only => [:new,:create, :index] @@ -137,11 +138,19 @@ class PollController < ApplicationController @poll_questions.poll_answers.new question_option end end - if @poll_questions.save - respond_to do |format| - format.js - end + # 如果是插入的话,那么从插入的这个id以后的question_num都将要+1 + if params[:quest_id] + @is_insert = true + @poll.poll_questions.where("question_number > #{params[:quest_num].to_i}").update_all(" question_number = question_number + 1") + @poll_question_num = params[:quest_num].to_i + @poll_questions.question_number = params[:quest_num].to_i + 1 end + if @poll_questions.save + respond_to do |format| + format.js + end + end + end #修改题目 @@ -328,6 +337,37 @@ class PollController < ApplicationController end end + + def import_poll + @poll = Poll.find(params[:to_id]) + question_num = @poll.poll_questions.select("max(question_number) question_number").first.question_number + import_poll = Poll.find(params[:import_id]) + import_poll.poll_questions.each_with_index do |question,index| + option = { + :is_necessary => question.is_necessary, + :question_title => question.question_title, + :question_type => question.question_type, + :question_number => question_num + index+1 + } + poll_questions = @poll.poll_questions.new option + for i in 1..question.poll_answers.count + answer = question.poll_answers[i-1][:answer_text] + question_option = { + :answer_position => i, + :answer_text => answer + } + poll_questions.poll_answers.new question_option + end + @poll.poll_questions << poll_questions + end + if @poll.save + @poll = Poll.find(params[:to_id]) + respond_to do |format| + format.js + end + end + end + #重新发布问卷 def republish_poll @poll.poll_questions.each do |poll_question| @@ -371,6 +411,70 @@ class PollController < ApplicationController end end + # 将其他地方的问卷导出来 + def other_poll + # 查作者是我,或者作者是当前课程的老师,且不在当前课程内的问卷 进行导入 + tea_ids = '(' + tea_ids << Course.find(params[:polls_group_id]).tea_id.to_s << ','<< User.current.id.to_s << ')' + @polls = Poll.where("user_id in #{tea_ids} and polls_type = 'course' and polls_group_id != #{params[:polls_group_id]}") + @polls_group_id = params[:polls_group_id] + respond_to do |format| + format.js + end + end + + # 将问卷导入本课程 + def import_other_poll + course_id = params[:course_id] + @course = Course.find(course_id) + params[:polls].each_with_index do |p,i| + poll = Poll.find(p) + option = { + :polls_name => poll.polls_name || l(:label_poll_new), + :polls_type => 'Course', + :polls_group_id => course_id, + :polls_status => 1, + :user_id => User.current.id, + :published_at => Time.now, + :closed_at => Time.now, + :show_result => 1, + :polls_description => poll.polls_description + } + @poll = Poll.create option + + poll.poll_questions.each do | q| + #question_title = params[:poll_questions_title].nil? || params[:poll_questions_title].empty? ? l(:label_enter_single_title) : params[:poll_questions_title] + option = { + :is_necessary => q[:is_necessary], + :question_title => q[:question_title], + :question_type => q[:question_type] || 1, + :question_number => q[:question_number] + } + @poll_questions = @poll.poll_questions.new option + + for i in 1..q.poll_answers.count + answer = q.poll_answers[i-1].nil? ? l(:label_new_answer) : q.poll_answers[i-1][:answer_text] + question_option = { + :answer_position => i, + :answer_text => answer + } + @poll_questions.poll_answers.new question_option + end + end + @poll.save + end + @is_teacher = User.current.allowed_to?(:as_teacher,@course) + if @is_teacher + polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}") + else + polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id} and polls_status = 2") + end + @polls = paginateHelper polls,20 #分页 + respond_to do |format| + format.js + end + end + private def find_poll_and_course @poll = Poll.find params[:id] diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 2efaf591a..f042bba50 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -86,8 +86,14 @@ class ProjectsController < ApplicationController @project_pages = Project.project_entities.visible.like(params[:name]).page(params[:page]).per(10) else @project_pages = Project.project_entities.visible.page(params[:page] ).per(10) + @project_pages = Project.project_entities.visible.page(params[:page] ).per(10) end @projects = @project_pages.order("created_on desc") + @limit = 10#per_page_option + + @project_count = Project.project_entities.visible.like(params[:name]).page(params[:page]).count + @project_pages = Paginator.new @project_count, @limit, params['page'] + respond_to do |format| format.html { render :layout => 'base' @@ -150,11 +156,15 @@ class ProjectsController < ApplicationController end def new - @issue_custom_fields = IssueCustomField.sorted.all - @trackers = Tracker.sorted.all - @project = Project.new - @project.safe_attributes = params[:project] - render :layout => 'base' + if User.current.login? + @issue_custom_fields = IssueCustomField.sorted.all + @trackers = Tracker.sorted.all + @project = Project.new + @project.safe_attributes = params[:project] + render :layout => 'base' + else + redirect_to signin_url + end end def share @@ -167,6 +177,10 @@ class ProjectsController < ApplicationController end def create + unless User.current.login? + redirect_to signin_url + return + end @issue_custom_fields = IssueCustomField.sorted.all @trackers = Tracker.sorted.all @project = Project.new @@ -280,11 +294,11 @@ class ProjectsController < ApplicationController # 根据私密性,取出符合条件的所有数据 if User.current.member_of?(@project) || User.current.admin? - @events_pages = ForgeActivity.where("project_id = ?",@project).order("created_at desc").page(params['page'|| 1]).per(20); + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type != ?",@project, "Document" ).order("created_at desc").page(params['page'|| 1]).per(20); #events = @activity.events(@date_from, @date_to) else @events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public - = ?",@project,1).order("created_at desc") + = ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc") .page(params['page'|| 1]).per(10); # @events = @activity.events(@date_from, @date_to, :is_public => 1) end @@ -361,37 +375,6 @@ class ProjectsController < ApplicationController end end - # dts测试工具 - def dts_dep - render_403 unless User.current.admin? - @dts = Dts.all - end - - # dts云部署 - def yun_dep - render_403 unless User.current.admin? - end - - # 软件知识库 - def soft_knowledge - render_403 unless User.current.admin? - end - - # 在线开发平台 - def online_dev - render_403 unless User.current.admin? - end - - # 软件资源库 - def soft_file - render_403 unless User.current.admin? - end - - # 软件服务 - def soft_service - render_403 unless User.current.admin? - end - #发送邮件邀请新用户 def invite_members_by_mail if User.current.member_of?(@project) || User.current.admin? diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 303e4a213..e0aea0c2e 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -449,6 +449,8 @@ update def stats @project_id = params[:id] @repository_id = @repository.identifier + # 提交次数统计 + @status_commit_count = Changeset.count(:conditions => ["#{Changeset.table_name}.repository_id = ?", @repository.id]) render :layout => 'base_projects' end @@ -463,8 +465,6 @@ update data = graph_author_commits_per_month(@repository) when "author_commits_six_month" data = author_commits_six_month(@repository) - when "author_qoc_per_author" - data = graph_author_qoc_per_author(@repository) when "author_code_six_months" data = author_code_six_month(@repository) end @@ -658,7 +658,7 @@ update ) graph.add_data( :data => commits_data, - :title => l(:label_revision_plural) + :title => l(:label_revision_commit_count) ) graph.burn end @@ -694,7 +694,7 @@ update ) graph.add_data( :data => commits_data, - :title => l(:label_revision_plural) + :title => l(:label_revision_commit_count) ) graph.burn end diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index 008fe00fc..3e0c280ac 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -4,28 +4,21 @@ class SchoolController < ApplicationController def upload uploaded_io = params[:logo] - school_id = 0 - schools = School.where("name = ?", params[:school]) - - schools.each do |s| - school_id = s.id - end - + school_id ||= params[:id] unless uploaded_io.nil? File.open(Rails.root.join('public', 'images', 'school', school_id.to_s+'.png'), 'wb') do |file| file.write(uploaded_io.read) end - s1 = School.find(school_id) s1.logo_link = '/images/school/'+school_id.to_s+'.png' s1.save - - - end + end + redirect_to admin_schools_url(:school_name => params[:school_name]) end def upload_logo - + @school = School.find params[:id] + @school_name = params[:school_name] end #获取制定学校开设的课程数 diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 3e1e0ba29..01f858442 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -387,8 +387,8 @@ class StudentWorkController < ApplicationController if stundet_work && params[:results] && params[:results].class.to_s == "Array" homework_common = stundet_work.homework_common params[:results].each do |result| - homework_test = homework_common.homework_tests.where("input = '#{result[:input]}' AND output = '#{result[:output]}'").first - if homework_test + homework_tests = homework_common.homework_tests.where("input = '#{result[:input]}' AND output = '#{result[:output]}'") + homework_tests.each do |homework_test| student_work_test = StudentWorkTest.new student_work_test.student_work = stundet_work student_work_test.homework_test = homework_test diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index fa5ce8405..410bd44e1 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -112,39 +112,20 @@ class UsersController < ApplicationController #added by young def user_projects - - #add by huang unless User.current.admin? if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?) render_404 return end end - #end - # if User.current.admin? - # @memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}") - # else - # cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" - # @memberships = @user.memberships.all(:conditions => cond) - # end - #events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20) - #@events_by_day = events.group_by(&:event_date) - # @state = 0 - - limit = 10; - query = Project.joins("join members m on #{Project.table_name}.id=m.project_id") - query = query.where("m.user_id = ? and #{Project.table_name}.project_type=?",@user.id,Project::ProjectType_project) + projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc") if(params[:status] == '1') - query = query.where("#{Project.table_name}.user_id = ?",@user.id); + projects = projects.where("projects.user_id = ?",@user.id) elsif(params[:status] == '2') - query = query.where("#{Project.table_name}.user_id <> ?",@user.id); + projects = projects.where("projects.user_id <> ?",@user.id) end - @obj_count = query.count(); - - @obj_pages = Paginator.new @obj_count,limit,params['page'] - @list = query.order("#{Project.table_name}.updated_on desc,#{Project.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); - @params = params - + @list = paginateHelper projects,10 + @params = params[:status] respond_to do |format| format.html{render :layout=>'base_users_new'} format.api @@ -262,75 +243,35 @@ class UsersController < ApplicationController def user_courses unless User.current.admin? - if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?) + if !@user.active? render_404 return end end - - #@user.coursememberships.all(:conditions => Course.visible_condition(User.current)) - - limit = 10; - query = Course.joins("join members m on #{Course.table_name}.id=m.course_id") - query = query.where("m.user_id = ?",@user.id) + courses = @user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc") if(params[:status] == '1') - query = query.where("endup_time >= ? or endup_time is null or endup_time=''",Time.now); + courses = courses.where("endup_time >= ? or endup_time is null or endup_time=''",Time.now) elsif(params[:status] == '2') - query = query.where("endup_time < ?",Time.now); + courses = courses.where("endup_time < ?",Time.now) end - @obj_count = query.count(); - - @obj_pages = Paginator.new @obj_count,limit,params['page'] - @list = query.order("#{Course.table_name}.updated_at desc,#{Course.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); - @params = params + @list = paginateHelper courses,10 + @params = params[:status] render :layout=>'base_users_new' - - # if User.current == @user || User.current.admin? - # membership = @user.coursememberships.all - # else - # membership = @user.coursememberships.all(:conditions => Course.visible_condition(User.current)) - # end - # - # membership.sort! {|older, newer| newer.created_on <=> older.created_on } - # @memberships = [] - # membership.collect { |e| - # @memberships.push(e) - # } - # ## 判断课程是否过期 [需封装] - # @memberships_doing = [] - # @memberships_done = [] - # #now_time = Time.now.year - # @memberships.map { |e| - # #end_time = e.course.get_time.year - # isDone = course_endTime_timeout?(e.course) - # if isDone - # @memberships_done.push e - # else - # @memberships_doing.push e - # end - # } - # respond_to do |format| - # format.html - # format.api - # end end # modified by fq def user_newfeedback - @jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @jours.update_all(:is_readed => true, :status => false) - @jours.each do |journal| - fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false) + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + if User.current == @user + jours.update_all(:is_readed => true, :status => false) + jours.each do |journal| + fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false) + end end - - #@limit = 10 - #@feedback_count = @jours.count - #@feedback_pages = Paginator.new @feedback_count, @limit, params['page'] - #@offset ||= @feedback_pages.offset - @jour = paginateHelper @jours,10 + @jour = paginateHelper jours,10 @state = false + render :layout=>'base_users_new' end - # end def user_comments @@ -482,95 +423,6 @@ class UsersController < ApplicationController render :layout=>nil end - # def user_course_activities - # @list = [] - # lastid = nil - # if params[:lastid]!=nil && !params[:lastid].empty? - # lastid = params[:lastid]; - # end - # - # user_ids = [] - # if @user == User.current - # watcher = User.watched_by(@user) - # watcher.push(User.current) - # user_ids = watcher.map{|x| x.id} - # else - # user_ids << @user.id - # end - # - # query_rec_count = 8 - # query_times = 10 #query_times次没查到query_rec_count条记录就不查了 - # query_i = 0; - # while( true ) - # query_i = query_i+1 - # if(query_i>query_times) - # break - # end - # query = Activity.where(user_id: user_ids) - # if(lastid != nil) - # query = query.where("id < ?",lastid) - # end - # lastid,item_list = query_activities(query,'course'); - # for item in item_list - # @list << item - # if @list.count() >= query_rec_count - # break - # end - # end - # if @list.count() >= query_rec_count - # break - # end - # if lastid == nil - # break - # end - # end - # render :layout=>nil - # end - # - # def user_project_activities - # @list = [] - # lastid = nil - # if params[:lastid]!=nil && !params[:lastid].empty? - # lastid = params[:lastid]; - # end - # - # user_ids = [] - # if @user == User.current - # watcher = User.watched_by(@user) - # watcher.push(User.current) - # user_ids = watcher.map{|x| x.id} - # else - # user_ids << @user.id - # end - # - # query_rec_count = 8 - # query_times = 10 #query_times次没查到query_rec_count条记录就不查了 - # query_i = 0; - # while( true ) - # query_i = query_i+1 - # if(query_i>query_times) - # break - # end - # query = Activity.where(user_id: user_ids) - # if(lastid != nil) - # query = query.where("id < ?",lastid) - # end - # lastid,item_list = query_activities(query,'project'); - # for item in item_list - # @list << item - # if @list.count() >= query_rec_count - # break - # end - # end - # if @list.count() >= query_rec_count - # break - # end - # if lastid == nil - # break - # end - # end - # render :action=>'user_course_activities',:layout=>nil - # end def user_course_activities lastid = nil if params[:lastid]!=nil && !params[:lastid].empty? @@ -629,7 +481,7 @@ class UsersController < ApplicationController query = query.where("#{Activity.table_name}.id < ?",lastid) end query = query.order("#{Activity.table_name}.id desc") - @list = query_activities(query); + @list = query_activities(query) render :action=>'user_course_activities',:layout=>nil end diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 9ce107f8b..6b14db9bb 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -100,44 +100,6 @@ class WelcomeController < ApplicationController @course_page = FirstPage.find_by_page_type('course') @school_id = params[:school_id] || User.current.user_extensions.school.try(:id) || 117 @logoLink ||= logolink() - - ##3-8月份为查找春季课程,9-2月份为查找秋季课程 - #month_now = Time.now.strftime("%m").to_i - #year_now = Time.new.strftime("%Y").to_i - #(month_now >= 3 && month_now < 9) ? course_term = l(:label_spring) : course_term = l(:label_autumn) - ##year_now -= 1 if year_now < 3 - #@school_id.nil? ? @cur_school_course = [] : @cur_school_course = find_miracle_course(10,7,@school_id, year_now, course_term) - ##未登录或者当前学校未开设课程 - #if @cur_school_course.empty? - # @has_course = false - # User.current.logged? ? course_count = 9 : course_count = 10 - # @cur_school_course += find_all_new_hot_course(course_count, @school_id, year_now, course_term) - # while @cur_school_course.count < 9 do - # if course_term == l(:label_spring) - # course_term = l(:label_autumn) - # year_now -= 1 - # else - # course_term = l(:label_spring) - # end - # @cur_school_course += find_all_new_hot_course((10-@cur_school_course.count), nil, year_now, course_term) - # end - #else - # if @cur_school_course.count < 9 - # @has_course = false - # @cur_school_course += find_all_new_hot_course(9-@cur_school_course.count, @school_id, year_now, course_term) - # if @cur_school_course.count < 9 - # if course_term == l(:label_spring) - # course_term = l(:label_autumn) - # year_now -= 1 - # else - # course_term = l(:label_spring) - # end - # @cur_school_course += find_all_new_hot_course(9-@cur_school_course.count, nil, year_now, course_term) - # end - # else - # @has_course = true - # end - #end end def logolink() diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 161791954..fc723d5d5 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -4,7 +4,7 @@ class WordsController < ApplicationController include ApplicationHelper before_filter :find_user, :only => [:new, :create, :destroy, :more, :back] def create - if params[:new_form][:user_message].size>0 + if params[:new_form][:user_message].size>0 && User.current.logged? unless params[:user_id].nil? if params[:reference_content] message = params[:new_form][:user_message] + "\n" + params[:reference_content] @@ -18,22 +18,13 @@ class WordsController < ApplicationController list = User.find(refer_user_id).add_jour(User.current, message, refer_user_id) end @jour = list.last - # @user.count_new_jour - # if a_message.size > 5 - # @message = a_message[-5, 5] - # else - # @message = a_message - # end - # @message_count = a_message.count end end - # @jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse - # @jour = paginateHelper @jours,10 + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + @jour = paginateHelper jours,10 respond_to do |format| - # format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}} format.js - #format.api { render_api_ok } end end @@ -93,7 +84,6 @@ class WordsController < ApplicationController end respond_to do |format| format.js - #format.api { render_api_ok } end end @@ -206,7 +196,15 @@ class WordsController < ApplicationController flash[:error] = feedback.errors.full_messages[0] redirect_to project_feedback_url(params[:id]) end + end + #给用户留言 + def leave_user_message + @user = User.find(params[:id]) + if params[:new_form][:user_message].size>0 && User.current.logged? && @user + @user.add_jour(User.current, params[:new_form][:user_message]) + end + redirect_to feedback_path(@user) end # add by nwb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 165e22071..9b9bf5f76 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1812,7 +1812,7 @@ module ApplicationHelper #获取用户未过期的课程 def get_user_course user courses_doing = [] - user.courses.each do |course| + user.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course| if !course_endTime_timeout?(course) courses_doing.push course end @@ -2378,4 +2378,98 @@ module ApplicationHelper end notice.html_safe end + + #老师C语言的标准代码 + def c_stantard_code_teacher + "// 老师您好!这是一个C语言的样例程序 +// 程序功能:输入两个整数,输出两者之和 +// 测试集合:老师可以给出多组测试集,例如: +// 输入1和2,输出3 +// 输入3和4,输出7 +// ... ... +// 系统将根据您给出的测试集对学生代码进行自动评分 + +// 特别提醒:程序采用命令行传参方式,输入通过argv传入 +// 否则您的作业标准代码将不能通过测试 + +#include //引用必须头文件 +int main(int argc, char** argv) { + int a = atoi(argv[1]); //将第一个输入转成整型 + int b = atoi(argv[2]); //将第二个输入转换为整型 + + printf(\"%d\",a+b); //输出a+b + return 0; +}".html_safe + end + + #老师C++语言的标准代码 + def c_stantard_code_teacher_ + "// 老师您好!这是一个C++语言的样例程序 +// 程序功能:输入两个整数,输出两者之和 +// 测试集合:老师可以给出多组测试集,例如: +// 输入1和2,输出3 +// 输入3和4,输出7 +// ... ... +// 系统将根据您给出的测试集对学生代码进行自动评分 + +// 特别提醒:程序采用命令行传参方式,输入通过argv传入 +// 否则您的作业标准代码将不能通过测试 + +#include //引用必须头文件 +#include +using namespace std; +int main(int argc, char** argv){ + int a = atoi(argv[1]); //将第一个输入转成整型 + int b = atoi(argv[2]); //将第二个输入转换为整型 + cout< //引用必须头文件 +int main(int argc, char** argv) { + int a = atoi(argv[1]); //将第一个输入转成整型 + int b = atoi(argv[2]); //将第二个输入转换为整型 + + printf(\"%d\",a+b); //输出a+b + return 0; +}".html_safe + end + + #学生C++语言的标准代码 + def c_stantard_code_student_ + "// 同学好!这是一个C++语言的样例程序 +// 程序功能:输入两个整数,输出两者之和 +// 测试集合:老师可以给出多组测试集,例如: +// 输入1和2,输出3 +// 输入3和4,输出7 +// ... ... +// 系统将根据您给出的测试集对学生代码进行自动评分 + +// 特别提醒:程序采用命令行传参方式,输入通过argv传入 +// 否则您的作业标准代码将不能通过测试 + +#include //引用必须头文件 +#include +using namespace std; +int main(int argc, char** argv){ + int a = atoi(argv[1]); //将第一个输入转成整型 + int b = atoi(argv[2]); //将第二个输入转换为整型 + cout< activity.course_act.id) + when "News" + title = "通知公告 " + activity.course_act.title + url = course_news_index_path(activity.course) + when "Attachment" + title = "课件 " + activity.course_act.filename + url = course_files_path(activity.course) + when "Message" + title = "课程讨论区 " + activity.course_act.subject + url = course_boards_path(activity.course,:parent_id => activity.course_act.parent_id ? activity.course_act.parent_id : activity.course_act.id, :topic_id => activity.course_act.id) + when "JournalsForMessage" + title = "留言 " + activity.course_act.notes + url = course_feedback_path(activity.course) + when "Poll" + title = "问卷 " + activity.course_act.polls_name + url = poll_index_path(:polls_type => "Course", :polls_group_id => activity.course_id) + end + end + link_to title.gsub(/<(?!img)[^>]*>/,'').html_safe, url, :class => "problem_tit c_dblue fl fb" + end + + #课程动态的描述 + def course_activity_desc activity + desc = "" + if activity.course_act + case activity.course_act_type + when "Course" + desc = "" + when "HomeworkCommon" + desc = activity.course_act.description + when "News" + desc = activity.course_act.description + when "Attachment" + desc = "" + when "Message" + desc = activity.course_act.content + when "JournalsForMessage" + desc = "" + when "Poll" + desc = activity.course_act.polls_description + end + end + desc.html_safe + end end diff --git a/app/helpers/homework_common_helper.rb b/app/helpers/homework_common_helper.rb index 49384cca4..43f815250 100644 --- a/app/helpers/homework_common_helper.rb +++ b/app/helpers/homework_common_helper.rb @@ -66,4 +66,31 @@ module HomeworkCommonHelper link end + #将状态转换为错误信息 + def status_to_err_msg status + case status.to_i + when -1 + '编译出错' + when -2 + '输入和输出不匹配' + when -3 + '输入和输出不匹配' + when 1 + '运行出错' + when 2 + '超时' + when 3 + '内存超出' + when 4 + '输出超出' + when 5 + '禁用函数' + when 6 + '其他错误' + when 0 + '成功' + else + '未知错误' + end + end end \ No newline at end of file diff --git a/app/helpers/poll_helper.rb b/app/helpers/poll_helper.rb index 3156f1b3a..22ee21936 100644 --- a/app/helpers/poll_helper.rb +++ b/app/helpers/poll_helper.rb @@ -74,4 +74,13 @@ module PollHelper end end + #带勾选框的问卷列表 + def poll_check_box_tags(name,polls,current_poll) + s = '' + polls.each do |poll| + s << "
" + end + s.html_safe + end + end \ No newline at end of file diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 0b2d74ee8..49865d335 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -321,6 +321,7 @@ module UsersHelper list = obj.watcher_users.order("#{Watcher.table_name}.id desc").limit(10).all return [count,list]; end + def get_visitor_users(obj) query = Visitor.where("master_id=?",obj.id) count = query.count @@ -332,46 +333,59 @@ module UsersHelper end def get_create_course_count(user) - if user == User.current - user.courses.count - else - user.courses.where("is_public = 1").count - end + user.courses.visible.where("tea_id = ?",user.id).count end + + #获取加入课程数 def get_join_course_count(user) - user.coursememberships.count - get_create_course_count(user) + user.courses.visible.count - get_create_course_count(user) end + + #发布作业数 def get_homework_commons_count(user) HomeworkCommon.where("user_id = ?",user.id).count end + + #资源数 def get_projectandcourse_attachment_count(user) Attachment.where("author_id = ? and container_type in ('Project','Course')",user.id).count end + + #创建项目数 def get_create_project_count(user) - Project.where("user_id = ? and project_type = ?",user.id,Project::ProjectType_project).count + user.projects.visible.where("projects.user_id=#{user.id}").count end + + #加入项目数 def get_join_project_count(user) - user.memberships.count(conditions: "projects.project_type = #{Project::ProjectType_project}") - get_create_project_count(user) + user.projects.visible.count - get_create_project_count(user) end + + #创建缺陷数 def get_create_issue_count(user) Issue.where("author_id = ?",user.id).count end + + #解决缺陷数 def get_resolve_issue_count(user) Issue.where("assigned_to_id = ? and status_id=3",user.id).count end + + #参与匿评数 def get_anonymous_evaluation_count(user) StudentWorksScore.where("user_id = ? and reviewer_role=3",user.id).count end def query_activities(query) - list = query.limit(8).all - result = []; + list = query.limit(13).all + result = [] for item in list container = get_activity_container(item) result << { :item=>item,:e=>container } end - return result + result end + def get_activity_container activity return activity.activity_container end @@ -387,6 +401,7 @@ module UsersHelper end return str.html_safe end + def get_activity_act_showname(activity) case activity.act_type when "HomeworkCommon" @@ -417,6 +432,7 @@ module UsersHelper return activity.act_type end end + def get_activity_act_createtime(activity) case activity.act_type when "HomeworkCommon" @@ -427,6 +443,7 @@ module UsersHelper return activity.act.created_on end end + def get_activity_container_url e if !e.visible? return "javascript:;" @@ -437,6 +454,7 @@ module UsersHelper end return url_for(:controller => 'projects', :action=>"show", :id=>e.id, :host=>Setting.host_name) end + def get_activity_url(activity,e) if !e.visible? return "javascript:;" @@ -465,6 +483,7 @@ module UsersHelper return 'javascript:;' end end + def get_activity_opt(activity,e) case activity.act_type when "HomeworkCommon" @@ -474,14 +493,14 @@ module UsersHelper when "Issue" return '发表了问题' when "Journal" - return '回复了问题' + return '更新了问题' when "JournalsForMessage" return e.class.to_s == 'Course' ? '发表了留言' : '提交了反馈' #return ( activity.act.reply_id == nil || activity.act.reply_id == 0 ) ? '' : '' when "Message" return ( activity.act.parent_id == nil || activity.act.parent_id == '' ) ? '发布了帖子' : '回复了帖子' when "Poll" - return '发布了问卷' + return '创建了问卷' else return '有了新动态' end diff --git a/app/models/attachment.rb b/app/models/attachment.rb index f999e27d6..f7fb9b1aa 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -27,6 +27,8 @@ class Attachment < ActiveRecord::Base belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id" # 被ForgeActivity虚拟关联 has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy # end include UserScoreHelper @@ -71,8 +73,8 @@ class Attachment < ActiveRecord::Base cattr_accessor :thumbnails_storage_path @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") - before_save :files_to_final_location - after_create :office_conver, :be_user_score,:act_as_forge_activity# user_score + before_save :files_to_final_location,:act_as_course_activity + after_create :office_conver, :be_user_score,:act_as_forge_activity after_update :office_conver, :be_user_score after_destroy :delete_from_disk,:down_user_score @@ -552,4 +554,10 @@ class Attachment < ActiveRecord::Base end end + #课程动态公共表记录 + def act_as_course_activity + if self.container_type == "Course" && self.course_acts.empty? + self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.container_id) + end + end end diff --git a/app/models/course.rb b/app/models/course.rb index 6d71ad967..89990dd48 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -33,6 +33,10 @@ class Course < ActiveRecord::Base has_many :student_works, :through => :homework_commons, :dependent => :destroy has_many :course_groups, :dependent => :destroy + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy + + has_many :course_activities acts_as_taggable acts_as_nested_set :order => 'name', :dependent => :destroy @@ -44,7 +48,7 @@ class Course < ActiveRecord::Base validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/ validates_length_of :description, :maximum => 10000 before_save :self_validate - after_create :create_board_sync + after_create :create_board_sync, :act_as_course_activity before_destroy :delete_all_members safe_attributes 'extra', @@ -310,6 +314,11 @@ class Course < ActiveRecord::Base end end + #课程动态公共表记录 + def act_as_course_activity + self.course_acts << CourseActivity.new(:user_id => self.tea_id,:course_id => self.id) + end + #项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题 #def name # read_attribute('name') || Project.find_by_identifier(self.extra).try(:name) diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb new file mode 100644 index 000000000..02b6dacf1 --- /dev/null +++ b/app/models/course_activity.rb @@ -0,0 +1,7 @@ +class CourseActivity < ActiveRecord::Base + attr_accessible :user_id, :course_act_id,:course_act_type,:course_id + # 虚拟关联 + belongs_to :course_act ,:polymorphic => true + belongs_to :course + belongs_to :user +end diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 291c14563..5fe01db96 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -13,17 +13,27 @@ class HomeworkCommon < ActiveRecord::Base has_many :student_works, :dependent => :destroy has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表 has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动 + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy acts_as_attachable acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" }, :description => :description, :author => :author, :url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}} - after_create :act_as_activity, :send_mail + after_create :act_as_activity, :send_mail, :act_as_course_activity after_destroy :delete_kindeditor_assets def act_as_activity self.acts << Activity.new(:user_id => self.user_id) end + + #课程动态公共表记录 + def act_as_course_activity + if self.course + self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.course_id) + end + end + #删除对应的图片 def delete_kindeditor_assets delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON diff --git a/app/models/homework_test.rb b/app/models/homework_test.rb index 4ed290ecd..df2848194 100644 --- a/app/models/homework_test.rb +++ b/app/models/homework_test.rb @@ -1,5 +1,5 @@ class HomeworkTest < ActiveRecord::Base - attr_accessible :input, :output, :homework_common_id + attr_accessible :input, :output, :homework_common_id,:result,:error_msg belongs_to :homework_common has_many :student_work_test diff --git a/app/models/issue.rb b/app/models/issue.rb index c2670a0cc..147e26cef 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -235,9 +235,10 @@ class Issue < ActiveRecord::Base base_reload(*args) end - def to_param - @to_param ||= "#{id}_#{self.project.name}(#{self.project.issues.index(self).to_i+1}-#{self.project.issues.count})"#.parameterize - end + # 之所以注释是以为最终以id形式显示,另外如果项目名称带点号或者纯数字会出现问题 + # def to_param + # @to_param ||= "#{id}_#{self.project.name}(#{self.project.issues.index(self).to_i+1}-#{self.project.issues.count})"#.parameterize + # end # Overrides Redmine::Acts::Customizable::InstanceMethods#available_custom_fields def available_custom_fields diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index b15c9b2d1..bcae58174 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -56,9 +56,11 @@ class JournalsForMessage < ActiveRecord::Base acts_as_attachable has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy validates :notes, presence: true, if: :is_homework_jour? - after_create :act_as_activity #huang + after_create :act_as_activity, :act_as_course_activity after_create :reset_counters! after_destroy :reset_counters! after_save :be_user_score @@ -177,4 +179,11 @@ class JournalsForMessage < ActiveRecord::Base def delete_kindeditor_assets delete_kindeditor_assets_from_disk self.id,7 end + + #课程动态公共表记录 + def act_as_course_activity + if self.jour_type == 'Course' + self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.jour_id) + end + end end diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 5ae9df001..a25aff6bb 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -388,7 +388,8 @@ class Mailer < ActionMailer::Base @user = applied.user recipients = @project.manager_recipients s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name) - @applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members') + @token = Token.get_token_from_user(@user, 'autologin') + @applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members', :token => @token.value) mail :to => recipients, :subject => s end diff --git a/app/models/message.rb b/app/models/message.rb index 15d358789..de5cc3f9b 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -32,6 +32,8 @@ class Message < ActiveRecord::Base has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy # 被ForgeActivity虚拟关联 has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy # end has_many :ActivityNotifies,:as => :activity, :dependent => :destroy @@ -68,7 +70,7 @@ class Message < ActiveRecord::Base after_update :update_messages_board after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets - after_create :act_as_activity,:be_user_score,:act_as_forge_activity, :send_mail + after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :send_mail #before_save :be_user_score scope :visible, lambda {|*args| @@ -185,6 +187,13 @@ class Message < ActiveRecord::Base :project_id => self.board.project.id) end end + + #课程动态公共表记录 + def act_as_course_activity + if self.course + self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.board.course_id) + end + end #更新用户分数 -by zjc def be_user_score diff --git a/app/models/news.rb b/app/models/news.rb index 7d33d760e..e5c1d192a 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -28,6 +28,8 @@ class News < ActiveRecord::Base has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy # 被ForgeActivity虚拟关联 has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy # end has_many :ActivityNotifies,:as => :activity, :dependent => :destroy @@ -49,7 +51,7 @@ class News < ActiveRecord::Base :author_key => :author_id acts_as_watchable - after_create :act_as_activity,:act_as_forge_activity,:add_author_as_watcher, :send_mail + after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:add_author_as_watcher, :send_mail after_destroy :delete_kindeditor_assets @@ -121,6 +123,13 @@ class News < ActiveRecord::Base end end + #课程动态公共表记录 + def act_as_course_activity + if self.course + self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.course_id) + end + end + # Time 2015-03-31 13:50:54 # Author lizanle # Description 删除news后删除对应的资源 diff --git a/app/models/poll.rb b/app/models/poll.rb index 64e9df79a..34a381246 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -8,7 +8,9 @@ class Poll < ActiveRecord::Base has_many :users, :through => :poll_users #该文件被哪些用户提交答案过 # 添加课程的poll动态 has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy - after_create :act_as_activity + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy + after_create :act_as_activity, :act_as_course_activity acts_as_event :title => Proc.new {|o| "#{l(:label_course_poll)}: #{o.polls_name}" }, :description => :polls_description, @@ -27,4 +29,10 @@ class Poll < ActiveRecord::Base self.acts << Activity.new(:user_id => self.user_id) end + #课程动态公共表记录 + def act_as_course_activity + if self.polls_type == "Course" + self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.polls_group_id) + end + end end diff --git a/app/models/user.rb b/app/models/user.rb index 005c394a8..1cd0675c8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -291,9 +291,10 @@ class User < Principal name end ## end - + + # 查询用户未读过的记录 def count_new_jour - count = self.new_jours.count + count = self.journals_for_messages.where("status=?", 1).count end #added by nie @@ -418,7 +419,7 @@ class User < Principal end def nickname(formatter = nil) - login + login.nil? || (login && login.empty?) ? "AnonymousUser" : login end def name(formatter = nil) diff --git a/app/views/admin/schools.html.erb b/app/views/admin/schools.html.erb new file mode 100644 index 000000000..0956981e8 --- /dev/null +++ b/app/views/admin/schools.html.erb @@ -0,0 +1,50 @@ +

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

+<%= form_tag({:controller => 'admin', :action => 'schools' }, :method => :get,:id=>"search_course_form") do %> + <%= submit_tag "搜索",:style => "float: right;margin-right: 15px;"%> + +<% end %> +
+ +
+ + + + + + + + + + + <% @schools.each do |school|%> + "> + + + + + + <% end%> + +
+ 序号 + + LOGO + + 学校名称 +
+ <%= school.id %> + + <%= image_tag(school.logo_link,width:40,height:40) %> + + + <%= link_to school.name,"http://#{Setting.host_course}/?school_id=#{school.id}" %> + + + <%= link_to("修改", upload_logo_school_path(school.id,:school_name => @school_name), :class => 'icon icon-copy') %> + <%#= link_to(l(:button_delete), organization_path(school.id), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %> +
+
+ +<% html_title(l(:label_project_plural)) -%> diff --git a/app/views/applied_project/_set_applied.js.erb b/app/views/applied_project/_set_applied.js.erb index 33d862d1c..472da3c09 100644 --- a/app/views/applied_project/_set_applied.js.erb +++ b/app/views/applied_project/_set_applied.js.erb @@ -17,6 +17,8 @@ if (window.Messenger) { Messenger().post({ id: "label_apply_project_waiting", message: "<%= l(:label_apply_project_waiting) %>", - showCloseButton: true, + showCloseButton: true }); }; + +$("#applied_project_link_<%= @project.id%>").replaceWith("<%= escape_javascript(link_to "加入项目",appliedproject_path(:user_id => User.current.id,:project_id => @project.id,:project_join => true),:class => "blue_n_btn fr mt20", :remote => "true",:method => "post",:id => "applied_project_link_#{@project.id}") %>"); diff --git a/app/views/applied_project/applied_join_project.js.erb b/app/views/applied_project/applied_join_project.js.erb index 846d2a61d..ae9d3f467 100644 --- a/app/views/applied_project/applied_join_project.js.erb +++ b/app/views/applied_project/applied_join_project.js.erb @@ -6,6 +6,7 @@ <% elsif @status == 2%> alert("<%= l('project.join.tips.success') %>"); hideModal($("#popbox")); + $("#applied_project_link_<%= @project.id%>").replaceWith("<%=escape_javascript(link_to '取消申请',appliedproject_applied_path(:project_id => @project.id,:user_id => User.current.id),:class => "blue_n_btn fr mt20", :remote => "true",:method => "delete",:id => "applied_project_link_#{@project.id}")%>"); <% elsif @status == 3%> alert("<%= l('project.join.tips.has') %>"); <%else%> diff --git a/app/views/attachments/_project_file_links.html.erb b/app/views/attachments/_project_file_links.html.erb index b6d934c64..3b76689f5 100644 --- a/app/views/attachments/_project_file_links.html.erb +++ b/app/views/attachments/_project_file_links.html.erb @@ -29,32 +29,32 @@ <% is_float ||= false %> <% for attachment in attachments %>
-

- <%if is_float%> -

- <% end%> - +

+ <%if is_float%> +

+ <% end%> + <% if options[:length] %> <%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true,:length => options[:length] -%> <% else %> <%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true -%> <% end %> - <%if is_float%> -
- <% end%> + <%if is_float%> +
+ <% end%> - <% if attachment.is_text? %> - <%= link_to image_tag('magnifier.png'), - :controller => 'attachments', - :action => 'show', - :id => attachment, - :filename => attachment.filename%> - <% end %> + <% if attachment.is_text? %> + <%= link_to image_tag('magnifier.png'), + :controller => 'attachments', + :action => 'show', + :id => attachment, + :filename => attachment.filename%> + <% end %>
- <%= h(" - #{attachment.description}") unless attachment.description.blank? %> -
+ <%= h(" - #{attachment.description}") unless attachment.description.blank? %> + ( <%= number_to_human_size attachment.filesize %>) @@ -66,6 +66,16 @@ :class => 'delete delete-homework-icon', :remote => true, :title => l(:button_delete) %> + <% elsif attachment.container_type == 'Issue' %> + <% if User.current == attachment.author %> + <%= link_to image_tag('delete.png'), attachment_path(attachment), + :data => {:confirm => l(:text_are_you_sure)}, + :method => :delete, + :class => 'delete', + #:remote => true, + #:id => "attachments_" + attachment.id.to_s, + :title => l(:button_delete) %> + <% end %> <% else %> <%= link_to image_tag('delete.png'), attachment_path(attachment), :data => {:confirm => l(:text_are_you_sure)}, @@ -89,13 +99,13 @@

<% end %>
- <% if defined?(thumbnails) && thumbnails %> - <% images = attachments.select(&:thumbnailable?) %> - <% if images.any? %> + <% if defined?(thumbnails) && thumbnails %> + <% images = attachments.select(&:thumbnailable?) %> + <% if images.any? %> <% images.each do |attachment| %>
<%= thumbnail_issue_tag(attachment) %>
<% end %> - <% end %> - <% end %> + <% end %> + <% end %>
diff --git a/app/views/courses/_course.html.erb b/app/views/courses/_course.html.erb index f2972df44..889319d5e 100644 --- a/app/views/courses/_course.html.erb +++ b/app/views/courses/_course.html.erb @@ -61,8 +61,8 @@

- <%= content_tag('span', link_to("#{@course_activity_count[@course.id]}", course_path(@course)), :class => "info") %> - <%= content_tag('span', l(:label_x_activity, :count => @course_activity_count[@course.id])) %> + <%= content_tag('span', link_to("#{@course.course_activities.count}", course_path(@course)), :class => "info") %> + <%= content_tag('span', l(:label_x_activity, :count => @course.course_activities.count)) %>

diff --git a/app/views/courses/_new_groups_name.html.erb b/app/views/courses/_new_groups_name.html.erb index 39fa33677..6ffbb6dd2 100644 --- a/app/views/courses/_new_groups_name.html.erb +++ b/app/views/courses/_new_groups_name.html.erb @@ -21,7 +21,7 @@ 删除班级 <% end%> - + 编辑班级 <% end %> @@ -31,7 +31,7 @@ <% if @canShowCode%> <%= form_tag(updategroupname_course_path(@course,:group_id => group.id), method: 'get', remote:true, :id => 'update_group_'+group.id.to_s) do %> <% end %> @@ -47,7 +47,7 @@
  • diff --git a/app/views/courses/_set_join.js.erb b/app/views/courses/_set_join.js.erb index 1dc20f046..5476e7ff0 100644 --- a/app/views/courses/_set_join.js.erb +++ b/app/views/courses/_set_join.js.erb @@ -4,13 +4,16 @@ <% if @state %> <% if @state == 0 %> alert("加入成功"); - hideModal($("#popbox")); + hideModal($("#popbox02")); + $("#try_join_course_link").replaceWith(" 'index',:course=>course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品"); + window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>" <% elsif @state == 1 %> alert("密码错误"); <% elsif @state == 2 %> alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)"); <% elsif @state == 3 %> alert("您已经加入了课程"); + window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>" <% elsif @state == 4 %> alert("您加入的课程不存在"); <% elsif @state == 5 %> diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 654c25a42..7159c3c83 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -1,83 +1,37 @@
    -<% if @controller_name=='ActivityNotifys' %> - <%= l(:label_activity)%> -

    与我相关 - -

    - -<% else %>

    <%= l(:label_activity)%>

    - <% if User.current.logged? %> - 与我相关 - - - <% end %> -<% end %>
    -<% if @events_by_day != nil && @events_by_day.size >0 %> - <% @events_by_day.keys.sort.reverse.each do |day| %> - <% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%> -
    - - <%= image_tag(url_to_avatar(e.event_author), :width => "42", :height => "42") %> - -
    - <%= link_to_user_header(e.event_author,false,:class => 'problem_name c_orange fl') if e.respond_to?(:event_author) %> - <%= link_to_user_header("(#{e.event_author})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName && e.respond_to?(:event_author) %> -   - <%= l(:label_new_activity) %>: - <% - link = (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : - (e.event_type.eql?("bid") ? homework_course_path(@course) : - (e.event_type.eql?("message") || e.event_type.eql?("reply") ? - course_boards_path(@course,:topic_id => e.id,:parent_id=>(e.parent_id ? e.parent_id : e.id)) : e.event_url)) - %> - <%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link, - :class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type, - 'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link", - 'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%> - <%if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%> - - <%end%> -
    -

    <%= e.event_description.html_safe %> -
    -

    - <%= l :label_activity_time %> : <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %> -

    - <%= link_to_attachments_course(e) if e.class.to_s == "News" %> -
    -
    -
    - <% end%> - <% end%> -<% elsif @controller_name=='ActivityNotifys' %> -

    <%= l(:label_no_data) %>

    -<% end%> -<% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %> -
    - - <%= image_tag(url_to_avatar(@user), :width => "42", :height => "42") %> - -
    - <%= link_to_user_header(@user,false,:class => 'problem_name c_orange fl') %> - <%= link_to_user_header("(#{@user})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName %> - <%= l(:label_user_create_project) %>: - <%= link_to @course.name,course_path(@course),:class => "problem_tit c_dblue fl fb"%> -
    -

    -
    - <%= l :label_create_time %> : <%= format_time(@course.created_at) %> -

    -
    -
    -
    +<%@course_activities.each do |activity|%> +
    + + <%= image_tag(url_to_avatar(activity.user), :width => "42", :height => "42") %> + +
    + <%= link_to_user_header(activity.user,false,:class => 'problem_name c_orange fl') %> +   + <%= activity.course_act_type == "Course" ? "创建了课程" : l(:label_new_activity) %>: + <%#= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link, + :class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type, + 'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link", + 'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%> + <%#if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%> + + <%#end%> + <%= link_to course_activity_link activity%> +
    +

    + <%= course_activity_desc activity%> +
    +

    + <%= l :label_activity_time %> : <%= format_time(activity.created_at) %> +

    + <%= link_to_attachments_course(activity.course_act) if activity.course_act_type.to_s == "News" %> +
    +
    +
    <% end%> +
      <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
    diff --git a/app/views/files/create.js.erb b/app/views/files/create.js.erb index a1c278a7a..81810344e 100644 --- a/app/views/files/create.js.erb +++ b/app/views/files/create.js.erb @@ -24,6 +24,8 @@ $('#upload_file_div').slideToggle('slow'); <% if @project %> closeModal(); $("#resource_list").html('<%= j(render partial: "project_file_new" ,locals: {project: @project}) %>'); + $("#project_files_count_info").html("<%= @all_attachments.count%>"); + $("#project_files_count_nav").html("(<%= @all_attachments.count%>)") // 添加文件上传成功提示 <% unless params[:attachments].nil? %> var div = $('
    文件上传成功!
    '); diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb index be08dd107..8c589c040 100644 --- a/app/views/homework_common/_homework_detail_programing_form.html.erb +++ b/app/views/homework_common/_homework_detail_programing_form.html.erb @@ -56,7 +56,7 @@
    • - <%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70"} %> + <%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70",:onchange => "homework_language_change($(this));"} %>
    • @@ -78,7 +78,7 @@
    • - +
    • @@ -87,16 +87,25 @@
    • - +
    • - +
    • - + <% if homework_test.result && !homework_test.result.to_s.empty?%> + <% if homework_test.result == 0%> + 正确 + <% else%> + 错误 + <% end%> + <% else%> + 测试 + <% end%> +
    • @@ -105,19 +114,79 @@
    • - +
    • - +
    • - + 测试 +
    • <% end %> + + "> + + + + + + +
      + 错误信息: + + <% if homework.homework_tests.first && homework.homework_tests.first && homework.homework_tests.first.error_msg %> + <%= homework.homework_tests.first.error_msg%> + <% end%> +
    - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index 2de96bca1..4a804ae60 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -49,40 +49,54 @@
    <% if homework.homework_type == 2 && homework.homework_detail_programing%> - - - "> - - - - <% homework.homework_tests.each do |test|%> + <% if @is_teacher%> +
    - 输入 - - 输出 -
    + "> - <% end%> - -
    - <%=test.input%> + 输入 - <%= test.output%> + 输出
    - <% end%> -
    + <% homework.homework_tests.each do |test|%> + "> + + <%=test.input%> + + + <%= test.output%> + + + <% end%> + + +
    + <% end%> -
    - <% unless homework.attachments.empty?%> +
    + 开发语言: +
    + <% if homework.homework_detail_programing.language.to_i == 1%> + C + <% elsif homework.homework_detail_programing.language.to_i == 2%> + C++ + <% end%> +
    +
    +
    + <% end%> + + <% unless homework.attachments.empty?%> +
    附件:
    <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework.attachments} %>
    - <% end%> -
    -
    +
    +
    + <% end%>
    扣分标准: diff --git a/app/views/homework_common/next_step.html.erb b/app/views/homework_common/next_step.html.erb index 75e9f4c0a..e84d0f87a 100644 --- a/app/views/homework_common/next_step.html.erb +++ b/app/views/homework_common/next_step.html.erb @@ -11,7 +11,7 @@ <%= hidden_field_tag "course",@course.id%> <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> 提交 - <%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> + <%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> <% end%>
    @@ -22,7 +22,7 @@ <%= hidden_field_tag "homework_common[homework_type]","2"%> <%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> 提交 - <%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> + <%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> <% end%> diff --git a/app/views/homework_common/programing_test.js.erb b/app/views/homework_common/programing_test.js.erb new file mode 100644 index 000000000..d1643329b --- /dev/null +++ b/app/views/homework_common/programing_test.js.erb @@ -0,0 +1,12 @@ +$("#test_send_<%= @index%>").replaceWith(" fl ml5 mt1 programing_test' onclick='programing_test(<%= @index%>)' id='test_send_<%= @index%>'><%= @result == 0 ? '正确' : '错误'%>"); +$("#test_result_<%= @index%>").val("<%= @result%>"); +<% if @err_msg || @result != 0%> + $("#homework_work_test_show").show(); + $("#homework_work_test_desc").text("<%= escape_javascript(@err_msg || status_to_err_msg(@result))%>"); + <% if @err_msg%> + $("#homework_test_error_msg").val("<%= escape_javascript(@err_msg)%>"); + <% end%> +<% else%> + $("#homework_work_test_show").hide(); + $("#homework_test_error_msg").val(""); +<% end%> \ No newline at end of file diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 8c12d62e0..01cbea1c1 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -6,7 +6,7 @@
    <%= link_to "#{@issue.project.name}"+">", project_issues_path(@issue.project) %> - <%= "#" + @issue.project_index %> + <%= "#" + @issue.id.to_s %>
    diff --git a/app/views/layouts/_base_footer_public.html.erb b/app/views/layouts/_base_footer_public.html.erb new file mode 100644 index 000000000..dba26f1f6 --- /dev/null +++ b/app/views/layouts/_base_footer_public.html.erb @@ -0,0 +1,46 @@ + +
    \ No newline at end of file diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index 16fa44c73..c6ba7cf10 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -18,7 +18,7 @@ diff --git a/app/views/layouts/_base_header_new.html.erb b/app/views/layouts/_base_header_new.html.erb index 71cf8ab02..67c750fe4 100644 --- a/app/views/layouts/_base_header_new.html.erb +++ b/app/views/layouts/_base_header_new.html.erb @@ -26,7 +26,7 @@
  • 我的课程
      - <% User.current.courses.each do |course| %> + <% User.current.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course| %> <% if !course_endTime_timeout?(course) %>
    • course.id, :host=>Setting.host_course) %>"><%= course.name %> <% end %> @@ -41,8 +41,12 @@
    • 我的项目
    • diff --git a/app/views/layouts/_new_header.html.erb b/app/views/layouts/_new_header.html.erb index a756009f0..5fbf3638d 100644 --- a/app/views/layouts/_new_header.html.erb +++ b/app/views/layouts/_new_header.html.erb @@ -26,7 +26,7 @@
    • <%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id},target:"_blank", :class => "parent" %>
        - <% user_course.reverse.each do |course| %> + <% user_course.each do |course| %>
      • <%= link_to course.name, {:controller => 'courses',:action => 'show',:id => course.id},target:"_blank" %>
      • @@ -40,7 +40,7 @@
      • <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name},target:"_blank", :class => "parent" %>
          - <% User.current.projects.reverse.each do |project| %> + <% User.current.projects.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").each do |project| %>
        • <%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name }, target:"_blank" %>
        • diff --git a/app/views/layouts/_user_courses_list.html.erb b/app/views/layouts/_user_courses_list.html.erb index a5cd6f273..ce9282ee7 100644 --- a/app/views/layouts/_user_courses_list.html.erb +++ b/app/views/layouts/_user_courses_list.html.erb @@ -4,7 +4,7 @@
            <% course_index = 0 %> - <% User.current.courses.reverse.each do |course| %> + <% User.current.courses.each do |course| %> <% if !course_endTime_timeout?(course) %> <%= render :partial => 'layouts/user_homework_list', :locals => {:course => course,:course_index => course_index} %> <% course_index += 1 %> diff --git a/app/views/layouts/_user_project_list.html.erb b/app/views/layouts/_user_project_list.html.erb index 4df61b01b..924bfa9d4 100644 --- a/app/views/layouts/_user_project_list.html.erb +++ b/app/views/layouts/_user_project_list.html.erb @@ -2,7 +2,7 @@
          • <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
              - <% User.current.projects.reverse.each do |project| %> + <% User.current.projects.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").each do |project| %>
            • <%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %>
            • diff --git a/app/views/layouts/_user_watch_btn.html.erb b/app/views/layouts/_user_watch_btn.html.erb index 234b81152..578319b68 100644 --- a/app/views/layouts/_user_watch_btn.html.erb +++ b/app/views/layouts/_user_watch_btn.html.erb @@ -1,8 +1,11 @@ -<% if(User.current.logged? && User.current!=target)%> - <%if(target.watched_by?(User.current))%> - 取消关注 - <% else %> - 关注 - <% end %> +<% if User.current.logged?%> + <% if User.current == target%> + 编辑资料 + <%else%> + <%if(target.watched_by?(User.current))%> + 取消关注 + <% else %> + 添加关注 + <% end %> + <% end%> <% end %> \ No newline at end of file diff --git a/app/views/layouts/_user_watch_list.html.erb b/app/views/layouts/_user_watch_list.html.erb index 00c0cdc40..7ccc8660d 100644 --- a/app/views/layouts/_user_watch_list.html.erb +++ b/app/views/layouts/_user_watch_list.html.erb @@ -1,5 +1,5 @@ <% watcher_count,watcher_list = get_watcher_users(user) %> -
              +

              关注

              更多
              diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 7a32cb67d..3242d79e9 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -113,7 +113,7 @@
              diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb index 4b6bd2887..09d437da4 100644 --- a/app/views/layouts/base_users_new.html.erb +++ b/app/views/layouts/base_users_new.html.erb @@ -17,6 +17,7 @@ <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'public_new', 'leftside_new','users', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> +<%= javascript_include_tag "avatars"%> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> @@ -69,7 +70,7 @@ <% end %>
              -
              +
              • 最近登录 :
              • <% if @user.user_extensions!=nil && @user.user_extensions.identity == 2 %> @@ -126,40 +127,62 @@
              +
            diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index ca7bb6159..f1b3d9b7b 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -93,21 +93,7 @@
            - - <% elsif e.forge_act_type == "Document" %> -
            - <%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %> -
            - - <%= h(e.project) if @project.nil? || @project.id != e.project_id %> - <%= link_to h(e.user), user_path(e.user_id), :class => "problem_name c_orange fl" %> <%= l(:label_new_activity) %> : - <%= link_to format_activity_title("#{l(:label_document)}: #{act.title}"), {:controller => 'documents', :action => 'show', :id => act.id}, :class => "problem_tit fl fb" %>
            -

            <%= textAreailizable act,:description %>
            - <%= l :label_create_time %> :<%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %>

            -
            -
            -
            <% elsif e.forge_act_type == "Attachment" %>
            diff --git a/app/views/projects/soft_file.html.erb b/app/views/projects/soft_file.html.erb deleted file mode 100644 index 9e486dd78..000000000 --- a/app/views/projects/soft_file.html.erb +++ /dev/null @@ -1,46 +0,0 @@ -
            -

            <%= l(:label_project_soft_file) %>

            -
            - - - -
            -
            -

            软件资源库部署中...

            -
            -
            0%
            -
            - -
            -
            -
            -
            - - \ No newline at end of file diff --git a/app/views/projects/soft_knowledge.html.erb b/app/views/projects/soft_knowledge.html.erb deleted file mode 100644 index bcb745357..000000000 --- a/app/views/projects/soft_knowledge.html.erb +++ /dev/null @@ -1,46 +0,0 @@ -
            -

            <%= l(:label_project_soft_knowledge) %>

            -
            - - - -
            -
            -

            云化部署中...

            -
            -
            0%
            -
            - -
            -
            -
            -
            - - \ No newline at end of file diff --git a/app/views/projects/soft_service.html.erb b/app/views/projects/soft_service.html.erb deleted file mode 100644 index 43376b915..000000000 --- a/app/views/projects/soft_service.html.erb +++ /dev/null @@ -1,46 +0,0 @@ -
            -

            <%= l(:label_project_soft_service) %>

            -
            - - - -
            -
            -

            云化部署中...

            -
            -
            0%
            -
            - -
            -
            -
            -
            - - \ No newline at end of file diff --git a/app/views/projects/yun_dep.html.erb b/app/views/projects/yun_dep.html.erb deleted file mode 100644 index 7a774f4e4..000000000 --- a/app/views/projects/yun_dep.html.erb +++ /dev/null @@ -1,47 +0,0 @@ -
            -

            <%= l(:label_project_dts_yun) %>

            -
            - - - -
            -
            -

            云化部署中....

            -
            -
            -
            - -
            -
            -
            -
            - - \ No newline at end of file diff --git a/app/views/repositories/stats.html.erb b/app/views/repositories/stats.html.erb index ba14e18b1..0bce15069 100644 --- a/app/views/repositories/stats.html.erb +++ b/app/views/repositories/stats.html.erb @@ -1,37 +1,30 @@

            <%= l(:label_statistics) %>

            -
            修订 是版本库的提交次数, 显示为橘红色。

            -
            变更 是对版本库中文件的修改次数, 显示为蓝色。
            -

            - <%= tag("embed", :width => 670, :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_month")) %> -

            -

            - <%# 用户每月提交代码次数 %> - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_author")) %> -

            -

            - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_per_month")) %> -

            -

            - <%# 用户每月提交代码量 %> - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_qoc_per_author")) %> -

            -

            - <%# 用户最近六个月的提交次数 %> - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_six_month")) %> -

            -

            - <%# 用户最近一年的提交次数 %> - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_qoc_per_author")) %> -

            -

            - <%# 用户最近六个月的代码量 %> - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_six_months")) %> -

            -

            - <%# 用户最近一年的代码量 %> - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_year")) %> -

            -

            <%= link_to l(:button_back), :action => 'show', :id => @project %>

            -<% html_title(l(:label_repository), l(:label_statistics)) -%> +<% if @status_commit_count ==0 %> +
            该项目目前还没有提交过代码!
            +<% else %> +
            修订 是版本库的提交次数, 显示为橘红色。

            +
            变更 是对版本库中文件的修改次数, 显示为蓝色。
            + +

            + <%= tag("embed", :width => 670, :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_month")) %> +

            +

            + <%# 用户每月提交代码次数 %> + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_author")) %> +

            +

            + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_per_month")) %> +

            +

            + <%# 用户最近六个月的提交次数 %> + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_six_month")) %> +

            +

            + <%# 用户最近六个月的代码量 %> + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_six_months")) %> +

            +

            <%= link_to l(:button_back), :action => 'show', :id => @project %>

            + <% html_title(l(:label_repository), l(:label_statistics)) -%> +<% end %> \ No newline at end of file diff --git a/app/views/school/upload_logo.html.erb b/app/views/school/upload_logo.html.erb index 97a3f171c..26da7e081 100644 --- a/app/views/school/upload_logo.html.erb +++ b/app/views/school/upload_logo.html.erb @@ -1,5 +1,28 @@ -<%= form_tag({action: :upload},method: "post", multipart: true) do %> - <%= text_field_tag 'school'%> - <%= file_field_tag 'logo' %> - <%= submit_tag('Upload') %> + + +<%= form_tag(upload_school_path(@school.id),method: "post", multipart: true) do %> + <%#= text_field_tag 'school'%> +
            + + <%= image_tag(@school.logo_link, id: "avatar_image", :class=>"school_avatar")%> + 上传图片 + <%= file_field_tag 'logo',:style => "display:none;", :id => "file", :onchange => "showPreview(this)"%> +
            +
            + <%= submit_tag('上传') %> + <%= submit_tag('取消') %> +
            +
            <% end %> + diff --git a/app/views/student_work/_evaluation_student_work.html.erb b/app/views/student_work/_evaluation_student_work.html.erb index 9569718fb..368c636df 100644 --- a/app/views/student_work/_evaluation_student_work.html.erb +++ b/app/views/student_work/_evaluation_student_work.html.erb @@ -48,8 +48,10 @@  <%= student_work.final_score%> 分。 迟交扣分  <%= student_work.late_penalty%> 分, - 缺评扣分 -  <%= student_work.absence_penalty%> 分, + <% if student_work.homework_common.homework_type == 1%> + 缺评扣分 +  <%= student_work.absence_penalty%> 分, + <% end%> 最终成绩为  <%= format("%.1f",score)%> 分。
            diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index 7081dea8c..b259e20a5 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -24,42 +24,41 @@
          • -
          • 测试结果: - - - - - - - - <%@homework.homework_tests.each do |test|%> - "> - - - <% student_work_test = StudentWorkTest.where(:homework_test_id => test.id,:student_work_id => @work.id).first%> - - - - <% end%> - <% student_work_test = @work.student_work_test.first%> - <% if student_work_test && student_work_test.error_msg && !student_work_test.error_msg.empty?%> - - - - <% end%> - - -
            输入输出测试结果
            <%= student_work_test.nil? ? "正在编译" : student_work_test.status_to_s%>
            - <%= student_work_test.error_msg%> -
            -
            -
          • - <% if @is_teacher%> +
          • 测试结果: + + + + + + + + <%@homework.homework_tests.each do |test|%> + "> + + + <% student_work_test = StudentWorkTest.where(:homework_test_id => test.id,:student_work_id => @work.id).first%> + + + + <% end%> + <% student_work_test = @work.student_work_test.first%> + <% if student_work_test && student_work_test.error_msg && !student_work_test.error_msg.empty?%> + + + + <% end%> + + +
            输入输出测试结果
            <%= student_work_test.nil? ? "正在编译" : student_work_test.status_to_s%>
            + <%= student_work_test.error_msg%> +
            +
            +
          • <%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%> diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index fc82aea1e..0250a7eed 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -137,22 +137,44 @@
            <% if @homework.homework_type == 2 && @homework.homework_detail_programing%> - - - <% @homework.homework_tests.each do |test|%> + <% if @is_teacher%> +
            + "> - <% end%> - -
            - <%=test.input%> + 输入 - <%= test.output%> + 输出
            + <% @homework.homework_tests.each do |test|%> + "> + + <%=test.input%> + + + <%= test.output%> + + + <% end%> + + +
            + <% end%> + +
            + 开发语言: +
            + <% if @homework.homework_detail_programing.language.to_i == 1%> + C + <% elsif @homework.homework_detail_programing.language.to_i == 2%> + C++ + <% end%> +
            +
            +
            <% end%> -
            <% unless @homework.attachments.empty?%> diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index eda09114e..c72f9d422 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -44,7 +44,7 @@

            - + <%= f.select :project_id,options_for_select(user_projects_option), {},{:class => "bo02 mb10"} %>

            @@ -54,7 +54,11 @@ <%= @homework.homework_type == 2 ? "提交代码" : "作品描述"%>    : - <%= f.text_area "description", :class => "w620 hwork_txt ", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%> + <% if @homework.homework_type == 2 && @homework.homework_detail_programing%> + <%= f.text_area "description", :class => "w620 hwork_txt h400", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();", :value => @homework.homework_detail_programing.language == "1" ? c_stantard_code_student : c_stantard_code_student_%> + <% else %> + <%= f.text_area "description", :class => "w620 hwork_txt", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%> + <% end%>

            diff --git a/app/views/tags/_project_tag.html.erb b/app/views/tags/_project_tag.html.erb index ce80e36ab..408f3ba1d 100644 --- a/app/views/tags/_project_tag.html.erb +++ b/app/views/tags/_project_tag.html.erb @@ -1,15 +1,6 @@ -
            - <%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> +
            +
            + <%= render :partial => "tags/tag_project_new_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> +
            -<% if User.current.logged?%> - <%= l(:label_add_tag)%> - -<% end%> diff --git a/app/views/tags/_tag_name.html.erb b/app/views/tags/_tag_name.html.erb index cb00ac8d7..7cd7bc02b 100644 --- a/app/views/tags/_tag_name.html.erb +++ b/app/views/tags/_tag_name.html.erb @@ -42,7 +42,7 @@ <% else %>
            - + <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> <% case object_flag %> diff --git a/app/views/tags/_tag_project_new_name.html.erb b/app/views/tags/_tag_project_new_name.html.erb new file mode 100644 index 000000000..e657071bc --- /dev/null +++ b/app/views/tags/_tag_project_new_name.html.erb @@ -0,0 +1,30 @@ +<% @tags = obj.reload.tag_list %> +<% if non_list_all && @tags.size > 0 %> + +<% else %> + + <% 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, :class => 'pt5' %> + + <%= link_to('x', remove_tag_path(:tag_name => tag,:taggable_id => obj.id, :taggable_type => object_flag), :remote => true, :confirm => l(:text_are_you_sure) ) if (ProjectInfo.find_by_project_id(obj.id)).try(:user_id) == User.current.id %> + + + <% end %> + <% end %> +<% end %> + +<% if User.current.logged?%> + <%= l(:label_add_tag)%> + +<% end%> + + diff --git a/app/views/tags/_tag_user_new_name.html.erb b/app/views/tags/_tag_user_new_name.html.erb new file mode 100644 index 000000000..95730c22c --- /dev/null +++ b/app/views/tags/_tag_user_new_name.html.erb @@ -0,0 +1,30 @@ +<% @tags = obj.reload.tag_list %> +<% if non_list_all && @tags.size > 0 %> + +<% else %> + + <% 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, :class => 'pt5' %> + + <%= link_to('x', remove_tag_path(:tag_name => tag,:taggable_id => obj.id, :taggable_type => object_flag), :remote => true, :confirm => l(:text_are_you_sure) ) if User.current.eql?(obj) %> + + + <% end %> + <% end %> +<% end %> + +<% if User.current.logged?%> + <%= l(:label_add_tag)%> + +<% end%> + + diff --git a/app/views/tags/_user_tag.html.erb b/app/views/tags/_user_tag.html.erb new file mode 100644 index 000000000..d04fb50a6 --- /dev/null +++ b/app/views/tags/_user_tag.html.erb @@ -0,0 +1,5 @@ +
            +
            + <%= render :partial => "tags/tag_user_new_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> +
            +
            diff --git a/app/views/tags/remove_tag.js.erb b/app/views/tags/remove_tag.js.erb index b8c65c13e..4c4409c1c 100644 --- a/app/views/tags/remove_tag.js.erb +++ b/app/views/tags/remove_tag.js.erb @@ -2,6 +2,12 @@ <% if @object_flag == '3'%> $('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>'); +<% elsif @object_flag == '1'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_user_new_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>'); +<% elsif @object_flag == '2'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_project_new_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>'); <% elsif @object_flag == '6'%> $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name', diff --git a/app/views/tags/tag_save.js.erb b/app/views/tags/tag_save.js.erb index 74a38c99d..5a29c113c 100644 --- a/app/views/tags/tag_save.js.erb +++ b/app/views/tags/tag_save.js.erb @@ -4,6 +4,14 @@ $('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_n :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); //$('#put-tag-form-issue').hide(); $('#name-issue').val(""); +<% elsif @obj_flag == '1'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_user_new_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#tags_name3').val(""); +<% elsif @obj_flag == '2'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_project_new_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#tags_name2').val(""); <% elsif @obj_flag == '6'%> <%if @course%> $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); diff --git a/app/views/users/_course_form.html.erb b/app/views/users/_course_form.html.erb index 3a6b317f0..dc277805c 100644 --- a/app/views/users/_course_form.html.erb +++ b/app/views/users/_course_form.html.erb @@ -30,7 +30,10 @@ 学生人数: item.id,:role=>2, :host=>Setting.host_course) %>"><%= studentCount(item) %> 开课学期: - <%= item.time %><%= get_course_term_locales item %> + + <%= item.time %> + <%= get_course_term_locales item %> +
            @@ -39,8 +42,10 @@ 课程结束 <% elsif(can_edit_flag) %> 发布作业 - <% else %> + <% elsif User.current.member_of_course? item %> 提交作品 + <% elsif User.current.logged?%> + <%= link_to "加入课程",try_join_path(:object_id => item.id), :class => "blue_n_btn fr mt20", :remote => "true",:id => "try_join_course_link"%> <% end %>
            \ No newline at end of file diff --git a/app/views/users/_user_jour_reply.html.erb b/app/views/users/_user_jour_reply.html.erb new file mode 100644 index 000000000..60eda9fcd --- /dev/null +++ b/app/views/users/_user_jour_reply.html.erb @@ -0,0 +1,40 @@ +<% parent_jour = JournalsForMessage.where("id = #{reply.m_reply_id}").first %> +<% if parent_jour%> +
            + <%= link_to image_tag(url_to_avatar(reply.user),:width => '32',:height => '32'), user_path(reply.user),:class => "users_pic_sub fl mr5" %> +
            + <%= link_to "#{reply.user.nickname} ".html_safe, user_path(reply.user),:class => 'course_name fl c_blue02 ', :target => "_blank"%> +  回复  + <%= link_to "#{parent_jour.user.nickname} : ".html_safe, user_path(parent_jour.user),:class => 'course_name fl c_blue02 mr5 ', :target => "_blank"%> +
            + <%= reply.notes.html_safe %> +
            +
            + + <%= time_tag(reply.created_on).html_safe%> + +
            + <%= link_to l(:button_reply),'javascript:void(0);',:nhname=>"sub_reply_btn", :class => "ml5 c_purple" %> + <% if User.current.admin? || reply.user == User.current%> + <%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => reply, :user_id => reply.user}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "c_purple ml5", :title => l(:button_delete)) %> + <% end %> +
            +
            + +
            +
            +<% end%> \ No newline at end of file diff --git a/app/views/users/_user_jours_new.html.erb b/app/views/users/_user_jours_new.html.erb new file mode 100644 index 000000000..0fe301641 --- /dev/null +++ b/app/views/users/_user_jours_new.html.erb @@ -0,0 +1,44 @@ +
            + <%= link_to image_tag(url_to_avatar(jour.user),:width => '46',:height => '46'), user_path(jour.user),:class => "users_pic fl" %> +
            +
            + <%= link_to "#{jour.user.nickname} : ".html_safe, user_path(jour.user),:class => 'fl c_blue02 f14 fb mb5', :target => "_blank"%> +
            +
            +
            + <%= jour.notes.html_safe %> +
            +
            + + <%= time_tag(jour.created_on).html_safe %> + +
            + <%= link_to l(:button_reply),'javascript:void(0);',:nhname=>"reply_btn", :class => "ml5 c_purple" %> + <% if User.current.admin? || jour.user == User.current%> + <%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => jour, :user_id => jour.user}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "ml5 c_purple", :title => l(:button_delete)) %> + <% end %> +
            +
            + +
            + +
            + <% fetch_user_leaveWord_reply(jour).each do |reply|%> + <%= render :partial => 'user_jour_reply', :locals => {:reply => reply} %> + <% end %> +
            +
            \ No newline at end of file diff --git a/app/views/users/_user_show.html.erb b/app/views/users/_user_show.html.erb index 8e3d27666..7cbb20e40 100644 --- a/app/views/users/_user_show.html.erb +++ b/app/views/users/_user_show.html.erb @@ -23,8 +23,19 @@ - <%= l(:label_x_has_fans,:count=>user.watcher_users.count)%> - <%= l(:label_has_watchers,:count=>User.watched_by(user.id).count) %> + <%= l(:label_x_has_fans,:count=>user.watcher_users.count, :remote => true)%> + <%= l(:label_has_watchers,:count=>User.watched_by(user.id).count, :remote => true) %> + <% if User.current.logged?%> + <% if User.current == user%> + 编辑资料 + <%else%> + <%if(user.watched_by?(User.current))%> + 取消关注 + <% else %> + 添加关注 + <% end %> + <% end%> + <% end %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 2c91f394f..e53d734c6 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,15 +1,5 @@ - -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"user" %> <% @center_flag = (User.current == @user) %> -<% if @center_flag %>
            <% if @user.allowed_to?(:add_project, nil, :global => true) %> @@ -26,52 +16,8 @@ <% end %>
            -<% end %>
            -
            -
            -
            - -

            -
            - 取消 - 留言 -
            -
            -
            - - -
            - - <% if !@center_flag %> - - <% end %>
            - <% if !@center_flag %> - - <% end %> -
            - - diff --git a/app/views/users/user_course_activities.html.erb b/app/views/users/user_course_activities.html.erb index bdebee6a5..ed5b66ed4 100644 --- a/app/views/users/user_course_activities.html.erb +++ b/app/views/users/user_course_activities.html.erb @@ -10,10 +10,19 @@ <%= rec[:item].user.show_name %> <%= get_activity_opt(rec[:item],rec[:e]) %> - - <%= get_activity_act_showname_htmlclear(rec[:item]) %> - + <% if(( rec[:e].is_public == false || rec[:e].is_public == 0 )&& !rec[:e].visible?)%> + + <%= get_activity_act_showname_htmlclear(rec[:item]) %> + + <% else %> + + <%= get_activity_act_showname_htmlclear(rec[:item]) %> + + <% end %> + <%= time_tag(get_activity_act_createtime(rec[:item])).html_safe %>
            <% end %> \ No newline at end of file diff --git a/app/views/users/user_courses.html.erb b/app/views/users/user_courses.html.erb index 36e061efa..769642e99 100644 --- a/app/views/users/user_courses.html.erb +++ b/app/views/users/user_courses.html.erb @@ -2,8 +2,6 @@ <% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %> 新建课程 - <% else %> - 加入课程 <% end %>
            @@ -13,9 +11,9 @@ diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb index deb360efd..a8107ce5f 100644 --- a/app/views/users/user_newfeedback.html.erb +++ b/app/views/users/user_newfeedback.html.erb @@ -1,7 +1,40 @@ -<% reply_allow = JournalsForMessage.create_by_user? User.current %> -<%= stylesheet_link_tag 'css', :media => 'all' %> +
            + + <% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %> + 新建课程 + <% end %> +
            +
            -<%= render :partial => 'user_jours', - :locals => { :journals => @jour, :state => false} -%> -<% html_title(l(:label_responses)) -%> \ No newline at end of file +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"user" %> +
            + + + +
            +
            + <%= form_for('new_form',:url => leave_user_message_path(@user.id),:method => "post") do |f|%> + +

            +
            + 取消 + 留言 + <% end%> +
            +
            + +
            + <%if @jour%> + <% @jour.each do |jour|%> + <%= render :partial => 'user_jours_new', :locals => {:jour => jour} %> + <%end%> + <% end%> + +
              + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> +
            +
            +
            +
            +
            +
            \ No newline at end of file diff --git a/app/views/users/user_projects.html.erb b/app/views/users/user_projects.html.erb index e7eeedb29..d76964020 100644 --- a/app/views/users/user_projects.html.erb +++ b/app/views/users/user_projects.html.erb @@ -2,8 +2,6 @@ <% if @user.allowed_to?(:add_project, nil, :global => true) %> 新建项目 - <% else %> - 加入项目 <% end %>
            @@ -13,9 +11,16 @@ @@ -43,7 +48,16 @@ - item.id, :host=>Setting.host_name) %>" target="_blank" class="blue_n_btn fr mt20">发布问题 + <% if User.current.member_of? item%> + item.id, :host=>Setting.host_name) %>" target="_blank" class="blue_n_btn fr mt20">发布问题 + <% elsif User.current.logged?%> + <% if item.applied_projects.find_by_user_id(User.current.id)%> + <%= link_to '取消申请',appliedproject_applied_path(:project_id => item.id,:user_id => User.current.id),:class => "blue_n_btn fr mt20", :remote => "true",:method => "delete",:id => "applied_project_link_#{item.id}"%> + <% else%> + <%= link_to "加入项目",appliedproject_path(:user_id => User.current.id,:project_id => item.id,:project_join => true),:class => "blue_n_btn fr mt20", :remote => "true",:method => "post",:id => "applied_project_link_#{item.id}" %> + <% end%> + + <% end%>
            <% end %> diff --git a/app/views/versions/_form.html.erb b/app/views/versions/_form.html.erb index f0ed7c84f..6ff8b070f 100644 --- a/app/views/versions/_form.html.erb +++ b/app/views/versions/_form.html.erb @@ -14,20 +14,20 @@ <%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]}, :label => "" %> -
          • - - <%= f.text_field :wiki_page_title, :size =>60, :label => "", :disabled => @project.wiki.nil? %> -
          • + + + +
          • <%= f.text_field :effective_date, :size => 10, :readonly => true,:class=>"fl" ,:style=>"margin-left:7px;",:label=>""%> <%= calendar_for('version_effective_date') %>
          • -
          • - - <%= f.select :sharing, @version.allowed_sharings.collect {|v| [format_version_sharing(v), v]},:label=>"" %> -
          • + + + +
          <% @version.custom_field_values.each do |value| %> diff --git a/app/views/versions/_overview.html.erb b/app/views/versions/_overview.html.erb index 47d65c34a..8d34a20da 100644 --- a/app/views/versions/_overview.html.erb +++ b/app/views/versions/_overview.html.erb @@ -13,5 +13,5 @@ project_issues_path(version.project, :status_id => 'o', :fixed_version_id => version, :set_filter => 1), :class =>"c_dblue") %>)

          <% else %> -

          <%= l(:label_roadmap_no_issues) %>

          +
          <%= l(:label_roadmap_no_issues) %>
          <% end %> diff --git a/app/views/versions/show.html.erb b/app/views/versions/show.html.erb index 1a7fce16d..6bfacbe86 100644 --- a/app/views/versions/show.html.erb +++ b/app/views/versions/show.html.erb @@ -4,7 +4,7 @@
          <%= link_to(l(:button_edit), edit_version_path(@version), :class => 'icon icon-edit') if User.current.allowed_to?(:manage_versions, @version.project) %> -<%= link_to_if_authorized(l(:button_edit_associated_wikipage, +<%#= link_to_if_authorized(l(:button_edit_associated_wikipage, :page_title => @version.wiki_page_title.truncate(30, omission: '...')), {:controller => 'wiki', :action => 'edit', @@ -17,7 +17,7 @@ <%= call_hook(:view_versions_show_contextual, { :version => @version, :project => @project }) %>
          -

          +

          <%= h(@version.name) %>

          @@ -27,11 +27,11 @@
          <% if @version.estimated_hours > 0 || User.current.allowed_to?(:view_time_entries, @project) %> -
          <%= l(:label_time_tracking) %> +
          <%= l(:label_time_tracking) %>
          -

          <%= l(:field_estimated_hours) %>:

          +

          <%= l(:field_estimated_hours) %>:

          <%= html_hours(l_hours(@version.estimated_hours)) %> @@ -40,7 +40,7 @@ <% if User.current.allowed_to?(:view_time_entries, @project) %>
          -

          <%= l(:label_spent_time) %>:

          +

          <%= l(:label_spent_time) %>:

          <%= html_hours(l_hours(@version.spent_hours)) %> diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index 143c32dbe..4edec2202 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -56,21 +56,11 @@ <% end %> - - <%= l(:label_welcome_trustie_course) %> + <%= l(:label_welcome_trustie_course) %> <% else %> <% unless @course_page.nil? %> - <%= l(:label_welcome_trustie_course) %> , @@ -112,7 +102,6 @@ course_term = "春季学期" end %> - <%# (month_now >= 3 && month_now < 9) ? course_term = "春季学期" : course_term = "秋季学期" %> <% cur_school_course = @school_id.nil? ? [] : find_miracle_course(10,7,@school_id, year_now, course_term) %> <% if cur_school_course.count == 0 %> diff --git a/app/views/wiki/show.html.erb b/app/views/wiki/show.html.erb index 28fab1243..c58f42dea 100644 --- a/app/views/wiki/show.html.erb +++ b/app/views/wiki/show.html.erb @@ -74,11 +74,11 @@ <% end %>

          -<% other_formats_links do |f| %> - <%= f.link_to 'PDF', :url => {:id => @page.title, :version => params[:version]} %> - <%= f.link_to 'HTML', :url => {:id => @page.title, :version => params[:version]} %> - <%= f.link_to 'TXT', :url => {:id => @page.title, :version => params[:version]} %> -<% end if User.current.allowed_to?(:export_wiki_pages, @project) %> +<%# other_formats_links do |f| %> + <%#= f.link_to 'PDF', :url => {:id => @page.title, :version => params[:version]} %> + <%#= f.link_to 'HTML', :url => {:id => @page.title, :version => params[:version]} %> + <%#= f.link_to 'TXT', :url => {:id => @page.title, :version => params[:version]} %> +<%# end if User.current.allowed_to?(:export_wiki_pages, @project) %> <% content_for :sidebar do %> <%= render :partial => 'sidebar' %> <% end %> diff --git a/app/views/words/create_reply.js.erb b/app/views/words/create_reply.js.erb index 8e57d7b0e..6aad1bfb5 100644 --- a/app/views/words/create_reply.js.erb +++ b/app/views/words/create_reply.js.erb @@ -1,11 +1,10 @@ <% if @save_succ %> <% if !@jfm.nil? && @jfm.jour_type == 'Principal' %> - var html = $("
          "+"<%= escape_javascript( render(:template => 'users/user_feedback4show',:locals => {:feed_list=>[@jfm]} )) %>"+"
          "); - $("div[nhname='container']",$("#nh_messages")).prepend(html.html()); -// $('#new_message_cancel_btn').click(); - $("a[nhname='reply_btn']",$("#nh_jours_<%= @jfm.m_reply_id %>")).click(); - var params = init_list_more_div_params($("#nh_messages")); - change_status_4_list_more_div(params); + $("#<%= @jfm.m_parent_id%>").children("div[nhname='reply_list']").prepend("<%= escape_javascript( render(:partial => 'users/user_jour_reply',:locals => {:reply=>@jfm} )) %>"); + div_1 = $("#<%= @jfm.m_reply_id%>").children("div[nhname='div_form']"); + div_1.hide(); + div_2 = $("#<%= @jfm.m_reply_id%>").children("div[nhname='sub_div_form']"); + div_2.hide(); <% else %> var pre_append = $('<%= j( diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index 92e15ab93..c138a7ea7 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -2,9 +2,10 @@ alert('<%=l(:notice_failed_delete)%>'); <% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication'].include? @journal_destroyed.jour_type)%> <% if @is_user%> - $("#nh_jours_<%= @journal_destroyed.id %>",$("div[nhname='container']",$("#nh_messages"))).remove(); - var params = init_list_more_div_params($("#nh_messages")); - change_status_4_list_more_div(params); + var destroyedItem = $('#<%=@journal_destroyed.id%>'); + destroyedItem.fadeOut(600,function(){ + destroyedItem.remove(); + }); <% else %> <% if @bid && @jours_count %> $('#jours_count').html("<%= @jours_count %>"); diff --git a/config/environments/development.rb b/config/environments/development.rb index 2aca152cb..a3e7dff99 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -7,6 +7,7 @@ RedmineApp::Application.configure do # Log error messages when you accidentally call methods on nil. config.whiny_nils = true + config.log_level =:debug config.logger = Logger.new('log/development.log', 'daily') # daily, weekly or monthly # Show full error reports and disable caching config.consider_all_requests_local = true diff --git a/config/locales/account/zh.yml b/config/locales/account/zh.yml index 69edc7aa3..c7c76707d 100644 --- a/config/locales/account/zh.yml +++ b/config/locales/account/zh.yml @@ -37,7 +37,7 @@ zh: label_password_lost: "忘记密码?" button_login: 登录 # account_controller中判断用户名或密码输入有误的提示信息 - notice_account_invalid_creditentials: "无效的用户名或密码" + notice_account_invalid_creditentials: "无效的用户名或密码,注意登录名区分大小写,谢谢!" # account_controller中判断未激活的提示信息 notice_account_invalid_creditentials_new: "您还未到邮箱激活。如果您丢失帐户,电子邮件验证帮助我们的支持团队验证帐户的所有权,并允许您接收所有您要求的通知。" diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 78e8379dc..0f0cce301 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -381,6 +381,7 @@ zh: label_organization_choose: --请选择组织-- label_organization_name: 组织名称 label_organization_list: 组织列表 + label_school_plural: 学校列表 label_organization_new: 新建组织 label_organization_edit: 修改组织 label_project_plural: 项目列表 @@ -670,6 +671,7 @@ zh: label_revision: 修订 label_revision_plural: 修订 lable_revision_code_count: 代码量 + label_revision_commit_count: 提交次数 label_revision_id: 修订 %{value} label_associated_revisions: 相关修订版本 label_added: 已添加 @@ -688,7 +690,7 @@ zh: label_sort_lowest: 置底 label_roadmap_due_in: "截止日期到 %{value}" label_roadmap_overdue: "%{value} 延期" - label_roadmap_no_issues: 该版本没有问题 + label_roadmap_no_issues: 该版本还没有对应的缺陷,可以在“发布问题”的“目标版本”中指定版本! label_user_search_type: 搜索类型 label_search_by_login: 登录名 label_search_by_name: 名字 @@ -2056,5 +2058,22 @@ zh: lable_unset: 未设置 label_chose_group: 请选择分班 +# label_hosted_organization: 主办单位 +# label_hosted_by: 国防科学技术大学并行与分布处理国家重点实验室 +# label_sponsor: 计算机科学与技术系 +# label_partners: 合作单位 +# label_co_organizer_NUDT: 国防科学技术大学计算机学院 +# label_co_organizer_EECS: 北京大学 +# label_co_organizer_BHU: 北京航空航天大学 +# label_co_organizer_CAS: 中国科学院软件研究所 +# label_co_organizer_InforS: 中创软件 +# label_rights_reserved: Copyright 2007~2015, All Rights Riserved +# label_about_us: 关于我们 +# label_contact_us: 联系我们 +# label_recruitment_information: 招聘信息 +# label_surpport_group: 帮助中心 +# label_forums: 论坛反馈 +# label_language: 语言 +# label_license: 湘ICP备09019772 diff --git a/config/routes.rb b/config/routes.rb index 1ae607eb7..cdcb1126c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -39,6 +39,17 @@ RedmineApp::Application.routes.draw do end + resources :school do + collection do + + end + + member do + get 'upload_logo' + post 'upload' + end + end + resources :homework_attach do collection do get 'get_homework_member_list' @@ -71,10 +82,14 @@ RedmineApp::Application.routes.draw do get 'poll_result' get 'close_poll' get 'export_poll' + get 'import_poll' + end collection do delete 'delete_poll_question' post 'update_poll_question' + get 'other_poll' + post 'import_other_poll' end end @@ -86,6 +101,7 @@ RedmineApp::Application.routes.draw do end collection do post 'next_step' + post 'programing_test' end end @@ -293,7 +309,7 @@ RedmineApp::Application.routes.draw do match 'user_projects_index', :to => 'users#user_projects_index', :via => :get match 'user_projects', :to => 'users#user_projects', :via => :get match 'user_activities', :to => 'users#user_activities', :via => :get, :as => "user_activities" - match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback" + # match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback" match 'info', :to => 'users#info', :via => [:get , :post], :as => 'user_info' match 'user_watchlist', :to => 'users#user_watchlist', :via => :get, :as => "user_watchlist" #add by huang match 'user_fanslist', :to => 'users#user_fanslist', :via => :get, :as => "user_fanslist" #add by huang @@ -386,14 +402,6 @@ RedmineApp::Application.routes.draw do get 'feedback', :action => 'feedback', :as => 'project_feedback' get 'watcherlist', :action=> 'watcherlist' - # 添加dts测试工具 - get 'dts_dep', :action=> 'dts_dep' - get 'yun_dep', :action=> 'yun_dep' - get 'soft_knowledge', :action=> 'soft_knowledge' - get 'soft_file', :action=> 'soft_file' - get 'online_dev', :action=> 'online_dev' - get 'soft_service', :action=> 'soft_service' - get 'invite_members', :action=> 'invite_members' get 'invite_members_by_mail', :action=> 'invite_members_by_mail' # get 'dts_repos', :aciton => 'dts_repos' @@ -670,6 +678,7 @@ RedmineApp::Application.routes.draw do match 'admin/test_email', :via => :get match 'admin/default_configuration', :via => :post get 'admin/organization' + get 'admin/schools' resources :auth_sources do member do @@ -779,6 +788,7 @@ RedmineApp::Application.routes.draw do match 'words/:id/leave_project_message', :to => 'words#leave_project_message' match 'projects/:id/feedback', :to => 'projects#feedback', :via => :get, :as => 'project_feedback' match 'project/:id/share', :to => 'projects#share', :as => 'share_show' #share + post 'words/:id/leave_user_message', :to => 'words#leave_user_message', :as => "leave_user_message" post 'join_in/join', :to => 'courses#join', :as => 'join' delete 'join_in/join', :to => 'courses#unjoin' @@ -808,9 +818,6 @@ RedmineApp::Application.routes.draw do post 'school/search_school/', :to => 'school#search_school' get 'school/search_school/', :to => 'school#search_school' - post 'school/upload', :to => 'school#upload' - get 'school/upload_logo', :to => 'school#upload_logo' - ######added by nie match 'tags/show_projects_tags' ########### added by liuping diff --git a/db/migrate/20150730093403_add_result_to_test.rb b/db/migrate/20150730093403_add_result_to_test.rb new file mode 100644 index 000000000..8494fbbf5 --- /dev/null +++ b/db/migrate/20150730093403_add_result_to_test.rb @@ -0,0 +1,9 @@ +class AddResultToTest < ActiveRecord::Migration + def up + add_column :homework_tests, :result, :integer,default: 0 + end + + def down + remove_column :homework_tests,:result + end +end diff --git a/db/migrate/20150730130816_add_errormsg_to_test.rb b/db/migrate/20150730130816_add_errormsg_to_test.rb new file mode 100644 index 000000000..31b1b2246 --- /dev/null +++ b/db/migrate/20150730130816_add_errormsg_to_test.rb @@ -0,0 +1,9 @@ +class AddErrormsgToTest < ActiveRecord::Migration + def up + add_column :homework_tests,:error_msg,:text + end + + def down + remove_column :homework_tests,:error_msg + end +end diff --git a/db/migrate/20150801034945_change_result_default.rb b/db/migrate/20150801034945_change_result_default.rb new file mode 100644 index 000000000..1f629aa45 --- /dev/null +++ b/db/migrate/20150801034945_change_result_default.rb @@ -0,0 +1,9 @@ +class ChangeResultDefault < ActiveRecord::Migration + def up + change_column :homework_tests,:result,:integer,:default => nil + end + + def down + change_column :homework_tests,:result,:integer,:default => 0 + end +end diff --git a/db/migrate/20150811065543_add_course_activities.rb b/db/migrate/20150811065543_add_course_activities.rb new file mode 100644 index 000000000..03ec7e354 --- /dev/null +++ b/db/migrate/20150811065543_add_course_activities.rb @@ -0,0 +1,15 @@ +class AddCourseActivities < ActiveRecord::Migration + def up + create_table :course_activities do |t| + t.integer :user_id + t.integer :course_id + t.integer :course_act_id + t.string :course_act_type + t.timestamps + end + end + + def down + drop_table :course_activities + end +end diff --git a/db/migrate/20150811080754_course_activities.rb b/db/migrate/20150811080754_course_activities.rb new file mode 100644 index 000000000..a4cae915d --- /dev/null +++ b/db/migrate/20150811080754_course_activities.rb @@ -0,0 +1,40 @@ +#encoding=UTF-8 +class CourseActivities < ActiveRecord::Migration + def up + Course.all.each do |course| + transaction do + course.course_acts << CourseActivity.new(:user_id => course.tea_id,:course_id => course.id) + #作业 + course.homework_commons.each do |homework_common| + homework_common.course_acts << CourseActivity.new(:user_id => homework_common.user_id,:course_id => course.id) + end + #通知 + course.news.each do |new| + new.course_acts << CourseActivity.new(:user_id => new.author_id,:course_id => course.id) + end + #资源 + course.attachments.each do |attachment| + attachment.course_acts << CourseActivity.new(:user_id => attachment.author_id,:course_id => course.id) + end + #讨论区 + if course.boards.first + course.boards.first.messages.each do |message| + message.course_acts << CourseActivity.new(:user_id => message.author_id,:course_id => course.id) + end + end + #留言 + course.journals_for_messages.each do |jour| + jour.course_acts << CourseActivity.new(:user_id => jour.user_id,:course_id => course.id) + end + #问卷 + Poll.where("polls_type = 'Course' and polls_group_id = #{course.id}").each do |poll| + poll.course_acts << CourseActivity.new(:user_id => poll.user_id,:course_id => course.id) + end + end + end + end + + def down + CourseActivity.destroy_all + end +end diff --git a/db/migrate/20150811083234_update_course_activity_time.rb b/db/migrate/20150811083234_update_course_activity_time.rb new file mode 100644 index 000000000..9ba8140d8 --- /dev/null +++ b/db/migrate/20150811083234_update_course_activity_time.rb @@ -0,0 +1,22 @@ +class UpdateCourseActivityTime < ActiveRecord::Migration + def up + count = CourseActivity.all.count / 10 + 1 + transaction do + for i in 1 ... count do i + CourseActivity.page(i).per(10).each do |activity| + if activity.course_act + if activity.course_act.respond_to?("created_at") + activity.created_at = activity.course_act.created_at + elsif activity.course_act.respond_to?("created_on") + activity.created_at = activity.course_act.created_on + end + activity.save + end + end + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 912b4e8b4..1488ca365 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150722015428) do +ActiveRecord::Schema.define(:version => 20150811083234) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -324,6 +324,15 @@ ActiveRecord::Schema.define(:version => 20150722015428) do t.datetime "updated_on", :null => false end + create_table "course_activities", :force => true do |t| + t.integer "user_id" + t.integer "course_id" + t.integer "course_act_id" + t.string "course_act_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "course_attachments", :force => true do |t| t.string "filename" t.string "disk_filename" @@ -454,6 +463,13 @@ ActiveRecord::Schema.define(:version => 20150722015428) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" + create_table "discuss_demos", :force => true do |t| + t.string "title" + t.text "body" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "documents", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.integer "category_id", :default => 0, :null => false @@ -627,6 +643,8 @@ ActiveRecord::Schema.define(:version => 20150722015428) do t.integer "homework_common_id" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.integer "result" + t.text "error_msg" end create_table "homework_users", :force => true do |t| @@ -854,7 +872,6 @@ ActiveRecord::Schema.define(:version => 20150722015428) do t.datetime "created_on" t.integer "comments_count", :default => 0, :null => false t.integer "course_id" - t.datetime "updated_on" end add_index "news", ["author_id"], :name => "index_news_on_author_id" diff --git a/lib/redmine.rb b/lib/redmine.rb index 3043cfe5d..0f6c14b8a 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -369,6 +369,7 @@ Redmine::MenuManager.map :admin_menu do |menu| menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural menu.push :courses, {:controller => 'admin', :action => 'courses'}, :caption => :label_course_all menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural + menu.push :schools, {:controller => 'admin', :action => 'schools'}, :caption => :label_school_plural menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made menu.push :mobile_version, {:controller => 'admin',:action => 'mobile_version'},:caption => :label_mobile_version menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural diff --git a/public/javascripts/course.js b/public/javascripts/course.js index b2736993b..6ba202b28 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -546,10 +546,12 @@ function submit_homework_form(){if(regexHomeworkCommonName()&®exHomeworkCommo //增加测试结果 function add_programing_test(obj) { var now = new Date().getTime(); - obj.after("
        • " + - "
        • " + + obj.after("
        • " + + "
        • " + "
        • " + "" + + "测试" + + "" + "
        • "); } //删除测试结果 diff --git a/public/javascripts/project.js b/public/javascripts/project.js index 98c148372..c7a615ba3 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -491,3 +491,8 @@ function judgeprojectname(){ } }); } + +//用户反馈 +function submitProjectFeedback() { + $("#project_feedback_form").submit(); +} \ No newline at end of file diff --git a/public/javascripts/user.js b/public/javascripts/user.js new file mode 100644 index 000000000..c7690a015 --- /dev/null +++ b/public/javascripts/user.js @@ -0,0 +1,261 @@ +//个人动态 +$(function(){ + function init_editor(params){ + var editor = params.kindutil.create(params.textarea, { + resizeType : 1,minWidth:"1px",width:"100%",height:"80px", + items:['emoticons'], + afterChange:function(){//按键事件 + nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); + }, + afterCreate:function(){ + var toolbar = $("div[class='ke-toolbar']",params.div_form); + $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情'); + params.toolbar_container.append(toolbar); + } + }).loadPlugin('paste'); + return editor; + } + + function nh_check_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()){ + params.contentmsg.html('内容不能为空'); + params.contentmsg.css({color:'#ff0000'}); + }else{ + params.contentmsg.html('填写正确'); + params.contentmsg.css({color:'#008000'}); + } + params.contentmsg.show(); + } + } + return result; + } + function init_form(params){ + params.form.submit(function(){ + var flag = false; + if(params.form.attr('data-remote') != undefined ){ + flag = true + } + var is_checked = nh_check_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 nh_reset_form(params){ + params.form[0].reset(); + params.textarea.empty(); + if(params.editor != undefined){ + params.editor.html(params.textarea.html()); + } + params.contentmsg.hide(); + } + + KindEditor.ready(function(K){ + $("a[nhname='reply_btn']").live('click',function(){ + var params = {}; + params.kindutil = K; + params.container = $(this).parent().parent('div'); + params.div_form = $("div[nhname='div_form']",params.container); + params.form = $("form",params.div_form); + params.textarea = $("textarea[name='user_notes']",params.div_form); + params.textarea.prev('div').css("height","60px"); + params.contentmsg = $("p[nhname='contentmsg']",params.div_form); + params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); + params.cancel_btn = $("a[nhname='cancel_btn']",params.div_form); + params.submit_btn = $("a[nhname='submit_btn']",params.div_form); + if(params.textarea.data('init') == undefined){ + params.editor = init_editor(params); + init_form(params); + params.cancel_btn.click(function(){ + nh_reset_form(params); + toggleAndSettingWordsVal(params.div_form, params.textarea); + }); + params.submit_btn.click(function(){ + params.form.submit(); + }); + params.textarea.data('init',1); + } + params.cancel_btn.click(); + setTimeout(function(){ + if(!params.div_form.is(':hidden')){ + params.textarea.show(); + params.textarea.focus(); + params.textarea.hide(); + } + },300); + }); + + $("a[nhname='sub_reply_btn']").live('click',function(){ + var params = {}; + params.kindutil = K; + params.container = $(this).parent().parent('div'); + params.div_form = $("div[nhname='sub_div_form']",params.container); + params.form = $("form",params.div_form); + params.textarea = $("textarea[name='user_notes']",params.div_form); + params.textarea.prev('div').css("height","60px"); + params.contentmsg = $("p[nhname='sub_contentmsg']",params.div_form); + params.toolbar_container = $("div[nhname='sub_toolbar_container']",params.div_form); + params.cancel_btn = $("a[nhname='sub_cancel_btn']",params.div_form); + params.submit_btn = $("a[nhname='sub_submit_btn']",params.div_form); + if(params.textarea.data('init') == undefined){ + params.editor = init_editor(params); + init_form(params); + params.cancel_btn.click(function(){ + nh_reset_form(params); + toggleAndSettingWordsVal(params.div_form, params.textarea); + }); + params.submit_btn.click(function(){ + params.form.submit(); + }); + params.textarea.data('init',1); + } + params.cancel_btn.click(); + setTimeout(function(){ + if(!params.div_form.is(':hidden')){ + params.textarea.show(); + params.textarea.focus(); + params.textarea.hide(); + } + },300); + }); + + $("div[nhname='new_message']").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']",params.div_form); + params.contentmsg = $("p[nhname='contentmsg']",params.div_form); + params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); + params.cancel_btn = $("#new_message_cancel_btn"); + params.submit_btn = $("#new_message_submit_btn"); + + if(params.textarea.data('init') == undefined){ + params.editor = init_editor(params); + init_form(params); + params.cancel_btn.click(function(){ + nh_reset_form(params); + }); + params.submit_btn.click(function(){ + params.form.submit(); + }); + params.textarea.data('init',1); + $(this).show(); + } + }); + }); +}); +function init_list_more_div(params){ + var p=params; + p.exbtn.click(function(){ + var isclose = p.container.data('isclose'); + var hasmore = p.container.data('hasmore'); + if(isclose == '1'){ + $("div[nhname='rec']",p.container).show(); + p.container.data('isclose','0'); + change_status_4_list_more_div(params); + return; + } + if(hasmore == '0'){ + change_status_4_list_more_div(params,'get'); + return; + } + var url = p.container.data('url'); + if($("div[nhname='rec']",p.container).length > 0){ + var lastid = $("div[nhname='rec']",p.container).filter(':last').data('id'); + url += "?lastid="+lastid; + var lasttime = $("div[nhname='rec']",p.container).filter(':last').data('time'); + if(lasttime != undefined){ + url += "&lasttime="+lasttime; + } + } + $.ajax( {url:url,dataType:'text',success:function(data){ + var html = $("
          "+data+"
          "); + var lens = $("div[nhname='rec']",html).length; + if(lens < p.size){ + p.container.data('hasmore','0'); + } + if(lens>0){ + var currpage = parseInt(p.container.data('currpage'))+1; + p.container.data('currpage',currpage); + p.container.append(html.html()) + } + change_status_4_list_more_div(params,'get'); + p.div.show(); + }} ); + }); + p.clbtn.click(function(){ + var i=0; + $("div[nhname='rec']",p.container).each(function(){ + i++; + if(i> p.size){ + $(this).hide(); + } + }); + p.container.data('isclose','1'); + change_status_4_list_more_div(params); + }); + p.exbtn.click(); +} +function change_status_4_list_more_div(params,opt){ + var p=params; + if($("div[nhname='rec']",p.container).length == 0 && opt != 'get'){ + p.exbtn.click(); + return; + } + var show_lens = $("div[nhname='rec']",p.container).length - $("div[nhname='rec']",p.container).filter(':hidden').length; + if( show_lens > p.size ){ + p.clbtn.show(); + }else{ + p.clbtn.hide(); + } + if($("div[nhname='rec']",p.container).length == 0){ + p.exbtn.html(p.nodatamsg); + }else if( p.container.data('hasmore') == '1' || p.container.data('isclose')=='1' ){ + p.exbtn.html('点击展开更多'); + }else{ + p.exbtn.html('没有更多了'); + } +} +function init_list_more_div_params(div){ + var params = {}; + params.div = div; + params.container = $("div[nhname='container']",div); + params.exbtn = $("a[nhname='expand']",div); + params.clbtn = $("a[nhname='close']",div); + params.size = params.container.data('pagesize'); + params.nodatamsg = params.container.data('nodatamsg'); + if( params.size == undefined ){ + params.size = 13; + } + return params; +} +$(function(){ + $("div[nhname='list_more_div']").each(function(){ + var params = init_list_more_div_params($(this)); + init_list_more_div(params) + }); +}); +//个人动态 end \ No newline at end of file diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index d4d309181..3e01d68ff 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2796,4 +2796,15 @@ div.repos_explain{ .upload_img img{max-width: 100%;} #activity .upload_img img{max-width: 580px;} -img,embed{max-width: 100%;} \ No newline at end of file +img,embed{max-width: 100%;} + +img.school_avatar { + background: rgb(245, 245, 245); + padding: 4px; + border: 1px solid #e5dfc7; + float: left; + display: block; + width: 100px; + height: 100px; + max-width: none; +} \ No newline at end of file diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 778a474cd..1393431d7 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -55,7 +55,7 @@ a:hover.problem_pic{border:1px solid #64bdd9;} .problem_txt{ width:610px; margin-left:10px; color:#777777;word-break: break-all;word-wrap: break-word;} a.problem_name{ color:#ff5722;max-width:60px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} a:hover.problem_name{ color:#d33503;} -a.problem_tit{ color:#0781b4; max-width:410px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +a.problem_tit{ color:#0781b4; max-width:410px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;vertical-align: top;} a.pro_mes_w{ height:20px; float:right;display:block; color:#999999;} a:hover.problem_tit{ color:#09658c; } .problem_main{ border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;} @@ -88,8 +88,6 @@ a:hover.talk_edit{ color:#ff5722;} .talk_text{ border:1px solid #64bdd9; height:100px;width:550px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;} .talk_new ul li{ } .sb{width:70px; height:26px; color:#606060; cursor:pointer;} -a.blue_btn{ background:#64bdd9; display:block; font-size:14px;color:#fff; font-weight:normal; text-align:center; margin-left:10px; margin-bottom:10px; padding:2px 10px;} -a:hover.blue_btn{ background:#329cbd;} a.grey_btn{ background:#d9d9d9; color:#656565;font-size:14px; font-weight:normal; text-align:center; margin-left:10px; margin-bottom:10px; padding:2px 10px;} a:hover.grey_btn{ background:#717171; color:#fff;} /****资源库***/ @@ -228,6 +226,7 @@ a:hover.ping_sub{ background:#14a8b9;} .w430{ width:470px;} .w557{ width:557px;} .w350{ width:350px;} +.h400{height: 400px !important;} .w620{ width:480px; height:160px; border:1px solid #CCC;} .bo{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:470px; } .bo02{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:480px; margin-left:2px; color: #999; } @@ -609,6 +608,7 @@ a:hover.Reply_pic{border:1px solid #64bdd9;} .w547{ width:544px;} .w196{ width:196px;} .w186{ width:186px;} +.w190{width: 190px;} .w200{width: 200px;} .w459{ width:459px;} .hwork_new_set{border:1px dashed #CCC; background:#f5f5f5; text-align:center; padding:10px 0; margin-bottom:10px;} @@ -665,7 +665,6 @@ a:hover.ping_pic{border:1px solid #64bdd9;} .ping_back_tit{ float:left; width:523px; margin-left:10px; } a.down_btn{ border:1px solid #CCC; color:#999; padding:0px 5px; font-size:12px; text-align:center; display:block;} a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;} -.fr{ float:right;} .min_search{ width:140px; height:20px; border:1px solid #d0d0d0; color:#666; background:url(../images/public_icon.png) 185px -193px no-repeat; } .li_min_search{ float:right; margin-right:-10px;} .info_ni_download{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 200px;margin-top: 10px;} @@ -696,6 +695,9 @@ a.work_list_tit{width:580px; display:block; overflow:hidden; font-size:14px; f .border_l{border-left:1px solid #e4e4e4;} .border_t{ border-top:1px solid #e4e4e4;} .td_end{border-top:1px solid #e4e4e4; height:auto; padding:5px; } +.wl{text-align: left;} +.vt{vertical-align: top;} +.td_board_left{border-right: 1px solid #e4e4e4;} .c_w{ color:#fff;} .filename { background: url(../images/pic_file.png) 0 -25px no-repeat;color: #3ca5c6;max-width: 150px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px; white-space: nowrap; text-overflow:ellipsis;} @@ -711,6 +713,7 @@ a:hover.about_me{ color:#0781b4;} .mb5 li{width:200px;word-wrap: break-word; word-break: normal; } +#homework_work_test_show{margin-left: 35px;width: 94%;} diff --git a/public/stylesheets/leftside_new.css b/public/stylesheets/leftside_new.css index c2d4d043c..2f31a1f65 100644 --- a/public/stylesheets/leftside_new.css +++ b/public/stylesheets/leftside_new.css @@ -31,7 +31,7 @@ a:hover.pr_join_a{ background:#41a8c8;} /*左侧导航*/ .subNavBox{width:240px; background:#fff;margin:10px 10px 0 0;} -.subNav{border-bottom:solid 1px #e5e3da;cursor:pointer;font-weight:bold;font-size:14px;color:#3ca5c6; height:26px;padding-left:10px;background-color:#fff; padding-top:2px;} +.subNav{border-bottom:solid 1px #e5e3da;cursor:auto;font-weight:bold;font-size:14px;color:#3ca5c6; height:26px;padding-left:10px;background-color:#fff; padding-top:2px;} .subNav_jiantou{background:url(../images/jiantou1.jpg) no-repeat;background-position:95% 50%; background-color:#fff;} .subNav_jiantou:hover{color:#0781b4; } .currentDd{color:#0781b4;} diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css index 353ec3937..97faa0f57 100644 --- a/public/stylesheets/polls.css +++ b/public/stylesheets/polls.css @@ -28,7 +28,7 @@ a:hover.pollsbtn{ background:#64bdd9; color:#fff; text-decoration:none;} #polls div{word-break: break-all;word-wrap: break-word;} .ur_prefix_content{ color:#656565; text-indent:30px; margin-top:10px; } .ur_card{border-top:1px solid #dcdcdc;margin-top:20px; color:#3a3a3a;} -.ur_title{ padding:20px 0px ; float:left; width:604px; } +.ur_title{ padding:20px 0px ; float:left; width:564px; } .ur_required{ font-weight: bold; color:red;} .ur_inputs{ color:#666;} .ur_table{border-top:1px solid #dcdcdc; background:#fff;} @@ -101,10 +101,13 @@ a:hover.icon_remove{background:url(images/icons.png) -20px -338px no-repeat;} .ur_editor02{width:648px; border:1px solid #cbcbcb; padding:10px; margin-bottom:10px;} a.ur_button_submit{ display:block; width:106px; height:31px; margin:0 auto; background:#15bccf; color:#fff; font-size:16px; text-align:center; padding-top:4px; margin-bottom:10px; } a:hover.ur_button_submit{ background:#0fa9bb; text-decoration:none;} + a.ur_icon_de{ background:url(images/icons.png) 0px -338px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px;} a:hover.ur_icon_de{ background:url(images/icons.png) -20px -338px no-repeat;} .ur_icon_edit{ background:url(images/icons.png) 0px -272px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px; margin-right:10px;} a:hover.ur_icon_edit{ background:url(images/icons.png) -21px -272px no-repeat;} +.ur_icon_add{ background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px; margin-right:10px;} +a:hover.ur_icon_add{background:url(images/icons.png) -20px -310px no-repeat;} /***弹框***/ .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;} @@ -127,7 +130,7 @@ a:hover.btn_de{ background:#ff5d31;} a.btn_pu{ border:1px solid #3cb761; color:#3cb761; } a:hover.btn_pu{ background:#3cb761;} .pollsbtn_grey{ border:1px solid #b1b1b1; color:#b1b1b1; padding:0px 9px; height:19px; padding-top:3px; } -.polls_title_w { width:300px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} +.polls_title_w { width:280px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} .polls_title_st { max-width:530px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} .polls_de_grey{ color:#b1b1b1; margin-top:3px;} .ml5{ margin-left:5px;} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index fa1bec754..8d86a6873 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -74,7 +74,11 @@ a:hover.problem_pic{border:1px solid #64bdd9;} .issues_icon{ background:url(../images/public_icon.png) 0 -342px no-repeat; width:16px; height:21px;} .problem_txt{ width:600px; margin-left:10px; color:#777777; } .pro_txt_w{width:610px;} -a.problem_name{ color:#ff5722; } +a.problem_name{ color:#ff5722;max-width: 80px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} a:hover.problem_name{ color:#d33503;} a.problem_tit{ color:#0781b4; max-width:430px; font-weight:bold; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} a.problem_tit02{ color:#0781b4; font-weight:bold;max-width:400px;} @@ -690,9 +694,10 @@ table.list thead th tr.changeset { height: 20px } tr.changeset ul, ol { margin-top: 0px; margin-bottom: 0px; } -tr.changeset td.revision_graph { width: 15%; background-color: #fffffb; } +tr.changeset td.revision_graph { width: 1%; background-color: #fffffb; } tr.changeset td.author { text-align: center; width: 15%; white-space:nowrap;} tr.changeset td.committed_on { text-align: center; width: 15%; white-space:nowrap;} +tr.changeset td.comments { text-align: center; word-break:break-all; word-wrap: break-word;;} div.changeset { padding: 4px;} div.changeset { border-bottom: 1px solid #ddd; } @@ -770,4 +775,6 @@ a:hover.Reply_pic{border:1px solid #64bdd9;} #about_newtalk{ display:none;} +/*version*/ +.time_tracter{color: #64BDD9;padding: 5px;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index d0893ca3d..82b3f17aa 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -77,9 +77,12 @@ h4{ font-size:14px; color:#3b3b3b;} .mr20{ margin-right:20px;} .mr30{ margin-right:30px;} .mr40{ margin-right:40px;} +.mr45{margin-right: 45px;} .mr50{margin-right: 50px;} .mr55{margin-right: 55px;} .mr70{margin-right: 70px;} +.mw15{margin:0 15px;} +.mw20{margin:0 20px;} .mt1{margin-top: 1px;} .mt3{ margin-top:3px;} .mt5{ margin-top:5px;} @@ -87,6 +90,7 @@ h4{ font-size:14px; color:#3b3b3b;} .mt10{ margin-top:10px;} .mt30{ margin-top: 30px;} .mb5{ margin-bottom:5px;} +.mb8{ margin-bottom:8px;} .mb10{ margin-bottom:10px;} .mb20{ margin-bottom:20px;} .pl15{ padding-left:15px;} @@ -165,11 +169,13 @@ a.c_green{ color:#28be6c;} .grey_btn{ background:#d9d9d9; color:#656565;font-size:14px; font-weight:normal; text-align:center;padding:2px 10px;} a.grey_btn{ background:#d9d9d9; color:#656565;font-size:14px; font-weight:normal; text-align:center;padding:2px 10px;} a:hover.grey_btn{ background:#717171; color:#fff;} -.green_btn{ background:#28be6c; color:#fff; font-size:14px; font-weight:normal;padding:2px 10px; text-align:center;} -a.green_btn{background:#28be6c;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center;} +.green_btn{ background:#28be6c; color:#fff; font-size:14px; font-weight:normal;padding:2px 8px; text-align:center;} +a.green_btn{background:#28be6c;color:#fff;font-size:14px; font-weight:normal; padding:2px 8px; text-align:center;cursor: pointer;} a:hover.green_btn{ background:#14ad5a;} -.blue_btn{ background:#64bdd9; color:#fff; font-size:14px; font-weight:normal;padding:2px 10px; text-align:center;} -a.blue_btn{background:#64bdd9;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center;} +.blue_btn{ background:#64bdd9; color:#fff; font-size:14px; font-weight:normal;padding:2px 8px; text-align:center;} +a.blue_btn{background:#64bdd9;color:#fff;font-size:14px; font-weight:normal; padding:2px 8px; text-align:center;cursor: pointer;} +.red_btn{ background:red; color:#fff; font-size:14px; font-weight:normal;padding:2px 8px; text-align:center;} +a.red_btn{background:red; color:#fff;font-size:14px; font-weight:normal; padding:2px 8px; text-align:center;cursor: pointer;} a.orange_btn_homework{background:#d63502;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center;} a:hover.blue_btn{ background:#329cbd;cursor: pointer;} a.orange_btn{ background:#ff5722;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center; } @@ -451,3 +457,13 @@ img,embed{max-width: 100%;} .is_public_checkbox{margin-left: 15px;margin-right: 10px;} .author_name{color: #3ca5c6 !important;} .ke-container-default{max-width: 100%;} + +/*底部*/ +/*#Footer{background-color:#ffffff; margin-bottom:10px; padding-bottom:15px; color:#666666;}*/ +/*.footerAboutContainer {width:auto; border-bottom:1px solid #efefef;}*/ +/*.footerAbout{ width:585px; margin:0 auto;height:35px; line-height:35px; border-bottom:1px solid #efefef; }*/ +/*.languageBox {width:55px; height:20px; margin-left:5px; outline:none; color:#666666; border:1px solid #d9d9d9;}*/ +/*.departments{ width:890px; margin:5px auto 0 auto;height:30px;line-height:30px;}*/ +/*.copyright{ width:390px; margin:0 auto;height:20px;line-height:20px;}*/ +/*a.f_grey {color:#666666;}*/ +/*a.f_grey:hover {color:#000000;}*/ diff --git a/public/stylesheets/public_new.css b/public/stylesheets/public_new.css index 428da5712..7389dff8a 100644 --- a/public/stylesheets/public_new.css +++ b/public/stylesheets/public_new.css @@ -7,6 +7,7 @@ table,tr,td{border:0;cellspacing:0; cellpadding:0;} ol,ul,li{ list-style-type:none} a:link,a:visited{color:#7f7f7f;text-decoration:none;} a:hover,a:active{color:#000;} +img{max-width: 100%;} /*常用*/ select,input,textarea{ border:1px solid #64bdd9; background:#fff; color:#000; padding-left:5px; } @@ -71,6 +72,9 @@ h4{ font-size:14px; color:#3b3b3b;} .mr20{ margin-right:20px;} .mr30{ margin-right:30px;} .mr40{ margin-right:40px;} +.mr45{margin-right: 45px;} +.mw15{margin:0 15px;} +.mw20{margin:0 20px;} .mt3{ margin-top:3px;} .mt5{ margin-top:5px;} .mt8{ margin-top:8px;} @@ -429,4 +433,15 @@ div.flash.warning, .conflict { a.box_close{ display:block; float:right; width:16px; height:16px; background:url(../images/img_floatbox.png) 0 0 no-repeat;} a:hover.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;} -div.ke-statusbar{height:1px; border-top:none;} \ No newline at end of file +div.ke-statusbar{height:1px; border-top:none;} + +/*底部*/ +/*#Footer{background-color:#ffffff; margin-bottom:10px; padding-bottom:15px; color:#666666;}*/ +/*.footerAboutContainer {width:auto; border-bottom:1px solid #efefef;}*/ +/*.footerAbout{ width:585px; margin:0 auto;height:35px; line-height:35px; border-bottom:1px solid #efefef; }*/ +/*.languageBox {width:55px; height:20px; margin-left:5px; outline:none; color:#666666; border:1px solid #d9d9d9;}*/ +/*.departments{ width:890px; margin:5px auto 0 auto;height:30px;line-height:30px;}*/ +/*.copyright{ width:390px; margin:0 auto;height:20px;line-height:20px;}*/ +/*a.f_grey {color:#666666;}*/ +/*a.f_grey:hover {color:#000000;}*/ + diff --git a/public/stylesheets/users.css b/public/stylesheets/users.css index 30e6594f5..9a809b7ce 100644 --- a/public/stylesheets/users.css +++ b/public/stylesheets/users.css @@ -8,7 +8,7 @@ .icon_female{ background:url(../images/pic_uersall.png) 0 -24px no-repeat; width:15px; height:15px;} .pf_intro{ width:222px; margin-top:5px; color:#696969;word-break: break-all; } .leftbox{ width:230px; padding:10px; padding-right:0px; padding-bottom:5px;background:#fff; margin-bottom:10px; margin-right:10px;} -.pic_members{ background:url(../images/pic_users.jpg) 0 0 no-repeat; display:block; width:38px; height:38px; border:1px solid #e9edf0; margin-right:5px; margin-bottom:5px;float:left;} +.pic_members{ display:block; width:38px; height:38px; border:1px solid #e9edf0; margin-right:5px; margin-bottom:5px;float:left;} .pic_members:hover{border:1px solid #c9c9c9;} /*新建*/ .top_new{ height:26px; border-bottom:10px solid #eaebed; padding:10px; background:#fff; float:left; margin-left:10px; width:730px; } @@ -24,12 +24,14 @@ a.icon_face{background:url(../images/public_icon.png) 0px -671px no-repeat; dis a:hover.icon_face{background:url(../images/public_icon.png) -79px -671px no-repeat; } .inputUsers_message{ border:1px solid #d2d2d2; width:718px; height:48px; color:#666; padding:5px; margin-bottom:5px;} .inputUsers_message02{ border:1px solid #d2d2d2; width:618px; height:26px; color:#666; padding:5px; margin-bottom:5px; } -.message_list_box{ background:#f5f5f5; padding:10px;} -.users_pic{ width:27px; height:27px; border:1px solid #e3e3e3;} +.message_list_box{ background:#f5f5f5; padding:10px;margin-top: 10px;} +.users_pic{ width:46px; height:46px; border:1px solid #e3e3e3;} .users_pic:hover{ border:1px solid #a5a5a5;} +.users_pic_sub{width:32px; height:32px; border:1px solid #e3e3e3;} +.users_pic_sub:hover{ border:1px solid #a5a5a5;} .massage_txt{ max-width:360px; color: #666;word-break:break-all;} .massage_time{ color:#8d8d8d; margin-top:5px;} -.message_list{ border-bottom:1px dashed #c9c9c9; padding-bottom:10px; margin-bottom:10px;} +.message_list{ border-bottom:1px dashed #c9c9c9; margin-bottom:10px;color: #5f5f5f;} .message_list_more{ text-align:center; width:720px;} /*课程动态*/ .line_box{ width:728px; border:1px solid #d9d9d9; padding-bottom:10px;} @@ -89,13 +91,15 @@ a.select_btn_select{ background:#64bddb; color:#fff;} .users_ctt input,.users_ctt select,.users_ctt textarea{ border:1px solid #CCC;} .users_ctt input,.users_ctt select,.users_ctt option{ height:26px;} .users_ctt input,.users_ctt textarea{ margin-left:2px;} -.users_ctt textarea{ margin-bottom:none;} +/*.users_ctt textarea{ margin-bottom:nor;}*/ .w450{ width:450px;} .w210{ width:200px;} .w70{ width:70px;} .h200{ height:200px;} /* 个人主页*/ -a.gz_btn{display:block; background:url(../images/pic_uersall.png) -318px -25px no-repeat; width:33px; height:18px; border:1px solid #cdcdcd; color:#333333; padding:0px 0 0 18px;} +a.edit_btn{display:block; background:url(../images/leftside.png) -1px 0 no-repeat; width:33px; height:18px; border:1px solid #cdcdcd; color:#333333; padding:0px 0 0 18px;} +a:hover.edit_btn{ color:#ff5722;} +a.gz_btn{display:block; background:url(../images/pic_uersall.png) -318px -25px no-repeat; width:53px; height:18px; border:1px solid #cdcdcd; color:#333333; padding:0px 0 0 18px;} a:hover.gz_btn{ color:#ff5722;} a.qx_btn{display:block; background:url(../images/pic_uersall.png) -318px -47px no-repeat; width:53px; height:18px; border:1px solid #cdcdcd; color:#333333; padding:0px 0 0 18px;} a:hover.qx_btn{color:#64bdd9;} @@ -123,5 +127,21 @@ a:hover.c_lgrey{ color:#3ca5c6;} .newhwork_div input,.newhwork_div select{ height:26px;border:1px solid #CCC; } .newhwork_div textarea{border:1px solid #CCC;} .w460{ width:460px;} +/* 留言新增*/ +.mes_box{ width:580px;} +.mes_box02{ margin-left:50px; border-top:1px dashed #c9c9c9; padding-top:10px;margin-bottom: 10px;} +.mes_box02_info{ width:540px; margin-left:5px;} +.users_r_top{ width:730px; height:40px; background:#eaeaea; margin-bottom:10px;} +.users_r_h2{background:#64bdd9; color:#fff; height:33px; width:90px; text-align:center; font-weight:normal; padding-top:7px; font-size:16px;} -a.hidepic>img{display:none;} \ No newline at end of file + +a.hidepic>img{display:none;} + +div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;} +span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;} +span.ke-toolbar-icon-url{background-image:url( ../images/public_icon.png )} +div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;} +span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;} +span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;} +div.ke-toolbar .ke-outline{border:none;} +.cr{clear: right;} \ No newline at end of file diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css index 4a23e59c5..1b32d4659 100644 --- a/public/themes/redpenny-master/stylesheets/application.css +++ b/public/themes/redpenny-master/stylesheets/application.css @@ -443,7 +443,6 @@ color: #000000; width:auto; /*float:center;*/ min-height:800px; - border: 1px solid #ffffff; } /*by huang*/ @@ -1122,6 +1121,11 @@ a.root { line-height: 1; } +.courses{ + margin:0px; + padding-left: 0em; +} + .project-table { margin-left: auto; margin-right: auto;