diff --git a/app/assets/javascripts/system_messages.js.coffee b/app/assets/javascripts/system_messages.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/system_messages.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/system_messages.css.scss b/app/assets/stylesheets/system_messages.css.scss new file mode 100644 index 000000000..a9947d45a --- /dev/null +++ b/app/assets/stylesheets/system_messages.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the SystemMessages controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 1624008f2..5666934b6 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -79,6 +79,11 @@ class AdminController < ApplicationController end end + # 系统消息 + def messages + @admin_messages = SystemMessage.new + end + def plugins @plugins = Redmine::Plugin.all end diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 53fb21b8c..434ea4470 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -101,8 +101,9 @@ class BoardsController < ApplicationController @topic_count = @board ? @board.topics.count : 0 if @project @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] + #现在发布帖子的时候置顶功能已经没有了。所以取消这个置顶排序 #{Message.table_name}.sticky DESC, @topics = @board.topics. - reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc"). + reorder("#{Message.table_name}.created_on desc"). includes(:last_reply). limit(@topic_pages.per_page). offset(@topic_pages.offset). diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 4088d4156..6b421bf2a 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -49,6 +49,9 @@ class CommentsController < ApplicationController # end # # ������ض�̬�ļ�¼add end flash[:notice] = l(:label_comment_added) + user_activity = UserActivity.where("act_type='News' and act_id =#{@news.id}").first + user_activity.updated_at = @comment.created_on + user_activity.save end if params[:user_activity_id] diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index db972941e..b30715a1f 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -468,13 +468,17 @@ class CoursesController < ApplicationController end def new - @course_type = params[:course_type] ||= params[:course] - @issue_custom_fields = IssueCustomField.sorted.all - @trackers = Tracker.sorted.all - @course = Course.new - @course.safe_attributes = params[:course] - # month = Time.now.month - render :layout => 'new_base' + if User.current.login? + @course_type = params[:course_type] ||= params[:course] + @issue_custom_fields = IssueCustomField.sorted.all + @trackers = Tracker.sorted.all + @course = Course.new + @course.safe_attributes = params[:course] + # month = Time.now.month + render :layout => 'new_base' + else + redirect_to signin_url + end end def desc_sort_course_by_avtivity(activity_count, courses) @@ -627,6 +631,11 @@ class CoursesController < ApplicationController end def feedback + @course.journals_for_messages.each do |messages| + query = messages.course_messages.where("user_id = ?", User.current.id) + query.update_all(:viewed => true); + end + if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course))) page = params[:page] # Find the page of the requested reply diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 2b44d51de..efbb4ffab 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -7,7 +7,7 @@ class ForumsController < ApplicationController before_filter :find_forum_if_available before_filter :authenticate_user_edit, :only => [:edit, :update] before_filter :authenticate_user_destroy, :only => [:destroy] - before_filter :require_login, :only => [:new, :create] + before_filter :require_login, :only => [:new, :create,:destroy,:update,:edit] helper :sort include SortHelper @@ -97,7 +97,24 @@ class ForumsController < ApplicationController def index @offset, @limit = api_offset_and_limit({:limit => 10}) - @forums_all = Forum.reorder("sticky DESC") + if(params[:reorder_complex]) + @type="reorder_complex" + @str=params[:reorder_complex] + @forums_all = Forum.reorder("topic_count #{params[:reorder_complex]},updated_at #{params[:reorder_complex]}") + elsif(params[:reorder_popu]) + @type="reorder_popu" + @str=params[:reorder_popu] + @forums_all = Forum.reorder("topic_count #{params[:reorder_popu]}") + elsif(params[:reorder_time]) + @type="reorder_time" + @str=params[:reorder_time] + @forums_all = Forum.reorder("updated_at #{params[:reorder_time]}") + else + params[:reorder_complex] = "desc" + @type="reorder_complex" + @str=params[:reorder_complex] + @forums_all = Forum.reorder("topic_count desc,updated_at desc") + end @forums_count = @forums_all.count @forums_pages = Paginator.new @forums_count, @limit, params['page'] @@ -106,6 +123,7 @@ class ForumsController < ApplicationController #@forums = Forum.all respond_to do |format| format.html # index.html.erb + format.js format.json { render json: @forums } end end @@ -113,11 +131,25 @@ class ForumsController < ApplicationController # GET /forums/1 # GET /forums/1.json def show - sort_init 'updated_at', 'desc' - sort_update 'created_at' => "#{Memo.table_name}.created_at", - 'replies' => "#{Memo.table_name}.replies_count", - 'updated_at' => "COALESCE (last_replies_memos.created_at, #{Memo.table_name}.created_at)" - + # sort_init 'updated_at', 'desc' + # sort_update 'created_at' => "#{Memo.table_name}.created_at", + # 'replies' => "#{Memo.table_name}.replies_count", + # 'updated_at' => "COALESCE (last_replies_memos.created_at, #{Memo.table_name}.created_at)" + order = "" + @order_str = "" + if(params[:reorder_complex]) + order = " last_replies_memos.created_at #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}" + @order_str = "reorder_complex="+params[:reorder_complex] + elsif(params[:reorder_popu]) + order = "replies_count #{params[:reorder_popu]}" + @order_str = "reorder_popu="+params[:reorder_popu] + elsif(params[:reorder_time]) + order = "#{Memo.table_name}.updated_at #{params[:reorder_time]}" + @order_str = "reorder_time="+params[:reorder_time] + else + order = "last_replies_memos.created_at desc, #{Memo.table_name}.created_at desc" + @order_str = "reorder_complex=desc" + end @memo = Memo.new(:forum => @forum) @topic_count = @forum.topics.count @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] @@ -126,19 +158,15 @@ class ForumsController < ApplicationController includes(:last_reply). limit(@topic_pages.per_page). offset(@topic_pages.offset). - order(sort_clause). + reorder(order). preload(:author, {:last_reply => :author}). all @memos - # @offset, @limit = api_offset_and_limit({:limit => 10}) - # @forum = Forum.find(params[:id]) - # @memos_all = @forum.topics - # @topic_count = @memos_all.count - # @topic_pages = Paginator.new @topic_count, @limit, params['page'] - - # @offset ||= @topic_pages.offset - # @memos = @memos_all.offset(@offset).limit(@limit).all + @my_topic_count = Memo.where("forum_id = #{@forum.id} and author_id = #{User.current.id} and parent_id is null").count + @my_replies_count = Memo.where("forum_id = #{@forum.id} and author_id = #{User.current.id} and parent_id is not null").count + @errors = params[:errors] respond_to do |format| + format.js format.html { render :layout => 'base_forums' }# show.html.erb @@ -172,20 +200,23 @@ class ForumsController < ApplicationController # Author lizanle # Description after save后需要进行资源记录的更新 # owner_type = 2 对应的是 forum + @save_flag=true if params[:asset_id] ids = params[:asset_id].split(',') update_kindeditor_assets_owner ids ,@forum.id,OwnerTypeHelper::FORUM end #end respond_to do |format| - + format.js format.html { redirect_to @forum, notice: l(:label_forum_create_succ) } format.json { render json: @forum, status: :created, location: @forum } end else + @save_flag=false respond_to do |format| flash.now[:error] = "#{l :label_forum_create_fail}: #{@forum.errors.full_messages[0]}" + format.js format.html { render action: "new" } format.json { render json: @forum.errors, status: :unprocessable_entity } end @@ -199,10 +230,12 @@ class ForumsController < ApplicationController respond_to do |format| if @forum.update_attributes(params[:forum]) + format.js {render :text=> true} format.html { redirect_to @forum, notice: l(:label_forum_update_succ) } format.json { head :no_content } else flash.now[:error] = "#{l :label_forum_update_fail}: #{@forum.errors.full_messages[0]}" + format.js { render :text=> false} format.html { render action: "edit" } format.json { render json: @forum.errors, status: :unprocessable_entity } end @@ -261,6 +294,52 @@ class ForumsController < ApplicationController end end + #检查forum的名字 + def check_forum_name + forum_name_exist = true + if params[:forum_id] + forum_name_exist = Forum.where("name = '#{params[:forum_name]}' and id != #{params[:forum_id]}").count >= 1 ? true : false + else + forum_name_exist = Forum.where("name = '#{params[:forum_name]}' ").count >= 1 ? true : false + end + render :text => forum_name_exist + end + + #添加论坛tag + def add_forum_tag + @forum = Forum.find(params[:id]) + unless @forum.nil? + @forum.tag_list.add(params[:tag_str].split(',')) + @forum.save + end + respond_to do |format| + format.js {render :delete_forum_tag} + end + end + + #删除forum的tag + def delete_forum_tag + @tag_id = (ActsAsTaggableOn::Tag.find_by_name(params[:tag_name])).id + #forum的taggable_type = 5 + @taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,params[:id],'Forum') + + unless @taggings.nil? + @taggings.delete + end + + # 是否还有其他记录 引用了 tag_id + @tagging = ActsAsTaggableOn::Tagging.find_by_tag_id(@tag_id) + # 如果taggings表中记录已经不存在 ,那么检查tags表 作删除动作 + if @tagging.nil? + @tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id) + @tag.delete unless @tag.nil? + end + @forum = Forum.find(params[:id]) + respond_to do |format| + format.js + end + end + private def find_forum_if_available diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 2e9925916..00d814bd3 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -3,9 +3,11 @@ class HomeworkCommonController < ApplicationController 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] - before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment] + + include StudentWorkHelper + before_filter :find_course, :only => [:index,:new,:create] + before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr] + before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr] before_filter :member_of_course, :only => [:index] def index @@ -18,265 +20,64 @@ class HomeworkCommonController < ApplicationController end end + #新建作业,在个人作业列表创建作业 def new - @homework_type = "1" - - @homework = HomeworkCommon.new - @homework.safe_attributes = params[:homework_common] - @homework.late_penalty = 2 - @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 = 2 - @homework_detail_manual.evaluation_num = 3 - @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') - @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - @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 - end - - #新建作业下一步 - def next_step - @homework_type = params[:homework_common_type] - - @homework = HomeworkCommon.new - @homework.safe_attributes = params[:homework_common] - @homework.late_penalty = 2 - @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 = 2 - @homework_detail_manual.evaluation_num = 3 - @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') - @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - @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 + render_404 end + #新建作业,在个人作业列表创建作业 def create - if params[:homework_common] - homework = HomeworkCommon.new - homework.name = params[:homework_common][:name] - homework.description = params[:homework_common][:description] - homework.end_time = params[:homework_common][:end_time] - homework.publish_time = params[:homework_common][:publish_time] - homework.homework_type = params[:homework_common][:homework_type] - homework.late_penalty = params[:late_penalty] - homework.user_id = User.current.id - homework.course_id = @course.id - - homework.save_attachments(params[:attachments]) - render_attachment_warning_if_needed(homework) - - if homework.homework_type == 2 - homework_detail_programing = HomeworkDetailPrograming.new - homework_detail_programing.language = params[:language] - homework_detail_programing.standard_code = params[:standard_code] - homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6 - question = {title:homework.name,content:homework.description} - question[:input] = [] - question[:output] = [] - if params[:input] && params[:output] && params[:result] - params[:input].each do |k,v| - if params[:output].include? k - homework_test = HomeworkTest.new - homework_test.input = v - homework_test.output = params[:output][k] - homework_test.result = params[:result][k] - homework_test.error_msg = params[:error_msg] - homework.homework_tests << homework_test - question[:input] << homework_test.input - question[:output] << homework_test.output - end - end - end - - # uri = URI('http://192.168.80.21:8080/api/questions.json') - # body = question.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) - # homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0 - - homework.homework_detail_programing = homework_detail_programing - else - #匿评作业相关属性 - homework_detail_manual = HomeworkDetailManual.new - homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 - homework_detail_manual.comment_status = 1 - homework_detail_manual.evaluation_start = params[:evaluation_start] - homework_detail_manual.evaluation_end = params[:evaluation_end] - homework_detail_manual.evaluation_num = params[:evaluation_num] - homework_detail_manual.absence_penalty = params[:absence_penalty] - homework.homework_detail_manual = homework_detail_manual - 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) - redirect_to homework_common_index_path(:course => @course.id) - } - end - return - end - end - - respond_to do |format| - format.html { - flash[:notice] = l(:notice_failed_create) - redirect_to new_homework_common_path(:course => @course.id) - } - end + redirect_to user_homeworks_user_path(User.current.id) end def edit + @user = User.current + @is_in_course = params[:is_in_course] respond_to do |format| - format.html + format.html{render :layout => 'new_base_user'} end end def update - @homework.name = params[:homework_common][:name] - @homework.description = params[:homework_common][:description] - @homework.end_time = params[:homework_common][:end_time] - @homework.publish_time = params[:homework_common][:publish_time] - @homework.homework_type = params[:homework_common][:homework_type] if params[:homework_common][:homework_type] - unless @homework.late_penalty == params[:late_penalty] - @homework.student_works.where("created_at > '#{@homework.end_time} 23:59:59'").each do |student_work| - student_work.late_penalty = params[:late_penalty] - student_work.save - end - @homework.late_penalty = params[:late_penalty] - end - # @homework.course_id = @course.id + if params[:homework_common] + @homework.name = params[:homework_common][:name] + @homework.description = params[:homework_common][:description] + @homework.end_time = params[:homework_common][:end_time] || Time.now + @homework.course_id = params[:course_id] - #匿评作业相关属性 - if @homework.homework_type == 1 && @homework_detail_manual - @homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 - @homework_detail_manual.evaluation_start = params[:evaluation_start] - @homework_detail_manual.evaluation_end = params[:evaluation_end] - @homework_detail_manual.evaluation_num = params[:evaluation_num] - unless @homework_detail_manual.absence_penalty == params[:absence_penalty] - if @homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值 - work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")" - @homework.student_works.each do |student_work| - absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count - student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0 - student_work.save - end - end - @homework_detail_manual.absence_penalty = params[:absence_penalty] - end - elsif @homework.homework_type == 0 #普通作业,缺评扣分为0分,每个作品的缺评扣分改为0分,防止某些作业在结束匿评之后改为普通作业 - @homework.student_works.where("absence_penalty != 0").each do |student_work| - student_work.late_penalty = 0 - student_work.save - end - @homework_detail_manual.absence_penalty = 0 if @homework_detail_manual - end + homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new + homework_detail_manual.evaluation_start = params[:evaluation_start].blank? ? @homework.end_time + 7 : params[:evaluation_start] + homework_detail_manual.evaluation_end = params[:evaluation_end].blank? ? homework_detail_manual.evaluation_start + 7 : params[:evaluation_end] - if @homework.homework_type == 2 && @homework_detail_programing #编程作业 - @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 - #需要删除的测试 - ids = homework_tests.map(&:id) - params[:input].keys.map(&:to_i) - ids.each do |id| - homework_test = HomeworkTest.find id - homework_test.destroy if homework_test - end - if params[:input] && params[:output] && params[:result] - params[:input].each do |k,v| - if params[:output].include? k - homework_test = HomeworkTest.find_by_id k - if homework_test #已存在的测试,修改 - homework_test.input = v - homework_test.output = params[:output][k] - homework_test.result = params[:result][k] - homework_test.error_msg = params[:error_msg] - else #不存在的测试,增加 - homework_test = HomeworkTest.new - homework_test.input = v - homework_test.output = params[:output][k] - homework_test.result = params[:result][k] - homework_test.error_msg = params[:error_msg] - homework_test.homework_common = @homework + @homework.save_attachments(params[:attachments]) + render_attachment_warning_if_needed(@homework) + + #编程作业相关属性 + if @homework.homework_type == 2 + @homework.homework_detail_programing ||= HomeworkDetailPrograming.new + @homework_detail_programing = @homework.homework_detail_programing + @homework_detail_programing.language = params[:language_type].to_i + + @homework.homework_tests.delete_all + inputs = params[:program][:input] + if Array === inputs + inputs.each_with_index do |val, i| + @homework.homework_tests << HomeworkTest.new( + input: val, + output: params[:program][:output][i] + ) end - homework_test.save 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]) - render_attachment_warning_if_needed(@homework) - - if @homework.save - @homework_detail_manual.save if @homework_detail_manual - @homework_detail_programing.save if @homework_detail_programing - respond_to do |format| - format.html { - flash[:notice] = l(:notice_successful_edit) + if @homework.save + @homework_detail_manual.save if @homework_detail_manual + @homework_detail_programing.save if @homework_detail_programing + if params[:is_in_course] == "1" redirect_to homework_common_index_path(:course => @course.id) - } - end - return - else - respond_to do |format| - format.html { - flash[:notice] = l(:notice_failed_edit) - redirect_to edit_homework_common_path(@homework) - } + else + redirect_to user_homeworks_user_path(User.current.id) + end end end end @@ -284,7 +85,13 @@ class HomeworkCommonController < ApplicationController def destroy if @homework.destroy respond_to do |format| - format.html {redirect_to homework_common_index_path(:course => @course.id)} + format.html { + if params[:is_in_course] == "1" + redirect_to homework_common_index_path(:course => @course.id) + else + redirect_to user_homeworks_user_path(User.current.id) + end + } end end end @@ -292,11 +99,11 @@ class HomeworkCommonController < ApplicationController #开启匿评 #statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限 def start_anonymous_comment - @statue =4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course) + @statue = 4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course) @statue = 5 and return if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") if @homework_detail_manual.comment_status == 1 student_works = @homework.student_works - if student_works && student_works.size >=2 + if student_works && student_works.size >= 2 student_works.each_with_index do |work, index| user = work.user n = @homework_detail_manual.evaluation_num @@ -309,6 +116,9 @@ class HomeworkCommonController < ApplicationController end @homework_detail_manual.update_column('comment_status', 2) @statue = 1 + # 匿评开启消息邮件通知 + send_message_anonymous_comment(@homework, m_status = 2) + Mailer.send_mail_anonymous_comment_open(@homework).deliver else @statue = 2 end @@ -320,19 +130,29 @@ class HomeworkCommonController < ApplicationController #关闭匿评 def stop_anonymous_comment @homework_detail_manual.update_column('comment_status', 3) - + #计算缺评扣分 work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")" @homework.student_works.each do |student_work| absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0 student_work.save end - + # 匿评关闭消息邮件通知 + send_message_anonymous_comment(@homework, m_status = 3) + Mailer.send_mail_anonymous_comment_close(@homework).deliver respond_to do |format| format.js end end + # 开启/关闭匿评消息通知 + def send_message_anonymous_comment(homework, m_status ) + # status 标记匿评状态 1为关闭 0为开启 + course = @homework.course + course.student.each do |st| + @homework.course_messages << CourseMessage.new(:user_id => st.student_id, :course_id => course.id, :viewed => false, :status => m_status) + end + end #提示 def alert_anonymous_comment @cur_size = 0 @@ -369,6 +189,27 @@ class HomeworkCommonController < ApplicationController end end + #启动匿评参数设置 + def start_evaluation_set + + end + + #设置匿评参数 + def set_evaluation_attr + if @homework_detail_manual + unless params[:evaluation_start].to_s == @homework_detail_manual.evaluation_start.to_s + @homework_detail_manual.evaluation_start = params[:evaluation_start] + end + + unless @homework_detail_manual.evaluation_end.to_s == params[:evaluation_end].to_s + @homework_detail_manual.evaluation_end = params[:evaluation_end] + end + + @homework_detail_manual.evaluation_num = params[:evaluation_num] + @homework_detail_manual.save + end + end + private #获取课程 def find_course diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 6a0b351ba..2232602aa 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -114,8 +114,10 @@ class IssuesController < ApplicationController def show # 当前用户查看指派给他的缺陷消息,则设置消息为已读 query = @issue.forge_messages - if User.current.id == @issue.assigned_to_id - query.update_all(:viewed => true) + query.each do |m| + if m.user_id == User.current.id + m.update_attribute(:viewed, true) + end end # 缺陷状态更新 query_journals = @issue.journals @@ -221,7 +223,6 @@ class IssuesController < ApplicationController end if saved - #修改界面增加跟踪者 watcherlist = @issue.watcher_users select_users = [] @@ -251,9 +252,7 @@ class IssuesController < ApplicationController JournalReply.add_reply(@issue.current_journal.id, reply_id, User.current.id) end flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? - respond_to do |format| - format.html { redirect_to issue_url(@issue.id) } format.api { render_api_ok } end @@ -392,6 +391,9 @@ class IssuesController < ApplicationController jour.notes = params[:notes] jour.journalized = @issue jour.save + user_activity = UserActivity.where("act_type='Issue' and act_id =#{@issue.id}").first + user_activity.updated_at = jour.created_on + user_activity.save @user_activity_id = params[:user_activity_id] respond_to do |format| format.js diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index 6cebfef7a..a38bd4096 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -36,8 +36,7 @@ class JournalsController < ApplicationController sort_update(@query.sortable_columns) if @query.valid? - @journals = @query.journals(:order => "#{Journal.table_name}.created_on DESC", - :limit => 25) + @journals = @query.journals(:order => "#{Journal.table_name}.created_on DESC", :limit => 25) end @title = (@project ? @project.name : Setting.app_title) + ": " + (@query.new_record? ? l(:label_changes_details) : @query.name) render :layout => false, :content_type => 'application/atom+xml' @@ -72,9 +71,9 @@ class JournalsController < ApplicationController end # Replaces pre blocks with [...] text = text.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]') - @content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> " - @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" - # @content = "
" << @content + @content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n" + @content << text.gsub(/(\r?\n|\r\n?)/, "\n ") + "\n" + @content = "
" << @content << "
\n\n
" @id = user.id rescue ActiveRecord::RecordNotFound render_404 diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index 27e0d472f..4181090a5 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -11,7 +11,7 @@ class MemosController < ApplicationController include AttachmentsHelper include ApplicationHelper - layout 'base_memos' + # layout 'base_memos' def quote @subject = @memo.subject @@ -73,41 +73,14 @@ class MemosController < ApplicationController end end #end - format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" } - format.json { render json: @memo, status: :created, location: @memo } + format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" } + format.json { render json: @memo, status: :created, location: @memo } else flash.now[:error] = "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" - # back_error_page = @memo.parent_id.nil? ? forum_path(@forum) : forum_memo_path(@forum, @memo.parent_id) - pre_count = REPLIES_PER_PAGE - - @memo_new = @memo.dup - @memo = @memo.root # 取出楼主,防止输入帖子id让回复作为主贴显示 - unless @memo.new_record? - @memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1)) - end - - - page = params[:page] - if params[:r] && page.nil? - offset = @memo.children.where("#{Memo.table_name}.id < ?", params[:r].to_i).count - page = 1 + offset / pre_count - else - - end - @reply_count = @memo.children.count - @reply_pages = Paginator.new @reply_count, pre_count, page - @replies = @memo.children. - includes(:author, :attachments). - reorder("#{Memo.table_name}.created_at DESC"). - limit(@reply_pages.per_page). - offset(@reply_pages.offset). - all - if @memo.new_record? - format.html { render :new,:layout=>'base'} - else - format.html { render action: :show } + format.js + format.html { redirect_to( forum_path(Forum.find(params[:forum_id]),:errors=>@memo.errors.full_messages[0])) } format.json { render json: @memo.errors, status: :unprocessable_entity } - end + #end end end @@ -115,6 +88,7 @@ class MemosController < ApplicationController REPLIES_PER_PAGE = 20 unless const_defined?(:REPLIES_PER_PAGE) def show + # 更新贴吧帖子留言对应的memo_messages的viewed字段 unless @memo.children.blank? @memo.children.each do |child| @@ -154,21 +128,27 @@ class MemosController < ApplicationController @memo_new = Memo.new - + @my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is null").count + @my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is not null").count # @memo = Memo.find_by_id(params[:id]) # @forum = Forum.find(params[:forum_id]) # @replies = @memo.replies # @mome_new = Memo.new respond_to do |format| - format.html # show.html.erb + format.html {render :layout=> 'base_forums'}#:layout=> 'base_forums', format.json { render json: @memo } format.xml { render xml: @memo } end end def edit + @my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is null").count + @my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is not null").count @replying = false + respond_to do |format| + format.html {render :layout=>'base_forums'} + end end def update @@ -176,7 +156,8 @@ class MemosController < ApplicationController if( #@memo.update_column(:subject, params[:memo][:subject]) && @memo.update_column(:content, params[:memo][:content]) && @memo.update_column(:sticky, params[:memo][:sticky]) && - @memo.update_column(:lock, params[:memo][:lock])) + @memo.update_column(:lock, params[:memo][:lock]) && + @memo.update_column(:subject,params[:memo][:subject])) @memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads])) @memo.save # @memo.root.update_attribute(:updated_at, @memo.updated_at) @@ -227,7 +208,7 @@ class MemosController < ApplicationController end def back_memo_url - forum_memo_path(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id)) + forum_memo_path(@forum, (@memo.root.nil? ? @memo : @memo.root)) end def back_memo_or_forum_url diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 9b0fd56a0..2c7df84cf 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -160,7 +160,11 @@ class MessagesController < ApplicationController @reply.safe_attributes = params[:reply] @reply.content = @quote + @reply.content @reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject] + # @reply.reply_id = params[:id] @topic.children << @reply + user_activity = UserActivity.where("act_type='Message' and act_id =#{@topic.id}").first + user_activity.updated_at = Time.now + user_activity.save #@topic.update_attribute(:updated_on, Time.now) if !@reply.new_record? if params[:asset_id] diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 77933666f..251c47d4c 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -33,7 +33,7 @@ class ProjectsController < ApplicationController before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] before_filter :file, :statistics #:watcherlist # 除非项目内人员,不可查看成员, TODO: 完了写报表里去 - before_filter :memberAccess, only: :member + # before_filter :memberAccess, only: :member # accept_rss_auth :index accept_api_auth :index, :show, :create, :update, :destroy @@ -162,7 +162,7 @@ class ProjectsController < ApplicationController @trackers = Tracker.sorted.all @project = Project.new @project.safe_attributes = params[:project] - render :layout => 'base' + render :layout => 'new_base' else redirect_to signin_url end @@ -188,7 +188,8 @@ class ProjectsController < ApplicationController @project.safe_attributes = params[:project] @project.organization_id = params[:organization_id] @project.user_id = User.current.id - @project.project_new_type = 1 + @project.project_new_type = params[:project_new_type] + params[:project][:is_public] ? @project.is_public = 1 : @project.is_public = 0 if validate_parent_id && @project.save @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') # Add current user as a project member if he is not admin @@ -216,10 +217,11 @@ class ProjectsController < ApplicationController end } format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) } + format.js end else respond_to do |format| - format.html { render :action => 'new', :layout => 'base'}#Added by young + format.html { render :action => 'new', :layout => 'new_base'}#Added by young format.api { render_validation_errors(@project) } end end @@ -258,7 +260,8 @@ class ProjectsController < ApplicationController # Author lizanle # Description 项目动态展示方法,删除了不必要的代码 def show - + # 更新消息为已读 + update_message_status(User.current, @project) if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) return end @@ -322,6 +325,12 @@ class ProjectsController < ApplicationController end def settings + # 修改查看消息状态 + applied_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type =? and viewed =?", User.current.id, @project, "AppliedProject", 0) + applied_messages.each do |applied_message| + applied_message.update_attributes(:viewed => true) + end + # end @issue_custom_fields = IssueCustomField.sorted.all @issue_category ||= IssueCategory.new @member ||= @project.members.new @@ -342,7 +351,7 @@ class ProjectsController < ApplicationController if params[:repository] == "pswd_is_null" html << l(:label_password_not_null) end - flash[:error] = html if !html.to_s.blank? + flash.now[:error] = html if !html.to_s.blank? end scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first @repository = Repository.factory(scm) @@ -351,24 +360,57 @@ class ProjectsController < ApplicationController end + # 项目邀请用户加入实现过程 # 两种情况:1、系统外用户;2、系统内用户 (通过邮件判定) def send_mail_to_member + # 该邮箱未注册过 if !params[:mail].blank? && User.find_by_mail(params[:mail].to_s).nil? - email = params[:mail] - Mailer.run.send_invite_in_project(email, @project, User.current) - @is_zhuce = false - flash[:notice] = l(:notice_email_sent, :value => email) + if !User.where("login =?", params[:mail]).first.nil? + # 用户名唯一,用户修改邮箱,未修改用户名,用户名等同邮箱的情况,默认改用户已经注册 + user = User.find_by_login(params[:mail].to_s) + if !user.member_of?(@project) + # 如果已经邀请过该用户,则不重复发送 + if InviteList.where("project_id =? and mail =?", @project.id, params[:mail].to_s).first.nil? + email = params[:mail] + Mailer.request_member_to_project(email, @project, User.current).deliver + flash[:notice] = l(:notice_email_sent, :value => email) + else + flash[:error] = l(:notice_email_invited) + end + else + flash[:error] = l(:label_member_of_project, :value => email) + end + else + email = params[:mail] + Mailer.send_invite_in_project(email, @project, User.current).deliver + @is_zhuce = false + flash[:notice] = l(:notice_email_sent, :value => email) + end + + # 邮箱地址已被注册 elsif !User.find_by_mail(params[:mail].to_s).nil? user = User.find_by_mail(params[:mail].to_s) if !user.member_of?(@project) - email = params[:mail] - Mailer.run.request_member_to_project(email, @project, User.current) - flash[:notice] = l(:notice_email_sent, :value => email) + # 如果已经邀请过该用户,则不重复发送 + invite_list = InviteList.where("project_id =? and mail =?", @project.id, params[:mail].to_s).first + if invite_list.nil? + email = params[:mail] + Mailer.request_member_to_project(email, @project, User.current).deliver + flash[:notice] = l(:notice_email_sent, :value => email) + else + # 已经发送过了,则隔3小时才能再次发送 + if Time.now - invite_list.created_at > 10800 + email = params[:mail] + Mailer.request_member_to_project(email, @project, User.current).deliver + flash[:notice] = l(:notice_email_sent, :value => email) + else + flash[:error] = l(:notice_email_invited) + end + end else flash[:error] = l(:label_member_of_project, :value => email) end else - flash[:error] = l(:notice_registed_error, :value => email) @is_zhuce = true end respond_to do |format| @@ -376,25 +418,26 @@ class ProjectsController < ApplicationController end end - #发送邮件邀请新用户 + # 发送邮件邀请新用户页面对应方法 def invite_members_by_mail if User.current.member_of?(@project) || User.current.admin? - @inviter_lists = InviteList.where(project_id:@project.id).all - @inviters = [] - @waiters = [] - unless @inviter_lists.blank? - @inviter_lists.each do|inviter_list| - unless inviter_list.user.nil? - if inviter_list.user.member_of?(@project) - @inviters << inviter_list.user - @inviters_count = @inviters.size - else - @waiters << inviter_list.user - @waiters_count = @waiters.size - end - end - end - end + @inviter_lists = InviteList.where(project_id:@project.id).order("created_at desc") + + # @inviters = [] + # @waiters = [] + # unless @inviter_lists.blank? + # @inviter_lists.each do|inviter_list| + # unless inviter_list.user.nil? + # if inviter_list.user.member_of?(@project) + # @inviters << inviter_list.user + # @inviters_count = @inviters.size + # else + # @waiters << inviter_list.user + # @waiters_count = @waiters.size + # end + # end + # end + # end @is_zhuce = false respond_to do |format| format.html @@ -406,16 +449,16 @@ class ProjectsController < ApplicationController end # 邀请Trustie注册用户 - def invite_members - if User.current.member_of?(@project) || User.current.admin? - @member ||= @project.members.new - respond_to do |format| - format.html - end - else - render_403 - end - end + # def invite_members + # if User.current.member_of?(@project) || User.current.admin? + # @member ||= @project.members.new + # respond_to do |format| + # format.html + # end + # else + # render_403 + # end + # end def edit end @@ -423,6 +466,11 @@ class ProjectsController < ApplicationController # by young # include CoursesHelper def member + # 消息"同意加入项目" + if params[:message_id] + message_invite(params[:message_id], params[:key]) + end + update_message_status(User.current, @project) # params[:login]为邮箱邀请用户加入,主要功能: # 1、自动注册 # 2、加入项目、创建角色 @@ -444,6 +492,10 @@ class ProjectsController < ApplicationController flash[:notice] = l(:label_mail_invite_success) end end + # 私有项目非项目成员无法访问成员列表 + unless @project.is_public? + return render_403 unless User.current.member_of?(@project) + end ## 有角色参数的才是课程,没有的就是项目 @render_file = 'project_member_list' # 判断是否课程 @@ -474,6 +526,24 @@ class ProjectsController < ApplicationController @members = paginateHelper @members end + def update_message_status(user, project) + project_invite_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type =?", user, project, "ProjectInvite") + project_invite_messages.each do |project_invite_message| + project_invite_message.update_attribute(:viewed, true) + end + end + + def message_invite(message_id, key) + forge_message = ForgeMessage.find(message_id) + if key == forge_message.secret_key + # 情况:用户收到邀请邮件还没看,但是管理员已经把该用户添加进项目 + if Member.where("user_id =? and project_id =?",forge_message.user_id, forge_message.project_id).first.nil? + Member.create(:role_ids => [4], :user_id => forge_message.user_id, :project_id => forge_message.project_id) + UserGrade.create(:user_id => forge_message.user_id, :project_id => forge_message.project_id) + end + end + end + #判断指定用户是否为课程教师 def isCourseTeacher(id) result = false diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 018a293e3..2d7bf02b1 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -3,12 +3,11 @@ class StudentWorkController < ApplicationController include StudentWorkHelper require 'bigdecimal' require "base64" - before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test] + before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule] before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work] before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work] before_filter :author_of_work, :only => [:edit, :update, :destroy] - before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list] - protect_from_forgery :except => :set_program_score + before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule] ### def program_test @@ -47,13 +46,23 @@ class StudentWorkController < ApplicationController end def index - # 消息状态更新 + # 作业消息状态更新 @homework.course_messages.each do |homework_message| - if User.current.id == homework_message.user_id - homework_message.update_attributes(:viewed => true) + if User.current.id == homework_message.user_id && homework_message.viewed == 0 + homework_message.update_attributes(:viewed => true) if homework_message.viewed == 0 end end - + # 作品打分消息状态更新 + studentworks_scores = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, "StudentWorksScore", 0) + studentworks_scores.each do |studentworks_score| + studentworks_score.update_attributes(:viewed => true) if studentworks_score.viewed == 0 + end + # 作品评论消息状态更新 + journals_for_teacher = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, "JournalsForMessage", 0) + journals_for_teacher.each do |journal_for_teacher| + journal_for_teacher.update_attributes(:viewed => true) + end + # 作品留言 # 消息end #设置作业对应的forge_messages表的viewed字段 query_student_work = @homework.course_messages @@ -62,8 +71,13 @@ class StudentWorkController < ApplicationController query.update_attributes(:viewed => true) end end + ################################################################################################################## @order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group] - @is_teacher = User.current.allowed_to?(:as_teacher,@course) + @homework_commons = @course.homework_commons.order("created_at desc") + @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? + @is_evaluation = @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评 + @show_all = false + course_group = CourseGroup.find_by_id(@group) if @group if course_group group_students = course_group.users @@ -72,71 +86,51 @@ class StudentWorkController < ApplicationController else student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')' end - #老师 || 非匿评作业 || 匿评结束 显示所有的作品 - @show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3 || User.current.admin? - if @show_all - if @homework.homework_type == 1 || @is_teacher || User.current.admin? #超级管理员 || 老师 || 匿评结束 显示所有的作品 - if @order == "name" - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name - else - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name - end - else #剩余情况: 学生 && 非匿评作业 如果未提交作品,只能看到自己的,提交了作品,能看到所有作品 - my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) - if my_work.empty? - @stundet_works = [] - else - if @order == "name" - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name - else - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name - end - end - end - else #学生 - if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品 - @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) - elsif @homework.homework_detail_manual.comment_status == 2 #匿评列表,显示匿评作品和我的作品 - @is_evaluation = true - my_work = @homework.student_works.where(:user_id => User.current.id) - @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} + if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表 + @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name + @show_all = true + elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 + @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表 + my_work = @homework.student_works.where(:user_id => User.current.id) + @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} + elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 + my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + if my_work.empty? + @stundet_works = [] + else + @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name + @show_all = true end + else + @stundet_works = [] end else - #老师 || 非匿评作业 || 匿评结束 显示所有的作品 - @show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3 || User.current.admin? - if @show_all - if @homework.homework_type == 1 || @is_teacher || User.current.admin? #超级管理员 || 老师 || 匿评结束 显示所有的作品 - if @order == "name" - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name - else - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name - end - else #剩余情况: 学生 && 非匿评作业 如果未提交作品,只能看到自己的,提交了作品,能看到所有作品 - my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) - if my_work.empty? - @stundet_works = [] - else - if @order == "name" - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name - else - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name - end - end - end - else #学生 - if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品 - @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) - elsif @homework.homework_detail_manual.comment_status == 2 #匿评列表,显示匿评作品和我的作品 - @is_evaluation = true - my_work = @homework.student_works.where(:user_id => User.current.id) - @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} + if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表 + @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name + @show_all = true + elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 + @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表 + my_work = @homework.student_works.where(:user_id => User.current.id) + @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} + elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 + my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + if my_work.empty? + @stundet_works = [] + else + @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name + @show_all = true end + else + @stundet_works = [] end end - @homework_commons = @course.homework_commons.order("created_at desc") + @score = @b_sort == "desc" ? "asc" : "desc" + respond_to do |format| + format.js format.html format.xls { send_data(homework_to_xls(@stundet_works), :type => "text/excel;charset=utf-8; header=present", @@ -170,15 +164,15 @@ class StudentWorkController < ApplicationController student_work.homework_common_id = @homework.id student_work.user_id = User.current.id student_work.save_attachments(params[:attachments]) + render_attachment_warning_if_needed(student_work) + #提交作品时,计算是否迟交 if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") student_work.late_penalty = @homework.late_penalty - else + else student_work.late_penalty = 0 end - render_attachment_warning_if_needed(student_work) if student_work.save - respond_to do |format| format.html { flash[:notice] = l(:notice_successful_create) @@ -231,16 +225,15 @@ class StudentWorkController < ApplicationController def show @score = student_work_score @work,User.current - @is_teacher = User.current.allowed_to?(:as_teacher,@course) + @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? + @student_work_scores = @work.student_works_scores.order("updated_at desc") respond_to do |format| format.js end end def destroy - if @homework.homework_type == 2 #编程作业,作品提交后不可以删除 - render_403 - elsif @work.destroy + if @work.destroy respond_to do |format| format.html { redirect_to student_work_index_url(:homework => @homework.id) @@ -251,10 +244,11 @@ class StudentWorkController < ApplicationController #添加评分,已评分则为修改评分 def add_score + @is_last = params[:is_last] == "true" render_403 and return if User.current == @work.user #不可以匿评自己的作品 - @is_teacher = User.current.allowed_to?(:as_teacher,@course) + @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? #老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分 - render_403 and return unless @is_teacher || (@homework.homework_type == 1 && @homework.homework_detail_manual.comment_status == 2) + render_403 and return unless @is_teacher || @homework.homework_detail_manual.comment_status == 2 @score = student_work_score @work,User.current if @score @score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" @@ -288,35 +282,11 @@ class StudentWorkController < ApplicationController case @score.reviewer_role when 1 #教师评分:最后一个教师评分为最终评分 @work.teacher_score = @score.score - @work.final_score = @score.score when 2 #教辅评分 教辅评分显示平均分 @work.teaching_asistant_score = @work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f - if @work.teacher_score.nil? - if @work.student_score.nil? - @work.final_score = @work.teaching_asistant_score - else - ta_proportion = @homework.homework_detail_manual.ta_proportion if @homework.homework_detail_manual - ta_proportion = @homework.homework_detail_programing.ta_proportion if @homework.homework_detail_programing - final_ta_score = BigDecimal.new("#{@work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}") - final_s_score = BigDecimal.new("#{@work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}")) - final_score = final_ta_score + final_s_score - @work.final_score = format("%.2f",final_score.to_f) - end - end when 3 #学生评分 学生评分显示平均分 @work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f - if @work.teacher_score.nil? - if @work.teaching_asistant_score.nil? - @work.final_score = @work.student_score - else - final_ta_score = BigDecimal.new("#{@work.teaching_asistant_score}") * BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}") - final_s_score = BigDecimal.new("#{@work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}")) - final_score = final_ta_score + final_s_score - @work.final_score = format("%.2f",final_score.to_f) - end - end end - if @work.save respond_to do |format| format.js @@ -328,6 +298,7 @@ class StudentWorkController < ApplicationController #添加评分的回复 def add_score_reply @score = StudentWorksScore.find params[:score_id] + @is_last = params[:is_last] == "true" @jour = @score.journals_for_messages.new(:user_id => User.current.id,:notes =>params[:message], :reply_id => 0) if @jour.save @status = 1 @@ -420,44 +391,53 @@ class StudentWorkController < ApplicationController end end - #设置编程作业得分 - def set_program_score - stundet_work = StudentWork.find_by_id params[:student_work_id] - @course = stundet_work.homework_common.course - student_score_count = 0 - if stundet_work && params[:results] && params[:results].class.to_s == "Array" - homework_common = stundet_work.homework_common - params[:results].each do |result| - homework_tests = homework_common.homework_tests.where("input = '#{result[:input]}' AND output = '#{result[:output]}'") - homework_tests.each do |homework_test| - student_work_test = StudentWorkTest.new - student_work_test.student_work = stundet_work - student_work_test.homework_test = homework_test - student_work_test.result = result[:status] - if student_work_test.result == 0 - student_score_count += 1 - end - student_work_test.error_msg = params[:compile_error_msg] - student_work_test.save! + #设置评分规则 + def set_score_rule + homework_detail_manual = @homework.homework_detail_manual + homework_detail_programing = @homework.homework_detail_programing + + unless @homework.late_penalty.to_s == params[:late_penalty].to_s + @homework.late_penalty = params[:late_penalty] + @homework.student_works.where("created_at > '#{@homework.end_time} 23:59:59'").each do |student_work| + student_work.late_penalty = @homework.late_penalty + student_work.save + end + + @homework.save + end + + unless homework_detail_manual.absence_penalty.to_s == params[:absence_penalty].to_s + homework_detail_manual.absence_penalty = params[:absence_penalty] + if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值 + work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")" + @homework.student_works.each do |student_work| + absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count + student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0 + student_work.save end end - unless homework_common.homework_tests.empty? - stundet_work.student_score = student_score_count * 100.0 / homework_common.homework_tests.count - if stundet_work.teacher_score.nil? - if stundet_work.teaching_asistant_score.nil? - stundet_work.final_score = stundet_work.student_score - else - final_ta_score = BigDecimal.new("#{stundet_work.teaching_asistant_score}") * BigDecimal.new("#{homework_common.homework_detail_programing.ta_proportion}") - final_s_score = BigDecimal.new("#{stundet_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{homework_common.homework_detail_programing.ta_proportion}")) - final_score = final_ta_score + final_s_score - stundet_work.final_score = format("%.1f",final_score.to_f) - end - end + homework_detail_manual.save if homework_detail_manual + end - stundet_work.save! + teacher_priority = params[:teacher_priority] ? 1 : 0 + if homework_detail_manual.ta_proportion.to_s != params[:ta_proportion].to_s || @homework.teacher_priority.to_s != teacher_priority.to_s || (homework_detail_programing && homework_detail_programing.ta_proportion.to_s != params[:sy_proportion].to_s) + homework_detail_manual.ta_proportion = params[:ta_proportion] + homework_detail_programing.ta_proportion = params[:sy_proportion] if homework_detail_programing + @homework.teacher_priority = teacher_priority + + @homework.save + homework_detail_manual.save if homework_detail_manual + homework_detail_programing.save if homework_detail_programing + + @homework.student_works.each do |student_work| + set_final_score @homework,student_work + student_work.save end end + respond_to do |format| + format.html{redirect_to student_work_index_url(:homework => @homework.id)} + end end private @@ -490,15 +470,19 @@ class StudentWorkController < ApplicationController end def teacher_of_course - render_403 unless User.current.allowed_to?(:as_teacher,@course) + render_403 unless User.current.allowed_to?(:as_teacher,@course) || User.current.admin? end #根据条件过滤作业结果 def search_homework_member homeworks,name - name = name.downcase - select_homework = homeworks.select{ |homework| - homework.user[:login].to_s.downcase.include?(name) || homework.user.user_extensions[:student_id].to_s.downcase.include?(name) || (homework.user[:lastname].to_s.downcase + homework.user[:firstname].to_s.downcase).include?(name) - } + if name == "" + select_homework = homeworks + else + name = name.downcase + select_homework = homeworks.select{ |homework| + homework.user[:login].to_s.downcase.include?(name) || homework.user.user_extensions[:student_id].to_s.downcase.include?(name) || (homework.user[:lastname].to_s.downcase + homework.user[:firstname].to_s.downcase).include?(name) + } + end select_homework end @@ -509,25 +493,7 @@ 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 - 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 #匿评作业 + if @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 @@ -547,7 +513,7 @@ class StudentWorkController < ApplicationController 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)]) + l(:excel_t_score),l(:excel_ta_score), l(:excel_s_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 @@ -558,9 +524,10 @@ class StudentWorkController < ApplicationController 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) + sheet1[count_row,8] = homework.system_score.nil? ? l(:label_without_score) : format("%.2f",homework.system_score) + sheet1[count_row,9] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) + sheet1[count_row,10] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) + sheet1[count_row,11] = format_time(homework.created_at) count_row += 1 end end @@ -660,4 +627,103 @@ class StudentWorkController < ApplicationController end JSON.parse(res.body) end + + #成绩计算 + def set_final_score homework,student_work + if homework && homework.homework_detail_manual + if homework.homework_type == 1 #匿评作业 + if homework.teacher_priority == 1 #教师优先 + if student_work.teacher_score + student_work.final_score = student_work.teacher_score + else + if student_work.teaching_asistant_score.nil? + student_work.final_score = student_work.student_score + elsif student_work.student_score.nil? + student_work.final_score = student_work.teaching_asistant_score + else + ta_proportion = homework.homework_detail_manual.ta_proportion + final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}") + final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}")) + final_score = final_ta_score + final_s_score + student_work.final_score = format("%.2f",final_score.to_f) + end + end + else #不考虑教师评分 + if student_work.teaching_asistant_score.nil? + student_work.final_score = student_work.student_score + elsif student_work.student_score.nil? + student_work.final_score = student_work.teaching_asistant_score + else + ta_proportion = homework.homework_detail_manual.ta_proportion + final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}") + final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}")) + final_score = final_ta_score + final_s_score + student_work.final_score = format("%.2f",final_score.to_f) + end + end + elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空 + if homework.teacher_priority == 1 #教师优先 + if student_work.teacher_score + student_work.final_score = student_work.teacher_score + else + if student_work.teaching_asistant_score.nil? #教辅未评分 + if student_work.student_score.nil? + student_work.final_score = student_work.system_score + else + ta_proportion = homework.homework_detail_programing.ta_proportion + homework.homework_detail_manual.ta_proportion / 2 + final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}") + final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}")) + final_score = final_sy_score + final_st_score + student_work.final_score = format("%.2f",final_score.to_f) + end + elsif student_work.student_score.nil? #学生未评分 + if student_work.teaching_asistant_score.nil? + student_work.final_score = student_work.system_score + else + ta_proportion = homework.homework_detail_programing.ta_proportion + (1.0 - homework.homework_detail_manual.ta_proportion - homework.homework_detail_programing.ta_proportion) / 2 + final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}") + final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}")) + final_score = final_sy_score + final_ts_score + student_work.final_score = format("%.2f",final_score.to_f) + end + else + final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") + final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}") + final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") - BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}")) + final_score = final_sy_score + final_ts_score + final_st_score + student_work.final_score = format("%.2f",final_score.to_f) + end + end + else #不考虑教师评分 + if student_work.teaching_asistant_score.nil? #教辅未评分 + if student_work.student_score.nil? + student_work.final_score = student_work.system_score + else + ta_proportion = homework.homework_detail_programing.ta_proportion + homework.homework_detail_manual.ta_proportion / 2 + final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}") + final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}")) + final_score = final_sy_score + final_st_score + student_work.final_score = format("%.2f",final_score.to_f) + end + elsif student_work.student_score.nil? #学生未评分 + if student_work.teaching_asistant_score.nil? + student_work.final_score = student_work.system_score + else + ta_proportion = homework.homework_detail_programing.ta_proportion + (1.0 - homework.homework_detail_manual.ta_proportion - homework.homework_detail_programing.ta_proportion) / 2 + final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}") + final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}")) + final_score = final_sy_score + final_ts_score + student_work.final_score = format("%.2f",final_score.to_f) + end + else + final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") + final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}") + final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") - BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}")) + final_score = final_sy_score + final_ts_score + final_st_score + student_work.final_score = format("%.2f",final_score.to_f) + end + end + end + end + end end \ No newline at end of file diff --git a/app/controllers/system_messages_controller.rb b/app/controllers/system_messages_controller.rb new file mode 100644 index 000000000..684378e8a --- /dev/null +++ b/app/controllers/system_messages_controller.rb @@ -0,0 +1,95 @@ +class SystemMessagesController < ApplicationController + # before_filter :message_author, :only => [:show] + # + # def message_author + # if(!User.current.logged? && !token.nil?) + # + # User.current =try_to_autologin1 + # end + # if @system_messages + # render_403 :message => :notice_not_authorized_message + # else + # deny_access + # end + # end + + def index + @system_messages = SystemMessage.all + end + + # def show + # @system_messages = SystemMessage.find(params[:id]) + # end + + # GET /products/new + # def new + # @product = Product.new + # end + + # GET /products/1/edit + # def edit + # end + + # POST /products + # POST /products.json + def create + unless User.current.admin? + render_403 + return + end + @system_messages = SystemMessage.new + @system_messages.description = params[:system_message][:description] + @system_messages.subject = params[:system_message][:subject] + @system_messages.user_id = User.current.id + respond_to do |format| + if @system_messages.save + format.html {redirect_to user_system_messages_path(User.current)} + flash[:notice] = l(:notice_successful_message) + else + if params[:system_messages][:description].empty? + flash[:error] = l(:label_content_blank_fail) + else + flash[:error] = l(:label_admin_message_fail) + end + format.html {redirect_to admin_messages_path} + end + end + end + + # PATCH/PUT /products/1 + # PATCH/PUT /products/1.json + # def update + # respond_to do |format| + # if @product.update(product_params) + # format.html { redirect_to @product, notice: 'Product was successfully updated.' } + # format.json { render :show, status: :ok, location: @product } + # else + # format.html { render :edit } + # format.json { render json: @product.errors, status: :unprocessable_entity } + # end + # end + # end + + # DELETE /products/1 + # DELETE /products/1.json + # def destroy + # @system_messages.destroy + # respond_to do |format| + # format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' } + # format.json { head :no_content } + # end + # end + + # private + # # Use callbacks to share common setup or constraints between actions. + # def set_product + # @product = Product.find(params[:id]) + # end + # + # # Never trust parameters from the scary internet, only allow the white list through. + # def message_params + # params.require(:admin_system_messages).permit(:content) + # end + + +end diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 253faa2b1..0ffa334c2 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -15,6 +15,7 @@ class TagsController < ApplicationController include ContestsHelper include ActsAsTaggableOn::TagsHelper include TagsHelper + include FilesHelper helper :projects helper :courses helper :tags @@ -230,6 +231,97 @@ class TagsController < ApplicationController end end + #更新某个tag名称 + def update_tag_name + @tag_name = params[:tagName] + @rename_tag_name = params[:renameName] + @taggable_id = params[:taggableId] + @taggable_type = numbers_to_object_type(params[:taggableType]) + @course_id = params[:courseId] + + @rename_tag = (ActsAsTaggableOn::Tag.find_by_name(@rename_tag_name)) #查找重命名后的tag + @tag_id = (ActsAsTaggableOn::Tag.find_by_name(@tag_name)).id #重命名前的tag_id + @taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type) unless @taggable_id.blank? + @obj = get_object(@taggable_id,params[:taggableType]) unless @taggable_id.blank? + if @taggable_id.blank? #如果没有传tag_id,那么直接更新tag_name就好了。但是要防止 重命名后的tag存在。 + #看重命名后的tag是否存在。如果存在的话,只需要更改taggings里边的id即可 + if @rename_tag + @taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type) + @taggings.update_attributes({:tag_id=>@rename_tag.id}) + else #如果不存在,那么就直接更新该tag名称为新的名称 + (ActsAsTaggableOn::Tag.find_by_name(@tag_name)).update_attributes(:name=>@rename_tag_name) + end + else + if(@rename_tag.nil?) #这次命名的是新的tag + + # 是否还有其他记录 引用了 tag_id + @tagging = ActsAsTaggableOn::Tagging.where("tag_id = #{@tag_id}") + # 如果taggings表中记录为 1 ,那么改变@tag_id对应的tag的名字 + if @tagging.count == 1 + @tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id) + @tag.update_attributes({:name=>@rename_tag_name}) + else #如果tagging表中的记录大于1,那么就要新增tag记录 + + unless @obj.nil? + @obj.tag_list.add(@rename_tag_name.split(",")) + @obj.save + end + #删除原来的对应的taggings的记录 + unless @taggings.nil? + @taggings.delete + end + end + else #这是已有的tag + # 更改taggings记录里的tag_id + unless @taggings.nil? + @taggings.update_attributes({:tag_id=>@rename_tag.id}) + end + end + end + + @obj_flag = params[:taggableType] + if @obj && @obj_flag == '6' && @obj.container.kind_of?(Course) + @course = @obj.container + @tag_list = @tag_list = get_course_tag_list @course + elsif @course_id + @course = Course.find(@course_id) + @tag_list = get_course_tag_list @course + + #这里要引用FilesController里的逻辑了。将资源库当前的文件列表刷新一遍。 + @flag = params[:flag] || false + sort = "" + @sort = "" + @order = "" + @is_remote = false + @isproject = false + + sort = "#{Attachment.table_name}.created_on desc" + + @containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)] + + show_attachments @containers + elsif @obj && @obj_flag == '5' + @forum = @obj + end + respond_to do |format| + format.js + end + end + + def show_attachments obj + @attachments = [] + obj.each do |container| + @attachments += container.attachments + end + @all_attachments = User.current.admin? ? @attachments : visable_attachemnts(@attachments) + @limit = 10 + @feedback_count = @all_attachments.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + #@curse_attachments_all = @all_attachments[@offset, @limit] + @obj_attachments = paginateHelper @all_attachments,10 + end + def tag_save @select_tag_name = params[:tag_for_save][:tag_name] @tags = params[:tag_for_save][:name] diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 01e08c3dd..9a6f72e2e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -40,7 +40,7 @@ class UsersController < ApplicationController :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource, :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction, - :user_import_homeworks,:user_search_homeworks,:user_import_resource] + :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages] before_filter :auth_user_extension, only: :show #before_filter :rest_user_score, only: :show #before_filter :select_entry, only: :user_projects @@ -95,33 +95,42 @@ class UsersController < ApplicationController # 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅;works_reply:作品回复 # issue:问题;journal:缺陷状态更新; forum:公共贴吧: user_feedback: 用户留言; new_reply:新闻回复(comment) def user_messages - unless User.current.logged? + if !User.current.logged? redirect_to signin_url return + elsif @user != User.current && !User.current.admin? + return render_403 end - # 当前用户查看消息,则设置消息为已读 + # 初始化/更新 点击按钮时间 + # 24小时内显示系统消息 + update_onclick_time + # 全部设为已读 if params[:viewed] == "all" - course_querys = @user.course_messages - forge_querys = @user.forge_messages - user_querys = @user.user_feedback_messages - forum_querys = @user.memo_messages - if User.current.id == @user.id - course_querys.update_all(:viewed => true) - forge_querys.update_all(:viewed => true) - user_querys.update_all(:viewed => true) - forum_querys.update_all(:viewed => true) - end + update_message_viewed(@user) end # @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count case params[:type] when nil @message_alls = [] - messages = MessageAll.where("user_id =?",@user).order("created_at desc") + messages = MessageAll.where("user_id =?" ,@user).order("created_at desc") messages.each do |message_all| @message_alls << message_all.message end + when 'unviewed' + @message_alls = [] + messages = MessageAll.where("user_id =?", @user).order("created_at desc") + messages.each do |message_all| + # 在点击或者刷新消息列表后未读的消息存放在数组 + if message_all.message.viewed == 0 + @message_alls << message_all.message + end + end + # when 'system_messages' + # @message_alls = SystemMessage.order("created_at desc").all + when 'apply' + @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?" , "AppliedProject", @user).order("created_at desc") when 'homework' - @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc") + @message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage') and user_id =?", @user).order("created_at desc") when 'course_message' @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc") # when 'forge_message' @@ -167,6 +176,48 @@ class UsersController < ApplicationController end end + # 初始化/更新 点击按钮时间 + def update_onclick_time + # 记录当前点击按钮的时间 + # 考虑到用户未退出刷新消息页面 + message_time = OnclickTime.where("user_id =?", User.current).first + if message_time.nil? + message_new_time = OnclickTime.new + message_new_time.user_id = User.current.id + message_new_time.onclick_time = Time.now + message_new_time.save + else + # 24小时内显示 + contrast_time = Time.now - 86400 + message_time.update_attributes(:onclick_time => Time.now) + end + # 24小时内显示系统消息 + @user_system_messages = SystemMessage.where("created_at >?", contrast_time).order("created_at desc") + end + + # 消息设置为已读 + def update_message_viewed(user) + course_querys = CourseMessage.where("user_id =? and viewed =?", user, 0) + forge_querys = ForgeMessage.where("user_id =? and viewed =?", user, 0) + user_querys = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0) + forum_querys = MemoMessage.where("user_id =? and viewed =?", user, 0) + if User.current.id == @user.id + course_querys.update_all(:viewed => true) + forge_querys.update_all(:viewed => true) + user_querys.update_all(:viewed => true) + forum_querys.update_all(:viewed => true) + end + end + + # 系统消息 + def user_system_messages + @sytem_messages = SystemMessage.order("created_at desc").all + @sytem_messages = paginateHelper @sytem_messages, 10 + respond_to do |format| + format.html{render :layout=>'new_base_user'} + end + end + def user_projects_index if User.current.admin? memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}").first @@ -323,11 +374,13 @@ class UsersController < ApplicationController #导入作业,确定按钮 def user_select_homework homework = HomeworkCommon.find_by_id params[:checkMenu] + homework_detail_programing = homework.homework_detail_programing @homework = HomeworkCommon.new if homework @homework.name = homework.name @homework.description = homework.description @homework.end_time = homework.end_time + @homework.homework_type = homework.homework_type @homework.course_id = homework.course_id homework.attachments.each do |attachment| att = attachment.copy @@ -337,6 +390,19 @@ class UsersController < ApplicationController att.save @homework.attachments << att end + + if homework_detail_programing + @homework.homework_detail_programing = HomeworkDetailPrograming.new + @homework_detail_programing = @homework.homework_detail_programing + @homework_detail_programing.ta_proportion = homework_detail_programing.ta_proportion + @homework_detail_programing.language = homework_detail_programing.language + homework.homework_tests.each_with_index do |homework_test| + @homework.homework_tests << HomeworkTest.new( + input: homework_test.input, + output: homework_test.output + ) + end + end end respond_to do |format| format.js @@ -361,10 +427,31 @@ class UsersController < ApplicationController end end + #修改编程作业 + def edit_user_commit_homework + if User.current.logged? + + respond_to do |format| + format.js + format.html {render :layout => 'new_base_user'} + end + else + render_403 + end + end + def user_commit_homework homework = HomeworkCommon.find(params[:homework]) student_work = StudentWork.where(homework_common_id: homework.id, user_id: User.current.id).first if student_work + + #提交作品时,计算是否迟交 + if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") + student_work.late_penalty = 1 + else + student_work.late_penalty = 0 + end + student_work.save flash[:notice] = l(:notice_successful_create) redirect_to student_work_index_url(:homework => params[:homework]) @@ -382,27 +469,28 @@ class UsersController < ApplicationController homework.end_time = params[:homework_common][:end_time] || Time.now homework.publish_time = Time.now homework.homework_type = params[:homework_type].to_i || 1 - homework.late_penalty = 2 + homework.late_penalty = 10 + homework.teacher_priority = 1 homework.user_id = User.current.id homework.course_id = params[:course_id] homework.save_attachments(params[:attachments]) render_attachment_warning_if_needed(homework) - #匿评作业相关属性 - if homework.homework_type == 1 - homework_detail_manual = HomeworkDetailManual.new - homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 - homework_detail_manual.comment_status = 1 - homework_detail_manual.evaluation_start = Time.now - homework_detail_manual.evaluation_end = Time.now - homework_detail_manual.evaluation_num = params[:evaluation_num] || 3 - homework_detail_manual.absence_penalty = 2 - homework.homework_detail_manual = homework_detail_manual - else + homework_detail_manual = HomeworkDetailManual.new + homework_detail_manual.ta_proportion = homework.homework_type == 1 ? 0.6 : 0.3 + homework_detail_manual.comment_status = 1 + homework_detail_manual.evaluation_start = params[:evaluation_start].blank? ? homework.end_time + 7 : params[:evaluation_start] + homework_detail_manual.evaluation_end = params[:evaluation_end].blank? ? homework_detail_manual.evaluation_start + 7 : params[:evaluation_end] + homework_detail_manual.evaluation_num = params[:evaluation_num] || 3 + homework_detail_manual.absence_penalty = 5 + homework.homework_detail_manual = homework_detail_manual + + #编程作业相关属性 + if homework.homework_type == 2 homework_detail_programing = HomeworkDetailPrograming.new homework.homework_detail_programing = homework_detail_programing - homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6 + homework_detail_programing.ta_proportion = 0.5 homework_detail_programing.language = params[:language_type].to_i inputs = params[:program][:input] @@ -559,12 +647,11 @@ class UsersController < ApplicationController redirect_to signin_url return end - # 更新用户留言消息状态 - @user.journals_for_messages.each do |jour_message| - jour_message.user_feedback_messages.each do |userfeedback_message| - if User.current.id == userfeedback_message.user_id - userfeedback_message.update_attributes(:viewed => true) - end + # 自己访问自己的页面才更新消息状态 + if User.current == @user + journals_messages = UserFeedbackMessage.where("user_id =? and journals_for_message_type =? and viewed =?", User.current.id, "JournalsForMessage", 0) + journals_messages.each do |journals_message| + journals_message.update_attributes(:viewed => true) end end # end @@ -791,24 +878,24 @@ class UsersController < ApplicationController if params[:type].present? case params[:type] when "course_homework" - @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'HomeworkCommon'").order('created_at desc').limit(10).offset(@page * 10) + @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'HomeworkCommon'").order('updated_at desc').limit(10).offset(@page * 10) when "course_news" - @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'News'").order('created_at desc').limit(10).offset(@page * 10) + @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'News'").order('updated_at desc').limit(10).offset(@page * 10) when "course_message" - @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10) + @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10) when "course_poll" - @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Poll'").order('created_at desc').limit(10).offset(@page * 10) + @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Poll'").order('updated_at desc').limit(10).offset(@page * 10) when "project_issue" - @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('created_at desc').limit(10).offset(@page * 10) + @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('updated_at desc').limit(10).offset(@page * 10) when "project_message" - @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10) + @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10) when "current_user" - @user_activities = UserActivity.where("user_id = #{User.current.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('created_at desc').limit(10).offset(@page * 10) + @user_activities = UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('updated_at desc').limit(10).offset(@page * 10) else - @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('created_at desc').limit(10).offset(@page * 10) + @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('updated_at desc').limit(10).offset(@page * 10) end else - @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('created_at desc').limit(10).offset(@page * 10) + @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('updated_at desc').limit(10).offset(@page * 10) end # @user_activities = paginateHelper @user_activities,500 @type = params[:type] diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index f74fbb04d..da6d48b8d 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -264,7 +264,7 @@ class WikiController < ApplicationController end @page.destroy respond_to do |format| - format.html { redirect_to project_wiki_index_url(@project) } + format.html {redirect_to edit_project_wiki_page_url @project, @page.title} format.api { render_api_ok } end end diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 53b40942a..1a01ac97b 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -1,4 +1,4 @@ -require 'zip' +require 'zip' class ZipdownController < ApplicationController #查找项目(课程) before_filter :find_project_by_bid_id, :only => [:assort] @@ -7,7 +7,7 @@ class ZipdownController < ApplicationController SAVE_FOLDER = "#{Rails.root}/files" OUTPUT_FOLDER = "#{Rails.root}/files/archiveZip" - #统一下载功能 + #统一下载功能 def download if User.current.logged? begin diff --git a/app/helpers/api_helper.rb b/app/helpers/api_helper.rb index f26f5c19b..f73cc87e6 100644 --- a/app/helpers/api_helper.rb +++ b/app/helpers/api_helper.rb @@ -75,7 +75,7 @@ module ApiHelper # 学生获取课程作业的状态 def get_homework_status homework homework_status = "" - if !homework.nil? + if homework if homework.homework_type == 1 && homework.homework_detail_manual case homework.homework_detail_manual.comment_status when 1 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4c78c03df..41e016562 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2297,25 +2297,19 @@ module ApplicationHelper #获取匿评相关连接代码 def homework_anonymous_comment homework - if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业 - if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") - link = "启动匿评".html_safe - elsif homework.student_works.count >= 2 #作业份数大于2 - case homework.homework_detail_manual.comment_status - when 1 - link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'fr mr10 work_edit' - when 2 - link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'fr mr10 work_edit' - when 3 - link = "匿评结束".html_safe - end - else - link = "启动匿评".html_safe + if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") + link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评" + elsif homework.student_works.count >= 2 && homework.homework_detail_manual#作业份数大于2 + case homework.homework_detail_manual.comment_status + when 1 + link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink' + when 2 + link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink' + when 3 + # link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束" end - elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业作业 - link = "编程作业".html_safe else - link = "启动匿评".html_safe + link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "学生提交作业数大于等于2时才可以启动匿评" end link end @@ -2323,14 +2317,18 @@ module ApplicationHelper def student_new_homework homework work = cur_user_works_for_homework homework if work.nil? - link_to l(:label_commit_homework), new_student_work_path(:homework => homework.id),:class => 'fr mr10 work_edit' + link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'fr mr10 work_edit' else if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前 - "#{l(:label_edit_homework)}".html_safe - elsif homework.homework_type == 2 #编程作业不能修改作品 - "作品已交".html_safe + link_to "作品已交", "javascript:void(0);", :class => 'fr mr10 pr_join_span c_white', :title => "开启匿评后不可修改作品" + elsif homework.homework_type == 2 #编程作业修改作品 + if homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 + link_to "作品已交", "javascript:void(0);", :class => 'fr mr10 pr_join_span c_white', :title => "开启匿评后不可修改作品" + else + link_to "修改作品", new_student_work_path(:homework => homework.id),:class => 'fr mr10 work_edit' + end else - link_to l(:label_edit_homework), edit_student_work_path(work.id),:class => 'fr mr10 work_edit c_blue' + link_to "修改作品", edit_student_work_path(work.id),:class => 'fr mr10 work_edit' end end end @@ -2343,9 +2341,9 @@ module ApplicationHelper homework = default_opt[:homework] work = cur_user_works_for_homework homework if work.nil? && !is_teacher - link_to "提交("+homework.student_works.count.to_s+")", new_student_work_path(:homework => homework.id), :class=> default_opt[:class] + link_to "提交("+homework.student_works.count.to_s+")", new_student_work_path(:homework => homework.id,:host=> Setting.host_course), :class=> default_opt[:class] else - link_to "提交("+homework.student_works.count.to_s+")", student_work_index_path(:homework => homework.id), :class=> default_opt[:class] + link_to "提交("+homework.student_works.count.to_s+")", student_work_index_path(:homework => homework.id,:host=> Setting.host_course), :class=> default_opt[:class] end end @@ -2358,10 +2356,10 @@ module ApplicationHelper if work.nil? link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue' else - if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前 - link_to "作品已交", "", :class => 'c_blue', :title => "开启匿评后不可修改作品" + if homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前 + link_to "作品已交", "javascript:void(0)", :class => 'c_blue', :title => "开启匿评后不可修改作品" elsif homework.homework_type == 2 #编程作业不能修改作品 - link_to "作品已交", student_work_index_path(:homework => homework.id),:class => 'c_blue',:title => "编程作业不可修改作品" + link_to "修改作品", new_student_work_path(:homework => homework.id),:class => 'c_blue' else link_to "修改作品", edit_student_work_path(work.id),:class => 'c_blue' end @@ -2370,7 +2368,7 @@ module ApplicationHelper end def student_anonymous_comment homework - if homework.homework_type == 1 && homework.homework_detail_manual + if homework.homework_detail_manual case homework.homework_detail_manual.comment_status when 1 "未开启匿评".html_safe @@ -2379,10 +2377,6 @@ module ApplicationHelper when 3 "匿评已结束".html_safe end - elsif homework.homework_type == 0 - "未启用匿评".html_safe - elsif homework.homework_type == 2 - " 编程作业  ".html_safe end end diff --git a/app/helpers/homework_common_helper.rb b/app/helpers/homework_common_helper.rb index 43f815250..a03c4ccd7 100644 --- a/app/helpers/homework_common_helper.rb +++ b/app/helpers/homework_common_helper.rb @@ -1,4 +1,5 @@ # encoding: utf-8 +include UsersHelper module HomeworkCommonHelper #迟交扣分下拉框 def late_penalty_option diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 12925b0b1..41f25d1a3 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -18,6 +18,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. include AvatarHelper +include StudentWorkHelper module ProjectsHelper def link_to_version(version, options = {}) return '' unless version && version.is_a?(Version) @@ -75,6 +76,47 @@ module ProjectsHelper return result end + # 项目类型 + def project_type_select + type = [] + option1 = [] + option1 << l(:label_development_team) + option1 << l(:label_development_team) + option2 = [] + option2 << l(:label_research_group) + option2 << l(:label_research_group) + option3 = [] + option3 << l(:label_friend_organization) + option3 << l(:label_friend_organization) + type << option1 + type << option2 + type << option3 + type + end + + # 项目类型描述 + def project_newtype_descrption + case params + when 1 + value = l(:label_type_des_development) + when 2 + value = l(:label_type_des_research) + when 3 + value = l(:label_type_des_friend) + end + end + +# 被邀请成员的状态 + def status_for_ivitied(ivite_list, project) + if ivite_list.user.member_of?(project) + value = "已经加入了项目!" + elsif ivite_list.user.active? + value = "邀请已发送,等待用户加入!" + else + value = "邀请已发送,等待用户激活账号!" + end + end + # Added by young def course_settings_tabs tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'}, diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index bff997ba4..e1cf3464e 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -2,17 +2,16 @@ include UserScoreHelper module StudentWorkHelper + #获取当前用户的项目列表 def user_projects_option - cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" - memberships = User.current.memberships.all(:conditions => cond) - projects = memberships.map(&:project) + projects = User.current.projects.visible not_have_project = [] - not_have_project << Setting.please_chose + not_have_project << "请选择关联项目" not_have_project << 0 type = [] type << not_have_project projects.each do |project| - if project != nil + if project option = [] option << project.name option << project.id @@ -100,4 +99,31 @@ module StudentWorkHelper end result end + + #教辅评分比例下拉框 + def ta_proportion_option + type = [] + i = 0 + while i <= 100 + option = [] + option << i.to_s + "%" + option << i.to_f / 100 + type << option + i += 10 + end + type + end + + def ta_proportion_option_to num + type = [] + i = 0 + while i <= num + option = [] + option << i.to_s + "%" + option << i.to_f / 100 + type << option + i += 10 + end + type + end end \ No newline at end of file diff --git a/app/helpers/system_messages_helper.rb b/app/helpers/system_messages_helper.rb new file mode 100644 index 000000000..fef238676 --- /dev/null +++ b/app/helpers/system_messages_helper.rb @@ -0,0 +1,2 @@ +module SystemMessagesHelper +end diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb index 284ee8c43..2e8b98a2d 100644 --- a/app/helpers/tags_helper.rb +++ b/app/helpers/tags_helper.rb @@ -1,5 +1,6 @@ module TagsHelper include StoresHelper + include CoursesHelper # 通过 id和type获取对象 def get_object(obj_id,obj_type) @obj = nil @@ -62,6 +63,27 @@ module TagsHelper end +#判断课程course中是否包含课件attachment,course中引用了attachment也算作包含 +def course_contains_attachment? course,attachment + course.attachments.each do |att| + if att.id == attachment.id || (!att.copy_from.nil? && !attachment.copy_from.nil? && att.copy_from == attachment.copy_from) || att.copy_from == attachment.id || att.id == attachment.copy_from + return true + end + end + false +end + +#判断用户是否拥有不包含当前资源的课程,需用户在该课程中角色为教师且该课程属于当前学期或下一学期 +def has_course? user,file + result = false + user.courses.each do |course| + if !course_contains_attachment?(course,file) && is_course_teacher(User.current,course) && course_in_current_or_next_term(course) + return true + end + end + result +end + # 判断用户是否是贴吧的管理员 # add by chenmin def is_forum_manager?(user_id,forum_id) diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 269630ec3..f6b083b4d 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -52,6 +52,40 @@ module UsersHelper end end + def title_for_message type + case type + when nil + '消息' + when 'unviewed' + '未读消息' + when 'apply' + '用户申请' + when 'system_messages' + '系统消息' + when 'homework' + '作业消息' + when 'course_message' + '课程讨论' + when 'course_news' + '课程通知' + when 'issue' + '项目任务' + when 'forum' + '贴吧帖子' + when 'user_feedback' + '用户留言' + end + end + + # 统计未读消息数 + def unviewed_message(user) + course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count + forge_count = ForgeMessage.where("user_id =? and viewed =?", user, 0).count + user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0).count + user_memo_count = MemoMessage.where("user_id =? and viewed =?", user, 0).count + messages_count = course_count + forge_count + user_feedback_count + user_memo_count + end + def user_mail_notification_options(user) user.valid_notification_options.collect {|o| [l(o.last), o.first]} end @@ -429,8 +463,8 @@ module UsersHelper def get_issue_des_update(journal) no_html = "message" arr = details_to_strings(journal.details, no_html) - unless journal.notes.empty? - arr << "留言内容:" + journal.notes + unless journal.notes.blank? + arr << journal.notes end str = '' arr.each { |item| str = str+item } @@ -548,7 +582,7 @@ module UsersHelper option << "请选择发布作业的课程" option << -1 type << option - user.courses.select{|c| user.allowed_to?(:as_teacher,c)}.each do |course| + user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").select{|c| user.allowed_to?(:as_teacher,c)}.each do |course| option = [] option << course.name+"("+course.time.to_s+course.term+")" option << course.id diff --git a/app/models/applied_project.rb b/app/models/applied_project.rb index accbc90e2..fb8bf90af 100644 --- a/app/models/applied_project.rb +++ b/app/models/applied_project.rb @@ -1,8 +1,21 @@ class AppliedProject < ActiveRecord::Base attr_accessible :project_id, :user_id - belongs_to :user - belongs_to :project + belongs_to :user + belongs_to :project + has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy + + after_create :send_appliled_message + + def send_appliled_message + # if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? + self.project.members.each do |m| + if m.roles.first.to_s.include?("Manager") + self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.project_id, :viewed => false) + end + end + # end + end #删除用户申请 def self.deleteappiled(userid, projectid) @@ -11,5 +24,4 @@ class AppliedProject < ActiveRecord::Base applied.destroy end end - end diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 47ab30cb1..f7fb9b1aa 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -73,7 +73,7 @@ class Attachment < ActiveRecord::Base cattr_accessor :thumbnails_storage_path @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") - before_save :files_to_final_location,:act_as_course_activity,:act_as_forge_activity + before_save :files_to_final_location,:act_as_course_activity after_create :office_conver, :be_user_score,:act_as_forge_activity after_update :office_conver, :be_user_score after_destroy :delete_from_disk,:down_user_score diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb index 103796a72..4e74142ad 100644 --- a/app/models/course_activity.rb +++ b/app/models/course_activity.rb @@ -14,13 +14,19 @@ class CourseActivity < ActiveRecord::Base if user_activity user_activity.save else - user_activity = UserActivity.new - user_activity.act_id = self.course_act_id - user_activity.act_type = self.course_act_type - user_activity.container_type = "Course" - user_activity.container_id = self.course_id - user_activity.user_id = self.user_id - user_activity.save + if self.course_act_type == 'Message' && !self.course_act.parent_id.nil? + user_activity = UserActivity.where("act_type = 'Message' and act_id = #{self.course_act.parent.id}").first + user_activity.created_at = self.created_at + user_activity.save + else + user_activity = UserActivity.new + user_activity.act_id = self.course_act_id + user_activity.act_type = self.course_act_type + user_activity.container_type = "Course" + user_activity.container_id = self.course_id + user_activity.user_id = self.user_id + user_activity.save + end end end diff --git a/app/models/forge_activity.rb b/app/models/forge_activity.rb index 9bc10bebf..c4f13c6d0 100644 --- a/app/models/forge_activity.rb +++ b/app/models/forge_activity.rb @@ -29,12 +29,19 @@ class ForgeActivity < ActiveRecord::Base if user_activity user_activity.save else - user_activity = UserActivity.new - user_activity.act_id = self.forge_act_id - user_activity.act_type = self.forge_act_type - user_activity.container_type = "Project" - user_activity.container_id = self.project_id - user_activity.save + if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil? + user_activity = UserActivity.where("act_type = 'Message' and act_id = #{self.forge_act.parent.id}").first + user_activity.created_at = self.created_at + user_activity.save + else + user_activity = UserActivity.new + user_activity.act_id = self.forge_act_id + user_activity.act_type = self.forge_act_type + user_activity.container_type = "Project" + user_activity.container_id = self.project_id + user_activity.user_id = self.user_id + user_activity.save + end end end diff --git a/app/models/forge_message.rb b/app/models/forge_message.rb index 0c8b3384f..0dce57598 100644 --- a/app/models/forge_message.rb +++ b/app/models/forge_message.rb @@ -8,7 +8,7 @@ class ForgeMessage < ActiveRecord::Base TYPE_OF_WIKI_ACT = "Wiki" TYPE_OF_NEWS_ACT = "News" - attr_accessible :forge_message_id, :forge_message_type, :project_id, :user_id, :viewed + attr_accessible :forge_message_id, :forge_message_type, :project_id, :user_id, :viewed, :secret_key belongs_to :forge_message ,:polymorphic => true belongs_to :project diff --git a/app/models/forum.rb b/app/models/forum.rb index 530639f81..9fa1b7dfd 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -14,7 +14,7 @@ class Forum < ActiveRecord::Base 'sticky', 'locked' validates_presence_of :name, :creator_id, :description - validates_length_of :name, maximum: 50 + validates_length_of :name, maximum: 160 #validates_length_of :description, maximum: 255 validates :name, :uniqueness => true after_destroy :delete_kindeditor_assets diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 0bff38558..c1e5666ac 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -60,6 +60,6 @@ class HomeworkCommon < ActiveRecord::Base self.homework_type == 2 && self.homework_detail_programing end - delegate :language_name, :to => :homework_detail_programing + delegate :language_name, :language, :to => :homework_detail_programing end diff --git a/app/models/homework_detail_programing.rb b/app/models/homework_detail_programing.rb index e5938d091..0c445d672 100644 --- a/app/models/homework_detail_programing.rb +++ b/app/models/homework_detail_programing.rb @@ -4,6 +4,6 @@ class HomeworkDetailPrograming < ActiveRecord::Base belongs_to :homework_common def language_name - %W(c c++).at(self.language.to_i - 1) + %W(C C++ Python Java).at(self.language.to_i - 1) end end diff --git a/app/models/invite_list.rb b/app/models/invite_list.rb index 4868fc3d7..66efc8609 100644 --- a/app/models/invite_list.rb +++ b/app/models/invite_list.rb @@ -1,5 +1,5 @@ class InviteList < ActiveRecord::Base - attr_accessible :project_id, :user_id + attr_accessible :project_id, :user_id, :mail belongs_to :user belongs_to :project diff --git a/app/models/issue.rb b/app/models/issue.rb index fa8cee988..2a6da44c5 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -147,6 +147,13 @@ class Issue < ActiveRecord::Base unless self.author_id == self.assigned_to_id self.forge_messages << ForgeMessage.new(:user_id => self.assigned_to_id, :project_id => self.project_id, :viewed => false) end + if self.tracker_id == 5 + self.project.members.each do |m| + if m.roles.first.to_s.include?("Manager") && m.user_id != self.author_id && m.user_id != self.assigned_to_id + self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.project_id, :viewed => false) + end + end + end end # 更新缺陷 @@ -1009,7 +1016,7 @@ class Issue < ActiveRecord::Base if leaf.start_date # Only move subtask if it starts at the same date as the parent # or if it starts before the given date - if start_date == leaf.start_date || date > leaf.start_date + if start_date == leaf.start_date || date > leaf.start_date leaf.reschedule_on!(date) end else @@ -1392,6 +1399,7 @@ class Issue < ActiveRecord::Base def attachment_added(obj) if @current_journal && @current_journal.user_id == obj.author_id && JournalDetail.find_all_by_value(obj.filename).count == 0 @current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => obj.id, :value => obj.filename) + end end @@ -1400,6 +1408,9 @@ class Issue < ActiveRecord::Base if @current_journal && !obj.new_record? @current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => obj.id, :old_value => obj.filename) @current_journal.save + user_activity = UserActivity.where("act_type='Issue' and act_id =#{@current_journal.journalized_id}").first + user_activity.updated_at = Time.now + user_activity.save end end @@ -1506,6 +1517,9 @@ class Issue < ActiveRecord::Base } end @current_journal.save + user_activity = UserActivity.where("act_type='Issue' and act_id =#{@current_journal.journalized_id}").first + user_activity.updated_at = Time.now + user_activity.save # reset current journal init_journal @current_journal.user, @current_journal.notes end diff --git a/app/models/journal.rb b/app/models/journal.rb index 0d86d12ff..9ffc5d405 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -171,11 +171,16 @@ class Journal < ActiveRecord::Base # 缺陷状态更改,消息提醒 def act_as_forge_message + receivers = [] + # 直接回复 if self.user_id != self.issue.author_id - self.forge_messages << ForgeMessage.new(:user_id => self.issue.author_id, :project_id => self.issue.project_id, :viewed => false) + receivers << self.issue.author_id end if self.user_id != self.issue.assigned_to_id && self.issue.assigned_to_id != self.issue.author_id # 指派人不是自己的话,则给指派人发送 - self.forge_messages << ForgeMessage.new(:user_id => self.issue.assigned_to_id, :project_id => self.issue.project_id, :viewed => false) + receivers << self.issue.assigned_to_id + end + receivers.each do |r| + self.forge_messages << ForgeMessage.new(:user_id => r, :project_id => self.issue.project_id, :viewed => false) end end diff --git a/app/models/journal_reply.rb b/app/models/journal_reply.rb index 814231776..16055608a 100644 --- a/app/models/journal_reply.rb +++ b/app/models/journal_reply.rb @@ -5,8 +5,34 @@ class JournalReply < ActiveRecord::Base belongs_to :user belongs_to :journal + after_create :send_journal_messages def self.add_reply(journal_id, reply_id, user_id) self.create(:journal_id => journal_id, :reply_id => reply_id, :user_id => user_id) end + + def send_journal_messages + journal = self.journal + replier = User.find(self.reply_id) + receivers = [] + # 被回复的人发送消息 + if journal.user_id != self.reply_id && self.reply_id != journal.issue.author_id && self.reply_id != journal.issue.assigned_to_id + receivers << replier + end + if journal.user_id != journal.issue.author_id && self.reply_id != journal.issue.author_id + receivers << self.journal.issue.author + end + # journal_forge_messages = ForgeMessage.new + receivers.each do |r| + journal.forge_messages << ForgeMessage.new(:user_id =>r.id, :project_id => journal.issue.project_id, :viewed => false) + end + + # if self.user_id != self.journal_reply.user_id + # receivers << self.journal_reply.user_id + # end + # # 给缺陷发布者发送 + # if self.user_id != self.issue.author_id && self.journal_reply.user_id != self.issue.author_id + # receivers << self.issue.author_id + # end + end end diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index c44b1aeee..81ada2f80 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -190,13 +190,45 @@ class JournalsForMessage < ActiveRecord::Base end end - # 课程作品留言消息通知 + # 课程/作品回复 留言消息通知 def act_as_course_message if self.jour_type == 'StudentWorksScore' if self.user_id != self.jour.user_id self.course_messages << CourseMessage.new(:user_id => self.jour.user_id,:course_id => self.jour.student_work.homework_common.course.id, :viewed => false) end end + # 课程留言 + if self.jour_type == 'Course' + receivers = [] + teachers = [] + # 获取课程的老师 + self.jour.members.each do |m| + if m.user.allowed_to?(:as_teacher, self.jour) + teachers << m + end + end + if self.reply_id == 0 # 主留言,即不是回复某条留言 + teachers.each do |teacher| + if teacher.user_id != self.user_id + receivers << teacher.user_id + end + end + else # 留言回复 + reply_to = User.find(self.reply_id) + if self.user_id != self.reply_id # 添加我回复的那个人 + receivers << reply_to.id + end + # 给老师发送。 过滤条件:老师自己给自己发;回复对象为老师则排除改老师 + teachers.each do |teacher| + if teacher.user_id != self.user_id && self.reply_id != teacher.user_id + receivers << teacher.user_id + end + end + end + receivers.each do |r| + self.course_messages << CourseMessage.new(:user_id => r, :course_id => self.jour.id, :viewed => false) + end + end end # 用户留言消息通知 diff --git a/app/models/mailer.rb b/app/models/mailer.rb index a25aff6bb..b820e6d54 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -34,8 +34,10 @@ class Mailer < ActionMailer::Base end def method_missing(name, *args, &block) if Setting.delayjob_enabled? && Object.const_defined?('Delayed') + # with delayed_job @target.delay.send(name, *args, &block) else + # without delayed_job @target.send(name, *args, &block).deliver end end @@ -45,10 +47,46 @@ class Mailer < ActionMailer::Base MailerProxy.new(self) end + # 作业匿评开启 + def send_mail_anonymous_comment_open(homework_common) + course = homework_common.course + recipients ||= [] + course.student.each do |student| + user = User.find(student.student_id) + @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}" + @token = Token.get_token_from_user(user, 'autologin') + @anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value)) + @anonymous_comment_close_name = homework_common.name + @author = homework_common.user + #收件人邮箱 + recipients << user.mail + end + mail :to => recipients, + :subject => @subject + end + + # 作业匿评关闭 + def send_mail_anonymous_comment_close(homework_common) + course = homework_common.course + recipients ||= [] + course.student.each do |student| + user = User.find(student.student_id) + @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}" + @token = Token.get_token_from_user(user, 'autologin') + @anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value)) + @anonymous_comment_close_name = homework_common.name + @author = homework_common.user + #收件人邮箱 + recipients << user.mail + end + mail :to => recipients, + :subject => @subject + end + # author: alan - # 发送邀请未注册用户加入项目邮件 + # 邀请未注册用户加入项目 # 功能: 在加入项目的同时自动注册用户 - def send_invite_in_project(email, project, invitor) + def send_invite_in_project(email, project, invitor) @email = email @subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} " @password = newpass(6) @@ -57,8 +95,8 @@ class Mailer < ActionMailer::Base login = login.sub(/%40/,'@') us = UsersService.new # 自动激活用户 - user = us.register_auto(login, @email, @password) - InviteList.create(:user_id => user.id, :project_id => project.id) + user = us.register_auto(login, email, @password) + InviteList.create(:user_id => user.id, :project_id => project.id, :mail =>email) User.current = user unless User.current.nil? @user = user @token = Token.get_token_from_user(user, 'autologin') @@ -74,15 +112,23 @@ class Mailer < ActionMailer::Base @project_name = "#{project.name}" @user = user @project = project - inviter_lists = InviteList.where(project_id:@project.id, user_id:@user.id).all - if inviter_lists.blank? - InviteList.create(:user_id => user.id, :project_id => project.id) + if InviteList.where("project_id= ? and user_id =? and mail =?", project.id, @user.id, email).first.nil? + InviteList.create(:user_id => user.id, :project_id => project.id, :mail => email) end @token = Token.get_token_from_user(user, 'autologin') @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value) + # 发送消息邀请 + send_message_request_member(user,project) + # end mail :to => email, :subject => @subject end + # 邀请信息消息 注:forge_message_id 为邀请人ID(特殊情况) + def send_message_request_member(user, project) + key = newpass(6).to_s + ForgeMessage.create(:user_id => user.id, :project_id => project.id, :forge_message_type => "ProjectInvite",:forge_message_id => User.current.id, :viewed => false, :secret_key =>key) + end + # author: alan # 根据用户选择发送个人日报或周报 # 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言 @@ -206,6 +252,20 @@ class Mailer < ActionMailer::Base mail :to => user.mail,:subject => subject if has_content end + # 作业截止时间邮件提醒 + def homework_endtime__added(homework_common, user_id) + user = User.find(user_id) + @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_homework_endtime)} " + @token = Token.get_token_from_user(user, 'autologin') + @homework_endtime_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value)) + @homework_endtime_name = homework_common.name + @author = homework_common.user + #收件人邮箱 + recipient = user.mail + mail :to => recipient, + :subject => "#{l(:mail_homework)}#{homework_common.name}#{l(:mail_homework_endtime)} " + end + # 公共讨论区发帖、回帖添加邮件发送信息 def forum_message_added(memo) @memo = memo diff --git a/app/models/member.rb b/app/models/member.rb index 292dd2034..655c79895 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -30,6 +30,9 @@ class Member < ActiveRecord::Base validate :validate_role before_destroy :set_issue_category_nil + # 删除项目成员一并删除该成员的邀请记录 + after_destroy :delete_ivite_list + def role end @@ -97,6 +100,16 @@ class Member < ActiveRecord::Base end end + # 删除成员一并删除该成员的邀请信息 + def delete_ivite_list + member_invite_lists = InviteList.where("user_id =? and project_id =?", self.user_id, self.project_id) + unless member_invite_lists.nil? + member_invite_lists.each do |member_invite_list| + member_invite_list.destroy + end + end + end + # Find or initilize a Member with an id, attributes, and for a Principal def self.edit_membership(id, new_attributes, principal=nil) @membership = id.present? ? Member.find(id) : Member.new(:principal => principal) diff --git a/app/models/message.rb b/app/models/message.rb index 37129885f..2c46857f8 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -86,7 +86,7 @@ class Message < ActiveRecord::Base } - safe_attributes 'subject', 'content' + safe_attributes 'subject', 'content', 'reply_id' safe_attributes 'board_id','locked', 'sticky', :if => lambda {|message, user| if message.project diff --git a/app/models/onclick_time.rb b/app/models/onclick_time.rb new file mode 100644 index 000000000..c62a9274c --- /dev/null +++ b/app/models/onclick_time.rb @@ -0,0 +1,5 @@ +class OnclickTime < ActiveRecord::Base + attr_accessible :onclick_time, :user_id + + belongs_to :user +end diff --git a/app/models/project.rb b/app/models/project.rb index 0618dd145..0cd6af35b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -66,8 +66,8 @@ class Project < ActiveRecord::Base # has_many :students_for_courses, :dependent => :destroy has_many :student, :through => :students_for_courses, :source => :user has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy - has_many :applied_projects - has_many :invite_lists + has_many :applied_projects, :dependent => :destroy + has_many :invite_lists, :dependent => :destroy has_one :dts # end diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 0a5c1b65c..cd4d81a32 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -32,10 +32,108 @@ class StudentWork < ActiveRecord::Base self.system_score = last_test.test_score end end - + set_final_score self.homework_common,self end def set_src self.description = last_test.src if last_test end + #成绩计算 + def set_final_score homework,student_work + if homework && homework.homework_detail_manual + if homework.homework_type == 1 #匿评作业 + if homework.teacher_priority == 1 #教师优先 + if student_work.teacher_score + student_work.final_score = student_work.teacher_score + else + if student_work.teaching_asistant_score.nil? + student_work.final_score = student_work.student_score + elsif student_work.student_score.nil? + student_work.final_score = student_work.teaching_asistant_score + else + ta_proportion = homework.homework_detail_manual.ta_proportion + final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}") + final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}")) + final_score = final_ta_score + final_s_score + student_work.final_score = format("%.2f",final_score.to_f) + end + end + else #不考虑教师评分 + if student_work.teaching_asistant_score.nil? + student_work.final_score = student_work.student_score + elsif student_work.student_score.nil? + student_work.final_score = student_work.teaching_asistant_score + else + ta_proportion = homework.homework_detail_manual.ta_proportion + final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}") + final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}")) + final_score = final_ta_score + final_s_score + student_work.final_score = format("%.2f",final_score.to_f) + end + end + elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空 + if homework.teacher_priority == 1 #教师优先 + if student_work.teacher_score + student_work.final_score = student_work.teacher_score + else + if student_work.teaching_asistant_score.nil? #教辅未评分 + if student_work.student_score.nil? + student_work.final_score = student_work.system_score + else + ta_proportion = homework.homework_detail_programing.ta_proportion + homework.homework_detail_manual.ta_proportion / 2 + final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}") + final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}")) + final_score = final_sy_score + final_st_score + student_work.final_score = format("%.2f",final_score.to_f) + end + elsif student_work.student_score.nil? #学生未评分 + if student_work.teaching_asistant_score.nil? + student_work.final_score = student_work.system_score + else + ta_proportion = homework.homework_detail_programing.ta_proportion + (1.0 - homework.homework_detail_manual.ta_proportion - homework.homework_detail_programing.ta_proportion) / 2 + final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}") + final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}")) + final_score = final_sy_score + final_ts_score + student_work.final_score = format("%.2f",final_score.to_f) + end + else + final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") + final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}") + final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") - BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}")) + final_score = final_sy_score + final_ts_score + final_st_score + student_work.final_score = format("%.2f",final_score.to_f) + end + end + else #不考虑教师评分 + if student_work.teaching_asistant_score.nil? #教辅未评分 + if student_work.student_score.nil? + student_work.final_score = student_work.system_score + else + ta_proportion = homework.homework_detail_programing.ta_proportion + homework.homework_detail_manual.ta_proportion / 2 + final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}") + final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}")) + final_score = final_sy_score + final_st_score + student_work.final_score = format("%.2f",final_score.to_f) + end + elsif student_work.student_score.nil? #学生未评分 + if student_work.teaching_asistant_score.nil? + student_work.final_score = student_work.system_score + else + ta_proportion = homework.homework_detail_programing.ta_proportion + (1.0 - homework.homework_detail_manual.ta_proportion - homework.homework_detail_programing.ta_proportion) / 2 + final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}") + final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}")) + final_score = final_sy_score + final_ts_score + student_work.final_score = format("%.2f",final_score.to_f) + end + else + final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") + final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}") + final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") - BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}")) + final_score = final_sy_score + final_ts_score + final_st_score + student_work.final_score = format("%.2f",final_score.to_f) + end + end + end + end + end end diff --git a/app/models/student_work_test.rb b/app/models/student_work_test.rb index 1cfb7f8b2..0246ecabf 100644 --- a/app/models/student_work_test.rb +++ b/app/models/student_work_test.rb @@ -45,7 +45,7 @@ class StudentWorkTest < ActiveRecord::Base private def get_success_count self.results.inject(0) do |sum, result| - sum += (result["status"].to_i == 0 ? 1 : 0) + sum += (result["status"] && result["status"].to_i == 0 ? 1 : 0) end || 0 end diff --git a/app/models/system_message.rb b/app/models/system_message.rb new file mode 100644 index 000000000..2a810e8b8 --- /dev/null +++ b/app/models/system_message.rb @@ -0,0 +1,8 @@ +class SystemMessage < ActiveRecord::Base + attr_accessible :content, :id, :user_id, :description, :subject + belongs_to :user + + validates :subject, presence: true + # validates :description, presence: true + validates_length_of :description, maximum: 10000 +end diff --git a/app/models/user.rb b/app/models/user.rb index b08b29981..0ed8aeda0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -132,13 +132,15 @@ class User < Principal has_many :course_messages has_many :memo_messages has_many :user_feedback_messages + has_one :onclick_time + has_many :system_messages # 虚拟转换 has_many :new_jours, :as => :jour, :class_name => 'JournalsForMessage', :conditions => "status=1" has_many :issue_assigns, :class_name => 'ForgeMessage', :conditions => 'viewed=0 and forge_message_type="Issue"' has_many :status_updates, :class_name => 'ForgeMessage', :conditions => 'viewed=0 and forge_message_type="Journal"' # 邮件邀请状态 - # has_many :invite_lists + has_many :invite_lists, :dependent => :destroy # end ######added by nie @@ -209,8 +211,10 @@ class User < Principal before_save :update_hashed_password before_destroy :remove_references_before_destroy # added by fq - after_create :act_as_activity + after_create :act_as_activity, :add_onclick_time # end + # 更新邮箱用户或用户名的同事,同步更新邀请信息 + after_update :update_invite_list scope :in_group, lambda {|group| group_id = group.is_a?(Group) ? group.id : group.to_i @@ -257,11 +261,19 @@ class User < Principal # 新消息统计 def count_new_message - course_count = CourseMessage.where("user_id =? and viewed =?", User.current.id, 0).count - forge_count = ForgeMessage.where("user_id =? and viewed =?", User.current.id, 0).count - user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", User.current.id, 0).count - user_memo_count = MemoMessage.where("user_id =? and viewed =?", User.current.id, 0).count - messages_count = course_count + forge_count + user_feedback_count + user_memo_count + if OnclickTime.where("user_id =?", User.current).first.nil? + message_new_time = OnclickTime.new + message_new_time.user_id = User.current.id + # 第一次初始化点击铃铛时间 + message_new_time.onclick_time = User.current.last_login_on.nil? ? Time.now : User.current.last_login_on + message_new_time.save + end + course_count = CourseMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count + forge_count = ForgeMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count + user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count + user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count + system_messages_count = SystemMessage.where("created_at >?", User.current.onclick_time.onclick_time).count + messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count end # 查询指派给我的缺陷记录 @@ -994,6 +1006,23 @@ class User < Principal self.acts << Activity.new(:user_id => self.id) end + # 注册用户的时候消息默认点击时间为用户创建时间 + def add_onclick_time + if OnclickTime.where("user_id =?" , self.id).first.nil? + OnclickTime.create(:user_id => self.id, :onclick_time => self.created_on) + end + end + + # 更新邮箱的同事,更新invite_lists表中的邮箱信息 + def update_invite_list + invite_lists = InviteList.where("user_id =?",self.id).all + unless invite_lists.blank? + invite_lists.each do |invite_list| + invite_list.update_attribute(:mail, self.mail) + end + end + end + # Removes references that are not handled by associations # Things that are not deleted are reassociated with the anonymous user def remove_references_before_destroy diff --git a/app/views/account/about_us.html.erb b/app/views/account/about_us.html.erb index 2d21783ce..f990cd64c 100644 --- a/app/views/account/about_us.html.erb +++ b/app/views/account/about_us.html.erb @@ -1,50 +1,50 @@ -<%= stylesheet_link_tag 'new_user'%> -
-

关于我们

-
-

- Trustie是一个面向高校创新实践的在线协作社区,是在中国高校推行大规模开放在线研究(Massive Open Online Research, MOORE)的支撑平台,也简称Trustie平台。老师、学生和科研人员可以在此开展各种在线协同学习、协同作业、协同开发等活动。 -

-

- MOORE是国防科学技术大学杨学军院士提出的一个面向高校科研教学活动的新型创新实践概念,为全面支持高校人才培养和科学研究提供了一种新思路。MOORE是对大规模在线开放课程(Massive Open Online Course, MOOC)的拓展,是课堂教学与创新实践深度结合的全新模式,可以看作MOOC2.0。 -

-

- 2005年开始,Trustie研制团队围绕网络时代的软件开发效率和质量这一核心问题展开研究,经过十年的磨砺与攻关,逐步揭示出以大众化协同开发、开放式资源共享、持续性可信评估为核心的互联网大规模协同机理,提出了全新的软件开发群体化方法。2008年起,研制团队开始探索如何将这种协同机理引入软件人才培养。MOORE概念的提出为研制团队的人才培养实践提供了新的发展方向和应用模式,使Trustie技术和工具能够更直接、更有效地与高校人才培养对接,形成了今天已被大量师生接受的在线人才培养平台。 -

-

- 研制团队认为MOORE的创新人才培养模式(如图1左图)是将互联网大规模协同机理与高校创新实践活动相结合的全新人才培养方法和模式,研制团队并基于本平台的架构形成了对MOORE核心机理的三方面认识(如图1右图)。 -

-
- -

图1 基于MOORE的创新人才培养模式与核心机理

-
-

- 目前,Trustie平台已经初步展现出大规模开放在线研究的生态系统蓝图,其核心是在线教学实践平台和在线协同研究平台,如图2。Trustie在线教学实践平台是支持教师和学生围绕课堂学习开展实践的平台(如图2),Trustie在线协同研究平台是支持开发小组围绕实践任务或研究工作开展分布式协作的平台(如图2)。两个核心平台为一名"新手"大学生成长为具有一定创新能力的"创客"提供了从学习到研究的一个渐进式成长环境(如图2)。 -

-

- 特别是,根据师生的实际需要,Trustie平台提供了私有模式和公开模式,支持针对未公开成果实施有效知识产权保护为前提的交流分享(如图2)。随着越来越多的高校、课程和研究小组的加入,MOORE创新实践模式的生态效益将不断显现出来。 -

-
- -

图2 基于MOORE的支撑平台和生态系统

-
-

- 研制团队特别感谢高校老师和学生的积极反馈、无私创意。平台的很多实用便捷的功能都是老师们积极参与和设计的结果,汇聚了大量师生的宝贵贡献,是研制团队和用户群体共同成长的结果。 -

-

- Trustie平台的基本思路是将开源模式与中国高校人才培养活动相结合,但其本质上是一种O2O(Online To Offline)的创新人才培养模式,只有在以下两个方面同步推进,才能在持续解决实际需求的过程中快速发展:
-     (1)构建实践平台,激活创新能力:成为支持不同规模的团队进行协同研究和协同开发的实践平台,支持各类可公开的课程实验任务、教研室科研任务的在线协同,能够有效提升和评估学生的创新能力、协作能力和实践能力。
-     (2)引入开源理念,形成创客文化:将互联网开源软件运动中的自由、对等、共享、创新的理念引入高校,使"自主创意并亲自动手实现创意"的创客精神深入人才培养活动,在学生群体中形成大胆创意、大胆实践的创新文化。 -

-

- 研制团队认为,Trustie平台是一种"互联网+"思维在高校教育领域的大型探索性实践。作为一种互联网应用,Trustie平台自身的开发也采取了互联网模式:Trustie研制团队采用了"网构化软件开发模式",坚持"每周一更"的快速上线、快速体验模式,以最大程度上贴近用户实际需求提升。欢迎高校师生一同投身创新实践,共同见证MOORE创新生态的早日形成。 -

-
- - - -
- - - - +<%= stylesheet_link_tag 'new_user'%> +
+

关于我们

+
+

+ Trustie是一个面向高校创新实践的在线协作社区,是在中国高校推行大规模开放在线研究(Massive Open Online Research, MOORE)的支撑平台,也简称Trustie平台。老师、学生和科研人员可以在此开展各种在线协同学习、协同作业、协同开发等活动。 +

+

+ MOORE是国防科学技术大学杨学军院士提出的一个面向高校科研教学活动的新型创新实践概念,为全面支持高校人才培养和科学研究提供了一种新思路。MOORE是对大规模在线开放课程(Massive Open Online Course, MOOC)的拓展,是课堂教学与创新实践深度结合的全新模式,可以看作MOOC2.0。 +

+

+ 2005年开始,Trustie研制团队围绕网络时代的软件开发效率和质量这一核心问题展开研究,经过十年的磨砺与攻关,逐步揭示出以大众化协同开发、开放式资源共享、持续性可信评估为核心的互联网大规模协同机理,提出了全新的软件开发群体化方法。2008年起,研制团队开始探索如何将这种协同机理引入软件人才培养。MOORE概念的提出为研制团队的人才培养实践提供了新的发展方向和应用模式,使Trustie技术和工具能够更直接、更有效地与高校人才培养对接,形成了今天已被大量师生接受的在线人才培养平台。 +

+

+ 研制团队认为MOORE的创新人才培养模式(如图1左图)是将互联网大规模协同机理与高校创新实践活动相结合的全新人才培养方法和模式,研制团队并基于本平台的架构形成了对MOORE核心机理的三方面认识(如图1右图)。 +

+
+ +

图1 基于MOORE的创新人才培养模式与核心机理

+
+

+ 目前,Trustie平台已经初步展现出大规模开放在线研究的生态系统蓝图,其核心是在线教学实践平台和在线协同研究平台,如图2。Trustie在线教学实践平台是支持教师和学生围绕课堂学习开展实践的平台(如图2),Trustie在线协同研究平台是支持开发小组围绕实践任务或研究工作开展分布式协作的平台(如图2)。两个核心平台为一名"新手"大学生成长为具有一定创新能力的"创客"提供了从学习到研究的一个渐进式成长环境(如图2)。 +

+

+ 特别是,根据师生的实际需要,Trustie平台提供了私有模式和公开模式,支持针对未公开成果实施有效知识产权保护为前提的交流分享(如图2)。随着越来越多的高校、课程和研究小组的加入,MOORE创新实践模式的生态效益将不断显现出来。 +

+
+ +

图2 基于MOORE的支撑平台和生态系统

+
+

+ 研制团队特别感谢高校老师和学生的积极反馈、无私创意。平台的很多实用便捷的功能都是老师们积极参与和设计的结果,汇聚了大量师生的宝贵贡献,是研制团队和用户群体共同成长的结果。 +

+

+ Trustie平台的基本思路是将开源模式与中国高校人才培养活动相结合,但其本质上是一种O2O(Online To Offline)的创新人才培养模式,只有在以下两个方面同步推进,才能在持续解决实际需求的过程中快速发展:
+     (1)构建实践平台,激活创新能力:成为支持不同规模的团队进行协同研究和协同开发的实践平台,支持各类可公开的课程实验任务、教研室科研任务的在线协同,能够有效提升和评估学生的创新能力、协作能力和实践能力。
+     (2)引入开源理念,形成创客文化:将互联网开源软件运动中的自由、对等、共享、创新的理念引入高校,使"自主创意并亲自动手实现创意"的创客精神深入人才培养活动,在学生群体中形成大胆创意、大胆实践的创新文化。 +

+

+ 研制团队认为,Trustie平台是一种"互联网+"思维在高校教育领域的大型探索性实践。作为一种互联网应用,Trustie平台自身的开发也采取了互联网模式:Trustie研制团队采用了"网构化软件开发模式",坚持"每周一更"的快速上线、快速体验模式,以最大程度上贴近用户实际需求提升。欢迎高校师生一同投身创新实践,共同见证MOORE创新生态的早日形成。 +

+
+ + + +
+ + + + diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index 56f2c5454..ed43f455a 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -1,286 +1,286 @@ -<%= stylesheet_link_tag 'new_user'%> -<%= stylesheet_link_tag 'leftside'%> - - -
-
-
- -
欢迎加入Trustie高校创新实践社区!老师、学生和科研人员可以在此开展各种在线协同学习、协同作业、协同开发等活动。Trustie是在中国推行大规模开放在线研究模式(MOORE)的支撑平台。
-
-
-
-
-
-
    -
  • 登录
  • -
  • -
-
-
<%= flash.empty? || flash[:error].nil? ? "" : flash[:error].html_safe %>
-
-
- - <%= form_tag(signin_path,:id=>'main_login_form',:method=>'post') do %> - <%= back_url_hidden_field_tag %> -
- <%= text_field_tag 'username', params[:username], :tabindex => '1' , - :class=>'loginSignBox',:placeholder=>'请输入邮箱地址或昵称', :onkeypress => "user_name_keypress(event);"%> - -
- <% if Setting.openid? %> -
- <%= text_field_tag "openid_url", nil, :tabindex => '3',:placeholder=>'请输入OpenId URL' %> -
- <% end %> -
- - <%= password_field_tag 'password', nil, :tabindex => '2',:class=>'loginSignBox' ,:placeholder=>'请输密码', :onkeypress => "user_name_keypress(event);"%> -
-
- <% if Setting.autologin? %> -
- <%= check_box_tag 'autologin', 1, true, :tabindex => 4 %> -
- <%= l(:label_stay_logged_in) %> - <% end %> - - <% if Setting.lost_password? %> - 忘记密码? - <% end %> -
- <% end %> -
- 登录 -
- -
- -
-
-
-
    -
  • 注册<%= link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %> -
  • -
-
-
- <%= form_for :user, :url => register_path,:method=>'post',:html=>{:id=>'main_reg_form'} do |f| %> - <%= error_messages_for 'user' %> -
- - <%= f.text_field :mail,:size => 25, :class=>'loginSignBox' ,:placeholder=>"请输入邮箱地址"%> - -
-
- - <%= f.password_field :password, :size => 25,:placeholder=>"请输入密码",:class=>'loginSignBox' %> - -
-
- - <%= f.password_field :password_confirmation, :size => 25,:placeholder=>"请再次输入密码",:class=>'loginSignBox' %> - -
-
- - <%= f.text_field :login, :size => 25,:placeholder=>"请输入用户昵称",:class=>'loginSignBox'%> - -
-
-
- -
- 我已阅读并接受Trustie服务协议条款
-
- 注册 - -
- <% end %> -
-
-
-
-
-
+<%= stylesheet_link_tag 'new_user'%> +<%= stylesheet_link_tag 'leftside'%> + + +
+
+
+ +
  欢迎加入Trustie高校创新实践社区!老师、学生和科研人员可以在此开展各种在线协同学习、协同作业、协同开发等活动。

  Trustie是在中国推行大规模开放在线研究模式(MOORE)的支撑平台。
+
+
+
+
+
+
    +
  • 登录
  • +
  • +
+
+
<%= flash.empty? || flash[:error].nil? ? "" : flash[:error].html_safe %>
+
+
+ + <%= form_tag(signin_path,:id=>'main_login_form',:method=>'post') do %> + <%= back_url_hidden_field_tag %> +
+ <%= text_field_tag 'username', params[:username], :tabindex => '1' , + :class=>'loginSignBox',:placeholder=>'请输入邮箱地址或昵称', :onkeypress => "user_name_keypress(event);"%> + +
+ <% if Setting.openid? %> +
+ <%= text_field_tag "openid_url", nil, :tabindex => '3',:placeholder=>'请输入OpenId URL' %> +
+ <% end %> +
+ + <%= password_field_tag 'password', nil, :tabindex => '2',:class=>'loginSignBox' ,:placeholder=>'请输密码', :onkeypress => "user_name_keypress(event);"%> +
+
+ <% if Setting.autologin? %> +
+ <%= check_box_tag 'autologin', 1, true, :tabindex => 4 %> +
+ <%= l(:label_stay_logged_in) %> + <% end %> + + <% if Setting.lost_password? %> + 忘记密码? + <% end %> +
+ <% end %> +
+ 登录 +
+ +
+ +
+
+
+
    +
  • 注册<%= link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %> +
  • +
+
+
+ <%= form_for :user, :url => register_path,:method=>'post',:html=>{:id=>'main_reg_form'} do |f| %> + <%= error_messages_for 'user' %> +
+ + <%= f.text_field :mail,:size => 25, :class=>'loginSignBox' ,:placeholder=>"请输入邮箱地址"%> + +
+
+ + <%= f.password_field :password, :size => 25,:placeholder=>"请输入密码",:class=>'loginSignBox' %> + +
+
+ + <%= f.password_field :password_confirmation, :size => 25,:placeholder=>"请再次输入密码",:class=>'loginSignBox' %> + +
+
+ + <%= f.text_field :login, :size => 25,:placeholder=>"请输入用户昵称",:class=>'loginSignBox'%> + +
+
+
+ +
+ 我已阅读并接受Trustie服务协议条款
+
+ 注册 + +
+ <% end %> +
+
+
+
+
+
diff --git a/app/views/admin/messages.html.erb b/app/views/admin/messages.html.erb new file mode 100644 index 000000000..f87741dd9 --- /dev/null +++ b/app/views/admin/messages.html.erb @@ -0,0 +1,64 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> +

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


+
+ <%= form_for(@admin_messages, :html => {:id =>'system_messages-form'}) do |f| %> +
  • + + +

    +
  • +
  • + + <%= f.kindeditor :description,:width=>'87.5%',:editor_id=>'system_message_editor' %> +

    +
  • +
    +

    +
    +
    + <%= link_to l(:label_submit), "javascript:void(0)", :class => "btn_message_free", :onclick => "system_message_editor.sync();submit_message();" %> +
    + <% end %> +
    + + diff --git a/app/views/attachments/file.html.erb b/app/views/attachments/file.html.erb index 75fa1858c..0ce174545 100644 --- a/app/views/attachments/file.html.erb +++ b/app/views/attachments/file.html.erb @@ -1,26 +1,38 @@ -

    <%=h @attachment.filename %>

    +
    +
    +
    +
    +
    +

    <%=h @attachment.filename %>

    -
    -

    <%= h("#{@attachment.description} - ") unless @attachment.description.blank? %> - <%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %>

    -

    <%= link_to_attachment @attachment, :text => l(:button_download), :download => true -%> - (<%= number_to_human_size @attachment.filesize %>)    - - <% if @attachment!=nil &&(@attachment.container_type == 'Document' || @attachment.container_type == 'WikiPage') && - User.current.allowed_to?({:controller => 'code_review', :action => 'update_diff_view'}, @attachment.project) %> - <%= l(:review_assignments)+":" %><%= link = link_to(l(:button_add), {:controller => 'code_review', - :action => 'assign', :action_type => 'attachment', - :id=>@attachment.project, - :change_id => '', :attachment_id => @attachment.id, - }, :class => 'icon icon-add') %> - <% end %> -

    +
    +

    <%= h("#{@attachment.description} - ") unless @attachment.description.blank? %> + <%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %>

    +

    <%= link_to_attachment @attachment, :text => l(:button_download), :download => true -%> + (<%= number_to_human_size @attachment.filesize %>)    + + <% if @attachment!=nil &&(@attachment.container_type == 'Document' || @attachment.container_type == 'WikiPage') && + User.current.allowed_to?({:controller => 'code_review', :action => 'update_diff_view'}, @attachment.project) %> + <%= l(:review_assignments)+":" %><%= link = link_to(l(:button_add), {:controller => 'code_review', + :action => 'assign', :action_type => 'attachment', + :id=>@attachment.project, + :change_id => '', :attachment_id => @attachment.id, + }, :class => 'icon icon-add') %> + <% end %> +

    +
    +   + <%= render :partial => 'common/file', :locals => {:content => @content, :filename => @attachment.filename} %> + + <% html_title @attachment.filename %> + + <% content_for :header_tags do -%> + <%= stylesheet_link_tag "scm" -%> + <% end -%> +
    +
    +
    +
    +
    -  -<%= render :partial => 'common/file', :locals => {:content => @content, :filename => @attachment.filename} %> -<% html_title @attachment.filename %> - -<% content_for :header_tags do -%> - <%= stylesheet_link_tag "scm" -%> -<% end -%> diff --git a/app/views/bids/edit.html.erb b/app/views/bids/edit.html.erb index da3d19267..554702d97 100644 --- a/app/views/bids/edit.html.erb +++ b/app/views/bids/edit.html.erb @@ -1,4 +1,5 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'prettify','/assets/kindeditor/pasteimg' %> +<%= stylesheet_link_tag 'prettify'%> <%= labelled_form_for @bid,:html => { :multipart => true } do |f| %> <%= render :partial => 'new_homework_form', :locals => { :bid => @bid, :bid_id => "edit_bid_#{@bid.id}",:f=>f,:edit_mode => true} %> <% end %> diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index f117acd7f..db174f30e 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -99,7 +99,7 @@ // } }); -
    +
    <%= topic.content.html_safe %> @@ -165,7 +165,7 @@
    <%= link_to User.current.member_of_course?(@board.course) ? "#{message.author.show_name}(#{message.author.login})" : "#{message.author}", user_path(message.author),:class => 'fl c_orange f14 ' %>
    -
    +
    <%= textAreailizable message,:content,:attachments => message.attachments %>
    diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index bc69e2666..4f022261f 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -51,9 +51,9 @@ :data => {:confirm => l(:text_are_you_sure)}, :class => 'talk_edit fr', :style => ' margin-right: 10px;') if topic.destroyable_by?(User.current) %> - <% if topic.sticky? %> - <%= l(:label_board_sticky)%> - <% end %> + <%# if topic.sticky? %> + + <%# end %>
    -
    +
    <%= topic.content.html_safe %> @@ -150,7 +150,7 @@
    <%= link_to_user_header message.author,false,:class => 'fl c_orange f14 ' %>
    -
    +
    <%= textAreailizable message,:content,:attachments => message.attachments %>
    diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb index dd3c3dfb2..7892ed773 100644 --- a/app/views/comments/create.js.erb +++ b/app/views/comments/create.js.erb @@ -1,3 +1,3 @@ -$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>"); +$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id,:first_user_activity =>@first_user_activity,:page => @page}) %>"); -init_KindEditor_data('<%= @user_activity_id%>'); +init_activity_KindEditor_data('<%= @user_activity_id%>',"","87%"); diff --git a/app/views/courses/_join_private_course.html.erb b/app/views/courses/_join_private_course.html.erb index 934a4eb33..4cc8b9fbf 100644 --- a/app/views/courses/_join_private_course.html.erb +++ b/app/views/courses/_join_private_course.html.erb @@ -57,6 +57,8 @@ :id => 'new-watcher-form') do %>
    • + + 课 程 ID: diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb index 8c7a41ddc..d2c17917e 100644 --- a/app/views/courses/new.html.erb +++ b/app/views/courses/new.html.erb @@ -5,6 +5,8 @@
        <%= labelled_form_for @course do |f| %>
      • + + diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 4ca8d3d43..a462db79d 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -20,6 +20,8 @@
      • + + diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 6eb722981..eceb29f34 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -7,7 +7,7 @@ <%= image_tag(url_to_avatar(activity.user), :width => "42", :height => "42") %> -
        +
        <%= link_to_user_header(activity.user,false,:class => 'problem_name c_orange fl') %>   <%= activity.course_act_type == "Course" ? "创建了课程" : l(:label_new_activity) %>: diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 353d19dab..e31eea960 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -3,13 +3,13 @@

        共有 <%= all_attachments.count%> 个资源

        <% if order == "asc" %> - 按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /  - <%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /  - <%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 + 按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /  + <%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /  + <%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 <% else %> - 按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /  - <%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>  /  - <%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 + 按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /  + <%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>  /  + <%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 <% end %>

        diff --git a/app/views/files/_tag_yun.html.erb b/app/views/files/_tag_yun.html.erb index 9db34ece4..f5e22002a 100644 --- a/app/views/files/_tag_yun.html.erb +++ b/app/views/files/_tag_yun.html.erb @@ -3,7 +3,7 @@ <% if tag_name && tag_name == k%> <%= k%>×<%= v%> <% else%> - <%= k%>×<%= v%> + <%= k%>×<%= v%> <% end%> <% end%> <% end%> \ No newline at end of file diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index aefa1a5a9..34f7452a7 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -223,6 +223,56 @@ }); } + <% if @course %> + var tagNameHtml; //当前双击的链接的父节点的html + var tagName; //标签的值 + var parentCssBorder; //当前双击的链接的父节点 + var ele; //当前双击的链接 + var tagId; //标签的id + var taggableType; //被标签的类型 + //这里renameTag有两种情况,一种是改变某个资源的tag名称。如果其他资源也有这个tag。则新增一个改变后的tag名 + //第二种是改变某个tag名称。其他所有的资源如果拥有这个tag。那么对应的tag名也要改掉。 + //目前这两种依据 的来源就是 是否 传了参数 id。如果有id。就指定了资源id,就是第一种情况。如果没有id。就是第二种情况 + function rename_tag(domEle,name,id,type){ + if(domEle.children().get(0) != undefined ){ //已经是编辑框的情况下不要动 + return; + } + tagNameHtml = domEle.parent().html() + tagName = name; + parentCssBorder = domEle.parent().css("border"); + ele = domEle; + tagId = id; + taggableType = type; + width = parseInt(domEle.css('width').replace('px','')) >=100 ? parseInt(domEle.css('width').replace('px','')) : 100 + domEle.html(''); + domEle.parent().css("border","1px solid #ffffff"); + $("#renameTagName").focus(); + } + //监听所有的单击事件 + $(document.body).click(function(e){ + node = document.elementFromPoint(e.clientX, e.clientY); + if(node.tagName == "INPUT"){ //如果是输入框的聚焦,那么就不要进行下去了 + return; + } + if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态 + if($("#renameTagName").val().trim() == tagName){ //如果值一样,则恢复原来的状态 + ele.parent().css("border",""); + ele.parent().html(tagNameHtml); + + }else{ //否则就要更新tag名称了 + if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){ + $.post( + '<%= update_tag_name_path %>', + {"taggableId": tagId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim(),"courseId":<%= @course.id%>} + ) + }else{ + ele.parent().css("border",""); + ele.parent().html(tagNameHtml); + } + } + } + }); + <%end %> diff --git a/app/views/forums/_file_form.html.erb b/app/views/forums/_file_form.html.erb new file mode 100644 index 000000000..560afc6d9 --- /dev/null +++ b/app/views/forums/_file_form.html.erb @@ -0,0 +1,79 @@ + +
        + +<% if defined?(container) && container && container.saved_attachments %> + <% container.attachments.each_with_index do |attachment, i| %> + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly => 'readonly') %><%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %><%= l(:field_is_public) %>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %> + <%= if attachment.id.nil? + #待补充代码 + else + link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') + end + %> + <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + +
        + <% end %> + <% container.saved_attachments.each_with_index do |attachment, i| %> + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly => 'readonly') %> + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %> + <%= l(:field_is_public) %>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %> + <%= if attachment.id.nil? + #待补充代码 + else + link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') + end + %> + <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + +
        + <% end %> +<% end %> +
        + <% project = project %> +
        + + <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> + + <%#= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'AnnexBtn fl mt3' %> + 上传附件 + <%= file_field_tag 'attachments[dummy][file]', + :id => '_file', + :class => 'file_selector', + :multiple => true, + :onchange => 'addInputFiles(this);', + :style => ie8? ? '' : 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js', :project => project), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :delete_all_files => l(:text_are_you_sure_all) + } %> + + + + + <%#= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %> + + + + <% content_for :header_tags do %> + <%= javascript_include_tag 'attachments' %> + <% end %> +
        \ No newline at end of file diff --git a/app/views/forums/_form_edit_mode.html.erb b/app/views/forums/_form_edit_mode.html.erb index a9bb05f79..ade5a24c4 100644 --- a/app/views/forums/_form_edit_mode.html.erb +++ b/app/views/forums/_form_edit_mode.html.erb @@ -1,49 +1,26 @@ - - -
        - <%= labelled_form_for(@forum) do |f| %> - <% if @forum.errors.any? %> - - <% end %> -
        -
        - <%= f.text_field :name, :required => true, :style => 'width: 100%;', :class => 'create-share', :maxlength => 50%> -
        -
        - <% if User.current.logged? && User.current.admin? %> - <% if @forum.safe_attribute? 'sticky' %> - <%= f.check_box :sticky %> - <%= label_tag 'message_sticky', l(:label_board_sticky) %> - <% end %> - <% if @forum.safe_attribute? 'locked' %> - <%= f.check_box :locked %> - <%= label_tag 'message_locked', l(:label_board_locked) %> - <% end %> +
        + <%= labelled_form_for(@forum) do |f| %> + +
        + +
        +
        + +
        +
        + + +
        +
        <% end %>
        -
        -

        - <%= f.kindeditor :description, :required => true,:owner_id => @forum.id,:owner_type => 2 %> -

        - -

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

        -
        -
        - <%= submit_tag l(:button_submit) %> - <%= link_to l(:button_back), forums_path ,:style => 'font-size: 14px; padding: 0px 3px;' %> -
        - <% end %> -
        +
        \ No newline at end of file diff --git a/app/views/forums/_forum_form.html.erb b/app/views/forums/_forum_form.html.erb new file mode 100644 index 000000000..9888b674e --- /dev/null +++ b/app/views/forums/_forum_form.html.erb @@ -0,0 +1,15 @@ + +
        + +
        +
        + +
        +
        + + +
        +
        \ No newline at end of file diff --git a/app/views/forums/_forum_list.html.erb b/app/views/forums/_forum_list.html.erb index ac27235eb..286219356 100644 --- a/app/views/forums/_forum_list.html.erb +++ b/app/views/forums/_forum_list.html.erb @@ -1,57 +1,38 @@ - -
        + <% if forums.any? %> <% forums.each do |forum| %> -
        -
        - <%= forum.creator.nil? ? (link_to image_tag(url_to_avatar(forum.creator), :class => "avatar")) : (link_to image_tag(url_to_avatar(forum.creator), :class => "avatar"), user_path(forum.creator)) %> -
        -
        - - - - - - - - - - -
        -

        - <%= link_to h(forum.name), forum_path(forum) %> -

        -
        -

        - <%= textAreailizable forum.description%> -

        -
        -

        - <%= authoring forum.created_at, forum.creator %> -

        -
        -
        -
        - - - - - - - - - -
        - <%= link_to (forum.memo_count), forum_path(forum) %> - - <%= link_to (forum.topic_count), forum_path(forum) %> -
        回答帖子
        -
        -
        +
        + + +
        +
        + + <%= link_to ( forum.topic_count), forum_path(forum),:class=>"linkGrey5 fb" %> +
        +
        帖子
        +
        +
        +
        +
        + + <%= link_to (forum.memo_count), forum_path(forum),:class=>"linkGrey5 fb" %> +
        +
        回答
        +
        +
        +
        <% end %> - + <% else %> -<% end %> -
        \ No newline at end of file + <%= render :partial => "layouts/no_content" %> +<% end %> \ No newline at end of file diff --git a/app/views/forums/_forum_tag_list.html.erb b/app/views/forums/_forum_tag_list.html.erb new file mode 100644 index 000000000..b074cbca3 --- /dev/null +++ b/app/views/forums/_forum_tag_list.html.erb @@ -0,0 +1,8 @@ +<% forum.tag_list.each do |tag|%> + +<% end %> \ No newline at end of file diff --git a/app/views/forums/_post_banner.html.erb b/app/views/forums/_post_banner.html.erb new file mode 100644 index 000000000..797b43245 --- /dev/null +++ b/app/views/forums/_post_banner.html.erb @@ -0,0 +1,33 @@ + + +
        综合 + <% if order_type=='reorder_complex' && order_str == 'desc' %> + + <% elsif order_type=='reorder_complex' && order_str == 'asc' %> + + <% else %> + + <% end %> +
        +
        人气 + <% if order_type=='reorder_popu' && order_str == 'desc' %> + + <% elsif order_type=='reorder_popu' && order_str == 'asc' %> + + <% else %> + + <% end %> +
        +
        时间 + <% if order_type=='reorder_time' && order_str == 'desc' %> + + <% elsif order_type=='reorder_time' && order_str == 'asc' %> + + <% else %> + + <% end %> +
        + +
        \ No newline at end of file diff --git a/app/views/forums/_show_topics.html.erb b/app/views/forums/_show_topics.html.erb index f8679cefa..d6e3f607b 100644 --- a/app/views/forums/_show_topics.html.erb +++ b/app/views/forums/_show_topics.html.erb @@ -1,47 +1,31 @@ - -
        共有 <%=link_to @forum.memos.count %> 个贴子
        <% if memos.any? %> <% memos.each do |topic| %> - - - - - -
        - <%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%> - - - - - - - - - - - - -
        <%= link_to h(topic.subject), forum_memo_path(topic.forum, topic) %> - - - - - - - -
        <%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic) %>
        回答
        <%= authoring topic.created_at, topic.author %> - - <% author = topic.last_reply.try(:author)%> - <% if author%> - 最后回复:<%=link_to_user author %> - <% end%> - -
        -
        -
        +
        +
        + + <%= link_to image_tag(url_to_avatar(topic.author), :width => 50,:height => 50,:alt => '贴吧图片'), user_path(topic.author) if topic.author%> +
        +
        + +
        <%= topic.content.html_safe%> + +
        + <% author = topic.last_reply.try(:author)%> + <% if author%> +
        最后回复:<%= author.name%>
        +
        <%= format_date(topic.last_reply.created_at)%>
        + <% end%> + +
        +
        + + <%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic),:target =>'_blank',:class=>'linkGrey2' %> +
        +
        +
        <% end %> - + <% else %>

        <%= l(:label_no_data) %>

        <% end %> diff --git a/app/views/forums/create.js.erb b/app/views/forums/create.js.erb new file mode 100644 index 000000000..be99d724a --- /dev/null +++ b/app/views/forums/create.js.erb @@ -0,0 +1,6 @@ +<%if @save_flag%> +$('#new_forum_div').slideToggle();$('#create_btn').parent().slideToggle(); +$('#reorder_time').click(); +<%else%> + $("#error").html("<%= @forum.errors.full_messages[0]%>").show(); +<%end %> \ No newline at end of file diff --git a/app/views/forums/delete_forum_tag.js.erb b/app/views/forums/delete_forum_tag.js.erb new file mode 100644 index 000000000..5080b3bdd --- /dev/null +++ b/app/views/forums/delete_forum_tag.js.erb @@ -0,0 +1,2 @@ +$("#forum_tag_list").html("<%= escape_javascript( render :partial=>'forum_tag_list',:locals=>{:forum=>@forum}) %>"); +$('#add_tag01').hide(); \ No newline at end of file diff --git a/app/views/forums/edit.html.erb b/app/views/forums/edit.html.erb index 0a40120c7..1fcbc6cab 100644 --- a/app/views/forums/edit.html.erb +++ b/app/views/forums/edit.html.erb @@ -1,4 +1,78 @@ - -

        编辑讨论区

        -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> + +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'new_user' %> + <%= render 'form_edit_mode' %> + \ No newline at end of file diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index 85cab957a..c31790f30 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -1,48 +1,177 @@ -<% @nav_dispaly_home_path_label = 1 - @nav_dispaly_main_course_label = 1 - @nav_dispaly_main_project_label = 1 - @nav_dispaly_main_contest_label = 1 %> - -
        - - - - - - - - - - - -
        公共贴吧 - - <%= l(:label_user_location) %> : - - - <% if User.current.logged? %> - <%= link_to( l(:label_forum_new), new_forum_path, :class => 'icon icon-add') %> - <% end %> - - -
        - - <%= link_to request.host()+"/forums", forums_path %> - - - <%= link_to l(:field_homepage), home_path %> > - <%= link_to "公共贴吧", forums_path %> -
        -
        -<% if @forums.size > 0 %> - <%= render :partial => 'forums/forum_list', :locals => {:forums => @forums} %> -<% else %> - <%= render :partial => "layouts/no_content" %> -<% end %> +<%= javascript_include_tag 'new_user' %> +<%= stylesheet_link_tag 'public'%> + + +
        +
        +
        + +
        + <%= render :partial => 'post_banner' ,:locals => {:order_type=>@type,:order_str=>@str}%> + + + + + + +
        +
        + <%= render :partial => 'forum_list',:locals => {:forums=>@forums}%> +
        +
          + <%= pagination_links_full @forums_pages, @forums_count ,:per_page_links => true,:remote =>true,:flag=>true%> +
        +
        +
        +
        +
        diff --git a/app/views/forums/index.js.erb b/app/views/forums/index.js.erb new file mode 100644 index 000000000..642c3c20a --- /dev/null +++ b/app/views/forums/index.js.erb @@ -0,0 +1,4 @@ +//$("#postBanner").html("<%#= render :partial => 'post_banner' ,:locals => {:order_type=>@type,:order_str=>@str }%>"); +$("#forum_list").html("<%= escape_javascript(render :partial => 'forum_list',:locals => {:forums=>@forums}) %>"); +//这里出现一个问题竟然是单双引号引起的。注意!! +$("#pages").html('<%= pagination_links_full @forums_pages, @forums_count,:per_page_links => false,:remote =>true,:flag=>true%>'); \ No newline at end of file diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index 24aa74c23..48ac057a0 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -1,42 +1,144 @@ - -
        -

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

        - <% if User.current.logged? %> - <%= labelled_form_for(@memo, :url => create_memo_forum_path(@forum), :html => {:multipart => true} ) do |f| %> -
        - <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> -

        - <%= f.text_field :subject, :required => true, :maxlength => 50%> -

        -

        - <%= f.kindeditor :content, :required => true %> -

        - -

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

        -

        - <%= l(:label_attachment_plural) %> -
        - <%= render :partial => 'attachments/form', :locals => {:container => @memo} %> -

        -
        - <%= f.submit :value => l(:label_memo_create) %> - <%= link_to l(:button_cancel), "#", :onclick => '$("#add-memo").hide(); return false;' %> -
        - <% end %> - <% end %> +<%= javascript_include_tag 'new_user' %> + +
        + + +
        + <%= render :partial => 'show_topics',:locals => {:memos=>@memos}%> +
        +
          + <%= pagination_links_full @topic_pages, @topic_count ,:per_page_links => true, :remote => true, :flag => true %> +
        + + + + + + + + + + +
        - - - <%= link_to(image_tag('edit.png')+l(:label_forum_edit),{:action => 'edit', :id => @forum}, :method => 'get', :title => l(:button_edit)) if @forum.editable_by?(User.current) %> - <%= link_to(image_tag('delete.png')+'删除讨论区', {:action => 'destroy', :id => @forum}, :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete) - ) if @forum.destroyable_by?(User.current) %> - - - <%= link_to l(:label_memo_new_from_forum), new_forum_memo_path(@forum), :class => 'icon icon-add', - :onclick => 'showAndScrollTo("add-memo", "memo_subject"); return false;' if User.current.logged? %> - -<%= render :partial => 'forums/show_topics', :locals => {:memos => @memos} %> +
        \ No newline at end of file diff --git a/app/views/forums/show.js.erb b/app/views/forums/show.js.erb new file mode 100644 index 000000000..9e36215ac --- /dev/null +++ b/app/views/forums/show.js.erb @@ -0,0 +1,2 @@ +$("#topics_list").html("<%= escape_javascript(render :partial => 'show_topics',:locals => {:memos=>@memos})%>") +$("#pages").html('<%= pagination_links_full @topic_pages, @topic_count,:per_page_links => false,:remote =>true%>'); \ No newline at end of file diff --git a/app/views/homework_common/_homework_detail_manual_form.html.erb b/app/views/homework_common/_homework_detail_manual_form.html.erb deleted file mode 100644 index 59294f82d..000000000 --- a/app/views/homework_common/_homework_detail_manual_form.html.erb +++ /dev/null @@ -1,110 +0,0 @@ -
          -
        • - - -

          -
        • -
          -
        • - -
          - <% if edit_mode %> - <%= f.kindeditor :description,:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %> - <% else %> - <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - <%= f.kindeditor :description,:editor_id => 'homework_description_editor' %> - <% end %> -
          -
        • -
          -
        • - - <%= render :partial => 'attachments/new_form', :locals => {:container => homework} %> -
        • -
          -
        • - - - <%= calendar_for('homework_end_time')%> -
          -
        • - -
          -
        -
        -

        基本规则设置(总分为100分)

        -
        -
          -
        • - - <%#= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %> - -  分 -
          -
        • -
        • - - <%= f.check_box :homework_type, :class => "mb10 mt5 fl" %> -
          -
        • -
        • - - <%= select_tag :ta_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.ta_proportion), {:class => "fl mb10 h26 w70"} %> - × 教辅评分 -   +   - - × 匿评得分 - = 学生得分 -
          -
        • -
        • - - 如果教师对学生作品进行了评分,则教师评分为学生最终得分。 -
          -
        • -
        -
        - -
        -

        学生互评设置

        -
        -
          -
        • - - - <%= calendar_for('evaluation_start_time')%> -
          -
        • -
        • - - - <%= calendar_for('evaluation_end_time')%> -
          -
        • -
        • - - -

          每个学生将收到 3 份待匿评作品

          -
          -
        • - -
        • - - <%= select_tag :absence_penalty,options_for_select(absence_penalty_option,homework.homework_detail_manual.absence_penalty), {:class => "fl mb10 h26 w70"} %> -  分 -

          学生漏评1个作品将扣 <%= homework.homework_detail_manual.absence_penalty%> 

          -
          -
        • -
        -
        \ No newline at end of file diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb deleted file mode 100644 index 829905327..000000000 --- a/app/views/homework_common/_homework_detail_programing_form.html.erb +++ /dev/null @@ -1,193 +0,0 @@ -
          -
        • - - -

          -
        • -
          -
        • - -
          - <% if edit_mode %> - <%= f.kindeditor :description,:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %> - <% else %> - <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - <%= f.kindeditor :description,:editor_id => 'homework_description_editor' %> - <% end %> -
          -
        • -
          -
        • - - <%= render :partial => 'attachments/new_form', :locals => {:container => homework} %> -
        • -
          -
        • - - - <%= calendar_for('homework_end_time')%> -
          -
        • - - -
        • - - <%#= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %> - -  分 -
          -
        • -
        - -
        -
        -

        编程评测设置

        -
        -
          -
        • - - <%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70",:onchange => "homework_language_change($(this));"} %> -
          -
        • - -
        • - - <%= select_tag :ta_proportion,options_for_select(ta_proportion_option,homework.homework_detail_programing.ta_proportion), {:class => "fl mb10 h26 w70"} %> - × 教辅评分 -   +   - - × 系统评分 - = 学生得分 -
          -
        • -
        • - - 如果教师对学生作品进行了评分,则教师评分为学生最终得分。 -
          -
        • - -
        • - - -
          -
        • - - <% if edit_mode %> - <% homework.homework_tests.each do |homework_test|%> -
          -
        • - - -
        • -
        • - - -
        • -
        • - - - <% if homework_test.result && !homework_test.result.to_s.empty?%> - <% if homework_test.result == 0%> - 正确 - <% else%> - 错误 - <% end%> - <% else%> - 测试 - <% end%> - -
        • -
          -
          - <% end%> - <% else %> -
          -
        • - - -
        • -
        • - - -
        • -
        • - - - 测试 - -
        • -
          -
          - <% end %> - - "> - - - - - - -
          - 错误信息: - - <% if homework.homework_tests.first && homework.homework_tests.first && homework.homework_tests.first.error_msg %> - <%= homework.homework_tests.first.error_msg%> - <% end%> -
          -
        -
        - - \ No newline at end of file diff --git a/app/views/homework_common/_new_homework_detail_manual_form.html.erb b/app/views/homework_common/_new_homework_detail_manual_form.html.erb deleted file mode 100644 index 7fb728ad0..000000000 --- a/app/views/homework_common/_new_homework_detail_manual_form.html.erb +++ /dev/null @@ -1,74 +0,0 @@ -
        -
        -
        -
        发布作业
        -
        -
        -
        - -
        -
        - 导入作业 - -
        - -
        -
        -
        -
        - <% if edit_mode %> - <%= f.kindeditor :description,:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %> - <% else %> - <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - <%= f.kindeditor :description,:editor_id => 'homework_description_editor' %> - <% end %> -
        -
        - -
        - - -
        - 高级功能 -
        -
        -
        - -
        - 发布 - <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'fr mr10 mt3'%> -
        -
        -
        -
        - -
        - - - diff --git a/app/views/homework_common/_set_evalutation_att.html.erb b/app/views/homework_common/_set_evalutation_att.html.erb new file mode 100644 index 000000000..01d9351ee --- /dev/null +++ b/app/views/homework_common/_set_evalutation_att.html.erb @@ -0,0 +1,53 @@ +
        + <%= form_for('new_form',:url => {:controller => 'homework_common',:action => 'set_evaluation_attr',:homework => @homework.id},:method => "post",:remote => true) do |f|%> + 匿评设置 +
        + +
        + 开启匿评 +
        + + <%= calendar_for('evaluation_start_time')%> +
        +
        +

        +
        +
        + +
        + 关闭匿评 +
        + + <%= calendar_for('evaluation_end_time')%> +
        +
        +

        +
        +
        + +
        + 匿评人数 + +
        +

        +
        +
        + +
        + 禁用匿评 + + 禁用后将无法进行学生互评 +
        +
        + +
        +
        + 确定 +
        +
        + 取消 +
        +
        +
        + <% end%> +
        \ No newline at end of file diff --git a/app/views/homework_common/alert_anonymous_comment.js.erb b/app/views/homework_common/alert_anonymous_comment.js.erb index 2b3248dc2..1c354aa45 100644 --- a/app/views/homework_common/alert_anonymous_comment.js.erb +++ b/app/views/homework_common/alert_anonymous_comment.js.erb @@ -3,5 +3,4 @@ showModal('ajax-modal', '500px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); -$('#ajax-modal').parent().css("top","").css("left",""); -$('#ajax-modal').parent().addClass("anonymos"); \ No newline at end of file +$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed"); \ No newline at end of file diff --git a/app/views/homework_common/edit.html.erb b/app/views/homework_common/edit.html.erb index 5b65b5982..5fc11728b 100644 --- a/app/views/homework_common/edit.html.erb +++ b/app/views/homework_common/edit.html.erb @@ -1,24 +1,24 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> -<%= error_messages_for 'homework_common' %> - -
        -

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

        + +
        +
        编辑作业
        -
        - <%if @homework.homework_type == 2%> - <%= form_for @homework do |f| %> - <%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %> - 提交 - <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> - <% end%> - <% else %> - <%= form_for @homework do |f| %> - <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %> - 提交 - <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> - <% end%> - <% end%> -
        + + +
        + <%= form_for @homework do |f| %> + +
        + <%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %> +
        + <% end%> +
        diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index bbf4aa343..8799bcab9 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -25,9 +25,9 @@ ( <%= link_to homework.student_works.count, student_work_index_path(:homework => homework.id), :class => 'c_red'%> )

        <% if @is_teacher%> + <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework,:is_in_course => 1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %> + <%= link_to(l(:button_edit),edit_homework_common_path(homework,:is_in_course => 1), :class => "fr mr10 work_edit ml10") %> <%= homework_anonymous_comment(homework)%> - <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %> - <%#= link_to(l(:button_edit),edit_homework_common_path(homework), :class => "fr mr10 work_edit") %> <% elsif @is_student%> <%= student_anonymous_comment homework %> <%= student_new_homework homework %> @@ -37,7 +37,7 @@ $(function(){if($("#bid_description_<%= homework.id%>_content").height()>360){$("#bid_show_more_des_button<%= homework.id%>").show();}});
        -
        +
        <%= homework.description.html_safe %>
        @@ -78,11 +78,7 @@
        开发语言:
        - <% if homework.homework_detail_programing.language.to_i == 1%> - C - <% elsif homework.homework_detail_programing.language.to_i == 2%> - C++ - <% end%> + <%= homework.language_name%>
        @@ -98,17 +94,17 @@
        <% end%> -
        + <%= l(:label_end_time)%>:<%= homework.end_time%> <% if betweentime(homework.end_time) < 0 %> diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb deleted file mode 100644 index 6fc0fff0e..000000000 --- a/app/views/homework_common/new.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> -<%= error_messages_for 'homework_common' %> -
        -

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

        -
        -
        - <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> - <%= 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 '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> - <% end%> -
        -
        diff --git a/app/views/homework_common/next_step.html.erb b/app/views/homework_common/next_step.html.erb deleted file mode 100644 index 7ed852fea..000000000 --- a/app/views/homework_common/next_step.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> -<%= error_messages_for 'homework_common' %> -
        -

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

        -
        -<% if @homework_type == "1"%> -
        - <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> - <%= 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 '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> - <% end%> -
        -<% elsif @homework_type == "2"%> -
        - <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> - <%= hidden_field_tag "course",@course.id%> - <%= 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 '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> - <% end%> -
        -
        -<% end%> \ No newline at end of file diff --git a/app/views/homework_common/set_evaluation_attr.js.erb b/app/views/homework_common/set_evaluation_attr.js.erb new file mode 100644 index 000000000..d6ab73df5 --- /dev/null +++ b/app/views/homework_common/set_evaluation_attr.js.erb @@ -0,0 +1 @@ +clickCanel(); \ No newline at end of file diff --git a/app/views/homework_common/start_anonymous_comment.js.erb b/app/views/homework_common/start_anonymous_comment.js.erb index 5f27a5b82..b0424bf7a 100644 --- a/app/views/homework_common/start_anonymous_comment.js.erb +++ b/app/views/homework_common/start_anonymous_comment.js.erb @@ -1,6 +1,6 @@ <% if @statue == 1%> alert('启动成功'); -$("#<%= @homework.id %>_start_anonymous_comment").replaceWith('<%= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "fr mr10 work_edit")%>'); +$("#<%= @homework.id %>_start_anonymous_comment").replaceWith('<%= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "postOptionLink")%>'); <% elsif @statue == 2 %> alert('启动失败\n作业总数大于等于2份时才能启动匿评'); <% elsif @statue == 3%> diff --git a/app/views/homework_common/start_evaluation_set.js.erb b/app/views/homework_common/start_evaluation_set.js.erb new file mode 100644 index 000000000..9d494f908 --- /dev/null +++ b/app/views/homework_common/start_evaluation_set.js.erb @@ -0,0 +1,6 @@ +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att') %>'); +showModal('ajax-modal', '350px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + +""); +$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed"); \ No newline at end of file diff --git a/app/views/homework_common/stop_anonymous_comment.js.erb b/app/views/homework_common/stop_anonymous_comment.js.erb index 9a6131c64..4725d5731 100644 --- a/app/views/homework_common/stop_anonymous_comment.js.erb +++ b/app/views/homework_common/stop_anonymous_comment.js.erb @@ -1,2 +1,2 @@ -$("#<%= @homework.id %>_stop_anonymous_comment").replaceWith('匿评结束'); +$("#<%= @homework.id %>_stop_anonymous_comment").replaceWith(''); alert('关闭成功'); \ No newline at end of file diff --git a/app/views/issues/_action_menu.html.erb b/app/views/issues/_action_menu.html.erb index 2643c93e7..ae2a848e0 100644 --- a/app/views/issues/_action_menu.html.erb +++ b/app/views/issues/_action_menu.html.erb @@ -3,4 +3,4 @@ <%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'talk_edit fr' if User.current.allowed_to?(:add_issues, @project) %> <%= link_to l(:button_delete), issue_path(@issue.id), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'talk_edit fr' if User.current.allowed_to?(:delete_issues, @project) %> <%= link_to l(:button_edit), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("all_attributes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %> -<%= link_to l(:label_user_newfeedback), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:add_issue_notes, @project) %> +<%= link_to l(:label_user_newfeedback), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("update", "issue_journal_kind_reply"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:add_issue_notes, @project) %> diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb index 68bd9f82c..54cb85212 100644 --- a/app/views/issues/_attributes.html.erb +++ b/app/views/issues/_attributes.html.erb @@ -6,12 +6,11 @@
      • <% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %> - <%= f.select :status_id, - (@allowed_statuses.collect { |p| [p.name, p.id] }), - {:no_label => true}, - # ajax 刷新 - #:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')", - :class => "w150" %> + <%= f.select :status_id, (@allowed_statuses.collect { |p| [p.name, p.id] }), + {:no_label => true}, + # ajax 刷新 + #:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')", + :class => "w150" %> <% else %> <%= h(@issue.status.name) %> <% end %> @@ -20,10 +19,9 @@
      • <% if @issue.safe_attribute? 'priority_id' %> - <%= f.select :priority_id, - (@priorities.collect { |p| [p.name, p.id] }), - {:required => true, :no_label => true}, :disabled => !@issue.leaf?, - :class => "w150" %> + <%= f.select :priority_id, (@priorities.collect { |p| [p.name, p.id] }), + {:required => true, :no_label => true}, :disabled => !@issue.leaf?, + :class => "w150" %> <% end %>
      • @@ -32,8 +30,8 @@ <% if @issue.safe_attribute? 'assigned_to_id' %> <%= f.select :assigned_to_id, principals_options_for_select(@issue.assignable_users, @issue.assigned_to), - {:required => @issue.required_attribute?('assigned_to_id'), :no_label => true}, - :class => "w150" %> + {:required => @issue.required_attribute?('assigned_to_id'), :no_label => true}, + :class => "w150" %> <% end %>
        @@ -41,8 +39,8 @@ <% if @issue.safe_attribute?('fixed_version_id') && @issue.assignable_versions.any? %> <%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), - {:include_blank => true, :required => @issue.required_attribute?('fixed_version_id'), :no_label => true}, - :class => "w150" %> + {:include_blank => true, :required => @issue.required_attribute?('fixed_version_id'), :no_label => true}, + :class => "w150" %> <%#= link_to(image_tag('add.png', :style => 'vertical-align: middle;'), new_project_version_path(@issue.project), :remote => true, @@ -60,11 +58,7 @@
      • <% if @issue.safe_attribute? 'start_date' %> - <%= f.text_field :start_date, - :size => 22, - :disabled => !@issue.leaf?, - :no_label => true, - :required => @issue.required_attribute?('start_date') %> + <%= f.text_field :start_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true, :required => @issue.required_attribute?('start_date') %> <%= calendar_for('issue_start_date', 'start_date') if @issue.leaf? %> <% end %>
      • @@ -72,10 +66,7 @@
      • <% if @issue.safe_attribute? 'due_date' %> - <%= f.text_field :due_date, :size => 22, - :disabled => !@issue.leaf?, - :no_label => true, - :required => @issue.required_attribute?('due_date') %> + <%= f.text_field :due_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true, :required => @issue.required_attribute?('due_date') %> <%= calendar_for('issue_due_date', 'start_date') if @issue.leaf? %> <% end %>
      • @@ -83,10 +74,7 @@
      • <% if @issue.safe_attribute? 'estimated_hours' %> - <%= f.text_field :estimated_hours, :size => 22, - :disabled => !@issue.leaf?, - :no_label => true, - :required => @issue.required_attribute?('estimated_hours') %> + <%= f.text_field :estimated_hours, :size => 22, :disabled => !@issue.leaf?, :no_label => true, :required => @issue.required_attribute?('estimated_hours') %> <%= l(:field_hours) %> <% end %>
      • @@ -94,9 +82,9 @@
      • <% if @issue.safe_attribute?('done_ratio') && @issue.leaf? && Issue.use_field_for_done_ratio? %> <%= f.select :done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }), - {:required => @issue.required_attribute?('done_ratio'), :no_label => true}, - :onchange => "PrecentChange(this.value)", - :class => "w150" %> + {:required => @issue.required_attribute?('done_ratio'), :no_label => true}, + :onchange => "PrecentChange(this.value)", + :class => "w150" %> <% end %>
      • diff --git a/app/views/issues/_attributes_show.html.erb b/app/views/issues/_attributes_show.html.erb new file mode 100644 index 000000000..7b9e2bedf --- /dev/null +++ b/app/views/issues/_attributes_show.html.erb @@ -0,0 +1,52 @@ + +
        + <%= issue_fields_rows do |rows| %> +
          +
        •  状态  : 

          <%= @issue.status.name %>

          +
        • +
          + <% unless @issue.disabled_core_fields.include?('assigned_to_id') %> +
        •  指派给  : 

          <%= @issue.assigned_to ? link_to_isuue_user(@issue.assigned_to) : "--" %> +
        • + <% end %> +
          +
        +
          +
        •  优先级  : 

          <%= @issue.priority.name %> +
        • +
          + <% unless @issue.disabled_core_fields.include?('done_ratio') %> +
        •  % 完成  : 

          <%= @issue.done_ratio %>% +
        • + <% end %> +
          +
        +
          + <% unless @issue.disabled_core_fields.include?('start_date') %> +
        •  开始  : 

          <%= format_date(@issue.start_date) %>

          +
        • + <% end %> +
          + <% unless @issue.disabled_core_fields.include?('estimated_hours') %> +
        •  周期  : 

          <%= l_hours(@issue.estimated_hours) %> +
        • + <% end %> +
          +
        +
          + <% unless @issue.disabled_core_fields.include?('due_date') %> +
        •  计划完成  : 

          <%= format_date(@issue.due_date)? format_date(@issue.due_date) : "--" %> +
        • + <% end %> +
          + <% unless @issue.disabled_core_fields.include?('fixed_version_id') %> +
        •  目标版本  : 

          <%= (@issue.fixed_version ? link_to_version(@issue.fixed_version, :class => "pro_info_p") : "--") %> +
        • + <% end %> +
          +
        + <% end %> + <%#= render_custom_fields_rows(@issue) %> + <%#= call_hook(:view_issues_show_details_bottom, :issue => @issue) %> +
        + \ No newline at end of file diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index 1f3f984b4..f6b41f36d 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -1,3 +1,4 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> <%= labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true} do |f| %> <%= error_messages_for 'issue', 'time_entry' %> <%= render :partial => 'conflict' if @conflict %> @@ -6,24 +7,20 @@ - <% end %> - - <% if @journals.present? %>
        <%= render :partial => 'history', :locals => {:issue => @issue, :journals => @journals} %>
        <% end %> -
        +
        + +
        回复 - <%= f.text_area :notes, :style => "width:99%;", :rows => "5", :no_label => true %> + <%= f.kindeditor :notes, :style => "width:99%;",:height=>'100px', :cssData =>"blockquote { padding:0px}", :rows => "5", :no_label => true, :editor_id=>'issue_journal_kind_reply' %>
        diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index 41fca87eb..0d5c876f1 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -28,11 +28,7 @@
      • <% if @issue.safe_attribute? 'subject' %> - <%= f.text_field :subject, - :class => "w576", - :maxlength => 255, - :style => "font-size:small", - :no_label => true %> + <%= f.text_field :subject, :class => "w576", :maxlength => 255, :style => "font-size:small", :no_label => true %> <%= javascript_tag do %> observeAutocompleteField('issue_subject', @@ -53,13 +49,7 @@ <%= f.label_for_field :description, :required => @issue.required_attribute?('description'), :no_label => true, :class => "label" %> <%#= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %> <%#= content_tag 'span', :id => "issue_description_and_toolbar" do %> - <%= f.kindeditor :description,:editor_id => "issue_desc_editor", - # :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min), - # :accesskey => accesskey(:edit), - # :class => "w583", - :width=>'87%', - :resizeType => 0, - :no_label => true %> + <%= f.kindeditor :description,:editor_id => "issue_desc_editor", :width=>'87%', :resizeType => 0, :no_label => true %> <%# end %> <%#= wikitoolbar_for 'issue_description' %> <% end %> @@ -68,13 +58,13 @@
  • - <% if @copy_from && @copy_from.attachments.any? %> -

    + <%# if @copy_from && @copy_from.attachments.any? %> + -

    - <% end %> + + <%# end %> <% if @copy_from && !@copy_from.leaf? %>

    diff --git a/app/views/issues/_form_custom_fields.html.erb b/app/views/issues/_form_custom_fields.html.erb index 4da98eb13..c97244902 100644 --- a/app/views/issues/_form_custom_fields.html.erb +++ b/app/views/issues/_form_custom_fields.html.erb @@ -1,13 +1,13 @@

    -
    -<% i = 0 %> -<% split_on = (@issue.custom_field_values.size / 2.0).ceil - 1 %> -<% @issue.editable_custom_field_values.each do |value| %> -

    <%= custom_field_tag_with_label :issue, value, :required => @issue.required_attribute?(value.custom_field_id) %>

    -<% if i == split_on -%> -
    -<% end -%> -<% i += 1 -%> -<% end -%> -
    +
    + <% i = 0 %> + <% split_on = (@issue.custom_field_values.size / 2.0).ceil - 1 %> + <% @issue.editable_custom_field_values.each do |value| %> +

    <%= custom_field_tag_with_label :issue, value, :required => @issue.required_attribute?(value.custom_field_id) %>

    + <% if i == split_on -%> +
    + <% end -%> + <% i += 1 -%> + <% end -%> +
    diff --git a/app/views/issues/_history.html.erb b/app/views/issues/_history.html.erb index 68e991594..8befaf37e 100644 --- a/app/views/issues/_history.html.erb +++ b/app/views/issues/_history.html.erb @@ -12,9 +12,9 @@

    <% if journal.details.any? %> <% details_to_strings(journal.details).each do |string| %> -

    <%= string %>

    +

    <%= string.html_safe %>

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

  • diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index efa5750c2..7c56aea6e 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -1,3 +1,3 @@ -$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>"); +$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id,:first_user_activity =>@first_user_activity,:page => @page}) %>"); -init_KindEditor_data(<%= @user_activity_id%>); \ No newline at end of file +init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); \ No newline at end of file diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 01cbea1c1..0eb779a23 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -12,6 +12,7 @@
    <%= link_to image_tag(url_to_avatar(@issue.author), :width => 46, :height => 46), user_path(@issue.author), :class => "ping_dispic" %>
    +

    @@ -20,104 +21,53 @@


    -

    <%= @issue.author %> - <%# if @issue.created_on != @issue.updated_on %> - 添加于 <%= format_time(@issue.created_on).html_safe %> - <%# else %> - <%#= format_time(@issue.updated_on).html_safe %> - <%# end %> + 由<%= @issue.author %>添加于 <%= format_time(@issue.created_on).html_safe %>

    + 'action_menu' %>
    -
    - <% if @issue.description? || @issue.attachments.any? -%> + <% if @issue.description? || @issue.attachments.any? -%> +
    <% if @issue.description? %> <%#= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %> <%= textAreailizable @issue, :description, :attachments => @issue.attachments %> <% end %> -
    -
    - - - <%= link_to_attachment_project @issue, :thumbnails => true %>
    - <% end -%> - <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> -
    -
    - -
    - <%= issue_fields_rows do |rows| %> -
      -
    •  状态  : 

      <%= @issue.status.name %>

      -
    • -
      - <% unless @issue.disabled_core_fields.include?('assigned_to_id') %> -
    •  指派给  : 

      <%= @issue.assigned_to ? link_to_isuue_user(@issue.assigned_to) : "--" %> -
    • - <% end %> -
      -
    -
      -
    •  优先级  : 

      <%= @issue.priority.name %> -
    • -
      - <% unless @issue.disabled_core_fields.include?('done_ratio') %> -
    •  % 完成  : 

      <%= @issue.done_ratio %>% -
    • - <% end %> -
      -
    +
    + <% end -%> + +
    + + + <%= link_to_attachment_project @issue, :thumbnails => true %>
    + <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> +
    +
    + + + <%= render :partial => 'attributes_show' %> + + + <%# 该应用是对issue主题内容的引用,对应:to => 'journals#new %> + + +
    +
    -
      - <% unless @issue.disabled_core_fields.include?('start_date') %> -
    •  开始  : 

      <%= format_date(@issue.start_date) %>

      -
    • - <% end %> -
      - <% unless @issue.disabled_core_fields.include?('estimated_hours') %> -
    •  周期  : 

      <%= l_hours(@issue.estimated_hours) %> -
    • - <% end %> -
      -
    -
      - <% unless @issue.disabled_core_fields.include?('due_date') %> -
    •  计划完成  : 

      <%= format_date(@issue.due_date)? format_date(@issue.due_date) : "--" %> -
    • - <% end %> -
      - <% unless @issue.disabled_core_fields.include?('fixed_version_id') %> -
    •  目标版本  : 

      <%= (@issue.fixed_version ? link_to_version(@issue.fixed_version, :class => "pro_info_p") : "--") %> -
    • - <% end %> -
      -
    - <% end %> - <%#= render_custom_fields_rows(@issue) %> - <%#= call_hook(:view_issues_show_details_bottom, :issue => @issue) %> -
    - -
    - <%= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'talk_edit fr' if authorize_for('issues', 'edit') %> -
    -
    + <% if @issue.editable? %>
    <%= render :partial => 'edit' %>

    - - - - + <%#--引用时不能修改,剥离出引用内容--%> + <%= l(:button_submit) %> <% end %> - <%#= submit_tag l(:button_submit) %> <%#= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue), 'issue-form' ,'preview',{:class => "blue_btn fr mr10"}%>
    @@ -128,6 +78,7 @@ <%= render :partial => 'changesets', :locals => {:changesets => @changesets} %>
    <% end %> +
    <% other_formats_links do |f| %> <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> diff --git a/app/views/journals/diff.html.erb b/app/views/journals/diff.html.erb index 190459b71..b842d87d0 100644 --- a/app/views/journals/diff.html.erb +++ b/app/views/journals/diff.html.erb @@ -1,8 +1,8 @@

    <%=h @issue.tracker %> #<%= @issue.id %>

    由<%= @journal.user %> 更新于 <%= format_time @journal.created_on %>

    -
    - <%= simple_format_without_paragraph @diff.to_html %> +
    + <%= @diff.to_html.gsub("<","<").gsub(">",">").gsub(""","\"").gsub("&gt;", ">").gsub("&lt;", "<").gsub("&quot;", "\"").html_safe %>

    <%= link_to l(:button_back), issue_path(@issue), :onclick => 'history.back(); return false;' %>

    diff --git a/app/views/journals/new.js.erb b/app/views/journals/new.js.erb index ae2574595..9c5d87079 100644 --- a/app/views/journals/new.js.erb +++ b/app/views/journals/new.js.erb @@ -1,10 +1,11 @@ -$('#issue_notes').val("<%= raw escape_javascript(@content) %>"); +issue_journal_kind_reply.html("<%= raw escape_javascript(@content) %>"); <% # when quoting a private journal, check the private checkbox - if @journal && @journal.private_notes? + if @journal && @journal.private_notes? %> $('#issue_private_notes').attr('checked', true); <% end %> +//quote_issue_journal() showAndScrollTo("update", "notes"); $('#notes').scrollTop = $('#notes').scrollHeight - $('#notes').clientHeight; diff --git a/app/views/layouts/_base_feedback.html.erb b/app/views/layouts/_base_feedback.html.erb index 07f852914..9fe25ce95 100644 --- a/app/views/layouts/_base_feedback.html.erb +++ b/app/views/layouts/_base_feedback.html.erb @@ -1,9 +1,9 @@ @@ -39,7 +39,7 @@ minStatue : true, skin : 'blue', durationTime : 1000 - } + }; var options = $.extend(defaults, options); this.each(function(){ @@ -56,13 +56,13 @@ if(options.minStatue == "true"){ $(".show_btn").css("float", options.float); sideContent.css('width', 0); - show_btn.css('width', 25); + show_btn.css('width', 29); } //close closeBtn.bind("click",function(){ sideContent.animate({width: '0px'},"fast"); - show_btn.stop(true, true).delay(300).animate({ width: '25px'},"fast"); + show_btn.stop(true, true).delay(300).animate({ width: '29px'},"fast"); cookiesave('minStatue','true','','',''); }); //show @@ -83,14 +83,10 @@ $(function(){ $("#button1").click(function(){ myTips("<%= l(:label_feedback_success) %>","success"); }); - }); function f_submit() { -// var subject = $("#memo_subject").val(); -// var content = $("#memo_content_1").val(); -// $("#memo_subject").val(subject+":"+ content.substr(0,18)+"..."); $("#new_memo").submit(); } @@ -169,15 +165,15 @@ function cookieget(n)
    <% get_memo %> - <% if @public_forum %> - <%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %> - <%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %> - <%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %> - <%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %> - - <%= l(:label_submit)%> - <% end %> - <% end %> + <% if @public_forum %> + <%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %> + <%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %> + <%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %> + <%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %> + + <%= l(:label_submit)%> + <% end %> + <% end %>
    -
    <%= l(:label_submit)%>
    +
    diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb index 812873045..752853c60 100644 --- a/app/views/layouts/_footer.html.erb +++ b/app/views/layouts/_footer.html.erb @@ -5,7 +5,7 @@
  • 服务协议|
  • <%= l(:label_surpport_group)%>|
  • -
  • <%= l(:label_forums)%>
  • +
  • <%= l(:label_forums)%>
  • diff --git a/app/views/layouts/_new_feedback.html.erb b/app/views/layouts/_new_feedback.html.erb index db0a3c3ee..136e49b37 100644 --- a/app/views/layouts/_new_feedback.html.erb +++ b/app/views/layouts/_new_feedback.html.erb @@ -30,6 +30,7 @@
    - 在线客服 + <%= l(:label_submit)%> +
    diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb index ae44bf0ac..fbc545607 100644 --- a/app/views/layouts/base.html.erb +++ b/app/views/layouts/base.html.erb @@ -8,11 +8,11 @@ <%= csrf_meta_tag %> <%= favicon %> -<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> +<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', 'nyan', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> <%= javascript_include_tag "jquery.leanModal.min" %> -<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> +<%= javascript_include_tag 'seems_rateable/jRating','prettify', 'seems_rateable/rateable'%> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index c2f159f28..fe0b5ef84 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -1,5 +1,5 @@ <%# course_model %> -<% teacher_num = teacherCount(@course) %> +<% teacher_num = searchTeacherAndAssistant(@course).count %> <% student_num = studentCount(@course) %> <% course_file_num = visable_attachemnts_incourse(@course).count%> <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> @@ -17,8 +17,8 @@ <%= javascript_heads %> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> - <%= stylesheet_link_tag 'public', 'leftside', 'jquery/jquery-ui-1.9.2', 'courses','header'%> - <%= javascript_include_tag "course","header","attachments" %> + <%= stylesheet_link_tag 'public', 'leftside', 'jquery/jquery-ui-1.9.2','prettify', 'courses','header'%> + <%= javascript_include_tag "course","header","attachments",'prettify' %> <%= yield :header_tags -%> @@ -33,36 +33,6 @@
    -
    -
    -

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

    -

    - <%= l(:label_user_location) %> : - <%= link_to l(:field_homepage), home_path %> - > - - <%=l(:label_courses_management_platform)%> - - > - <%= link_to @course.name, course_path(@course) %> -

    -
    - - - - - - - - - - -
    -
    @@ -77,7 +47,7 @@ <% if is_teacher%> <%= link_to "#{l(:button_configure)}".html_safe, {:controller => 'courses', :action => 'settings', :id => @course}, :class => "pr_join_a" %> <%= set_course_time @course%> - <%= link_to "#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %> + <%#= link_to "#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %> <% else%>
    <%= join_in_course_header(@course, User.current) %>
    <% end%> @@ -87,12 +57,12 @@
    <%= @course.name %> - <% if @course.is_public == 0%> + + <% if @course.is_public == 0%> <%= l(:field_is_private)%> - <% end %> - + <% end %>
    @@ -123,7 +93,7 @@
    - <%= render_flash_messages %> <%= yield %> - <%= call_hook :view_layouts_base_content %> + <%#= render_flash_messages %> + <%#= call_hook :view_layouts_base_content %>
    -
    +
    diff --git a/app/views/layouts/base_forums.html.erb b/app/views/layouts/base_forums.html.erb index 7cd0022ea..366291691 100644 --- a/app/views/layouts/base_forums.html.erb +++ b/app/views/layouts/base_forums.html.erb @@ -7,15 +7,128 @@ <%= csrf_meta_tag %> <%= favicon %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application','prettify', 'nyan','leftside', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> - <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> + <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'prettify' %> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> - <%= stylesheet_link_tag 'base','header', :media => 'all'%> + <%= stylesheet_link_tag 'base','header','new_user', :media => 'all'%> + @@ -28,82 +141,78 @@ <% end%>
    +
    +
    +
    +
    +
    <%= link_to image_tag(url_to_avatar(@forum.creator),:width=>75,:height => 75,:alt=>'贴吧图像' ),user_path( @forum.creator) %> + +
    +
    +
    <%= @forum.name%>
    + + +
    +
    +
    <%= @forum.description%> + <%if @forum.creator.id == User.current.id%> + + + <%= image_tag('signature_edit.png',{:width=>12,:height=>12})%> + + <%end%> +
    +
    +
    + <%= render :partial=>'forums/forum_tag_list',:locals=>{:forum=>@forum}%> +
    + <% if(@forum.creator.id == User.current.id)%> + + 添加标签 + <% end %> +
    +
    + <%if @forum.creator.id == User.current.id%> + + + 编辑贴吧 + 删除贴吧 + + + <% end %> +
    +
    +
    <%= link_to image_tag(url_to_avatar(User.current),:width=>50,:height => 50,:alt=>'贴吧图像' ),user_path( User.current) %>
    +
    我在贴吧
    +
    +
    + +
    +
    + +
    发帖
    +
    -
    -
    -
    -
    -
    - - - - - - - - - - -
    <%= l(:label_projects_community)%><%= l(:label_user_location) %> : - -
    <%= link_to request.host()+"/forums", forums_path %>

    <%=link_to l(:label_home),home_path %> > <%=link_to '公共贴吧', :controller => 'forums', :action => 'index' %> > <%=link_to @forum.name, forum_path(@forum) %>

    -
    - -
    +
    +
    +
    +
    + + <%= yield %> + <%#= call_hook :view_layouts_base_content %> +
    +
    +
    - <%= render_flash_messages %> - <%= yield %> - <%= call_hook :view_layouts_base_content %> -
    - -
    - <%#= render :partial => 'layouts/base_footer'%> -
    - - -
    -
    -
    <%= render :partial => 'layouts/footer' %>
    - <%= call_hook :view_layouts_base_body_bottom %> + <%#= call_hook :view_layouts_base_body_bottom %> diff --git a/app/views/layouts/base_memos.html.erb b/app/views/layouts/base_memos.html.erb index 2831d642e..02cdf4485 100644 --- a/app/views/layouts/base_memos.html.erb +++ b/app/views/layouts/base_memos.html.erb @@ -7,12 +7,12 @@ <%= csrf_meta_tag %> <%= favicon %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', 'nyan', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> - <%= javascript_include_tag "ckeditor/ckeditor.js" %> + <%= javascript_include_tag "ckeditor/ckeditor.js",'prettify' %> <%= yield :header_tags -%> <%= stylesheet_link_tag 'base','header', :media => 'all'%> diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 425b720d9..c9bc68c33 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -12,8 +12,8 @@ <%= favicon %> <%= javascript_heads %> <%= heads_for_theme %> - <%= stylesheet_link_tag 'public', 'pleft', 'project','jquery/jquery-ui-1.9.2','header' %> - <%= javascript_include_tag 'cookie','project', 'header','select_list_move' %> + <%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header' %> + <%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move' %> <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> @@ -21,7 +21,7 @@ - +
    -
    +
    @@ -103,15 +103,15 @@ 课程 <% if is_current_user%> <% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%> - <%=link_to "", new_course_path, :class => "homepageMenuSetting fr", :title => "新建课程"%> + <%=link_to "", new_course_path(:host=> Setting.host_course), :class => "homepageMenuSetting fr", :title => "新建课程"%> <% else%> <%=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:remote => true, :title => "加入课程"%> <% end%> <% end%>
    -
    + <% courses = @user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5)%> +
      - <% courses = @user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5)%> <%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %>
    @@ -119,18 +119,18 @@ 项目 <% if is_current_user%> - <%=link_to "", new_project_path, :class => "homepageMenuSetting fr", :title => "新建项目"%> + <%=link_to "", new_project_path(:host=> Setting.host_name), :class => "homepageMenuSetting fr", :title => "新建项目"%> <% end%>
    -
    + <% projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%> +
      - <% projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%> <%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :page => 0} %>
    - <%= link_to '留言',feedback_path(@user),:class=>'homepageMenuText'%> + <%= link_to '留言',feedback_path(@user, :host=> Setting.host_user),:class=>'homepageMenuText'%>
    @@ -195,8 +195,8 @@ 48px*48px
    - 取  消 - 确  定 + 取  消 + 确  定
    diff --git a/app/views/layouts/static_base.html.erb b/app/views/layouts/static_base.html.erb index b81b0755d..15dd9145b 100644 --- a/app/views/layouts/static_base.html.erb +++ b/app/views/layouts/static_base.html.erb @@ -7,10 +7,10 @@ <%= csrf_meta_tag %> <%= favicon %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan','prettify', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> - <%= javascript_include_tag "jquery.leanModal.min" %> + <%= javascript_include_tag "jquery.leanModal.min",'prettify' %> <%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> diff --git a/app/views/layouts/users_base.html.erb b/app/views/layouts/users_base.html.erb index e356c0560..6c1edbd1b 100644 --- a/app/views/layouts/users_base.html.erb +++ b/app/views/layouts/users_base.html.erb @@ -7,16 +7,16 @@ <%= csrf_meta_tag %> <%= favicon %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application', 'nyan','prettify', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> - <%= javascript_include_tag "jquery.leanModal.min" %> + <%= javascript_include_tag "jquery.leanModal.min" ,'prettify','avatars'%> <%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> - <%= stylesheet_link_tag 'base','header', :media => 'all'%> + <%= stylesheet_link_tag 'base','header','new_user' ,:media => 'all'%>
    @@ -29,27 +29,27 @@
    -
    -
    -
    - <%#=render :partial => 'layouts/base_header'%> -
    -
    + + + + + + <%= render_flash_messages %> <%= yield %> <%= call_hook :view_layouts_base_content %>
    -
    + -
    -
    + + -
    -
    + +
    <%= render :partial => 'layouts/footer' %> diff --git a/app/views/mailer/applied_project.html.erb b/app/views/mailer/applied_project.html.erb index 4f266e6ce..eb49c35b9 100644 --- a/app/views/mailer/applied_project.html.erb +++ b/app/views/mailer/applied_project.html.erb @@ -1,5 +1,11 @@ -<%= l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name) %> -
    - -

    <%= link_to(h(@project.name), @applied_url) %>

    +
    + +
    +
    diff --git a/app/views/mailer/applied_project.text.erb b/app/views/mailer/applied_project.text.erb index 7af8c2018..0dd3f308d 100644 --- a/app/views/mailer/applied_project.text.erb +++ b/app/views/mailer/applied_project.text.erb @@ -1,4 +1,7 @@ -<%= l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name) %> +<%= l(:mail_issue_content)%> +<%=link_to @user.show_name, user_url(@user) %> +<%=link_to @project.name, @applied_url %> + + -

    <%= link_to(h(@project.name), @applied_url) %>

    diff --git a/app/views/mailer/homework_endtime__added.html.erb b/app/views/mailer/homework_endtime__added.html.erb new file mode 100644 index 000000000..e639ab51a --- /dev/null +++ b/app/views/mailer/homework_endtime__added.html.erb @@ -0,0 +1,11 @@ +
    + +
    +
    \ No newline at end of file diff --git a/app/views/mailer/homework_endtime__added.text.erb b/app/views/mailer/homework_endtime__added.text.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/mailer/request_member_to_project.html.erb b/app/views/mailer/request_member_to_project.html.erb index 7c0d25dbb..c2da231a3 100644 --- a/app/views/mailer/request_member_to_project.html.erb +++ b/app/views/mailer/request_member_to_project.html.erb @@ -4,9 +4,9 @@
  • <%= l(:mail_issue_content)%> -

    <%= @invitor_name %> 邀请您加入项目:<%= @project_name %>

    +

    <%= @invitor_name %> 邀请您加入项目:<%=link_to @project_name, project_url(@project) %>

    -

    点击“同意加入”按钮,即可快速加入项目!


    +

    点击“同意加入”按钮,即可快速加入项目,查看项目相关信息!


    diff --git a/app/views/mailer/send_invite_in_project.html.erb b/app/views/mailer/send_invite_in_project.html.erb index ec559732f..54435e9ef 100644 --- a/app/views/mailer/send_invite_in_project.html.erb +++ b/app/views/mailer/send_invite_in_project.html.erb @@ -1,7 +1,5 @@ -
      -
    • <%= l(:mail_issue_content)%>

      <%= @subject %>

      @@ -9,13 +7,9 @@

      <%= link_to @project_url, @project_url%>

      您的账号为:<%= @email %>

      密码为: <%= @password %>

      - +

      为了您的账号安全,请勿将邮件信息告知他人!

    • -
    -
    -
    - - + \ No newline at end of file diff --git a/app/views/mailer/send_mail_anonymous_comment_close.html.erb b/app/views/mailer/send_mail_anonymous_comment_close.html.erb new file mode 100644 index 000000000..128f9fae8 --- /dev/null +++ b/app/views/mailer/send_mail_anonymous_comment_close.html.erb @@ -0,0 +1,10 @@ +
    +
      +
    • <%= l(:mail_issue_content)%> + +

      <%=link_to @author, user_url(@author) %> 发布的作业:<%=link_to @anonymous_comment_close_name, @anonymous_comment_close_url%> 已经关闭了匿评!

      +
      +
    • +
    +
    +
    \ No newline at end of file diff --git a/app/views/mailer/send_mail_anonymous_comment_close.text.erb b/app/views/mailer/send_mail_anonymous_comment_close.text.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/mailer/send_mail_anonymous_comment_open.html.erb b/app/views/mailer/send_mail_anonymous_comment_open.html.erb new file mode 100644 index 000000000..5409ade55 --- /dev/null +++ b/app/views/mailer/send_mail_anonymous_comment_open.html.erb @@ -0,0 +1,10 @@ +
    +
      +
    • <%= l(:mail_issue_content)%> + +

      <%=link_to @author, user_url(@author) %> 发布的作业:<%=link_to @anonymous_comment_close_name, @anonymous_comment_close_url%> 已经开启匿评了!

      +
      +
    • +
    +
    +
    \ No newline at end of file diff --git a/app/views/mailer/send_mail_anonymous_comment_open.text.erb b/app/views/mailer/send_mail_anonymous_comment_open.text.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/memos/_attachments_links.html.erb b/app/views/memos/_attachments_links.html.erb new file mode 100644 index 000000000..15473e6e7 --- /dev/null +++ b/app/views/memos/_attachments_links.html.erb @@ -0,0 +1,71 @@ +
    + <% for attachment in attachments %> + + + + <% if options[:length] %> + + <%= link_to_short_attachment attachment, :class => 'fl FilesName02', :download => true,:length => options[:length] -%> + (<%= number_to_human_size attachment.filesize , :precision => 0 %>) + <% if options[:deletable] %> + <%#= 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_short_attachment attachment, :class => 'fl FilesName02', :download => true, :length => 32 -%> + (<%= number_to_human_size attachment.filesize , :precision => 0 %>) + <% if options[:deletable] %> + <%#= 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 %> +
    + <% end %> + + <%# if attachment.is_text? %> + <%#= link_to image_tag('magnifier.png'), + :controller => 'attachments', + :action => 'show', + :id => attachment, + :filename => attachment.filename%> + <%# end %> + + + + + + + + + + + <%#= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author) %> + + + + + <% end %> + <% if defined?(thumbnails) && thumbnails %> + <% images = attachments.select(&:thumbnailable?) %> + <% if images.any? %> +
    + <% images.each do |attachment| %> +
    <%= thumbnail_tag(attachment) %>
    + <% end %> +
    + <% end %> + <% end %> +
    diff --git a/app/views/memos/_praise_tread.html.erb b/app/views/memos/_praise_tread.html.erb new file mode 100644 index 000000000..17af4b090 --- /dev/null +++ b/app/views/memos/_praise_tread.html.erb @@ -0,0 +1,36 @@ + + <% if User.current.logged? %> + <% if horizontal %> + +
    + <% @is_valuate = is_praise_or_tread(obj,user_id)%> + <% if @is_valuate.size > 0 %> + <% @flag = @is_valuate.first.praise_or_tread %> + <% if @flag == 1 %> + <%= get_praise_num(obj)%> + <% end %> + <% else %> + <% if user_id == obj.author_id %> + + + <%= get_praise_num(obj)%> + + <% else %> + + <%# if OptionNumber.get_user_option_number(user_id).nil? || OptionNumber.get_user_option_number(user_id).total_score < 2 %> + + <%#= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)), + :controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %> + <%= get_praise_num(obj)%> + + + + + + + + <% end %> + <% end %> +
    + <% end %> + <% end %> diff --git a/app/views/memos/edit.html.erb b/app/views/memos/edit.html.erb index 487d923b5..310cdb6ad 100644 --- a/app/views/memos/edit.html.erb +++ b/app/views/memos/edit.html.erb @@ -1,55 +1,58 @@ - -<% @replying = !@memo.parent.nil? %> -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> -

    <%=l(:label_memo_edit)%>

    -<%= labelled_form_for(@memo, :url => forum_memo_path(@memo.forum_id, @memo)) do |f| %> - <% if @memo.errors.any? %> -
    -

    - <%= pluralize(@memo.errors.count, "error") %> - prohibited this memo from being saved: -

    -
      - <% @memo.errors.full_messages.each do |msg| %> -
    • - <%= msg %> -
    • - <% end %> -
    -
    - <% end %> -
    -

    - <% if @memo.parent.nil? && @memo.children.first.nil? %> - <%#= f.text_field :subject, :required => true, :size => 96 ,:readonly => false, :maxlength => 50%> - <% else %> - <%#= f.text_field :subject, :required => true, :size => 96 ,:readonly => true, :style => "border: 1px solid gray", :maxlength => 50%> - <% end %> -

    - <% if User.current.admin?%> -

    - <% unless @replying %> - <% if @memo.safe_attribute? 'sticky' %> - <%= f.check_box :sticky %> - <%= label_tag 'memo_sticky', l(:label_board_sticky) %> - <% end %> - <% if @memo.safe_attribute? 'lock' %> - <%= f.check_box :lock %> <%= label_tag 'memo_locked', l(:label_board_locked) %> - <% end %> - <% end %> -

    - <% end %> -

    - <%= f.kindeditor :content, :required => true, :size => 80,:owner_id => @memo.id,:owner_type => 1 %> -

    - -

    - <%= l(:label_attachment_plural) %> -
    - <%= render :partial => 'attachments/form', :locals => {:container => @memo} %> -

    -
    -
    - <%= f.submit :value => l(:button_change) %>  <%= link_to l(:button_back), back_url ,:class => "button-canel",:style => "color: #ffffff;"%> +<%= javascript_include_tag 'new_user'%> + +
    +
    编辑帖子
    +
    +
    + <%= labelled_form_for(@memo, :url => forum_memo_path(@memo.forum_id, @memo),:html=>{:id=>'edit_memo'}) do |f| %> + +
    + +
    -<% end %> +
    + + +
    +
    + + <%= render :partial => 'forums/file_form', :locals => {:container => @memo} %> + + +
    +
    + <% end %> +
    + \ No newline at end of file diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 586279504..133a90547 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -1,188 +1,119 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor","forum" %> -<%= 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}%> - -
    -
    - <%= link_to image_tag(url_to_avatar(@memo.author), :class => "avatar"), user_path(@memo.author) %> -
    -

    - <%=link_to @memo.author.name, user_path(@memo.author) %> -

    -
    -
    -
    - - <%= link_to( - l(:button_quote), - {:action => 'quote', :id => @memo}, - :remote => true, - :method => 'get', - :title => l(:button_quote) - )if !@memo.locked? && User.current.logged? %> - - <%= link_to( - #image_tag('edit.png'), - l(:button_edit), - {:action => 'edit', :id => @memo}, - :method => 'get', - :title => l(:button_edit) - ) if @memo.editable_by?(User.current) %> - - <%= link_to( - l(:button_delete), - {:action => 'destroy', :id => @memo}, - :method => :delete, - :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:button_delete) - ) if @memo.destroyable_by?(User.current) %> -
    - -
     
    - -
    - <%= label_tag l(:field_subject) %>: - <%=h @memo.subject %> -
    -
    - <%= @memo.content.html_safe %> -

    - <% if @memo.attachments.any?%> - <% options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %> - <%= render :partial => 'attachments/links', :locals => {:attachments => @memo.attachments, :options => options, :is_float => true} %> - <% end %> -

    -
    -
    -
    - <%= authoring @memo.created_at, @memo.author %> -
    - -
    -
    -
    -
    -

    <%= l(:label_reply_plural) %> (<%= @replies.nil? ? 0 : @replies.size %>)

    - <% pages_count = @reply_pages.offset %> - <% @replies.each do |reply| %> -
    "> -

    -
    - - <%= link_to( - l(:button_quote), - {:action => 'quote', :id => reply}, - :remote => true, - :method => 'get', - :title => l(:button_quote) - )if !@memo.locked? && User.current.logged? %> - - <%= link_to( - #image_tag('edit.png'), - l(:button_edit), - {:action => 'edit', :id => reply}, - :title => l(:button_edit) - ) if reply.editable_by?(User.current) %> - - <%= link_to( - l(:button_delete), - {:action => 'destroy', :id => reply}, - :method => :delete, - :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:button_delete) - ) if reply.destroyable_by?(User.current) %> - -
    -
    - - - - - - - - -
    - <%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %> - -
    - <%=h sanitize(reply.content.html_safe) %> -
    -

    - <% if reply.attachments.any?%> - <% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %> - <%= render :partial => 'attachments/links', :locals => {:attachments => reply.attachments, :options => options, :is_float => true} %> - <% end %> -

    -
    - <%= authoring reply.created_at, reply.author %> -
    -
    - <% end %> - -
    - -<% if User.current.login? %> -
    - <%= render :partial => 'reply_box' %> -
    -<% else %> -
    - <%= l(:label_user_login_tips) %> - <%= link_to l(:label_user_login_new), signin_path %> -
    -
    -<% end %> - - - +
    +
    +
    + <%= link_to image_tag(url_to_avatar(@memo.author),:width=>50,:height => 50,:alt=>'贴吧图像' ),user_path(@memo.author) %> +
    +
    + <% if @memo.author.id == User.current.id%> +
    + +
    + <%end%> + + +
    <%= format_date( @memo.created_at)%>
    + + <%= render :partial => "memos/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%> + +
    +
    + <%= @memo.content.html_safe%> +
    +
    +
    + <% if @memo.attachments.any?%> + <% options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %> + <%= render :partial => 'attachments_links', :locals => {:attachments => @memo.attachments, :options => options, :is_float => true} %> + <% end %> +
    +
    +
    +
    +
    +
    +
    +
    回复(<%=@reply_count %>)
    +
    +
    + <% if @reply_count > 2%> + 点击展开更多回复 + <% end %> +
    +
    +
    + <% @replies.each_with_index do |reply,i| %> +
    +
    + <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
    +
    +
    <%= reply.author.name%><%= format_date(reply.created_at) %>
    +
    <%= reply.content.html_safe%>
    +
    +
    +
    + <% end %> +
    +
    +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
    +
    +
    + <%= form_for('memo',:url=>forum_memos_path,:method => "post") do |f|%> + <%= f.hidden_field :subject, :required => true, value: @memo.subject %> + <%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %> + <%= f.hidden_field :parent_id, :required => true, value: @memo.id %> + <%= hidden_field_tag :quote,"",:required => false,:style => 'display:none' %> + +
    + +
    +

    + <% end%> +
    +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/messages/reply.js.erb b/app/views/messages/reply.js.erb index 9d3d68855..4cd1a86d6 100644 --- a/app/views/messages/reply.js.erb +++ b/app/views/messages/reply.js.erb @@ -1,6 +1,6 @@ <%if @project%> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>"); + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:first_user_activity =>@first_user_activity,:page => @page}) %>"); <%elsif @course%> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>"); + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:first_user_activity =>@first_user_activity,:page => @page}) %>"); <%end%> -init_KindEditor_data(<%= @user_activity_id%>); \ No newline at end of file +init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); \ No newline at end of file diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 688d7e2ac..0e36d5fd9 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -213,6 +213,7 @@ <% occupation1 = User.current.user_extensions.occupation %> <% occupation = User.current.user_extensions.occupation %> <% title = User.current.user_extensions.technical_title %> + <% gender = User.current.user_extensions.gender %> <% language = User.current.language %> <% else %> <% province = "湖南省" %> @@ -510,6 +511,13 @@ } } } + function init_gender(pField, gender) { + for (var i=0; i" init_identity_and_title(document.getElementById('userIdentity'), identity, document.getElementById('userTechnical_title'), title, language); + //sex + var gender = "<%= "#{gender}" %>" + init_gender(document.getElementById('gender'), gender); + $("#userIdentity").change(); <% if( !@act.nil? && @act == 'password') %> $("#users_tb_2").click(); diff --git a/app/views/my/save_user_avatar.js.erb b/app/views/my/save_user_avatar.js.erb index 03608a768..1e24a4a7c 100644 --- a/app/views/my/save_user_avatar.js.erb +++ b/app/views/my/save_user_avatar.js.erb @@ -1,3 +1,3 @@ -$("#nh_user_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_tx',:style=>"width:90px;height:90px;overflow:hidden",:alt=>"头像") %>'); +$("#nh_user_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_tx',:style=>"width:78px;height:78px;overflow:hidden",:alt=>"头像") %>'); $("#nh_user_logo").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_logo',:width =>"40",:height => "40",:alt=>"头像") %>'); hideModal(); \ No newline at end of file diff --git a/app/views/news/_course_news_list.html.erb b/app/views/news/_course_news_list.html.erb index da963b3cd..74a70e33d 100644 --- a/app/views/news/_course_news_list.html.erb +++ b/app/views/news/_course_news_list.html.erb @@ -7,7 +7,7 @@ <% 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) %>: diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index f39eb8266..2d8dae59d 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -4,7 +4,7 @@
    <%= link_to image_tag(url_to_avatar(@news.author),:width => 42,:height => 42), user_path(@news.author), :class => "problem_pic fl" %> -
    +

    <%=h @news.title %>

    @@ -32,7 +32,8 @@ <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> <%= kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字"%>
    -

    +

    +

    <%= l(:label_cancel_with_space) %> @@ -48,9 +49,9 @@ <% comments.each do |comment| %> <% next if comment.new_record? %>

    -
    <%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author)%>
    +
    <%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author), :class => "problem_pic fl"%>
    -
    +
    <%= link_to_user_header(comment.author,false,:class => 'c_blue fb fl mb10 ') if comment.respond_to?(:author) %> <%= format_time(comment.created_on) %> @@ -76,4 +77,4 @@ <% end %> -<% html_title @news.title -%> +<% html_title @news.title -%> \ No newline at end of file diff --git a/app/views/news/_project_form.html.erb b/app/views/news/_project_form.html.erb index dfe1fb937..269420bfe 100644 --- a/app/views/news/_project_form.html.erb +++ b/app/views/news/_project_form.html.erb @@ -1,7 +1,7 @@ <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
  • - +

  • diff --git a/app/views/news/_project_news.html.erb b/app/views/news/_project_news.html.erb index 04fdb6dac..efbb74e46 100644 --- a/app/views/news/_project_news.html.erb +++ b/app/views/news/_project_news.html.erb @@ -1,3 +1,9 @@ + <% btn_tips = l(:label_news_new) label_tips = l(:label_news) @@ -25,7 +31,7 @@ <% @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_add_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" %>
    diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb index 6e94f0947..463b0f489 100644 --- a/app/views/news/_project_show.html.erb +++ b/app/views/news/_project_show.html.erb @@ -14,7 +14,7 @@
    <%= link_to image_tag(url_to_avatar(@news.author),:width => 42,:height => 42), user_path(@news.author), :class => "problem_pic fl" %> -
    +

    <%=h @news.title %>

    <%#= watcher_link(@news, User.current) %> <%= link_to(l(:button_edit), diff --git a/app/views/poll/_edit_head.html.erb b/app/views/poll/_edit_head.html.erb index 06e162f0d..8eebae5a2 100644 --- a/app/views/poll/_edit_head.html.erb +++ b/app/views/poll/_edit_head.html.erb @@ -22,3 +22,21 @@
    <% end%> + diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb index 1828ede6d..c03570072 100644 --- a/app/views/poll/_poll.html.erb +++ b/app/views/poll/_poll.html.erb @@ -30,13 +30,13 @@ <% if poll.polls_status == 1 %>
  • <%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml5"%>
  • <% else%> -
  • 编辑
  • +
  • 编辑
  • <% end%> <% if poll.polls_status == 2 %>
  • 关闭
  • <% else %> -
  • 关闭
  • +
  • 关闭
  • <% end%> <% if poll.polls_status == 1%> diff --git a/app/views/praise_tread/praise_plus.js.erb b/app/views/praise_tread/praise_plus.js.erb index d56ff0e68..30a53723e 100644 --- a/app/views/praise_tread/praise_plus.js.erb +++ b/app/views/praise_tread/praise_plus.js.erb @@ -1,4 +1,9 @@ - -$('#praise_tread_<%= @obj.id %>').html('<%= j( -render :partial => "/praise_tread/praise_tread",:locals => {:obj => @obj,:user_id => User.current.id,:horizontal => @horizontal} -)%>'); +<% if @obj_type == 'Memo'%> + $('#praise_tread_<%= @obj.id %>').html('<%= j( + render :partial => "/memos/praise_tread",:locals => {:obj => @obj,:user_id => User.current.id,:horizontal => @horizontal} + )%>'); +<% else %> + $('#praise_tread_<%= @obj.id %>').html('<%= j( + render :partial => "/praise_tread/praise_tread",:locals => {:obj => @obj,:user_id => User.current.id,:horizontal => @horizontal} + )%>'); +<% end %> diff --git a/app/views/projects/_form.html.erb b/app/views/projects/_form.html.erb index 1e3f4b620..4df254fd0 100644 --- a/app/views/projects/_form.html.erb +++ b/app/views/projects/_form.html.erb @@ -12,14 +12,6 @@

    <%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:0px;" %>

    -

    - <%#= f.text_field :enterprise_name, :size => 60, :style => "width:490px;" %> - - <%= select_tag :organization_id,options_for_select(project_organizations_id_option,@project.organization_id),{} %> -

    <%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH, value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %> diff --git a/app/views/projects/_form_new.html.erb b/app/views/projects/_form_new.html.erb new file mode 100644 index 000000000..c53c23d47 --- /dev/null +++ b/app/views/projects/_form_new.html.erb @@ -0,0 +1,28 @@ +<%# 这些代码删除也没什么影响,暂时放着,待优化 %> +<%= wikitoolbar_for 'project_description' %> + +<% @project.custom_field_values.each do |value| %> +

    + <%= custom_field_tag_with_label :project, value %> +

    +<% end %> +<%= call_hook(:view_projects_form, :project => @project, :form => f) %> +<% unless @project.identifier_frozen? %> + <% content_for :header_tags do %> + <%= javascript_include_tag 'project_identifier' %> + <% end %> +<% end %> + +<% if !User.current.admin? && @project.inherit_members? && @project.parent && User.current.member_of?(@project.parent) %> + <%= javascript_tag do %> + $(document).ready(function() { + $("#project_inherit_members").change(function(){ + if (!$(this).is(':checked')) { + if (!confirm("<%= escape_javascript(l(:text_own_membership_delete_confirmation)) %>")) { + $("#project_inherit_members").attr("checked", true); + } + } + }); + }); + <% end %> +<% end %> diff --git a/app/views/projects/create.js.erb b/app/views/projects/create.js.erb new file mode 100644 index 000000000..9bb447789 --- /dev/null +++ b/app/views/projects/create.js.erb @@ -0,0 +1,3 @@ +$("#project_id").replaceWith("<%= escape_javascript(select_tag :project_id, options_for_select(user_projects_option), {:class => "InputBox W680 fl"})%>"); +hideModal("#popbox02"); +alert("创建成功"); \ No newline at end of file diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb index 8c951a485..44c571422 100644 --- a/app/views/projects/invite_members_by_mail.html.erb +++ b/app/views/projects/invite_members_by_mail.html.erb @@ -31,9 +31,9 @@ $("#valid_email").text("<%= l(:label_email_format_error)%>"); return false; } - else if(email.split('@')[0].length >= 20) + else if(email.length > 25) { - $("#valid_email").text("邮箱名过长,最长为20个字符"); + $("#valid_email").text("邮箱名过长,最长为25个字符"); return false; } else @@ -85,7 +85,39 @@ <%= l(:label_send_email)%> <% end %> + <%# 邀请用户的状态 %> + <% unless @inviter_lists.blank? %> +
    +
    +
    项目成员邀请状态列表
    +
    +
    + <% @inviter_lists.each do |inviter_list| %> + + + <% if inviter_list.user != nil %> + + + + + + + <% end %> + +
    + <% if inviter_list.user.active? %> + <%=link_to inviter_list.user.name, user_path(inviter_list.user), :class => "c_eblue" %> + <% else %> + <%= inviter_list.user.name %> + <% end %> + <%= status_for_ivitied(inviter_list, @project) %>
    + <% end %> +
    +
    + <% end %> + + <% unless @inviter_lists.blank? %>
    <% unless @inviters_count.nil? %> diff --git a/app/views/projects/new.html.erb b/app/views/projects/new.html.erb index 98612b733..66d933adc 100644 --- a/app/views/projects/new.html.erb +++ b/app/views/projects/new.html.erb @@ -1,23 +1,112 @@ <% @nav_dispaly_project_label = 1 @nav_dispaly_forum_label = 1 %> +<%= error_messages_for 'project' %> +
    +

    <%= l(:label_project_new)%>

    +
    +
    +
      + <%= labelled_form_for @project do |f| %> +
    • + + + + + +
    • +
      +
    • + + <%= select_tag :project_new_type, options_for_select([["开发模式", "1"], ["研讨模式", "2"], ["圈子模式", "3"]]) %> + <%=l(:label_type_des_development) %> +
    • +
      +
    • + + +
      +
    • +
    • +

      + <%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH, + value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %> + <% unless @project.identifier_frozen? %> + + <%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> + <%= l(:text_project_identifier_info).html_safe %> + + <% end %>

      +
    • +
    • + + + (打钩为公开,不打钩则不公开,若不公开,仅项目成员可见该项目。) +
      +
    • +
    • +

      + <%= f.text_field :project_type, :value => 0 %> +

      +
    • +
    • + <%= render :partial => 'form_new', :locals => { :f => f } %> +
    • +
    • + 提交 + <%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%> +
      +
    • + <% end%> +
    +
    +
    -<%= labelled_form_for @project do |f| %> -
    - <%=l(:label_project_new)%> - - -
    -

    - <%=raw l(:label_project_new_description)%> -

    - <%= render :partial => 'form', :locals => { :f => f } %> - - <%= submit_tag l(:button_create), :class => "enterprise"%> - -
    - <%#= submit_tag l(:button_create_and_continue), :name => 'continue' %> - <%= javascript_tag "$('#project_name').focus();" %> -
    -<% end %> +<% html_title(l(:label_project_new)) -%> + + -<% html_title(l(:label_project_new)) -%> \ No newline at end of file diff --git a/app/views/projects/settings.html.erb b/app/views/projects/settings.html.erb index e70e20cef..3fc9a89d6 100644 --- a/app/views/projects/settings.html.erb +++ b/app/views/projects/settings.html.erb @@ -2,13 +2,15 @@ $(function(){ <%if @select_tab%> <%if @select_tab == "modules"%> - project_setting(2); + project_setting(2); + <% elsif @select_tab == "members"%> + project_setting(3); <% elsif @select_tab == "versions"%> - project_setting(4); - $("#pro_st_edit_ban").toggle(); + project_setting(4); + $("#pro_st_edit_ban").toggle(); <% elsif @select_tab == "repositories" %> - project_setting(6); - $("#pro_st_edit_ku").toggle(); + project_setting(6); + $("#pro_st_edit_ku").toggle(); <%else%> <% end%> <% end%> diff --git a/app/views/projects/settings/_new_edit.html.erb b/app/views/projects/settings/_new_edit.html.erb index a8998ece5..b38871a60 100644 --- a/app/views/projects/settings/_new_edit.html.erb +++ b/app/views/projects/settings/_new_edit.html.erb @@ -5,9 +5,8 @@ <%= render :partial=>"avatar/new_avatar_form",:locals=> {source:@project} %>
    -
  • - + @@ -15,25 +14,15 @@
  • - +
  • -
  • - - <%= select_tag :organization_id,options_for_select(project_organizations_id_option,@project.organization_id),{} %> -
  • -
  • >
  • -
  • - - > -
    -
  • 保存 <% end %> diff --git a/app/views/projects/settings/_new_repositories.html.erb b/app/views/projects/settings/_new_repositories.html.erb index be793a409..410bd8c32 100644 --- a/app/views/projects/settings/_new_repositories.html.erb +++ b/app/views/projects/settings/_new_repositories.html.erb @@ -59,7 +59,7 @@
    -<%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form',:method=>"post"} do |f| %> +<%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form',:method=>"post",:autocomplete=>'off'} do |f| %>
    • @@ -79,6 +79,8 @@
    • <% end %>
    • + + <%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false,:label=>"", :no_label => true %> <% unless @repository.identifier_frozen? %> @@ -87,7 +89,7 @@
    • - <%= f.password_field :upassword, :label=> "", :no_label => true %> + <%= f.password_field :upassword, :label=> "", :no_label => true%> <%= l(:label_upassword_info)%>
    • diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index f1b3d9b7b..22317dc91 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -24,7 +24,7 @@ <% if e.forge_act_type == "Issue" %>
      <%= image_tag(url_to_avatar(act.author), :width => "42", :height => "42") %> -
      +
      <%= h(e.project) if @project.nil? || @project.id != e.project_id %> <%= link_to act.author, user_path(act.author), :class => "problem_name c_orange fl" %> <%= l(:label_new_activity) %> : @@ -34,7 +34,7 @@ :id => act.id}, :class => "problem_tit fl fb " %>
      -

      <%= textAreailizable act,:description %>
      +

      <%= act.description.html_safe %>
      <%= l :label_activity_time %> :<%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %>

      @@ -51,7 +51,7 @@ <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.project_issues_index}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"}, :class => "problem_tit fl fb" %>
      -

      <%= textilizable act,:notes %>
      +

      <%= act.notes.html_safe %>
      <%= l :label_activity_time %> :<%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %>

      @@ -60,7 +60,7 @@ <% elsif e.forge_act_type == "Message" %>
      <%= 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) %> : @@ -79,7 +79,7 @@ <% elsif e.forge_act_type == "News" %>
      <%= 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) %> : diff --git a/app/views/student_work/_add_score_reply.html.erb b/app/views/student_work/_add_score_reply.html.erb index 2866b2da6..417d3d2c1 100644 --- a/app/views/student_work/_add_score_reply.html.erb +++ b/app/views/student_work/_add_score_reply.html.erb @@ -1,4 +1,5 @@ <%= form_for('', :remote => true, :method => :post,:url => add_score_reply_student_work_index_path(:score_id => score.id)) do |f|%> <%= f.text_area 'message', :class => 'ping_text', :placeholder => l(:text_caracters_maximum,:count=>250),:maxlength => 250 %> + 回复 <% end%> \ No newline at end of file diff --git a/app/views/student_work/_evaluation_student_work_title.html.erb b/app/views/student_work/_evaluation_student_work_title.html.erb deleted file mode 100644 index f19438f78..000000000 --- a/app/views/student_work/_evaluation_student_work_title.html.erb +++ /dev/null @@ -1,47 +0,0 @@ -
    • - 学号 -
    • -
    • - <%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> - <% if @show_all && @order == "name"%> - <%= link_to "",student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> - <% end%> -
    • -
    • - 作品名称 -
    • -
    • - <%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> - <% if @show_all && @order == "created_at"%> - <%= link_to "",student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> - <% end%> -
    • -
    • - <%= link_to "教师",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> - <% if @show_all && @order == "teacher_score"%> - <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> - <% end%> -
    • -
    • - <%= link_to "教辅",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> - <% if @show_all && @order == "teaching_asistant_score"%> - <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> - - <% end%> -
    • -
    • - <% if @homework.homework_type == 1%> - <%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> - <% elsif @homework.homework_type == 2%> - <%= link_to "系统",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> - <% end %> - <% if @show_all && @order == "student_score"%> - <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> - <% end%> -
    • -
    • - <%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> - <% if @show_all && @order == "score"%> - <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> - <% end%> -
    • \ No newline at end of file diff --git a/app/views/student_work/_evaluation_title.html.erb b/app/views/student_work/_evaluation_title.html.erb new file mode 100644 index 000000000..cfd9632c2 --- /dev/null +++ b/app/views/student_work/_evaluation_title.html.erb @@ -0,0 +1,15 @@ +
        +
      • + 作品名称 + 姓名 + 学号 +
      • + +
      • + 时间 +
      • + +
      • + 我的评分 +
      • +
      \ No newline at end of file diff --git a/app/views/student_work/_evaluation_un_title.html.erb b/app/views/student_work/_evaluation_un_title.html.erb new file mode 100644 index 000000000..9a21e109b --- /dev/null +++ b/app/views/student_work/_evaluation_un_title.html.erb @@ -0,0 +1,51 @@ +
        +
      • + 作品名称 + 姓名 + 学号 +
      • + +
      • + <%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml50" ,:remote => true%> + <% if @show_all && @order == "created_at"%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%> + <% end%> +
      • + +
      • + <%= link_to "教师",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10" ,:remote => true%> + <% if @show_all && @order == "teacher_score"%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%> + <% end%> +
      • + +
      • + <%= link_to "教辅",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10",:remote => true%> + <% if @show_all && @order == "teaching_asistant_score"%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%> + <% end%> +
      • + + <% if @homework.homework_type == 2%> +
      • + <%= link_to "系统",@show_all ? student_work_index_path(:homework => @homework.id,:order => "system_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10",:remote => true%> + <% if @show_all && @order == "system_score"%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "system_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%> + <% end%> +
      • + <% end%> + +
      • + <%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10",:remote => true%> + <% if @show_all && @order == "student_score"%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%> + <% end%> +
      • + +
      • + <%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10",:remote => true%> + <% if @show_all && @order == "score"%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%> + <% end%> +
      • +
      \ No newline at end of file diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb new file mode 100644 index 000000000..da2723636 --- /dev/null +++ b/app/views/student_work/_evaluation_un_work.html.erb @@ -0,0 +1,81 @@ + +
        +
      • +
          +
        • + <%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40"),user_activities_path(User.current.id))%> +
        • +
          +
        • + <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%> +
          + <%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%> +
          +
        • +
        • +
            +
          • + <%= student_work.user.show_name%> +
          • +
          • + <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> +
          • +
          +
        • +
          +
        +
      • +
      • + <%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>  + <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %> + [迟交] + <% end %> +
      • +
      • + <%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%> +
      • +
      • + <%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%> +
      • + + <% if @homework.homework_type == 2%> + +
      • + <%= student_work.system_score.nil? ? "--" : format("%.1f",student_work.system_score)%> +
      • + <% end%> + +
      • + <%= student_work.student_score.nil? ? "--" : format("%.1f",student_work.student_score)%> + <% unless student_work.student_score.nil?%> + + (<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>) + +
        + 现共有 +  <%= student_work.student_works_scores.where(:reviewer_role => 3).count%>  + 名学生进行了匿评,平均分为 +  <%= format("%.1f",student_work.student_score)%> 分。 +
        + <% end%> +
      • + + + <% score = student_work.respond_to?("score") ? student_work.score : (student_work.final_score || 0) - student_work.absence_penalty - student_work.late_penalty%> +
      • + <%= score.nil? ? "--" : format("%.1f",score)%> + <% unless score.nil?%> +
        + 作品最终评分为 +  <%= student_work.final_score%> 分。 + 迟交扣分 +  <%= student_work.late_penalty%> 分, + 缺评扣分 +  <%= student_work.absence_penalty%> 分, + 最终成绩为 +  <%= format("%.1f",score)%> 分。 +
        + <% end%> +
      • +
      + diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index be07269c3..63cb7ea99 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -1,29 +1,62 @@ -
        " id="student_work_<%= student_work.id%>"> +
          <% is_my_work = student_work.user == User.current%> -
        • - <% if is_my_work%> - - <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> - - <% else%> - -- - <% end%> +
        • +
            + <% if is_my_work%> +
          • + <%= image_tag(url_to_avatar(student_work.user),width:"40", height: "40") %> +
          • +
          • + <% 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 => "linkGrey f14 StudentName break_word width285"%> +
            +
          • +
          • +
              +
            • + <%= student_work.user.show_name%> +
            • +
            • + <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> +
            • +
            +
          • + <% else%> +
          • + <%= image_tag(url_to_avatar(""),width:"40", height: "40") %> +
          • +
          • +
            + <%= link_to "匿名的作品", student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%> +
            +
          • +
          • +
              +
            • + 匿名 +
            • +
            • + -- +
            • +
            +
          • + <% end%> + +
        • -
        • - <% if is_my_work%> - <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02" %> - <% else%> - <%= link_to "匿名","javascript:void(0)", :class => "c_blue02"%> - <% end%> -
        • -
        • - <% 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"%> +
        • + <%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>  + <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %> + [迟交] + <% end %>
        • + + <% my_score = student_work_score(student_work,User.current) %> -
        • - <%= my_score.nil? ? "--" : format("%.2f",my_score.score)%> +
        • + <%= my_score.nil? ? "--" : format("%.1f",my_score.score)%>
        • -
          -
        \ No newline at end of file +
      + diff --git a/app/views/student_work/_evaluation_work_title.html.erb b/app/views/student_work/_evaluation_work_title.html.erb deleted file mode 100644 index 0be6228bb..000000000 --- a/app/views/student_work/_evaluation_work_title.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -
    • - 学号 -
    • -
    • - 学生姓名 -
    • -
    • - 作品名称 -
    • -
    • - <%= link_to "我的评分","javascript:void(0)",:class => "c_dark f14 fb fl"%> -
    • \ No newline at end of file diff --git a/app/views/student_work/_jour_replay.html.erb b/app/views/student_work/_jour_replay.html.erb index 77fb476bf..4b594d7f4 100644 --- a/app/views/student_work/_jour_replay.html.erb +++ b/app/views/student_work/_jour_replay.html.erb @@ -6,9 +6,9 @@ <% if jour.user==User.current || User.current.admin? %> <%= link_to(l(:label_bid_respond_delete), destroy_score_reply_student_work_index_path(:jour_id => jour.id), - :remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete), :class => "fr c_purple") %> + :remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete), :class => "fr linkBlue mr5") %> <% end %> - + <%=format_time jour.created_on %>
      diff --git a/app/views/student_work/_new_project.html.erb b/app/views/student_work/_new_project.html.erb new file mode 100644 index 000000000..3d9214c7d --- /dev/null +++ b/app/views/student_work/_new_project.html.erb @@ -0,0 +1,31 @@ +
      + <%= labelled_form_for(Project.new,:remote => "true") do |f| %> +

      新建项目

      +
      +
      +
      + + +

      +
      +
      + +

      + +
      + +
      + +
      + + 确定 + + 取消 +
      +
      + <% end%> +
      +
      diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index b259e20a5..b5ff8f064 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -1,78 +1,102 @@
      -
      +
      • - - 上交时间: - + 上交时间: <%=format_time @work.created_at %>
      • - <% if @work.user != User.current%> - + + <% if @work.user == User.current && @homework.homework_detail_manual.comment_status == 1 %> + +
      • + <%= link_to("", student_work_path(@work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> +
      • +
      • + <%= link_to "",new_student_work_path(:homework => @homework.id),:class => "pic_edit"%> +
      • + <% end%> + <% if @homework.homework_detail_manual.comment_status == 3 && @work.user != User.current%> +
      • <%= render :partial => 'student_work_praise' %>
      • <% end%>
        +
      • - - 编程代码: - -
        - <%= text_format @work.description%> + 编程代码: +
        + <%= text_format(@work.description) if @work.description%>
      • <% 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%> -
        -
        +
      • + + 测试结果: + +
        + <% @work.student_work_tests.each_with_index do |test, index| %> +
        +

        + 第<%= @work.student_work_tests.count - index%>次测试 +

        + + <%= test.created_at.to_s(:db) %> + +
        +
        + <% if test.status.to_i == -2 %> +
        + <%= test.results.first %> +
        + <% else %> +
        +
          + <% test.results.each_with_index do |x, i| %> +
        • + 测试<%=i+1%> + <% if x["status"].to_i != 0 %> + 测试错误! + 您的输出: + <%=x["result"]%> + 正确输出: + <%=x["output"]%> +
          + <% else %> + 测试正确! +
          + <% end %> +
        • + <% end %> +
        +
        + <% end %> + <% end %> +
      • - -
        - <%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%> -
        <% end%> + +
      • + <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && @work.user != User.current )%> + +
        + <%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%> +
        + <% end%> +
        +
      -
      - <%@work.student_works_scores.order("updated_at desc").each do |score|%> +
      + <%@student_work_scores.each do |score|%>
      - <%= render :partial => 'student_work_score',:locals => {:score => score}%> + <%= render :partial => 'student_work_score',:locals => {:score => score,:is_last => score == @student_work_scores.last}%>
      <% end%> -
      - 收起 +
      + + 收起
      -
      \ No newline at end of file +
      \ No newline at end of file diff --git a/app/views/student_work/_set_score_rule.html.erb b/app/views/student_work/_set_score_rule.html.erb new file mode 100644 index 000000000..7deed7fb8 --- /dev/null +++ b/app/views/student_work/_set_score_rule.html.erb @@ -0,0 +1,63 @@ +<%= form_for('new_form',:url => {:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id},:method => "post") do |f|%> +
      + 评分设置 +
      + 迟交扣分 + +
      +
      + 缺评扣分 + +
      + + <% if homework.homework_type == 2%> +
      + 系统评分 + <%= select_tag :sy_proportion,options_for_select(ta_proportion_option,homework.homework_detail_programing.ta_proportion), {:class => "markPercentage"} %> +
      + + + <% else%> + + <% end%> + +
      + 教辅评分 + <%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_programing ? homework.homework_detail_programing.ta_proportion * 100 : 0).to_i),homework.homework_detail_manual.ta_proportion), {:class => "markPercentage"} %> +
      +
      + 学生匿评 + +
      +
      + 教师优先 + /> + 教师评分为最终评分 +
      +
      +
      + 确定 +
      +
      + 取消 +
      +
      +
      +
      +<% end%> diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index f6580659e..2aa14be71 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -1,72 +1,74 @@
      -
      -
        -
      • - 上交时间: - <%=format_time @work.created_at %> -
      • +
        +
          +
        • + 上交时间: + <%=format_time @work.created_at %> +
        • - <% if !@is_teacher && @work.user == User.current && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1) %> - -
        • - <%= link_to("", student_work_path(@work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> -
        • -
        • - <%= link_to "",edit_student_work_path(@work),:class => "pic_edit"%> -
        • - <% end%> - <% if (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3) && @work.user != User.current%> - -
        • - <%= render :partial => 'student_work_praise' %> -
        • - <% end%> -
          - - - - - - <% if @work.project%> -
        • - 关联项目: - <%= link_to( @work.project.name, project_path(@work.project.id), :class => "c_blue02" )%> -
        • - <% end%> -
        • - 内容: -
          - <%= text_format(@work.description) if @work.description%> -
          + <% if @work.user == User.current && @homework.homework_detail_manual.comment_status == 1 %> + +
        • + <%= link_to("", student_work_path(@work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> +
        • +
        • + <%= link_to "",edit_student_work_path(@work),:class => "pic_edit"%> +
        • + <% end%> + <% if @homework.homework_detail_manual.comment_status == 3 && @work.user != User.current%> + +
        • + <%= render :partial => 'student_work_praise' %> +
        • + <% end%>
          - -
        • - 附件: - <% if @work.attachments.empty?%> - 尚未提交附件 - <% else%> -
          - <%= render :partial => 'work_attachments', :locals => {:attachments => @work.attachments} %> + + + + <% if @work.project%> +
        • + 关联项目: + <%= link_to( @work.project.name, project_path(@work.project.id), :class => "linkBlue" )%> +
        • + <% end%> + +
        • + 内容: +
          + <%= text_format(@work.description) if @work.description%> +
          +
          +
        • +
        • + 附件: + <% if @work.attachments.empty?%> + 尚未提交附件 + <% else%> +
          + <%= render :partial => 'work_attachments', :locals => {:attachments => @work.attachments} %> +
          + <% end%> +
          +
        • +
        • + <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && @work.user != User.current )%> + +
          + <%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%> +
          + <% end%> +
          +
        • +
        + +
        + <%@student_work_scores.each do |score|%> +
        + <%= render :partial => 'student_work_score',:locals => {:score => score,:is_last => score == @student_work_scores.last}%>
        <% end%> - +
        + + 收起
        - - <% if @is_teacher || (@homework.homework_type == 1 && @homework.homework_detail_manual.comment_status == 2 && @work.user != User.current )%> - -
        - <%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%> -
        - <% end%> -
      - -
      - <%@work.student_works_scores.order("updated_at desc").each do |score|%> -
      - <%= render :partial => 'student_work_score',:locals => {:score => score}%> -
      - <% end%> -
      -收起 -
      -
      \ No newline at end of file +
      \ No newline at end of file diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb new file mode 100644 index 000000000..197fecac9 --- /dev/null +++ b/app/views/student_work/_student_work_list.html.erb @@ -0,0 +1,36 @@ +
      + + 作品 + + (<%= @stundet_works.count%>) + + + <%if @is_teacher || @homework.homework_detail_manual.comment_status == 3%> +
      + + +
      + <%= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %> + <% end%> +
      +
      + +
      + <% if @is_evaluation && !@stundet_works.empty?%> + <%= render :partial => "evaluation_title"%> + <% else%> + <%= render :partial => "evaluation_un_title"%> + <% end%> +
      +
      + +<% @stundet_works.each do |student_work|%> + <% if @is_evaluation%> + <%= render :partial => "evaluation_work", :locals => {:student_work => student_work}%> + <% else%> + <%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work}%> + <% end%> +
      +
      +
      +<% end%> \ No newline at end of file diff --git a/app/views/student_work/_student_work_score.html.erb b/app/views/student_work/_student_work_score.html.erb index 8d10853f8..c800ae8d0 100644 --- a/app/views/student_work/_student_work_score.html.erb +++ b/app/views/student_work/_student_work_score.html.erb @@ -1,24 +1,31 @@ -
        +
          <% show_real_name = @is_teacher || score.user == User.current || score.user.allowed_to?(:as_teacher,@course) %> <%= link_to image_tag(url_to_avatar(show_real_name ? score.user : ""), :width => "34", :height => "34"), show_real_name ? user_path(score.user) : "javascript:void(0)",:class => "ping_pic fl" %> -
          - <%= link_to show_real_name ? score.user.show_name : "匿名", show_real_name ? user_path(score.user) : "javascript:void(0)", :title => show_real_name ? score.user.show_name : "匿评用户", :class => "c_blue fl" %> - (<%= student_work_score_role score%>) +
          + <%= link_to show_real_name ? score.user.show_name : "匿名", show_real_name ? user_path(score.user) : "javascript:void(0)", :title => show_real_name ? score.user.show_name : "匿评用户", :class => "linkBlue fl" %> + + (<%= student_work_score_role score%>) + 评分: - <%= score.score%>分 - 回复 - - <%=format_time score.updated_at %> - + + <%= score.score%>分 + + 回复 + + <%=format_time score.updated_at %> +
          +

          <%= score.comment%>

          + <%= render :partial => 'work_attachments', :locals => {:attachments => score.attachments} %>
          +
          - <%= render :partial => 'add_score_reply',:locals => {:score => score}%> + <%= render :partial => 'add_score_reply',:locals => {:score => score,:is_last => is_last}%>
          @@ -27,6 +34,6 @@ <%= render :partial => 'jour_replay',:locals => {:jour => jour}%> <% end%>
          +
          -
          -
        \ No newline at end of file +
      diff --git a/app/views/student_work/_student_work_title.html.erb b/app/views/student_work/_student_work_title.html.erb deleted file mode 100644 index 24e6a1b37..000000000 --- a/app/views/student_work/_student_work_title.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -
    • - 学号 -
    • -
    • - <%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> - <% if @show_all && @order == "name"%> - <%= link_to "",student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> - <% end%> -
    • -
    • - 作品名称 -
    • -
    • - <%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> - <% if @show_all && @order == "created_at"%> - <%= link_to "",student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> - <% end%> -
    • -
    • - <%= link_to "教师",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> - <% if @show_all && @order == "teacher_score"%> - <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> - <% end%> -
    • -
    • - <%= link_to "教辅",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> - <% if @show_all && @order == "teaching_asistant_score"%> - <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> - - <% end%> -
    • -
    • - <%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> - <% if @show_all && @order == "score"%> - <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> - <% end%> -
    • \ No newline at end of file diff --git a/app/views/student_work/_work_attachments.html.erb b/app/views/student_work/_work_attachments.html.erb index f303897bc..a75f68f70 100644 --- a/app/views/student_work/_work_attachments.html.erb +++ b/app/views/student_work/_work_attachments.html.erb @@ -1,8 +1,8 @@ <% attachments.each_with_index do |attachment,i| %>
      - <%= link_to_short_attachment attachment, :class => 'link_file', :download => true -%> - <%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload', :confirm => l(:text_are_you_sure)) if attachment.id && User.current == attachment.author %> - (<%= number_to_human_size attachment.filesize %>) + <%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%> + <%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) if attachment.id && User.current == attachment.author %> + (<%= number_to_human_size attachment.filesize %>)
      <% end -%> diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb index 1de92b51a..6cb5bd6d8 100644 --- a/app/views/student_work/add_score.js.erb +++ b/app/views/student_work/add_score.js.erb @@ -2,39 +2,16 @@ $("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :parti $('#score_<%= @work.id%>').peSlider({range: 'min'}); <% if @is_new%> - $("#score_list_<%= @work.id%>").prepend("
      <%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>
      "); + $("#score_list_<%= @work.id%>").find("div:last").find("ul").addClass("ping_line"); + $("#score_list_<%= @work.id%>").prepend("
      <%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score,:is_last => true}) %>
      "); <% else %> - $("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>"); + $("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score,:is_last => @is_last}) %>"); <% end%> $("#score_list_<%= @work.id%>").removeAttr("style"); <% if @is_teacher %> - <% if @homework.homework_type == 1%> - $("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_student_work',:locals => {:student_work => @work}) %>"); - <% elsif @homework.homework_type == 2%> - $("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_student_work',:locals => {:student_work => @work}) %>"); - <% else%> - $("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'student_work',:locals => {:student_work => @work}) %>"); - <% end%> + $("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_un_work',:locals => {:student_work => @work}) %>"); <% else %> $("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work}) %>"); <% end%> - - -$(function(){ - //匿评评分提示 - $(".student_score_info").bind("mouseover",function(e){ - $(this).find("div").show(); - }); - $(".student_score_info").bind("mouseout",function(e){ - $(this).find("div").hide(); - }); - //最终成绩提示 - $(".student_final_scor_info").bind("mouseover",function(e){ - $(this).find("div").show(); - }); - $(".student_final_scor_info").bind("mouseout",function(e){ - $(this).find("div").hide(); - }); -}); diff --git a/app/views/student_work/add_score_reply.js.erb b/app/views/student_work/add_score_reply.js.erb index 28704630f..f21870cd5 100644 --- a/app/views/student_work/add_score_reply.js.erb +++ b/app/views/student_work/add_score_reply.js.erb @@ -1,4 +1,4 @@ -$("#add_score_reply_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'add_score_reply', :locals => {:score => @score}) %>"); +$("#add_score_reply_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'add_score_reply', :locals => {:score => @score,:is_last => @is_last}) %>"); <% if @status && @status == 1%> $("#replay_histroy_<%= @score.id%>").prepend("<%= escape_javascript(render :partial => 'jour_replay', :locals => {:jour => @jour}) %>"); $("#add_score_reply_<%= @score.id%>").hide(); diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 776af3b3e..9c48d310b 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -1,5 +1,12 @@ -
      - -
      - - -
      -
      -
      -
        -
      • 全部作品
      • -
      • 作业信息
      • -
      -
      -
      - -
      -
      -
      - - <%= link_to "所有作品(#{@stundet_works.count})".html_safe,student_work_index_path(:homework => @homework.id), :class => "fl"%> - - <% if @show_all%> - - <%= select_tag(:late_penalty,options_for_select(course_group_list(@course),@group), {:class => "fl h22 w100 ml10"}) if(@is_teacher && course_group_list(@course).count > 0) %> - 搜索 - <%= link_to("缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank") if((@is_teacher || User.current.admin?) && @homework.homework_type == 1) %> - <% end%> + +
      + <% if @is_teacher%> -
      - <% 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%> - <%= 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'%> - 导出全部: +
      +
        +
      • + +
          +
        • + <%= link_to "导出作业成绩", student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :group => @group, :format => 'xls'),:class=>'hworkExport postTypeGrey', :id => "export_student_work"%> +
        • +
        • + <% if @homework.student_works.empty?%> + <%= link_to "导出作业附件", "javascript:void(0)", class: "hworkExport resourcesGrey", :onclick => "alert('没有学生提交作业,无法下载附件')" %> + <% else%> + <%= link_to "导出作业附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json), + remote: true, class: "hworkExport resourcesGrey", :id => "download_homework_attachments" %> + <% end%> +
        • +
        • + <%= link_to("导出缺评情况", absence_penalty_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'hworkExport resourcesGrey')%> +
        • +
        • + <%= link_to("导出匿评情况", evaluation_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'hworkExport resourcesGrey')%> +
        • +
        • + 评分设置 +
        • +
        +
      • +
      <% end%>
      -
      +
      + +
      +
      +
      + <%= render :partial => "student_work/student_work_list"%> +
      +
      +
      +
      - - <% if @is_evaluation%> -
        - <%= render :partial => 'evaluation_work_title'%> -
      -
      - <% @stundet_works.each do |student_work|%> - <%= render :partial => "evaluation_work",:locals => {:student_work => student_work}%> -
      - <% end%> - <% else %> - <% if @homework.homework_type == 1 || @homework.homework_type == 2%> -
        - <%= render :partial => 'evaluation_student_work_title'%> -
      -
      - <% @stundet_works.each do |student_work|%> - <%= render :partial => "evaluation_student_work",:locals => {:student_work => student_work}%> -
      - <% end%> - <% else%> -
        - <%= render :partial => 'student_work_title'%> -
      -
      - <% @stundet_works.each do |student_work|%> - <%= render :partial => "student_work",:locals => {:student_work => student_work}%> -
      - <% end%> - <% end%> - <% end%> -
      -
      - -
      -
      - <%= link_to(image_tag(url_to_avatar(@homework.user), :width => "42", :height => "42"), user_path(@homework.user), :class => "problem_pic fl") %> -
      -

      - <%= @homework.name%> -

      - <% if @is_teacher%> - <%= homework_anonymous_comment(@homework)%> - <% else%> - <%= student_anonymous_comment @homework %> - <%= student_new_homework @homework %> - <% end %> -
      - -
      - <%= @homework.description.html_safe %> -
      -
      - - <% if @homework.homework_type == 2 && @homework.homework_detail_programing%> - <% if @is_teacher%> - - - "> - - - - <% @homework.homework_tests.each do |test|%> - "> - - - - <% end%> - -
      - 输入 - - 输出 -
      - <%=test.input%> - - <%= test.output%> -
      -
      - <% 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?%> - 附件: -
      - <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => @homework.attachments} %> -
      - <% end%> -
      -
      - -
      - 扣分标准: -
      - <% if @homework.homework_type == 1%> - <%= scoring_rules @homework.late_penalty,@homework.id,@is_teacher,@homework.homework_detail_manual.absence_penalty%> - <% else%> - <%= scoring_rules @homework.late_penalty,@homework.id,@is_teacher%> - <% end%> -
      -
      - -
      - 截止时间:<%= @homework.end_time%> -
      - <% if betweentime(@homework.end_time) < 0 %> - - <%= l(:label_commit_limit)%> - - <% else %> - -
      -
      - <% end %> -
      -
      -
      -
      -
      - - -
      -
      +
      +
      +
      \ No newline at end of file diff --git a/app/views/student_work/index.js.erb b/app/views/student_work/index.js.erb new file mode 100644 index 000000000..73b94260d --- /dev/null +++ b/app/views/student_work/index.js.erb @@ -0,0 +1,2 @@ +$("#homework_student_work_list").html("<%= escape_javascript(render :partial => 'student_work/student_work_list') %>"); +$("#export_student_work").replaceWith("<%= escape_javascript( link_to "导出作业成绩", student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :group => @group, :name => @name, :format => 'xls'),:class=>'hworkExport postTypeGrey', :id => 'export_student_work') %>"); \ No newline at end of file diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index 556f054f1..c7f1d45c4 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -1,17 +1,26 @@
      @@ -72,6 +81,18 @@ <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false} %>
      + +
      + +
      + <%= select_tag :project_id, options_for_select(user_projects_option, @student_work.project_id), {:class => "InputBox W680 fl"} %> + <%#=link_to "", new_project_path, :class => "ml5 mt5 SetUpIcon fl", :title => "快速创建"%> + +
      +
      +
      确定 @@ -80,4 +101,4 @@
      <% end%>
      -
      +
      \ No newline at end of file diff --git a/app/views/student_work/show.js.erb b/app/views/student_work/show.js.erb index 1c8874c2f..e6b99c146 100644 --- a/app/views/student_work/show.js.erb +++ b/app/views/student_work/show.js.erb @@ -1,11 +1,11 @@ -if($("#about_hwork_<%= @work.id%>").children().length > 0) - {$("#about_hwork_<%= @work.id%>").html("");} -else - { - <% if @homework.homework_type == 2%> - $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show') %>"); - <% else%> - $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show') %>"); - <% end%> - $('#score_<%= @work.id%>').peSlider({range: 'min'}); - } \ No newline at end of file +if($("#about_hwork_<%= @work.id%>").children().length > 0){ + $("#about_hwork_<%= @work.id%>").html(""); +} +else{ + <% if @homework.homework_type == 2%> + $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show') %>"); + <% else%> + $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show') %>"); + <% end%> + $('#score_<%= @work.id%>').peSlider({range: 'min'}); +} \ No newline at end of file diff --git a/app/views/system_messages/index.html.erb b/app/views/system_messages/index.html.erb new file mode 100644 index 000000000..4ed40757b --- /dev/null +++ b/app/views/system_messages/index.html.erb @@ -0,0 +1,3 @@ +<% @system_messages.each do |sm| %> +
      • <%= sm.content %>
      +<% end %> diff --git a/app/views/tags/_tag_list.html.erb b/app/views/tags/_tag_list.html.erb index b512f1ef3..49c9b2351 100644 --- a/app/views/tags/_tag_list.html.erb +++ b/app/views/tags/_tag_list.html.erb @@ -2,7 +2,8 @@ <% if @tags.size > 0 %> <% @tags.each do |tag| %> - <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> + <%#= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> + <%= tag %> <% case object_flag %> <% when '10' %> diff --git a/app/views/tags/tag_save.js.erb b/app/views/tags/tag_save.js.erb index 5a29c113c..f6ada82eb 100644 --- a/app/views/tags/tag_save.js.erb +++ b/app/views/tags/tag_save.js.erb @@ -20,8 +20,9 @@ $('#tags_name2').val(""); $("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @select_tag_name}) %>"); <%else%> $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); - $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/course_attachment_tag_name', - :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); + $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").replaceWith('<%= escape_javascript(render :partial => 'tags/tag_new', :locals => {:obj => @obj, :object_flag => "6"}) %>'); +//render :partial => 'tags/course_attachment_tag_name', +//:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) <%end%> $("#tags_name_<%=@obj.id%>").val(""); diff --git a/app/views/tags/update_tag_name.js.erb b/app/views/tags/update_tag_name.js.erb new file mode 100644 index 000000000..ec81e7cbc --- /dev/null +++ b/app/views/tags/update_tag_name.js.erb @@ -0,0 +1,50 @@ +//本js使用的新的tag显示方法 +<% if @obj_flag == '3'%> +$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +//$('#put-tag-form-issue').hide(); +$('#name-issue').val(""); +<% elsif @obj_flag == '1'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_user_new_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#tags_name3').val(""); +<% elsif @obj_flag == '2'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_project_new_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#tags_name2').val(""); +<% elsif @obj_flag == '6'%> +<%if @course%> + <% if @obj %> + $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); + $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list', + :locals => {:obj => @obj,:object_flag => @obj_flag,:select_tag_name => @select_tag_name}) %>'); + $("#tags_name_<%=@obj.id%>").val(""); + $("#add_tag_<%=@obj.id%>").hide(); + <% else %> + $("#course_list").html("<%= escape_javascript(render :partial => 'files/course_list', + :locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments}) %>"); + <% end %> +$("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @select_tag_name}) %>"); +<%else%> +$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); +$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/course_attachment_tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$("#tags_name_<%=@obj.id%>").val(""); +$("#add_tag_<%=@obj.id%>").hide(); +<%end%> + + +<% elsif @obj_flag == '9'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/new_tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#tags_name').val(""); +<% elsif @obj_flag == '10'%> +//$("#put-tag-form-<%#=@obj.class%>-<%#=@obj.id%>").hide(); +<% elsif @obj_flag == '5'%> + $('#forum_tag_list').html('<%= escape_javascript(render :partial=>'forums/forum_tag_list',:locals=>{:forum=>@forum})%>') +<% else%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#tags_name').val(""); +//$('#put-tag-form').hide(); +<% end %> \ No newline at end of file diff --git a/app/views/users/_activity_new_score_index.html.erb b/app/views/users/_activity_new_score_index.html.erb index 8140fd756..605219476 100644 --- a/app/views/users/_activity_new_score_index.html.erb +++ b/app/views/users/_activity_new_score_index.html.erb @@ -1,4 +1,3 @@ -
          <%= l('userscore.skill.tramples')%> * (-2) = <%= option_num.tread %> * (-2) = <%= option_num.tread * (-2) %>
          <%= l('userscore.skill.like.level1')%> * 4 = <%= option_num.praise_by_one %> * 4 = <%= option_num.praise_by_one * 4 %>
          <%= l('userscore.skill.like.level2')%> * 6 = <%= option_num.praise_by_two %> * 6 = <%= option_num.praise_by_two * 6 %>
      diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index b1ca2838a..afd2f142b 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -6,22 +6,43 @@
      <% if activity.try(:user).try(:realname) == ' ' %> - <%= link_to activity.try(:user), user_path(activity.user_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:user), user_path(activity.user_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> <% else %> - <%= link_to activity.try(:user).try(:realname), user_path(activity.user_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:user).try(:realname), user_path(activity.user_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id), :class => "newsBlue ml15"%> + <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%>
      -
      - <%= link_to activity.name.to_s, student_work_index_path(:homework => activity.id), :class => "postGrey"%> + + <% if activity.homework_detail_manual.comment_status == 1%> + 未开启匿评 + <% elsif activity.homework_detail_manual.comment_status == 2%> + 匿评中 + <% elsif activity.homework_detail_manual.comment_status == 3%> + 匿评已结束 + <% end%>
      - <%= student_work_activity_submit_status(homework: activity) %> + <% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %> + <%= user_for_homework_common activity,is_teacher %>
      + + <% if activity.homework_type == 2 && is_teacher%> +
      + <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %> +
      + <% end %> + <% if activity.homework_type == 2%> +
      + 语言: + <%= activity.language_name%> +
      + <% end %> +
      截止时间:<%= activity.end_time.to_s %>
      -
      +
      <%= activity.description.html_safe %>
    <% end %> + +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    +
    + <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> + + + +
    + +
    +

    + <% end%> +
    +
    +
    +
    +
    +
    diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index d2213c743..99e85fc73 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -18,16 +18,17 @@
    发布时间:<%= format_time(activity.created_on) %>
    -
    +
    <%= activity.description.html_safe %>
    + <% count=activity.comments.count %>
    -
    - <% count=activity.comments.count %> -
    +
    +
    +
    回复(<%= count %>)
    <%#= format_date(activity.updated_on) %>
    @@ -40,20 +41,6 @@ <% end %>
    -
    -
    - <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> - - -

    -
    - 取消 - 发送 - <% end%> -
    -
    -
    - <% replies_all_i = 0 %> <% if count > 0 %>
    @@ -62,7 +49,7 @@ <% replies_all_i = replies_all_i + 1 %>
  • - <%= link_to image_tag(url_to_avatar(comment.author), :width => "45", :height => "45"), user_path(comment.author_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.author_id), :alt => "用户头像" %>
    @@ -73,7 +60,7 @@ <% end %> <%= format_time(comment.created_on) %>
    -
    <%= comment.comments.html_safe %>
    +
    <%= comment.comments.html_safe %>
  • @@ -81,5 +68,23 @@
    <% end %> + +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    +
    + <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> + + +
    + +
    +

    + <% end%> +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/users/_course_news_reply.html.erb b/app/views/users/_course_news_reply.html.erb deleted file mode 100644 index c3f8571be..000000000 --- a/app/views/users/_course_news_reply.html.erb +++ /dev/null @@ -1,177 +0,0 @@ - -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> - -<% if @news.commentable? %> -
    -

    <%= l(:label_comment_add) %>

    - <%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %> -
    - <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - <%= kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字"%> -
    -

    - - <%= l(:label_cancel_with_space) %> - - - <%= l(:label_comment_with_space) %> - -

    - <% end %> -
    -<% end %> - -
    - - <%= form_for('new_form', :method => :post, - :url => {:controller => 'words', :action => 'leave_course_message'},:html => {:id=>'leave_message_form'}) do |f|%> - <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - -

    - <% end %> -
    -
    -
    - 取  消 - - 发送 - -
    -
    - -
    - - - - - diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 04f541d77..0b86dc3eb 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -33,7 +33,7 @@ <%=format_time(activity.created_on) %>
    -
    +
    <% if activity.description? %> <%= textAreailizable activity, :description, :attachments => activity.attachments %> <% end %> @@ -63,11 +63,11 @@
    + <% count = activity.journals.count %>
    - -
    - <% count = activity.journals.count %> -
    回复(<%= count %>)
    +
    +
    +
    回复(<%= count %>)
    <%#= format_date(activity.updated_on) %>
    <% if count > 2 %>
    @@ -78,20 +78,6 @@ <% end %>
    -
    -
    - <%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f|%> - - -

    -
    - 取消 - 发送 - <% end%> -
    -
    -
    - <% replies_all_i = 0 %> <% if count > 0 %>
    @@ -100,7 +86,7 @@ <% replies_all_i=replies_all_i + 1 %>
  • - <%= link_to image_tag(url_to_avatar(reply.user), :width => "45", :height => "45"), user_path(reply.user_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.user_id), :alt => "用户头像" %>
    @@ -111,17 +97,14 @@ <% end %> <%= format_time(reply.created_on) %>
    - <% if reply.details.any? %> - <% details_to_strings(reply.details).each do |string| %> -
    - <%= string %> -
    - <% end %> - <% else %> -
    - <%= reply.notes.html_safe %> -
    - <% end %> +
    + <% if reply.details.any? %> + <% details_to_strings(reply.details).each do |string| %> +

    <%= string %>

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

    <%= reply.notes.html_safe %>

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

    + <% end%> +
    +
    +
    +
    +
    +
    - <% act= user_activity.act unless user_activity.act_type == "ProjectCreateInfo" %> - <% case user_activity.container_type.to_s %> - <% when 'Course' %> - <% if act %> - <% case user_activity.act_type.to_s %> - <% when 'HomeworkCommon' %> - <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> - <% when 'News' %> - <%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> - <% when 'Message'%> - <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> - <% when 'Poll' %> - <%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %> - <% end %> - <% end %> - <% when 'Project' %> - <% if act %> - <% case user_activity.act_type.to_s %> - <% when 'Issue' %> - <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> - <% when 'Message' %> - <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> - <% end %> - <% end %> - <% end %> - <% end %> -<% end %> - -<% if user_activities.count == 10%> -
    轻抚展开更多<%=link_to "", user_activities_path(@user.id,:type => type,:page => page),:id => "more_activities_link",:remote => "true",:class => "none" %>
    - <%#= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%> -<% end%> - - + <% act= user_activity.act unless user_activity.act_type == "ProjectCreateInfo" %> + <% case user_activity.container_type.to_s %> + <% when 'Course' %> + <% if act %> + <% case user_activity.act_type.to_s %> + <% when 'HomeworkCommon' %> + <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %> + <% when 'News' %> + <%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %> + <% when 'Message'%> + <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %> + <% when 'Poll' %> + <%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id,:first_user_activity =>first_user_activity,:page => page} %> + <% end %> + <% end %> + <% when 'Project' %> + <% if act %> + <% case user_activity.act_type.to_s %> + <% when 'Issue' %> + <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %> + <% when 'Message' %> + <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %> + <% end %> + <% end %> + <% end %> + <% end %> +<% end %> + +<% if user_activities.count == 10%> +
    展开更多<%=link_to "", user_activities_path(@user.id,:type => type,:page => page),:id => "more_activities_link",:remote => "true",:class => "none" %>
    + <%#= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%> +<% end%> + + \ No newline at end of file diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index 0944ffab6..9b7c6c06a 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -47,11 +47,11 @@
    - 上传附件 - <%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mr15 mt3",:remote => true%> + 上传附件 + <%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3 mr20",:remote => true%> <% if defined?(has_program) && has_program %> - 编程 - + 编程 + <% end %>
    diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 4af5742a9..6e07e7122 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -1,27 +1,31 @@ <% content_for :header_tags do %> <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg'%> <%= javascript_include_tag 'homework','baiduTemplate' %> + <% end %>
    - +

    - <%= link_to "导入作业", user_import_homeworks_user_path(User.current.id),:class => "BlueCirBtn fl mr10",:remote => true%> + <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id),:class => "BlueCirBtn fl mr10",:remote => true) unless edit_mode%>
    - + <%= calendar_for('homework_end_time')%> -

    - - + + + <% if homework_common.homework_detail_manual%> + <% if homework_common.homework_detail_manual.comment_status == 1%> + 未开启匿评 + <% elsif homework_common.homework_detail_manual.comment_status == 2%> + 匿评中 + <% elsif homework_common.homework_detail_manual.comment_status == 3%> + 匿评已结束 + <% end%> + <% end%>
    <%= user_for_homework_common homework_common,is_teacher %>
    <% if homework_common.homework_type == 2 && is_teacher%> -
    - <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: homework_common.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %> -
    +
    + <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: homework_common.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %> +
    + <% end %> + <% if homework_common.homework_type == 2%> +
    + 语言: + <%= homework_common.language_name%> +
    <% end %>
    <%= l(:label_end_time)%>:<%= homework_common.end_time%>
    -
    +
    <%= homework_common.description.html_safe %>
    <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %>
    - <%# if is_teacher%> - <% if false%> + <% if is_teacher%> + <%# if false%>
      • - <%= link_to l(:button_edit),edit_homework_common_path(homework_common), :class => "postOptionLink"%> + <%= link_to l(:button_edit),edit_homework_common_path(homework_common,:is_in_course => 0), :class => "postOptionLink"%>
      • - <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %> + <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => 0),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %> +
      • +
      • + <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common),:class => "postOptionLink", :remote => true) if homework_common.homework_detail_manual.comment_status == 1%> +
      • +
      • + <%= homework_anonymous_comment homework_common %>
    • diff --git a/app/views/users/_user_programing_attr.html.erb b/app/views/users/_user_programing_attr.html.erb new file mode 100644 index 000000000..e0bee689a --- /dev/null +++ b/app/views/users/_user_programing_attr.html.erb @@ -0,0 +1,44 @@ + +

      编程作业的测试集设置

      +
      +
      +
      + +
      + <% if edit_mode && homework.is_program_homework? %> + <% homework.homework_tests.each_with_index do |test, index| %> +
      + + + + <% if index != 0 %> + + <% end %> +
      +
      + <% end %> + <% else %> +
      + + + +
      +
      + <% end %> + +
      + 温馨提示:您可以在发布作业后,在作业“模拟答题”中进行标准代码的检测。 + 确  定 +
      +
      + +
      + + \ No newline at end of file diff --git a/app/views/users/new_user_commit_homework.html.erb b/app/views/users/new_user_commit_homework.html.erb index 8b02b4594..c8998fd55 100644 --- a/app/views/users/new_user_commit_homework.html.erb +++ b/app/views/users/new_user_commit_homework.html.erb @@ -1,6 +1,8 @@ <% content_for :header_tags do %> - <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> + <%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %> <%= javascript_include_tag 'homework','baiduTemplate' %> + <%= stylesheet_link_tag "/assets/codemirror/codemirror" %> + <% end %> @@ -49,11 +51,17 @@
      -
      <%= @homework.name %>
      截止时间:<%= @homework.end_time %> -
      - <%= @homework.user.show_name %> -

      <%= @homework.description.html_safe %>
      -

      +
      + <%= @homework.name %> +
      + + 截止时间:<%= @homework.end_time %> + +
      + <%= @homework.user.show_name %> +

      + <%= @homework.description.html_safe %> +

      @@ -69,12 +77,17 @@
      请使用 <%= @homework.language_name %> 语言编写 + style="display-hidden" id="data-language">
      -
      +
      <%= f.text_area :name, id: 'program-title', class:"InputBox W700", placeholder:"请概括你的代码的功能" %>
      <%= f.text_area :description, id: 'program-src', class:"InputBox W700 H150", placeholder:"请贴入你的代码", rows: 10 %> +
      测试代码 diff --git a/app/views/users/search.html.erb b/app/views/users/search.html.erb index a8401c406..f5287cbd4 100644 --- a/app/views/users/search.html.erb +++ b/app/views/users/search.html.erb @@ -1,94 +1,70 @@ - + function searchByChange() + { + $("#search_by_input").val($("#search_by").val()); + } + -
      - <%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %> - - - - - - - - - - -
      - <%= l(:label_software_user ) %> - - <%= l(:label_user_location) %> : - - - - - - - - - - -
      - <%=link_to l(:field_homepage), home_path %> > - <%= l(:label_software_user)%> -
      -
      -<% end %> - - -
      - <% if @users.size > 0 %> - <%= render :partial => 'user_show' %> - - - <% else %> - <%= render :partial => "layouts/no_content"%> - <% end %> -
      - -<% html_title(l(:label_user_plural)) -%> + <% end %> + + +
      + <% if @users.size > 0 %> + <%= render :partial => 'user_show' %> + <% else %> + <%= render :partial => "layouts/no_content"%> + <% end %> +
      + +
      +
      + <% html_title(l(:label_user_plural)) -%> +
      +
      +
      +
      +
    +
    diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index aab715b16..de166b4e7 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -29,7 +29,7 @@
    • 更多
    • -
    • <%= link_to "我的动态", {:controller => "users", :action => "show", :type => "current_user"}, :class =>"homepagePostTypeAll postTypeGrey"%> +
    • <%= link_to "我的动态", {:controller => "users", :action => "show", :type => "current_user"}, :class =>"homepagePostTypeMine postTypeGrey"%>
    • <%= link_to "全部动态", {:controller => "users", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
  • diff --git a/app/views/users/show_chen.erb b/app/views/users/show_chen.erb deleted file mode 100644 index 3bd0014c6..000000000 --- a/app/views/users/show_chen.erb +++ /dev/null @@ -1,279 +0,0 @@ -
    -
    -
    最新动态
    - -
    - -
    -
    - 用户头像
    -
    - - -
    - -
    截止时间:2015-08-20
    -
    -
    (作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
    - -
    -
    -
    -
    -
    -
    -
    - 用户头像
    -
    - - -
    - -
    截止时间:2015-08-20
    -
    -
    (作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
    - -
    -
    -
    -
    - - - -
    -
    -
    - 用户头像
    -
    - - -
    - 时间:2015-07-31 -
    -
    - -
    -
    -
    -
    -
    -
    -
    回复(5)
    -
    2015-07-31
    - -
    -
    - -
    -
    - - - -
    -
    -
    -
    - 用户头像 -
    -
    -
    黄井泉 学生 - 2015-08-01删除 -
    -
    很开心!
    -
    -
    -
    -
    -
    - 用户头像 -
    -
    -
    陈正东 学生 - 2015-08-02删除 -
    -
    假期好热,没出去。
    -
    -
    -
    -
    -
    -
    -
    -
    - 用户头像
    -
    - - -
    -
    指派给  苏稳 -
    -
    时间:2015-08-20
    -
    -
    (缺陷描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
    -
    - 文件附件.zip(123KB) -
    -
    - 图片附件.png(123KB) -
    -
    - -
    -
    -
    -
    -
    -
    -
    回复(5)
    -
    2015-07-26
    - -
    -
    - -
    -
    - - - -
    -
    -
    -
    - 用户头像 -
    -
    -
    尹教授 - 2015-08-01删除 -
    -
    请大家说下软件工程是什么!
    -
    -
    -
    -
    -
    - 用户头像 -
    -
    -
    Tang 学生 - 2015-08-01删除 -
    -
    软件工程是一门研究用工程化方法构建和维护有效的、实用的和高质量的软件的学科。它涉及程序设计语言、数据库、软件开发工具、系统平台、标准、设计模式等方面。
    -
    -
    -
    -
    -
    \ No newline at end of file diff --git a/app/views/users/user_homeworks.html.erb b/app/views/users/user_homeworks.html.erb index b3aaf5ece..a37709b69 100644 --- a/app/views/users/user_homeworks.html.erb +++ b/app/views/users/user_homeworks.html.erb @@ -3,14 +3,10 @@ $("#homework_name").val(""); $("#homework_end_time").val(""); $("#course_id").val($("#option_select").val()); - $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new })%>"); + $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true })%>"); homework_description_editor.html(""); $("#homework_editor").toggle(); } - - function checkAllBox(doc){ - - }
    作业
    @@ -21,6 +17,7 @@
    <% homework = HomeworkCommon.new %> + <% homework.homework_detail_manual = HomeworkDetailManual.new%> <%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
    <%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %> diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index c3c1a447b..149cd8857 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -1,43 +1,81 @@
    -
    消息
    -
      -
    • -
        -
      • <%= link_to "全部",user_message_path(User.current), :class => "resourcesGrey" %>
      • - <%# 课程相关消息 %> -
      • <%= link_to "作业消息", user_message_path(User.current, :type => 'homework'), :class => "resourcesGrey" %>
      • -
      • <%= link_to "课程讨论",user_message_path(User.current, :type => 'course_message'), :class => "resourcesGrey" %>
      • -
      • <%= link_to "课程通知",user_message_path(User.current, :type => 'course_news'), :class => "resourcesGrey" %>
      • - - - - - <%# 项目相关消息 %> -
      • <%= link_to "项目任务", user_message_path(User.current, :type => 'issue'), :class => "resourcesGrey" %>
      • - - - - - <%# 项目相关消息 %> -
      • <%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %>
      • - <%# 系统贴吧 %> -
      • <%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %>
      • - -
      -
    • -
    -
    +
    <%= title_for_message(params[:type]) %>
    +
      +
    • +
        +
      • <%= link_to "全部",user_message_path(User.current), :class => "resourcesGrey" %>
      • +
      • <%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "resourcesGrey" %>
      • +
      • <%= link_to "用户申请", user_message_path(User.current, :type => 'apply'), :class => "resourcesGrey" %>
      • + <%# 课程相关消息 %> +
      • <%= link_to "作业消息", user_message_path(User.current, :type => 'homework'), :class => "resourcesGrey" %>
      • +
      • <%= link_to "课程讨论",user_message_path(User.current, :type => 'course_message'), :class => "resourcesGrey" %>
      • +
      • <%= link_to "课程通知",user_message_path(User.current, :type => 'course_news'), :class => "resourcesGrey" %>
      • + + + + + <%# 项目相关消息 %> +
      • <%= link_to "项目任务", user_message_path(User.current, :type => 'issue'), :class => "resourcesGrey" %>
      • + + + + + <%# 项目相关消息 %> +
      • <%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %>
      • + <%# 系统贴吧 %> +
      • <%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %>
      • + <%# 系统消息 %> +
      • <%= link_to "系统消息", user_system_messages_path(User.current), :class => "resourcesGrey" %>
      • +
      +
    • +
    +
    -<% if params[:type].nil? %> -
    - 有 <%= User.current.count_new_message %> 条未读<%= link_to "全部设为已读", user_message_path(User.current, :viewed => 'all') %> -
    -<% end %> -<% if @message_alls.count >0 %> - <%# 课程消息 %> +<% if @message_alls.count >0 || @user_system_messages.count >0 %> + <% if params[:type].nil? || params[:type] == "unviewed" %> +
    + 有 <%= unviewed_message(@user) %> 条未读 + <% unless (unviewed_message(@user) == 0 || User.current != @user) %> + <%= link_to "全部设为已读", user_message_path(User.current, :viewed => 'all') %> + <% end %> +
    + <% end %> + <%# 系统消息 %> + <% if params[:type] != 'system_messages' %> + <% @user_system_messages.each do |usm| %> +
      +
    • + +
    • +
    • + Trustie平台发布新消息: +
    • + 【系统消息】
    • +
    • + + <%= link_to usm.subject.blank? ? (usm.content.nil? ? usm.description.html_safe : usm.content.html_safe) : usm.subject, user_system_messages_path(User.current), + :id => "content_link_#{usm.id}", + :onmouseover =>"message_titile_show($(this),event);", + :onmouseout => "message_titile_hide($(this));" + %> +
    • + +
    • <%= time_tag(usm.created_at).html_safe %>
    • +
    + <% end %> + <% end %> + <% unless @message_alls.nil? %> <% @message_alls.each do |ma| %> + <%# 课程消息 %> <% if ma.class == CourseMessage %> <% if ma.course_message_type == "News" %>
      @@ -46,7 +84,15 @@
    • <%= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id }, :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", - :title => "#{ma.course_message.title}" %>
    • + :onmouseover =>"message_titile_show($(this),event)", + :onmouseout => "message_titile_hide($(this))" %> +
    • <%= time_tag(ma.created_at).html_safe %>
    <% end %> @@ -59,21 +105,206 @@ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %> -