diff --git a/app/api/mobile/entities/course_dynamic.rb b/app/api/mobile/entities/course_dynamic.rb index fe31668ff..6077a8722 100644 --- a/app/api/mobile/entities/course_dynamic.rb +++ b/app/api/mobile/entities/course_dynamic.rb @@ -4,56 +4,50 @@ module Mobile include Redmine::I18n def self.course_dynamic_expose(field) expose field do |c,opt| - if field == :update_time - (format_time(c[field]) if (c.is_a?(Hash) && c.key?(field))) - elsif field == :news_count - obj = nil - c[:dynamics].each do |d| - if d[:type] == 1 - obj = d[:count] - end - end - obj - elsif field == :document_count - obj = nil - c[:dynamics].each do |d| - if d[:type] == 3 - obj = d[:count] - end - end - obj - elsif field == :topic_count - obj = nil - c[:dynamics].each do |d| - if d[:type] == 2 - obj = d[:count] - end - end - obj - elsif field == :homework_count - obj = nil - c[:dynamics].each do |d| - if d[:type] == 4 - obj = d[:count] - end - end - obj - else + # if field == :news_count + # obj = nil + # c[:dynamics].each do |d| + # if d[:type] == 1 + # obj = d[:count] + # end + # end + # obj + # elsif field == :document_count + # obj = nil + # c[:dynamics].each do |d| + # if d[:type] == 3 + # obj = d[:count] + # end + # end + # obj + # elsif field == :topic_count + # obj = nil + # c[:dynamics].each do |d| + # if d[:type] == 2 + # obj = d[:count] + # end + # end + # obj + # elsif field == :homework_count + # obj = nil + # c[:dynamics].each do |d| + # if d[:type] == 4 + # obj = d[:count] + # end + # end + # obj + # else c[field] if (c.is_a?(Hash) && c.key?(field)) - end + # end end end - course_dynamic_expose :type - course_dynamic_expose :count course_dynamic_expose :course_name course_dynamic_expose :course_term course_dynamic_expose :course_time course_dynamic_expose :course_id course_dynamic_expose :course_img_url course_dynamic_expose :message - course_dynamic_expose :update_time - course_dynamic_expose :count course_dynamic_expose :news_count course_dynamic_expose :document_count course_dynamic_expose :topic_count @@ -63,62 +57,32 @@ module Mobile course_dynamic_expose :current_user_is_member course_dynamic_expose :current_user_is_teacher - expose :documents,using:Mobile::Entities::Attachment do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 3 - obj = d[:documents] - end - end - obj - end + # expose :documents,using:Mobile::Entities::Attachment do |f,opt| + # obj = nil + # f[:dynamics].each do |d| + # if d[:type] == 3 + # obj = d[:documents] + # end + # end + # obj + # end expose :topics,using:Mobile::Entities::Message do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 2 - obj = d[:topics] - end - end - obj + f[:topics] end expose :homeworks,using:Mobile::Entities::Homework do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 4 - obj = d[:homeworks] - end - end - obj + f[:homeworks] end expose :news,using:Mobile::Entities::News do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 1 - obj = d[:news] - end - end - obj + f[:news] end expose :better_students,using:Mobile::Entities::User do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 6 - obj = d[:better_students] - end - end - obj + f[:better_students] end expose :active_students,using:Mobile::Entities::User do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 7 - obj = d[:active_students] - end - end - obj + f[:active_students] end end 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 a0a61786c..1623979f0 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -20,11 +20,10 @@ class CoursesController < ApplicationController menu_item l(:label_sort_by_influence), :only => :index before_filter :can_show_course, :except => [] - before_filter :logged_user_by_apptoken,:only => [:show,:new_homework,:feedback] - before_filter :find_course, :except => [ :index, :search,:list, :new,:join,:unjoin, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_private_courses] - before_filter :authorize_course, :only => [:show, :settings, :edit, :update, :modules, :close, :reopen, :view_homework_attaches, :course] - before_filter :authorize_course_global, :only => [:view_homework_attaches, :new,:create] - before_filter :require_admin, :only => [:copy, :archive, :unarchive, :destroy, :calendar] + before_filter :logged_user_by_apptoken,:only => [:show,:feedback] + before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses] + before_filter :authorize_course, :only => [:show, :settings, :update, :course] + before_filter :authorize_course_global, :only => [:new,:create] before_filter :toggleCourse, :only => [:finishcourse, :restartcourse] before_filter :require_login, :only => [:join, :unjoin] @@ -605,7 +604,7 @@ class CoursesController < ApplicationController def toggleCourse @course_prefs = Course.find_by_extra(@course.extra) - unless (@course_prefs.teacher == User.current || User.current.admin?) + unless (User.current.allowed_to?(:as_teacher,@course_prefs) || User.current.admin?) render_403 end end @@ -809,6 +808,12 @@ class CoursesController < ApplicationController end end + #删除课程 + #删除课程只是将课程的is_delete状态改为false,is_delete为false状态的课程只有管理员可以看到 + def destroy + + end + private def allow_join course if course_endTime_timeout? course diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 04a07e9a8..e3424707f 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] @@ -18,28 +19,28 @@ class HomeworkCommonController < ApplicationController end def new - @homework_type = "1" - - @homework = HomeworkCommon.new - @homework.safe_attributes = params[:homework_common] - @homework.late_penalty = 0 - @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - @homework.publish_time = Time.now.strftime('%Y-%m-%d') - - if @homework_type == "1" - #匿评作业相关属性 - @homework_detail_manual = HomeworkDetailManual.new - @homework_detail_manual.ta_proportion = 0.6 - @homework_detail_manual.absence_penalty = 0 - @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') - @homework.homework_detail_manual = @homework_detail_manual - elsif @homework_type == "2" - #编程作业相关属性 - @homework_detail_programing = HomeworkDetailPrograming.new - @homework.homework_detail_programing = @homework_detail_programing - end + # @homework_type = "1" + # + # @homework = HomeworkCommon.new + # @homework.safe_attributes = params[:homework_common] + # @homework.late_penalty = 0 + # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + # @homework.publish_time = Time.now.strftime('%Y-%m-%d') + # + # if @homework_type == "1" + # #匿评作业相关属性 + # @homework_detail_manual = HomeworkDetailManual.new + # @homework_detail_manual.ta_proportion = 0.6 + # @homework_detail_manual.absence_penalty = 0 + # @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') + # @homework.homework_detail_manual = @homework_detail_manual + # elsif @homework_type == "2" + # #编程作业相关属性 + # @homework_detail_programing = HomeworkDetailPrograming.new + # @homework.homework_detail_programing = @homework_detail_programing + # end respond_to do |format| format.html end @@ -99,12 +100,13 @@ 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.homework_tests << homework_test question[:input] << homework_test.input question[:output] << homework_test.output @@ -144,6 +146,8 @@ class HomeworkCommonController < ApplicationController end if homework.save + homework_detail_programing.save if homework_detail_programing + homework_detail_manual.save if homework_detail_manual respond_to do |format| format.html { flash[:notice] = l(:notice_successful_create) @@ -209,7 +213,7 @@ class HomeworkCommonController < ApplicationController end if @homework.homework_type == 2 && @homework_detail_programing #编程作业 - @homework_detail_programing.language = "C++" + @homework_detail_programing.language = params[:language] @homework_detail_programing.standard_code = params[:standard_code] @homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6 homework_tests = @homework.homework_tests @@ -236,6 +240,24 @@ class HomeworkCommonController < ApplicationController end end end + + #发送修改作业的请求 + question = {title:@homework.name,content:@homework.description} + question[:input] = [] + question[:output] = [] + @homework.homework_tests.each do |test| + question[:input] << test.input + question[:output] << test.output + end + uri = URI("http://192.168.80.21:8080/api/questions/#{@homework_detail_programing.question_id}.json") + body = question.to_json + res = Net::HTTP.new(uri.host, uri.port).start do |client| + request = Net::HTTP::Put.new(uri.path) + request.body = body + request["Content-Type"] = "application/json" + client.request(request) + end + result = JSON.parse(res.body) end @homework.save_attachments(params[:attachments]) @@ -331,6 +353,23 @@ 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) + 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 56b4a30fc..185e7128e 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -71,10 +71,15 @@ class NewsController < ApplicationController scope = @course ? @course.news.course_visible : News.course_visible @news_count = scope.count - #@news_pages = Paginator.new @news_count, @limit, params['page'] - #@offset ||= scope_page.offset - scope_order = scope.all(:include => [:author, :course], - :order => "#{News.table_name}.created_on DESC") + @q = params[:subject] + if params[:subject].nil? + scope_order = scope.all(:include => [:author, :course], + :order => "#{News.table_name}.created_on DESC") + else + scope_order = scope.where("#{News.table_name}.title like '#{'%' << params[:subject].to_s << '%'}'").all(:include => [:author, :course], + :order => "#{News.table_name}.created_on DESC") + end + # :offset => @offset, # :limit => @limit) @newss = paginateHelper scope_order,10 @@ -83,6 +88,7 @@ class NewsController < ApplicationController @news = News.new render :layout => 'base_courses' } + format.js format.api format.atom { render_feed(@newss, :title => (@course ? @course.name : Setting.app_title) + ": #{l(:label_news_plural)}") } end @@ -141,7 +147,7 @@ class NewsController < ApplicationController ids = params[:asset_id].split(',') update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS end - # ض̬ļ¼add start + # ������ض�̬�ļ�¼add start teachers = searchTeacherAndAssistant(@course) for teacher in teachers if(teacher.user_id != User.current.id) @@ -155,7 +161,7 @@ class NewsController < ApplicationController notify.save() end end - # ض̬ļ¼add end + # ������ض�̬�ļ�¼add end render_attachment_warning_if_needed(@news) flash[:notice] = l(:notice_successful_create) redirect_to course_news_index_url(@course) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 758747e02..dda5b81b2 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -137,11 +137,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 +336,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| diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 2efaf591a..09ae5ad79 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -150,11 +150,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 +171,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 +288,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 diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 272ae1d37..7b364a46b 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 @@ -459,6 +461,12 @@ update data = graph_commits_per_month(@repository) when "commits_per_author" data = graph_commits_per_author(@repository) + when "author_commits_per_month" + data = graph_author_commits_per_month(@repository) + when "author_commits_six_month" + data = author_commits_six_month(@repository) + when "author_code_six_months" + data = author_code_six_month(@repository) end if data headers["Content-Type"] = "image/svg+xml" @@ -484,7 +492,18 @@ update if params[:repository_id].present? @repository = @project.repositories.find_by_identifier_param(params[:repository_id]) else - @repository = @project.repository + # 多版本库,如果一个版本库为空则去下一个 + rep_count = @project.repositories.count + if @project.repository.nil? + for i in 0..rep_count + unless @project.repositories[i].nil? + @repository = @project.repositories[i] + break + end + end + else + @repository = @project.repository + end end (render_404; return false) unless @repository @path = params[:path].is_a?(Array) ? params[:path].join('/') : params[:path].to_s @@ -606,6 +625,123 @@ update ) graph.burn end + + # 用户最近一年的提交次数 + def graph_author_commits_per_month(repository) + @date_to = Date.today + @date_from = @date_to << 12 + @date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day) + commits_by_author = Changeset.count(:all, :group => :committer, + :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) + commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25) + + fields = commits_by_author.collect {|r| r.first} + commits_data = commits_by_author.collect {|r| r.last} + + fields = fields + [""]*(10 - fields.length) if fields.length<10 + commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10 + + # Remove email adress in usernames + fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') } + + graph = SVG::Graph::BarHorizontal.new( + :height => 400, + :width => 600, + :fields => fields, + :stack => :side, + :scale_integers => true, + :show_data_values => true, + :rotate_y_labels => false, + :graph_title => l(:label_author_commits_year), + :show_graph_title => true, + :no_css => true + ) + graph.add_data( + :data => commits_data, + :title => l(:label_revision_commit_count) + ) + graph.burn + end + + # 用户最近六个月的提交次数 + def author_commits_six_month(repository) + @date_to = Date.today + @date_from = @date_to << 6 + @date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day) + commits_by_author = Changeset.count(:all, :group => :committer, + :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) + commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25) + + fields = commits_by_author.collect {|r| r.first} + commits_data = commits_by_author.collect {|r| r.last} + + fields = fields + [""]*(10 - fields.length) if fields.length<10 + commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10 + + # Remove email adress in usernames + fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') } + + graph = SVG::Graph::BarHorizontal.new( + :height => 400, + :width => 600, + :fields => fields, + :stack => :side, + :scale_integers => true, + :show_data_values => true, + :rotate_y_labels => false, + :graph_title => l(:label_author_commits_six_month), + :show_graph_title => true + ) + graph.add_data( + :data => commits_data, + :title => l(:label_revision_commit_count) + ) + graph.burn + end + + # 最近六个月代码量统计 + def author_code_six_month(repository) + @date_to = Date.today + @date_from = @date_to << 6 + @date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day) + commits_by_author = Changeset.count(:group => :committer, :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) + commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40) + all_author = [] + commits_by_author.each do |cba| + all_author << cba.first + end + # all_author = all_author.collect {|c| c.gsub(%r{/ /<.+@.+>}, '') } + all_author = all_author.collect {|c| c.split.first } + commits_by_author = repository.commits(all_author, "#{@date_from}", "#{@date_to}", repository.id == 150 ? "szzh" : 'master') + + fields = commits_by_author.collect {|r| r.first} + commits_data = commits_by_author.collect {|r| r.last} + + fields = fields + [""]*(10 - fields.length) if fields.length<10 + commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10 + + # Remove email adress in usernames + fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') } + + graph = SVG::Graph::BarHorizontal.new( + :height => 400, + :width => 600, + :fields => fields, + :stack => :side, + :scale_integers => true, + :show_data_values => true, + :rotate_y_labels => false, + :graph_title => l(:label_author_code_six_month), + :show_graph_title => true + ) + graph.add_data( + :data => commits_data, + :title => l(:lable_revision_code_count) + ) + graph.burn + end + + def check_hidden_repo project = Project.find(params[:id]) if !User.current.member_of?(project) 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 209fa7269..3e1e0ba29 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -157,7 +157,7 @@ class StudentWorkController < ApplicationController end def edit - if @homework.homework_type == 2 #编程作业不能修改作业 + if !User.current.admin? && @homework.homework_type == 2 #编程作业不能修改作业 render_403 else respond_to do |format| @@ -396,6 +396,7 @@ class StudentWorkController < ApplicationController if student_work_test.result == 0 student_score_count += 1 end + student_work_test.error_msg = params[:compile_error_msg] student_work_test.save! end end @@ -444,7 +445,7 @@ class StudentWorkController < ApplicationController #判断是不是当前作品的提交者 #提交者 && (非匿评作业 || 未开启匿评) 可以编辑作品 def author_of_work - render_403 unless (User.current.id == @work.user_id || User.current.admin?) && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 ) + render_403 unless User.current.admin? || (User.current.id == @work.user_id && @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 ) end def teacher_of_course @@ -467,22 +468,60 @@ class StudentWorkController < ApplicationController sheet1 = book.create_worksheet :name => "homework" blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 sheet1.row(0).default_format = blue - sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), - l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_f_score),l(:excel_commit_time)]) - count_row = 1 - items.each do |homework| - sheet1[count_row,0]=homework.user.id - sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s - sheet1[count_row,2] = homework.user.login - sheet1[count_row,3] = homework.user.user_extensions.student_id - sheet1[count_row,4] = homework.user.mail - sheet1[count_row,5] = homework.name - sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) - sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) - sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) - sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) - sheet1[count_row,10] = format_time(homework.created_at) - count_row += 1 + if @homework.homework_type == 0 #普通作业 + sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), + l(:excel_t_score),l(:excel_ta_score),l(:excel_f_score),l(:excel_commit_time)]) + count_row = 1 + items.each do |homework| + sheet1[count_row,0]=homework.user.id + sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s + sheet1[count_row,2] = homework.user.login + sheet1[count_row,3] = homework.user.user_extensions.student_id + sheet1[count_row,4] = homework.user.mail + sheet1[count_row,5] = homework.name + sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) + sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) + # sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) + sheet1[count_row,8] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) + sheet1[count_row,9] = format_time(homework.created_at) + count_row += 1 + end + elsif @homework.homework_type == 1 #匿评作业 + sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), + l(:excel_t_score),l(:excel_ta_score), l(:excel_n_score),l(:excel_f_score),l(:excel_commit_time)]) + count_row = 1 + items.each do |homework| + sheet1[count_row,0]=homework.user.id + sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s + sheet1[count_row,2] = homework.user.login + sheet1[count_row,3] = homework.user.user_extensions.student_id + sheet1[count_row,4] = homework.user.mail + sheet1[count_row,5] = homework.name + sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) + sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) + sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) + sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) + sheet1[count_row,10] = format_time(homework.created_at) + count_row += 1 + end + elsif @homework.homework_type == 2 #编程作业 + sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), + l(:excel_t_score),l(:excel_ta_score), l(:excel_s_score),l(:excel_f_score),l(:excel_commit_time)]) + count_row = 1 + items.each do |homework| + sheet1[count_row,0]=homework.user.id + sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s + sheet1[count_row,2] = homework.user.login + sheet1[count_row,3] = homework.user.user_extensions.student_id + sheet1[count_row,4] = homework.user.mail + sheet1[count_row,5] = homework.name + sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) + sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) + sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) + sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) + sheet1[count_row,10] = format_time(homework.created_at) + count_row += 1 + end end book.write xls_report xls_report.string diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d6597f3da..0c5b441d4 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.order("updated_on 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,33 @@ 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.order("created_at 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| + 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) 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 @@ -448,7 +387,7 @@ class UsersController < ApplicationController def user_courses4show query = Course.joins("join members m on #{Course.table_name}.id=m.course_id") - query = query.where("m.user_id = ?",@user.id) + query = query.where("m.user_id = ?",@user.id).order("#{Course.table_name}.id desc") if User.current == @user #看自己 else if @user.user_extensions!=nil && @user.user_extensions.identity == 0 #看老师 @@ -456,13 +395,12 @@ class UsersController < ApplicationController query = query.where("r.role_id in(3,7,9)") end query = query.where(Course.table_name+".is_public = 1") - # or exists (select 1 from courses c2,members m2 where c2.id=m2.course_id and c2.id=#{Course.table_name}.id and m2.user_id= User.current.id) end if params[:lastid]!=nil && !params[:lastid].empty? - query = query.where("( (#{Course.table_name}.updated_at=? and #{Course.table_name}.id < ?) or #{Course.table_name}.updated_atnil end @@ -483,95 +421,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? @@ -630,7 +479,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/api_helper.rb b/app/helpers/api_helper.rb index 1f34112ad..f26f5c19b 100644 --- a/app/helpers/api_helper.rb +++ b/app/helpers/api_helper.rb @@ -1,5 +1,11 @@ # encoding: utf-8 module ApiHelper + ONE_MINUTE = 60 * 1000 + ONE_HOUR = 60 * ONE_MINUTE + ONE_DAY = 24 * ONE_HOUR + ONE_MONTH = 30 * ONE_DAY + + ONE_YEAR = 12 * ONE_MONTH #获取用户的工作单位 def get_user_work_unit user work_unit = "" @@ -163,5 +169,37 @@ module ApiHelper end + # 获取当前时间 + def time_from_now time + lastUpdateTime = time.to_i*1000 + + currentTime = Time.now.to_i*1000 + timePassed = currentTime - lastUpdateTime; + timeIntoFormat = 0 + updateAtValue = "" + if timePassed < 0 + updateAtValue = "时间有问题" + elsif timePassed < ONE_MINUTE + updateAtValue = "一分钟前" + elsif timePassed < ONE_HOUR + timeIntoFormat = timePassed / ONE_MINUTE + updateAtValue = timeIntoFormat.to_s + "分钟前" + elsif (timePassed < ONE_DAY) + timeIntoFormat = timePassed / ONE_HOUR + updateAtValue = timeIntoFormat.to_s + "小时前" + elsif (timePassed < ONE_MONTH) + timeIntoFormat = timePassed / ONE_DAY + updateAtValue = timeIntoFormat.to_s + "天前" + elsif (timePassed < ONE_YEAR) + timeIntoFormat = timePassed / ONE_MONTH + updateAtValue = timeIntoFormat.to_s + "个月前" + else + timeIntoFormat = timePassed / ONE_YEAR + updateAtValue = timeIntoFormat.to_s + "年前" + end + updateAtValue + + end + end \ No newline at end of file diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index 06b154d36..9dd0bed8c 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -38,7 +38,7 @@ module MembersHelper scope = [] end principals = paginateHelper scope,10 - s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5') + s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals') links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options| link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q],:flag => true, :format => 'js')), :remote => true } diff --git a/app/helpers/praise_tread_helper.rb b/app/helpers/praise_tread_helper.rb index 90ce6d61d..c142f0973 100644 --- a/app/helpers/praise_tread_helper.rb +++ b/app/helpers/praise_tread_helper.rb @@ -20,9 +20,9 @@ module PraiseTreadHelper # when 0 # return @record.tread_num.nil? ? 0 : @record.tread_num # end - return (@record.praise_num.to_i-@record.tread_num.to_i) + return ((@record.praise_num.nil? ? 0 : @record.praise_num.to_i)-(@record.tread_num.nil? ? 0 : @record.tread_num.to_i)) else - return 0 + return 0 end end diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 5cbc3af5a..c77eba0c5 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -236,13 +236,14 @@ module RepositoriesHelper # 判断项目是否有主版本库 def judge_main_repository(pro) if pro.repositories.blank? - return false + status = false else - pro.repositories.sort.each do |rep| - rep.is_default? - return true + pro.repositories.each do |rep| + status = true and break if rep.is_default? + status = false end end + status end # def cvs_field_tags(form, repository) # content_tag('p', form.text_field( diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index d4f9e4eb8..5553990e6 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -328,109 +328,55 @@ module UsersHelper return [0,[]] end list = query.order("updated_on desc").limit(10).all - return [count,list]; + return [count,list] end def get_create_course_count(user) - return Course.where("tea_id = ?",user.id).count() + if user == User.current + user.courses.count + else + user.courses.where("is_public = 1").count + end end def get_join_course_count(user) - return user.coursememberships.count() - get_create_course_count(user) + user.coursememberships.count - get_create_course_count(user) end def get_homework_commons_count(user) - return HomeworkCommon.where("user_id = ?",user.id).count() + HomeworkCommon.where("user_id = ?",user.id).count end def get_projectandcourse_attachment_count(user) - return Attachment.where("author_id = ? and container_type in ('Project','Course')",user.id).count() + Attachment.where("author_id = ? and container_type in ('Project','Course')",user.id).count end def get_create_project_count(user) - return Project.where("user_id = ? and project_type = ?",user.id,Project::ProjectType_project).count() + Project.where("user_id = ? and project_type = ?",user.id,Project::ProjectType_project).count end def get_join_project_count(user) - return user.memberships.count(conditions: "projects.project_type = #{Project::ProjectType_project}") - get_create_project_count(user) + user.memberships.count(conditions: "projects.project_type = #{Project::ProjectType_project}") - get_create_project_count(user) end def get_create_issue_count(user) - return Issue.where("author_id = ?",user.id).count() + Issue.where("author_id = ?",user.id).count end def get_resolve_issue_count(user) - return Issue.where("assigned_to_id = ? and status_id=3",user.id).count() + Issue.where("assigned_to_id = ? and status_id=3",user.id).count end def get_anonymous_evaluation_count(user) - return StudentWorksScore.where("user_id = ? and reviewer_role=3",user.id).count() + StudentWorksScore.where("user_id = ? and reviewer_role=3",user.id).count end - - # def query_activities(query,type) - # query_rec_count = 8 - # # query = query.where("act_type='JournalsForMessage'") - # #query = query.where("act_type not in (?)", ['JournalsForMessage','Message','HomeworkCommon','News','Issue','Journal','Poll']) - # list = query.order("id desc").limit(query_rec_count).all - # - # result = []; - # for item in list - # container = get_activity_container(item,type) - # if( activity_is_show(item,container) ) - # result << { :item=>item,:e=>container } - # end - # end - # return [lastid,result] - # end - # def get_activity_container activity,type - # e = nil; - # if type == 'Project' - # if activity.act_type == 'Poll' - # # 项目没有问卷 - # # e = Project.find_by_id(activity.act.polls_group_id) - # else - # e = activity.act.project if activity.act.respond_to?('project') - # end - # end - # if type == 'Course' - # if activity.act_type == 'Poll' - # e = Course.find_by_id(activity.act.polls_group_id) - # else - # e = activity.act.course if activity.act.respond_to?('course') - # end - # end - # - # return e; - # 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 - end - def get_activity_container activity - return activity.activity_container - # if type == 'Project' - # return activity.act.project if activity.act.respond_to?('project') - # end - # if type == 'Course' - # if activity.act_type == 'Poll' - # return Course.find_by_id(activity.act.polls_group_id) - # end - # return activity.act.course if activity.act.respond_to?('course') - # end - # return nil; + result + end + + def get_activity_container activity + return activity.activity_container end - # def activity_is_show(activity,e) - # if(!e) - # return false - # end - # - # if activity.user_id == User.current.id - # return true - # end - # if( e.visible? ) - # return true - # end - # return false - # end def get_activity_act_showname_htmlclear(activity) str = get_activity_act_showname(activity) str = str.gsub(/<.*>/,'') @@ -529,14 +475,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/homework_test.rb b/app/models/homework_test.rb index 7c477bfaf..4ed290ecd 100644 --- a/app/models/homework_test.rb +++ b/app/models/homework_test.rb @@ -2,5 +2,5 @@ class HomeworkTest < ActiveRecord::Base attr_accessible :input, :output, :homework_common_id belongs_to :homework_common - has_one :student_work_test + has_many :student_work_test 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/repository/git.rb b/app/models/repository/git.rb index c1f0020eb..7c484e87f 100644 --- a/app/models/repository/git.rb +++ b/app/models/repository/git.rb @@ -38,6 +38,12 @@ class Repository::Git < Repository 'Git' end + def commits(authors, start_date, end_date, branch='master') + scm.commits(authors, start_date, end_date,branch).map {|commit| + [commit[:author], commit[:num]] + } + end + def report_last_commit extra_report_last_commit end diff --git a/app/models/student_work_test.rb b/app/models/student_work_test.rb index 2e6efdf0a..413528b82 100644 --- a/app/models/student_work_test.rb +++ b/app/models/student_work_test.rb @@ -1,6 +1,6 @@ # encoding: utf-8 class StudentWorkTest < ActiveRecord::Base - attr_accessible :student_work_id, :homework_test_id, :result + attr_accessible :student_work_id, :homework_test_id, :result, :error_msg belongs_to :homework_test belongs_to :student_work diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 185f448ce..c2944fed5 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -654,36 +654,42 @@ class CoursesService return end if current_user == @user || current_user.admin? - membership = @user.coursememberships.page(1).per(15) + membership = @user.coursememberships else - membership = @user.coursememberships.page(1).per(15).all(:conditions => Course.visible_condition(current_user)) + membership = @user.coursememberships.all(:conditions => Course.visible_condition(current_user)) end if membership.nil? || membership.count == 0 raise l(:label_no_courses, :locale => get_user_language(current_user)) end - membership.sort! { |older, newer| newer.created_on <=> older.created_on } + #membership.sort! { |older, newer| newer.created_on <=> older.created_on } #定义一个数组集合,存放hash数组,该hash数组包括课程的信息,并包含课程的最新发布的资源,最新的讨论区留言,最新的作业,最新的通知 result = [] #对用户所有的课程进行循环,找到每个课程最新发布的资源,最新的讨论区留言,最新的作业,最新的通知,并存进数组 + membership.each do |mp| course = mp.course latest_course_dynamics = [] + notices_count = 0 + topic_count = 0 + topics = nil + homeworkss = nil + notices = nil # 课程通知 latest_news = course.news.page(1).per(2).order("created_on desc") unless latest_news.first.nil? - latest_course_dynamics << {:type => 1, :time => latest_news.first.created_on,:count=>course.news.count, - :news => latest_news.all} + notices_count = course.news.count + notices = latest_news.all + latest_course_dynamics << {:time => latest_news.first.created_on } end - # 课程讨论区 latest_message = course.boards.first.topics.page(1).per(2) unless latest_message.first.nil? - latest_course_dynamics << {:type => 2, :time => latest_message.first.created_on, :count =>course.boards.nil? ? 0 : course.boards.first.topics.count, - :topics => latest_message.all} + topic_count = course.boards.nil? ? 0 : course.boards.first.topics.count + topics = latest_message.all + latest_course_dynamics << {:time => latest_message.first.created_on} end - # 课程资源 # latest_attachment = course.attachments.order("created_on desc").page(1).per(2) # unless latest_attachment.first.nil? @@ -694,14 +700,17 @@ class CoursesService #课程作业 已经交的学生列表(暂定显示6人),未交的学生列表,作业的状态 homeworks = course.homework_commons.page(1).per(2).order('created_at desc') unless homeworks.first.nil? - latest_course_dynamics << {:type => 4, :time => homeworks.first.updated_at, :count=>course.homework_commons.count , :homeworks => homeworks} + homeworkss = homeworks + latest_course_dynamics << {:time => homeworks.first.updated_at} end latest_course_dynamics.sort! { |order, newer| newer[:time] <=> order[:time] } # 课程学霸 学生总分数排名靠前的5个人 homework_count = course.homework_commons.count sql = "select users.*,ROUND(sum(student_works.final_score),2) score from student_works left outer join users on student_works.user_id = users.id" << " where homework_common_id in ( select id from homework_commons where homework_commons.course_id = #{course.id}) GROUP BY student_works.user_id ORDER BY score desc limit 0,4" + better_students = User.find_by_sql(sql) + # 找出在课程讨论区发帖回帖数最多的 active_students = [] sql1 = " select users.*,count(author_id)*2 active_count from messages " << @@ -710,20 +719,41 @@ class CoursesService " GROUP BY messages.author_id ORDER BY count(author_id) desc " << " limit 0,4" active_students = User.find_by_sql(sql1) + if homework_count != 0 && !better_students.empty? - latest_course_dynamics <<{:type=> 6,:time=>"1970-01-01 0:0:0 +0800",:count=> 4,:better_students=> better_students} + latest_course_dynamics <<{:time=>"1970-01-01 0:0:0 +0800"} end unless active_students.empty? - latest_course_dynamics <<{:type=> 7,:time=>"1970-01-01 0:0:0 +0800",:count=> 4,:active_students=>active_students} + latest_course_dynamics <<{:time=>"1970-01-01 0:0:0 +0800"} end latest_course_dynamic = latest_course_dynamics.first unless latest_course_dynamic.nil? - result << {:course_name => course.name,:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course), :course_id => course.id, :course_img_url => url_to_avatar(course), :course_time => course.time, :course_term => course.term,:message => "", :dynamics => latest_course_dynamics, - :course_student_num=>course ? course.members.count : 0,:time_from_now=> distance_of_time_in_words(Time.now, latest_course_dynamic[:time].to_time) << "前",:time=>latest_course_dynamic[:time].to_time} + result << {:course_name => course.name, + :current_user_is_member => current_user.member_of_course?(course), + :current_user_is_teacher => is_course_teacher(current_user,course), + :course_id => course.id, + :course_img_url => url_to_avatar(course), + :course_time => course.time, + :course_term => course.term, + :news_count => notices_count, + :homework_count => homework_count, + :topic_count => topic_count, + :news => notices, + :homeworks => homeworkss, + :topics => topics, + :better_students => better_students, + :active_students => active_students, + :message => "", + :course_student_num=>course ? course.members.count : 0, + #:time_from_now=> distance_of_time_in_words(Time.now, latest_course_dynamic[:time].to_time) << "前", + :time_from_now=>time_from_now(latest_course_dynamic[:time].to_time), #.strftime('%Y-%m-%d %H:%M:%S').to_s, + :time=>latest_course_dynamic[:time].to_time} end + end #返回数组集合 result.sort! { |order, newer| newer[:time] <=> order[:time] } + result end diff --git a/app/views/account/lost_password.html.erb b/app/views/account/lost_password.html.erb index 8ed93f36c..3c6c57f52 100644 --- a/app/views/account/lost_password.html.erb +++ b/app/views/account/lost_password.html.erb @@ -9,7 +9,7 @@

- <%= text_field_tag 'mail', nil, :size => 40 %> + <%= text_field_tag 'mail', nil, :size => 40, :placeholder => '请输入注册邮箱'%> <%= submit_tag l(:button_submit) %>

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..b644fb9fa 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/avatar/_avatar_form.html.erb b/app/views/avatar/_avatar_form.html.erb index 632ea5d4d..43aaf9132 100644 --- a/app/views/avatar/_avatar_form.html.erb +++ b/app/views/avatar/_avatar_form.html.erb @@ -43,7 +43,7 @@
-<%#= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %> +<%= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %> <%= l(:button_upload_photo) %> diff --git a/app/views/courses/_course.html.erb b/app/views/courses/_course.html.erb index f2972df44..0b879f905 100644 --- a/app/views/courses/_course.html.erb +++ b/app/views/courses/_course.html.erb @@ -61,7 +61,7 @@

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

diff --git a/app/views/courses/_new_groups_name.html.erb b/app/views/courses/_new_groups_name.html.erb index 39fa33677..fc2c5a62d 100644 --- a/app/views/courses/_new_groups_name.html.erb +++ b/app/views/courses/_new_groups_name.html.erb @@ -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/_new_member_list.html.erb b/app/views/courses/_new_member_list.html.erb index e8eebe00d..35d9fe399 100644 --- a/app/views/courses/_new_member_list.html.erb +++ b/app/views/courses/_new_member_list.html.erb @@ -63,7 +63,7 @@ :member_id => member.id, :remote => true}, :class => 'ml258 c_red' %> - <%= format_date(member.created_on)%> + <%= format_date(member.created_on)%> <%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %>
    diff --git a/app/views/courses/_set_join.js.erb b/app/views/courses/_set_join.js.erb index 1dc20f046..f880ce945 100644 --- a/app/views/courses/_set_join.js.erb +++ b/app/views/courses/_set_join.js.erb @@ -1,10 +1,11 @@ <% if object_id%> $("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(course, user)) %>"); + $("#try_join_course_link").replaceWith(" 'index',:course=>course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品"); <% end %> <% if @state %> <% if @state == 0 %> alert("加入成功"); - hideModal($("#popbox")); + hideModal($("#popbox02")); <% elsif @state == 1 %> alert("密码错误"); <% elsif @state == 2 %> 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 5d1d5ce88..5e53c4b15 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 @@ - \ 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..74ec9439a --- /dev/null +++ b/app/views/homework_common/programing_test.js.erb @@ -0,0 +1,2 @@ +$("#test_send_<%= @index%>").replaceWith(" fl ml5 mt1' onclick='programing_test(<%= @index%>)' id='test_send_<%= @index%>'><%= @result == 0 ? '正确' : '错误'%>"); +$("#test_result_<%= @index%>").val("<%= @result%>"); \ 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..c4f61d73c 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -34,7 +34,7 @@
  • <%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')', - { :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.host_user }, + {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user}, {:class => 'my-message'} if User.current.logged?%>
  • diff --git a/app/views/layouts/_user_watch_btn.html.erb b/app/views/layouts/_user_watch_btn.html.erb index 71eea7166..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_projects.html.erb b/app/views/layouts/base_projects.html.erb index 972b3b3a6..b168e5f81 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -80,11 +80,13 @@
    <% if @project.project_type == 0 %> - <%= l(:label_project_score)%> : - <%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects', - :action => 'show_projects_score', - :remote => true, - :id => @project.id}, :class => "c_orange f14" ) %> + <% unless project_scores(@project) == 0 %> + <%= l(:label_project_score)%> : + <%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects', + :action => 'show_projects_score', + :remote => true, + :id => @project.id}, :class => "c_orange f14" ) %> + <% end %> <% end %>
    diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb index ef6d82245..33973b047 100644 --- a/app/views/layouts/base_users_new.html.erb +++ b/app/views/layouts/base_users_new.html.erb @@ -17,79 +17,11 @@ <%= 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 -%> - - @@ -103,12 +35,6 @@ $(".subNav").click(function(){ <%=link_to l(:field_homepage), home_path %> > <%=link_to (@center_flag ? '个人中心' : '个人主页'), user_path(@user) %> > <%=link_to @user.name, user_path(@user) %>

    - - - - - -
    @@ -116,7 +42,7 @@ $(".subNav").click(function(){
    - <%= image_tag(url_to_avatar(@user), :id=>'nh_user_tx',:style=>"width:216px;height:216px;",:alt=>"头像") %> + <%= image_tag(url_to_avatar(@user), :id=>'nh_user_tx',:style=>"width:214px;height:214px;overflow:hidden",:alt=>"头像") %> <% if @center_flag %> <% end %> @@ -144,13 +70,15 @@ $(".subNav").click(function(){ <% end %>
    -
    +
      -
    • 加入时间 :
    • +
    • 最近登录 :
    • <% if @user.user_extensions!=nil && @user.user_extensions.identity == 2 %>
    • <%= l(:label_company_name) %> :
    • <% elsif !@user.firstname.empty? || !@user.lastname.empty? %> -
    • 真实姓名 :
    • + <% if @user.user_extensions.identity == 0 %> +
    • 真实姓名 :
    • + <% end %> <% end %> <% unless @user.user_extensions.nil? %> <% if @user.user_extensions.identity == 0 %> @@ -172,8 +100,10 @@ $(".subNav").click(function(){ <% end %>
      -
    • <%= format_date(@user.created_on) %>
    • -
    • <%= @user.show_name %>
    • +
    • <%= format_date(@user.last_login_on) %>
    • + <% if @user.user_extensions.identity == 0 %> +
    • <%= @user.show_name %>
    • + <% end %> <% unless @user.user_extensions.nil? %> <% if @user.user_extensions.identity == 0 %>
    • <%= get_technical_title @user %>
    • @@ -197,75 +127,142 @@ $(".subNav").click(function(){
    +
    + + diff --git a/app/views/mailer/message_posted.html.erb b/app/views/mailer/message_posted.html.erb index c55f4b000..ed8cb8626 100644 --- a/app/views/mailer/message_posted.html.erb +++ b/app/views/mailer/message_posted.html.erb @@ -8,8 +8,9 @@ <% if @message.project %> <%=h @message.board.project.name %> - <%=h @message.board.name %>: <%= link_to(h(@message.subject), @message_url,:style=>'color:#1b55a7; font-weight:bold;') %> <% elsif @message.course %> - <%=h @message.board.course.name %> - <%=h @message.board.name %>: <%= link_to(h(@message.subject), @message_url,:style=>'color:#1b55a7; font-weight:bold;') %> - <% end %> + <%=h @message.board.course.name %> - <%=h @message.board.name %>: + <%= link_to(h(@message.subject), @message_url + "?topic_id=#{@message.id}&&parent_id=#{@message.parent_id ? @message.parent_id : @message.id}",:style=>'color:#1b55a7; font-weight:bold;') %> + <% end %> <%= l(:mail_issue_title_active)%>

      diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 59dc1e674..11efbe0a2 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -225,10 +225,10 @@ :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> <%= l(:label_project_issue_update) %> <% if issues_journal.notes.blank? || issues_journal.notes.nil? %> - <%= link_to truncate(l(:label_isuue_mail_status),length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), + <%= link_to truncate(issues_journal.issue.subject.html_safe, length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <% else %> - <%= link_to truncate(issues_journal.notes.html_safe,length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), + <%= link_to truncate(issues_journal.notes.html_safe, length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <% end %> <%= format_time(issues_journal.created_on) %> diff --git a/app/views/members/autocomplete.js.erb b/app/views/members/autocomplete.js.erb index 01faf7da9..5f21ee38e 100644 --- a/app/views/members/autocomplete.js.erb +++ b/app/views/members/autocomplete.js.erb @@ -1,4 +1,9 @@ <% if @project%> + var checked = $("#principals input:checked").size(); + if(checked > 0) + { + alert('翻页或搜索后将丢失当前选择的用户数据!'); + } <% if @flag == "true"%> $('#principals_for_new_member').html('<%= escape_javascript(render_project_members(@project)) %>'); <% else%> diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 55a2410b0..586279504 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -7,7 +7,9 @@ <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
      - <%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%> + + <%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%> +
      <%= link_to image_tag(url_to_avatar(@memo.author), :class => "avatar"), user_path(@memo.author) %> diff --git a/app/views/my/clear_user_avatar_temp.js.erb b/app/views/my/clear_user_avatar_temp.js.erb index 9513bdac4..788678673 100644 --- a/app/views/my/clear_user_avatar_temp.js.erb +++ b/app/views/my/clear_user_avatar_temp.js.erb @@ -4,4 +4,5 @@ $('#ajax-modal').siblings().hide(); $('#ajax-modal').parent().removeClass("alert_praise"); //$('#ajax-modal').parent().css("top","").css("left",""); - $('#ajax-modal').parent().addClass("alert_box"); \ No newline at end of file + $('#ajax-modal').parent().addClass("alert_box"); + $('#ajax-modal').parent().css("border", "2px solid #15bccf").css("border-radius", "0").css(" -webkit-border-radius", "0").css(" -moz-border-radius", "0"); \ No newline at end of file diff --git a/app/views/my/save_user_avatar.js.erb b/app/views/my/save_user_avatar.js.erb index ce4bae501..54cb3de48 100644 --- a/app/views/my/save_user_avatar.js.erb +++ b/app/views/my/save_user_avatar.js.erb @@ -1,2 +1,2 @@ -$("#nh_user_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_tx',:style=>"width:216px;height:216px;",:alt=>"头像") %>'); +$("#nh_user_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_tx',:style=>"width:214px;height:214px;overflow:hidden",:alt=>"头像") %>'); hideModal(); \ No newline at end of file diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index c89f0af26..e2c50fe24 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -2,70 +2,39 @@ btn_tips = l(:label_news_notice) label_tips = l(:label_course_news) %> +

      <%= label_tips %>

      -

      - <%= l(:label_total_news) %> - <%= @news_count %> - <%= l(:label_course_news_count) %> -

      - <% if @course && User.current.allowed_to?(:manage_news, @course) %> - <%= link_to(btn_tips,new_course_news_path(@course),:class => 'problem_new_btn fl c_dorange')%> -
      +
      +

      + <%= l(:label_total_news) %> + <%= @news_count %> + <%= l(:label_course_news_count) %> +

      + <% if @course && User.current.allowed_to?(:manage_news, @course) %> + <%= link_to(btn_tips,new_course_news_path(@course),:class => 'problem_new_btn fl c_dorange')%> +
      - <% end %> + <% end %> +
      +
      -
      - <% if @newss.empty? %> -

      - <%= l(:label_no_data) %> -

      - <% else %> - <% @newss.each do |news| %> -
      - <%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %> -
      - <%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %> - - <%= l(:label_release_news) %>: - - <%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %> - <%=link_to "#{news.comments.all.count}".html_safe, news_path(news.id), :class => "pro_mes_w" %> -
      -
      - -
      -
      - <%= news.description.html_safe %> -
      -
      -
      - -
      - <%= l(:label_create_time)%>:<%= format_time(news.created_on)%> - <%= link_to_attachments_course news %> -
      - <%#= render :partial => 'student_work/work_attachments', :locals => {:attachments => news.attachments} %> -
      -
      -
      - - <% end %> - <% end %> +
      + <%= render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count} %>
      - - -
        - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> -
      <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> <%= stylesheet_link_tag 'scm' %> diff --git a/app/views/news/_course_news_list.html.erb b/app/views/news/_course_news_list.html.erb new file mode 100644 index 000000000..da963b3cd --- /dev/null +++ b/app/views/news/_course_news_list.html.erb @@ -0,0 +1,47 @@ +
      +<% if newss.empty? %> +

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

      +<% else %> + <% newss.each do |news| %> +
      + <%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %> +
      + <%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %> + + <%= l(:label_release_news) %>: + + <%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %> + <%=link_to "#{news.comments.all.count}".html_safe, news_path(news.id), :class => "pro_mes_w" %> +
      +
      + +
      +
      + <%= news.description.html_safe %> +
      +
      +
      + +
      + <%= l(:label_create_time)%>:<%= format_time(news.created_on)%> + <%= link_to_attachments_course news %> +
      + <%#= render :partial => 'student_work/work_attachments', :locals => {:attachments => news.attachments} %> +
      +
      +
      + + <% 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/news/index.js.erb b/app/views/news/index.js.erb new file mode 100644 index 000000000..04671917b --- /dev/null +++ b/app/views/news/index.js.erb @@ -0,0 +1 @@ +$("#news_list").html("<%= escape_javascript(render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count})%>"); \ No newline at end of file diff --git a/app/views/poll/_new_MC.html.erb b/app/views/poll/_new_MC.html.erb index 8c47baa01..e5f2a6b82 100644 --- a/app/views/poll/_new_MC.html.erb +++ b/app/views/poll/_new_MC.html.erb @@ -1,5 +1,6 @@ <%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%> + <% insert_begin = insert_begin %>
      diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index 74ca9fb32..c5c016583 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -2,27 +2,262 @@
      @@ -9,9 +12,11 @@ * <%end%>
      + <%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id), method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %> +
      @@ -29,4 +34,15 @@
      -
      \ No newline at end of file +
      + +
      +
      + \ No newline at end of file diff --git a/app/views/poll/_show_MCQ.html.erb b/app/views/poll/_show_MCQ.html.erb index 63b9d1c1f..f13cf17d3 100644 --- a/app/views/poll/_show_MCQ.html.erb +++ b/app/views/poll/_show_MCQ.html.erb @@ -12,6 +12,7 @@ <%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id), method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %> +
      @@ -29,4 +30,15 @@
      -
      \ No newline at end of file +
      + +
      +
      + \ No newline at end of file diff --git a/app/views/poll/_show_head.html.erb b/app/views/poll/_show_head.html.erb index 4a1b2256d..752a5b310 100644 --- a/app/views/poll/_show_head.html.erb +++ b/app/views/poll/_show_head.html.erb @@ -1,5 +1,8 @@ +
      + +

      <%= poll.polls_name%>

      <%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
      diff --git a/app/views/poll/_show_mulit.html.erb b/app/views/poll/_show_mulit.html.erb index 2d52fffb5..6c98b8257 100644 --- a/app/views/poll/_show_mulit.html.erb +++ b/app/views/poll/_show_mulit.html.erb @@ -13,9 +13,21 @@ <%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id), method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %> +
      -
      \ No newline at end of file +
      + +
      +
      + \ No newline at end of file diff --git a/app/views/poll/_show_single.html.erb b/app/views/poll/_show_single.html.erb index 8caa7b1a5..68b93d244 100644 --- a/app/views/poll/_show_single.html.erb +++ b/app/views/poll/_show_single.html.erb @@ -12,8 +12,20 @@ <%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id), method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %> +
      -
      \ No newline at end of file +
    + +
    +
    + \ No newline at end of file diff --git a/app/views/poll/create_poll_question.js.erb b/app/views/poll/create_poll_question.js.erb index ac44ebb4c..8a597514e 100644 --- a/app/views/poll/create_poll_question.js.erb +++ b/app/views/poll/create_poll_question.js.erb @@ -1,4 +1,8 @@ +<% if @is_insert %> + $("#poll_content").html('<%= escape_javascript(render :partial => 'poll_content', :locals => {:poll => @poll})%>'); +<% else %> $("#new_poll_question").html(""); + $("#poll_content").append("
    " + "
    " + "<% if @poll_questions.question_type == 1%>" + @@ -23,4 +27,4 @@ $("#poll_content").append("
    " + "<% end%>" + "
    " + "
    "); - +<% end %> diff --git a/app/views/poll/import_poll.js.erb b/app/views/poll/import_poll.js.erb new file mode 100644 index 000000000..9f1d8e7cb --- /dev/null +++ b/app/views/poll/import_poll.js.erb @@ -0,0 +1,4 @@ +/** + * Created by lizanle on 2015/7/29. + */ +$("#poll_content").html('<%= escape_javascript(render :partial => 'poll_content', :locals => {:poll => @poll})%>'); \ No newline at end of file diff --git a/app/views/projects/_project_jours.html.erb b/app/views/projects/_project_jours.html.erb index baee72475..919abfcbf 100644 --- a/app/views/projects/_project_jours.html.erb +++ b/app/views/projects/_project_jours.html.erb @@ -1,15 +1,15 @@ <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
    @@ -22,18 +22,18 @@
    <% else %> - - <%= form_for('new_form', :method => :post, - :url => {:controller => 'words', :action => 'leave_project_message'}) do |f|%> - <%= f.text_area 'project_message', :rows => 3, :cols => 65, - :placeholder => "#{l(:label_welcome_my_respond)}",:nhname=>'new_message_textarea' %> -

    -
    - <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "blue_btn fr mt10 mb10" %> - <% end %> + <%= form_for('new_form', :method => :post, :html => {:id => 'project_feedback_form', :multipart => true}, + :url => {:controller => 'words', :action => 'leave_project_message'}) do |f|%> + <%= f.text_area 'project_message', :rows => 3, :cols => 65, + :placeholder => "#{l(:label_welcome_my_respond)}",:nhname=>'new_message_textarea' %> +

    +
    + <%#= submit_tag l(:button_leave_meassge), :name => nil , :class => "blue_btn fr mt10 mb10" %> + <%= link_to l(:button_leave_meassge), "javascript:void(0)", :onclick => 'submitProjectFeedback();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fr mt10 mb10' %> + <% end %> <% end %> -
    +
    <%= render :partial => 'history',:locals => { :journals => @jour, :state => false} %> @@ -42,47 +42,47 @@
    diff --git a/app/views/projects/_tools_expand.html.erb b/app/views/projects/_tools_expand.html.erb index 4cf7ebcab..85c8ca6b1 100644 --- a/app/views/projects/_tools_expand.html.erb +++ b/app/views/projects/_tools_expand.html.erb @@ -43,97 +43,69 @@
  • <% if User.current.admin? %> - 软件知识库 - <%#= link_to l(:label_project_soft_knowledge) ,soft_knowledge_project_path(@project) %> - <% end %> -
  • -
  • - <% if User.current.admin? %> - 软件资源库 - <%#= link_to l(:label_project_soft_file) ,soft_file_project_path(@project) %> - <% end %> -
  • - -
  • - <% if User.current.admin? %> - <%= link_to l(:label_project_dts_new) ,dts_dep_project_path(@project), data: { confirm:'你确定要对本项目进行代码缺陷测试分析吗?' } %> - <% end %> -
  • - -
  • - <% if User.current.admin? %> - 在线开发平台 - <%#= link_to l(:label_project_online_dev) ,online_dev_project_path(@project) %> - <% end %> -
  • -
  • - <% if User.current.admin? %> - 软工服务平台 + QoS评估工具 <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> <% end %>
  • -
  • <% if User.current.admin? %> - 形式验证工具 + QoS证据采集工具 <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> <% end %>
  • -
  • <% if User.current.admin? %> - QoS 评估工具 + QoS证据评估统计分析工具 <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> <% end %>
  • -
  • <% if User.current.admin? %> - QoS 证据采集工具 - <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> + <%= link_to "代码缺陷测试工具(DTS)" ,dts_dep_project_path(@project), data: { confirm:'你确定要对本项目进行代码缺陷测试分析吗?' } %> + <% end %> +
  • +
  • + <% if User.current.admin? %> + 软工服务平台(SASSP) + <% end %> +
  • +
  • + <% if User.current.admin? %> + 软件知识库(KnowledgeBase) + <% end %> +
  • +
  • + <% if User.current.admin? %> + 可信评估工具(Evaluator) + <% end %> +
  • +
  • + <% if User.current.admin? %> + 在线验证工具(BACH-Online) + <% end %> +
  • +
  • + <% if User.current.admin? %> + 软件测试工具(SSCC-Web) + <% end %> +
  • +
  • + <% if User.current.admin? %> + 服务资源共享平台(ServiceXchange) + <% end %> +
  • +
  • + <% if User.current.admin? %> + 在线服务开发平台(ServiceFoundry) + <% end %> +
  • +
  • + <% if User.current.admin? %> + 组合开发和运行演化平台(Service4All) <% end %>
  • -
  • - <% if User.current.admin? %> - 可信度评估工具 SAS - - <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> - <% end %> -
  • -
  • - <% if User.current.admin? %> - 可信评估工具 Evaluator - <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> - <% end %> -
  • -
  • - <% if User.current.admin? %> - 软件测试工具 SSCC-Web - <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> - <% end %> -
  • - - - - - - -
  • - <% if User.current.admin? %> - QoS 证据评估统计分析工具 - <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> - <% end %> -
  • - -
  • - <% if User.current.admin? %> - 在线验证工具 BACH-Online - <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> - <% end %> -
  • diff --git a/app/views/projects/search.html.erb b/app/views/projects/search.html.erb index fedc9f846..b77b3fda6 100644 --- a/app/views/projects/search.html.erb +++ b/app/views/projects/search.html.erb @@ -69,12 +69,12 @@ } 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/yun_dep.html.erb b/app/views/projects/yun_dep.html.erb index 20abf038f..7a774f4e4 100644 --- a/app/views/projects/yun_dep.html.erb +++ b/app/views/projects/yun_dep.html.erb @@ -5,27 +5,27 @@
    -

    云化部署中...

    -
    -
    0%
    +

    云化部署中....

    +
    +
    + +<%= 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 b5bdd6f55..9569718fb 100644 --- a/app/views/student_work/_evaluation_student_work.html.erb +++ b/app/views/student_work/_evaluation_student_work.html.erb @@ -9,7 +9,8 @@ <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
  • - <%= link_to student_work.name, student_work_path(student_work.id),:remote => true,:title => student_work.name, :class => "c_blue02"%> + <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%> + <%= link_to student_work_name, student_work_path(student_work.id),:remote => true,:title => student_work.name, :class => "c_blue02"%>
  • <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %> diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index 11ce7b080..be07269c3 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -18,7 +18,8 @@ <% end%>
  • - <%= link_to student_work.name, student_work_path(student_work),:remote => true, :title => student_work.name, :class => "c_blue02"%> + <% student_work_name = student_work.name.nil? || student_work.name.empty? ? '匿名的作品' : student_work.name%> + <%= link_to student_work_name, student_work_path(student_work),:remote => true, :title => student_work.name, :class => "c_blue02"%>
  • <% my_score = student_work_score(student_work,User.current) %>
  • diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index eab8313bc..b259e20a5 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -23,40 +23,42 @@
  • -
  • 测试结果: - - - - - - - - - - - - - - - <%@homework.homework_tests.each do |test|%> - "> - - - - - - <% end%> - - -
    - <%= test.input%> - - <%= test.output%> - <%= test.student_work_test.nil? ? "正在编译" : test.student_work_test.status_to_s%>
    -
    -
  • <% 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/_show.html.erb b/app/views/student_work/_show.html.erb index 2b7d49402..f6580659e 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -36,7 +36,7 @@
  • 内容:
    - <%= text_format @work.description%> + <%= text_format(@work.description) if @work.description%>
  • diff --git a/app/views/student_work/_student_work.html.erb b/app/views/student_work/_student_work.html.erb index dd7ab7e2d..f7eb7514d 100644 --- a/app/views/student_work/_student_work.html.erb +++ b/app/views/student_work/_student_work.html.erb @@ -9,7 +9,8 @@ <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
  • - <%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%> + <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%> + <%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%>
  • <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %> diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 781277b57..3783d67d3 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -55,21 +55,23 @@ <% end%> <% if @is_teacher%>
    - <% if @homework.student_works.empty?%> - <%= link_to "附件", "javascript:void(0)", class: "down_btn fr zip_download_alert", :onclick => "alert('没有学生提交作业,无法下载附件')" %> - <% else%> - <%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json), - remote: true, class: "down_btn fr zip_download_alert", :id => "download_homework_attachments" %> + <% unless @homework.homework_type == 2%> + <% if @homework.student_works.empty?%> + <%= link_to "附件", "javascript:void(0)", class: "down_btn fr zip_download_alert", :onclick => "alert('没有学生提交作业,无法下载附件')" %> + <% else%> + <%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json), + remote: true, class: "down_btn fr zip_download_alert", :id => "download_homework_attachments" %> + <% end%> +
    + 使用 + winzip + 工具进行解压可能会导致 + 下载文件乱码 + ,建议您使用 + winrar + 工具进行解压 +
    <% end%> -
    - 使用 - winzip - 工具进行解压可能会导致 - 下载文件乱码 - ,建议您使用 - winrar - 工具进行解压 -
    <%= link_to("匿评", evaluation_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'down_btn fr') if @homework.homework_type == 1%> <%= link_to("缺评", absence_penalty_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'down_btn fr') if @homework.homework_type == 1%> <%= link_to l(:label_list), student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'down_btn fr'%> @@ -135,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/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/remove_tag.js.erb b/app/views/tags/remove_tag.js.erb index b8c65c13e..cd56fef1a 100644 --- a/app/views/tags/remove_tag.js.erb +++ b/app/views/tags/remove_tag.js.erb @@ -2,6 +2,9 @@ <% 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 == '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..992c472ed 100644 --- a/app/views/tags/tag_save.js.erb +++ b/app/views/tags/tag_save.js.erb @@ -4,6 +4,10 @@ $('#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 == '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_fans_item.html.erb b/app/views/users/_user_fans_item.html.erb index 66181d23b..4ca8fbefc 100644 --- a/app/views/users/_user_fans_item.html.erb +++ b/app/views/users/_user_fans_item.html.erb @@ -1,6 +1,6 @@
    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..ee94cb35a --- /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.login} ".html_safe, user_path(reply.user),:class => 'course_name fl c_blue02 ', :target => "_blank"%> +  回复  + <%= link_to "#{parent_jour.user.login} : ".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..9a9e14787 --- /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.login} : ".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/show.html.erb b/app/views/users/show.html.erb index efe5d0539..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_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/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/welcome/index.html.erb b/app/views/welcome/index.html.erb index c03b0de76..816d6550a 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -45,10 +45,10 @@ <% if @organization.nil? %> <% unless @first_page.nil? %> - <%= l(:label_welcome_trustie_project)%>,  - <%= l(:label_welcome_trustie_project_description)%> + + <%= @first_page.description.html_safe %> <% end %> <% else %> 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/projects/zh.yml b/config/locales/projects/zh.yml index e1971cfb9..e47cd476c 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -92,7 +92,7 @@ zh: label_project_dts_new: DTS缺陷测试 label_project_dts_statics: DTS缺陷报告 - label_project_dts_yun: 云化部署 + label_project_dts_yun: 云化部署工具 label_project_soft_knowledge: 软件知识库 label_project_soft_file: 软件资源库 label_project_online_dev: 在线开发平台 @@ -350,7 +350,7 @@ zh: label_input_email: 请输入邮箱地址 label_invite_trustie_user: "邀请Trustie注册用户" - label_invite_trustie_user_tips: "输入姓名、邮箱、昵称" + label_invite_trustie_user_tips: "支持姓名、邮箱、昵称搜索!" label_user_role_null: 用户和角色不能留空! label_invite_project: 邀请您加入项目 label_mail_invite_success: 您已成功加入项目! diff --git a/config/locales/zh.yml b/config/locales/zh.yml index b2faa6319..1018a213a 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: 项目列表 @@ -669,6 +670,8 @@ zh: label_tag: 标签 label_revision: 修订 label_revision_plural: 修订 + lable_revision_code_count: 代码量 + label_revision_commit_count: 提交次数 label_revision_id: 修订 %{value} label_associated_revisions: 相关修订版本 label_added: 已添加 @@ -715,6 +718,11 @@ zh: label_commits_per_month: 每月提交次数 label_commits_per_author: 每用户提交次数 + label_author_commits_per_month: 用户最近一月的提交次数 + label_author_commits_six_month: 用户最近六个月提交次数 + label_author_commits_year: 最近一年的提交次数 + label_author_code_six_month: 用户最近六个月代码量 + label_author_code_year: 用户最近一年代码量 label_view_diff: 查看差别 label_diff_inline: 直列 label_diff_side_by_side: 并排 @@ -1835,6 +1843,7 @@ zh: excel_t_score: 教师评分 excel_ta_score: 教辅评分 excel_n_score: 匿名评分 + excel_s_score: 系统评分 excel_f_score: 成绩 excel_commit_time: 提交时间 excel_homework_score: 作业积分 diff --git a/config/routes.rb b/config/routes.rb index 1ae607eb7..a8cffb2ed 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,6 +82,7 @@ RedmineApp::Application.routes.draw do get 'poll_result' get 'close_poll' get 'export_poll' + get 'import_poll' end collection do delete 'delete_poll_question' @@ -86,6 +98,7 @@ RedmineApp::Application.routes.draw do end collection do post 'next_step' + post 'programing_test' end end @@ -293,7 +306,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 @@ -670,6 +683,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 +793,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 +823,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/20150722015428_add_errormsg_to_studen_work_test.rb b/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb new file mode 100644 index 000000000..dc973e142 --- /dev/null +++ b/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb @@ -0,0 +1,9 @@ +class AddErrormsgToStudenWorkTest < ActiveRecord::Migration + def up + add_column :student_work_tests,:error_msg,:text + end + + def down + remove_column :student_work_tests,:error_msg + end +end 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/schema.rb b/db/schema.rb index 6754a30b7..96be7103e 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 => 20150719092427) do +ActiveRecord::Schema.define(:version => 20150730130816) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -632,8 +632,10 @@ ActiveRecord::Schema.define(:version => 20150719092427) do t.text "input" t.text "output" t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "result", :default => 0 + t.text "error_msg" end create_table "homework_users", :force => true do |t| @@ -1248,6 +1250,7 @@ ActiveRecord::Schema.define(:version => 20150719092427) do t.integer "result" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.text "error_msg" end create_table "student_works", :force => true do |t| 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/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb index 1876190d9..927018b34 100644 --- a/lib/redmine/scm/adapters/git_adapter.rb +++ b/lib/redmine/scm/adapters/git_adapter.rb @@ -380,6 +380,36 @@ module Redmine nil end + def parse_commit(commits) + sum = {file: 0, insertion: 0, deletion: 0} + commits.split("\n").each do |commit| + if /(\d+)\s+?file/ =~ commit + sum[:file] += $1 .to_i + end + if /(\d+)\s+?insertion/ =~ commit + sum[:insertion] += $1.to_i + end + if /(\d+)\s+?deletion/ =~ commit + sum[:deletion] += $1.to_i + end + end + sum[:insertion] + sum[:deletion] + end + + def commits(authors, start_date, end_date, branch='master') + rs = [] + authors.each do |author| + cmd_args = %W|log #{branch} --pretty=tformat: --shortstat --author=#{author} --since=#{start_date} --until=#{end_date}| + commits = '' + git_cmd(cmd_args) do |io| + commits = io.read + end + logger.info "git log output for #{author} #{commits}" + rs << {author: author, num: parse_commit(commits)} + end + rs + end + class Revision < Redmine::Scm::Adapters::Revision # Returns the readable identifier def format_identifier diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index a9633861e..270618522 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -5104,8 +5104,8 @@ KEditor.prototype = { } } }); - statusbar.removeClass('statusbar').addClass('ke-statusbar') - .append(''); + //statusbar.removeClass('statusbar').addClass('ke-statusbar') + // .append(''); if (self._fullscreenResizeHandler) { K(window).unbind('resize', self._fullscreenResizeHandler); self._fullscreenResizeHandler = null; diff --git a/public/javascripts/course.js b/public/javascripts/course.js index b2736993b..c7b01cee1 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 5a7bb001a..5c6fd9867 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -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;} /****资源库***/ @@ -609,6 +607,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 +664,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;} @@ -685,12 +683,18 @@ input#score{ width:40px;} .ui-slider .ui-slider-handle:hover,.ui-slider .ui-slider-handle:focus{background:#64bdd9;} .ui-slider .ui-slider-handle:active{background-image:none;} .ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;top:0;height:100%;background:#64bdd9;left:0;} + /* 编程作品 */ .border_ce{ border:1px solid #e4e4e4; } .border_ce tr td{ height:26px; } -.td_tit{width:155px; text-align:center;} -.td_50{width:50px; text-align:center;} -a.work_list_tit{width:610px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.td_tit{width:170px; text-align:center;} +.td_50{width:60px; text-align:center;} +a.work_list_tit{width:580px; display:block; overflow:hidden; font-size:14px; font-weight:bold; white-space: nowrap; text-overflow:ellipsis;} +.work_list_pro{ width:670px;} +.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; } +.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;} .evaluation{position: relative;} @@ -708,3 +712,5 @@ a:hover.about_me{ color:#0781b4;} + + diff --git a/public/stylesheets/leftside.css b/public/stylesheets/leftside.css index 50b47fff4..990c02d54 100644 --- a/public/stylesheets/leftside.css +++ b/public/stylesheets/leftside.css @@ -15,6 +15,7 @@ a.pr_join_a{ color:#fff; display:block; padding:0 5px 0 3px; padding-top:2px; h .pr_close{ display:block; background:url(../images/leftside.png) -1px -49px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } .pr_add{display:block; background:url(../images/leftside.png) 0px -71px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } .pr_arrow{display:block; background:url(../images/leftside.png) 0px -90px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } +.pr_delete{ display:block; background:url(../images/leftside.png) -1px -157px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } .pr_info_name{ color:#3e4040; font-size:14px; line-height:1.5;} a:hover.pr_info_name{ color:#3ca5c6;} .pr_info_score{ font-size:14px; color:#3e4040; } 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..83fa5089b 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;} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index f005b2df6..cce9b7673 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;} @@ -551,7 +555,24 @@ p.percent { font-size: 12px; } .repositorytitle select{ width: 110px; height: 21px; } - +.riviseRed { + width:15px; + height:15px; + margin-right: 3px; + background-color:#FF0000; + filter:alpha(opacity=50); /* ie 有效*/ + -moz-opacity:0.5; /* Firefox 有效*/ + opacity: 0.5; /* 通用,其他浏览器 有效*/ +} +.changeBlue { + width:15px; + height:15px; + margin-right: 3px; + background-color:#0000FF; + filter:alpha(opacity=50); /* ie 有效*/ + -moz-opacity:0.5; /* Firefox 有效*/ + opacity: 0.5; /* 通用,其他浏览器 有效*/ +} /*导出*/ @@ -673,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; } diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index b3d16908d..576a9da0c 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -73,6 +73,7 @@ h4{ font-size:14px; color:#3b3b3b;} .ml320{ margin-left:320px;} .mr5{ margin-right:5px;} .mr10{ margin-right:10px;} +.mr15 {margin-right: 15px;} .mr20{ margin-right:20px;} .mr30{ margin-right:30px;} .mr40{ margin-right:40px;} @@ -86,6 +87,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;} @@ -164,11 +166,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; } diff --git a/public/stylesheets/public_new.css b/public/stylesheets/public_new.css index 428da5712..361b08482 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; } @@ -429,4 +430,4 @@ 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;} diff --git a/public/stylesheets/users.css b/public/stylesheets/users.css index 81529288c..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,15 +91,17 @@ 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:33px; height:18px; border:1px solid #cdcdcd; color:#333333; padding:0px 0 0 18px;} +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;} a.c_lgrey{ color:#CCC;} a:hover.c_lgrey{ color:#3ca5c6;} @@ -113,7 +117,7 @@ a:hover.c_lgrey{ color:#3ca5c6;} /* 20150506上传头像*/ .uppicBox{ width:265px; height:265px; background:#f2f2f5; float:left; color:#666; text-align:center;} .showpicBox{width:133px; height:250px; background:#f2f2f5; float:left; margin-left:20px; text-align:center; padding-top:15px; color:#666;} -.mr2{ margin-right:2px;} +.mr15{ margin-right:15px;} .uppic_btn{border:none; width:150px; background:none; margin-bottom:5px; color:#666; margin-top:105px;} /* 新建作品*/ .mr8{ margin-right:8px;} @@ -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;