diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 1e68ed2ed..687ef9503 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -147,6 +147,9 @@ class HomeworkCommonController < ApplicationController else @statue = 3 end + @user_activity_id = params[:user_activity_id].to_i + @is_in_course = params[:is_in_course].to_i + @course_activity = params[:course_activity].to_i end #关闭匿评 @@ -162,6 +165,9 @@ class HomeworkCommonController < ApplicationController # 匿评关闭消息邮件通知 send_message_anonymous_comment(@homework, m_status = 3) Mailer.send_mail_anonymous_comment_close(@homework).deliver + @user_activity_id = params[:user_activity_id].to_i + @is_in_course = params[:is_in_course].to_i + @course_activity = params[:course_activity].to_i respond_to do |format| format.js end @@ -188,6 +194,9 @@ class HomeworkCommonController < ApplicationController @homework.student_works.map { |work| @cur_size += work.student_works_scores.where(:reviewer_role => 3).count} end @percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100) + @user_activity_id = params[:user_activity_id].to_i + @is_in_course = params[:is_in_course].to_i + @course_activity = params[:course_activity].to_i respond_to do |format| format.js end diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 8d50b91f1..c36877092 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -89,7 +89,9 @@ class StudentWorkController < ApplicationController else student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')' end - if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表 + #老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表 + if @is_teacher || @homework.homework_detail_manual.nil? || + (@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) @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 #学生 && 未开启匿评 只看到自己的 @@ -110,7 +112,7 @@ class StudentWorkController < ApplicationController end @student_work_count = (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).count else - if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表 + if @is_teacher || @homework.homework_detail_manual.nil? || (@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) #老师 || 超级管理员 显示所有列表 @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 #学生 && 未开启匿评 只看到自己的 @@ -166,6 +168,7 @@ class StudentWorkController < ApplicationController def create if params[:student_work] + @submit_result = true student_work = StudentWork.find(params[:student_work_id]) if params[:student_work_id] student_work ||= StudentWork.new student_work.name = params[:student_work][:name] @@ -181,7 +184,6 @@ class StudentWorkController < ApplicationController else student_work.late_penalty = 0 end - if student_work.save course_activity = CourseActivity.where("course_act_type='HomeworkCommon' and course_act_id =#{@homework.id}").first if course_activity @@ -196,21 +198,13 @@ class StudentWorkController < ApplicationController @student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first respond_to do |format| format.js -=begin - format.html { - flash[:notice] = l(:notice_successful_create) - redirect_to student_work_index_url(:homework => @homework.id) - } -=end end return end end + @submit_result = false respond_to do |format| - format.html { - flash[:notice] = l(:notice_failed_create) - redirect_to new_student_work_url(:homework => @homework.id) - } + format.js end end diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 6ad1a66b4..8590b836a 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -272,6 +272,7 @@ class WordsController < ApplicationController format.js{ @user_activity_id = params[:user_activity_id] @is_in_course = params[:is_in_course] + @course_activity = params[:course_activity] @homework_common_id = params[:homework_common_id] } end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b6c4ec91b..e5cd9b52b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2307,15 +2307,15 @@ module ApplicationHelper end #获取匿评相关连接代码 - def homework_anonymous_comment homework + def homework_anonymous_comment (homework, is_in_course, user_activity_id = -1, course_activity = -1) if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") 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' + link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), 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' + link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink' when 3 # link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束" end @@ -2372,10 +2372,12 @@ module ApplicationHelper link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品" elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 link_to "匿评结束", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束" - elsif homework.homework_type == 2 #编程作业不能修改作品 - link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue' + elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品 + link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue' + elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") + link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue' else - link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue' + link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品" end end end diff --git a/app/helpers/homework_common_helper.rb b/app/helpers/homework_common_helper.rb index a03c4ccd7..2d3c72c20 100644 --- a/app/helpers/homework_common_helper.rb +++ b/app/helpers/homework_common_helper.rb @@ -57,12 +57,12 @@ module HomeworkCommonHelper end #根据传入作业确定跳转到开启匿评还是关闭匿评功能 - def alert_anonyoms_path homework,homework_detail_manual + def alert_anonyoms_path homework,homework_detail_manual,user_activity_id,is_in_course,course_activity link = "" if homework_detail_manual.comment_status == 1 - link = start_anonymous_comment_homework_common_url homework.id + link = start_anonymous_comment_homework_common_url homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity elsif homework_detail_manual.comment_status == 2 - link = stop_anonymous_comment_homework_common_url homework.id + link = stop_anonymous_comment_homework_common_url homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity end link end diff --git a/app/views/homework_common/_alert_anonyoms.html.erb b/app/views/homework_common/_alert_anonyoms.html.erb index 73f240b02..3b1f6f692 100644 --- a/app/views/homework_common/_alert_anonyoms.html.erb +++ b/app/views/homework_common/_alert_anonyoms.html.erb @@ -34,7 +34,7 @@

<% end %>
- + 确  定 diff --git a/app/views/homework_common/start_anonymous_comment.js.erb b/app/views/homework_common/start_anonymous_comment.js.erb index b0424bf7a..ea63ea12c 100644 --- a/app/views/homework_common/start_anonymous_comment.js.erb +++ b/app/views/homework_common/start_anonymous_comment.js.erb @@ -1,12 +1,19 @@ <% 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 => "postOptionLink")%>'); + alert('启动成功'); + <% if @user_activity_id == -1 %> + $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); + init_activity_KindEditor_data(<%= @homework.id%>,"","87%"); + <% else %> + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); + init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); + <% end %> +/*$("#<%#= @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份时才能启动匿评'); + alert('启动失败\n作业总数大于等于2份时才能启动匿评'); <% elsif @statue == 3%> -alert("已开启匿评,请务重复开启"); + alert("已开启匿评,请务重复开启"); <% elsif @statue == 4%> -alert("您没有权限开启匿评"); + alert("您没有权限开启匿评"); <% elsif @statue == 5%> -alert("作业提交截止之后才能启动匿评"); + alert("作业提交截止之后才能启动匿评"); <% end %> \ 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 4725d5731..214a157dc 100644 --- a/app/views/homework_common/stop_anonymous_comment.js.erb +++ b/app/views/homework_common/stop_anonymous_comment.js.erb @@ -1,2 +1,10 @@ -$("#<%= @homework.id %>_stop_anonymous_comment").replaceWith(''); -alert('关闭成功'); \ No newline at end of file +alert('关闭成功'); +<% if @user_activity_id == -1 %> +$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); +init_activity_KindEditor_data(<%= @homework.id%>,"","87%"); +<% else %> +$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); +init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); +<% end %> +/* +$("#<%#= @homework.id %>_stop_anonymous_comment").replaceWith('');*/ diff --git a/app/views/projects/settings/_new_repositories.html.erb b/app/views/projects/settings/_new_repositories.html.erb index 5196fd8e8..43535153d 100644 --- a/app/views/projects/settings/_new_repositories.html.erb +++ b/app/views/projects/settings/_new_repositories.html.erb @@ -72,10 +72,12 @@ <%= repository.identifier %> <%=h repository.scm_name %> <%if repository.scm_name=="Git"%> - + <% rep_url = "http://" + repository.login.to_s + '_'+ repository.identifier.to_s + "@" + ip.to_s + h( repository.url.slice(project_path_cut, repository.url.length)) %> + - <%=truncate( 'http://' << repository.login.to_s << '_'<< repository.identifier.to_s << '@'<< ip.to_s << h( repository.url.slice(project_path_cut, repository.url.length)),:length=>60) %> + + + <%#= rep_url %> <%else %> diff --git a/app/views/repositories/_dir_list_content.html.erb b/app/views/repositories/_dir_list_content.html.erb index abee097c5..81706c25e 100644 --- a/app/views/repositories/_dir_list_content.html.erb +++ b/app/views/repositories/_dir_list_content.html.erb @@ -21,7 +21,7 @@ {:action => (entry.is_dir? ? 'show' : 'entry'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev}, :class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%> -<%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %> + <% if @repository.report_last_commit %> <%= link_to_revision(entry.changeset, @repository) if entry.changeset %> diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index dbf7291cb..fd541c643 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -6,7 +6,7 @@ <%=format_time work.created_at %> - <% if work.user == User.current && @homework.homework_detail_manual.comment_status == 1 %> + <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %>
  • <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 1f3d44258..286d5eb39 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -6,7 +6,7 @@ <%=format_time work.created_at %>
  • - <% if work.user == User.current && @homework.homework_detail_manual.comment_status == 1 %> + <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %>
  • <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index eeda41858..d834bc845 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -36,7 +36,7 @@ <% end%>
    - <% if student_work.user == User.current %> + <% if student_work.user == User.current && !@is_evaluation %> <% if @homework.homework_type == 2%> <%=render :partial => 'programing_work_show', :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> <% else %> diff --git a/app/views/student_work/_work_information.html.erb b/app/views/student_work/_work_information.html.erb index 151661b0e..2b5e3b67a 100644 --- a/app/views/student_work/_work_information.html.erb +++ b/app/views/student_work/_work_information.html.erb @@ -1,6 +1,6 @@
    - 您上传的作品信息 + 请您确认刚刚上传的作品信息

    作品名称:<%=@student_work.name%>

    @@ -10,7 +10,7 @@

    件: <% if @student_work.attachments.count == 0%> - <%= "无附件"%> + <%= "无附件"%> <% else %>

    <% @student_work.attachments.each do |attachment| %> @@ -21,9 +21,15 @@

    -
    \ No newline at end of file +
    + + \ No newline at end of file diff --git a/app/views/student_work/create.js.erb b/app/views/student_work/create.js.erb index 69dd8364d..42b1db8b8 100644 --- a/app/views/student_work/create.js.erb +++ b/app/views/student_work/create.js.erb @@ -1,7 +1,16 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>'); -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 +<% if @submit_result%> + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>'); + showModal('ajax-modal', '500px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before("" + + ""); + $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("anonymos"); +<% else %> + window.location.href = '<%= new_student_work_url(:homework => @homework.id)%>'; +<% end %> + +function clickCanel() { + hideModal('#popbox02'); + window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>'; +} \ No newline at end of file diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 8f1f0033e..b0e70c9b0 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -162,6 +162,9 @@
    截止时间:<%= @homework.end_time %> 23:59
    + <% if @homework.homework_detail_manual.comment_status == 0 %> +
    发布时间:<%= @homework.publish_time %> 00:00
    + <% end %> <% if @homework.homework_detail_manual%> <% if @homework.homework_detail_manual.comment_status == 1%> <% end_time = @homework.end_time.to_time.to_i + 24*60*60 - 1 %> diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index f442e34e4..38a4d6edd 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -93,7 +93,7 @@ <%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
  • - <%= homework_anonymous_comment activity %> + <%= homework_anonymous_comment activity,-1,user_activity_id,course_activity %>
  • <% end %> <% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%> @@ -167,6 +167,7 @@
    <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%> <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %> + <%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %>
    diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 1947c8ce8..0c2a28e5c 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -56,14 +56,14 @@ <%= homework_common.language_name%>
    <% end %> - <% if homework_common.homework_detail_manual.comment_status == 0 %> -
    - <%= l(:label_publish_time)%>:<%= homework_common.publish_time%> -
    - <% end %>
    <%= l(:label_end_time)%>:<%= homework_common.end_time%> 23:59
    + <% if homework_common.homework_detail_manual.comment_status == 0 %> +
    + <%= l(:label_publish_time)%>:<%= homework_common.publish_time%> 00:00 +
    + <% end %>
    @@ -98,9 +98,9 @@ <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common),:class => "postOptionLink", :remote => true)%> <% end %> - <% if homework_common.anonymous_comment == 0 &&(comment_status == 0 || comment_status == 1)%> + <% if homework_common.anonymous_comment == 0%>
  • - <%= homework_anonymous_comment homework_common %> + <%= homework_anonymous_comment(homework_common, is_in_course) %>
  • <% end %> <% if homework_common.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%> diff --git a/app/views/words/leave_homework_message.js.erb b/app/views/words/leave_homework_message.js.erb index 91525c889..08fed725c 100644 --- a/app/views/words/leave_homework_message.js.erb +++ b/app/views/words/leave_homework_message.js.erb @@ -1,5 +1,5 @@ <% if @user_activity_id %> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id}) %>"); + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>"); init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); <% elsif @homework_common_id && @is_in_course %> $("#homework_common_<%= @homework_common_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework_common,:is_in_course => @is_in_course}) %>"); diff --git a/lib/tasks/gitlab_to_git.rake b/lib/tasks/gitlab_to_git.rake index 3c7d119f2..8b7f7279e 100644 --- a/lib/tasks/gitlab_to_git.rake +++ b/lib/tasks/gitlab_to_git.rake @@ -4,7 +4,7 @@ namespace :rep_fault do desc "set ossean's type value" task :rep_update => :environment do rep = Repository.find(400) - rep.type = "Repository::Gitlab" + rep.type = "Repository::Git" rep.save end diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 90d085ea3..0c7f4156f 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -663,7 +663,7 @@ function regex_homework_end_publish_time() var myDate = new Date(); if($.trim($("#homework_publish_time").val()) == "") { - $("#homework_publish_time").val(myDate.toLocaleDateString()); + $("#homework_publish_time").val(formate_date(myDate)); } var publish_time = Date.parse($("#homework_publish_time").val()); var end_time = Date.parse($("#homework_end_time").val()); @@ -695,6 +695,21 @@ function regex_homework_end_time() } } +function formate_date(date){ + var str = ""; + var year = date.getFullYear(); + var month = date.getMonth() + 1; + var day = date.getDate(); + if(month < 10) { + month = '0' + month; + } + if(day < 10) { + day = '0' + day; + } + str = year + '-' + month + '-' + day; + return str; +} + //验证发送到课程 function regex_course_id(){ var course_id = $("#course_id").val(); diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index e99abd4f1..ca7b28ee7 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -97,7 +97,7 @@ function regex_homework_end_publish_time() var myDate = new Date(); if($.trim($("#homework_publish_time").val()) == "") { - $("#homework_publish_time").val(myDate.toLocaleDateString()); + $("#homework_publish_time").val(formate_date(myDate)); } var end_time = Date.parse($("#homework_end_time").val()); var publish_time = Date.parse($("#homework_publish_time").val()); @@ -129,6 +129,21 @@ function regex_homework_end_time() } } +function formate_date(date){ + var str = ""; + var year = date.getFullYear(); + var month = date.getMonth() + 1; + var day = date.getDate(); + if(month < 10) { + month = '0' + month; + } + if(day < 10) { + day = '0' + day; + } + str = year + '-' + month + '-' + day; + return str; +} + //验证发送到课程 function regex_course_id(){ var course_id = $("#course_id").val(); diff --git a/public/javascripts/project.js b/public/javascripts/project.js index 9344434eb..a31ae2356 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -517,8 +517,9 @@ function jsCopy(){ e.select(); document.execCommand("Copy"); } -function jsCopy2(){ - var e=document.getElementById("copy_rep_content2"); +function jsCopy2(id){ + //alert("copy_rep_content2_" + id); + var e=document.getElementById("copy_rep_content2_" + id); e.select(); document.execCommand("Copy"); } diff --git a/public/stylesheets/repository.css b/public/stylesheets/repository.css index e2d636e2e..27941cb9e 100644 --- a/public/stylesheets/repository.css +++ b/public/stylesheets/repository.css @@ -207,11 +207,13 @@ } .cloneUrl {width:235px; height:21px; border:1px solid #dddddd; outline:none; overflow:hidden; line-height:21px; resize:none;white-space:nowrap;} +.cloneUrl2 {width:328px; height:21px; border:1px solid #dddddd; outline:none; overflow:hidden; line-height:21px; resize:none;white-space:nowrap;} .clone_btn {width:30px; height:21px; border-top:1px solid #dddddd; border-bottom:1px solid #dddddd; border-right:1px solid #dddddd; outline:none; float:left; background-image:linear-gradient(#FCFCFC, #EEE); text-align:center;} .vl_btn {height:21px; padding:0px 5px; vertical-align:middle; border:1px solid #dddddd; float:left; line-height:21px; background-image:linear-gradient(#FCFCFC, #EEE);} .vl_btn_2 {height:21px; padding:0px 5px; vertical-align:middle; border-top:1px solid #dddddd; border-bottom:1px solid #dddddd; border-right:1px solid #dddddd; float:left; line-height:21px;} .recordBanner {width:670px; height:30px; background-color:#f1f1f1; color:#666666; line-height:30px; vertical-align:middle;} .vl_copy {background:url(../images/vlicon/clone_url.png) 0px 0px no-repeat; padding-left:22px;} +.vl_copy2 {background:url(../images/vlicon/clone_url.png) 0px 0px no-repeat; padding-left:22px;} .vl_zip {background:url(../images/vlicon/download_icon.png) 0px 0px no-repeat; padding-left:22px;} .vl_fork {background:url(../images/vlicon/fork_icon.png) 0px -2px no-repeat; padding-left:22px;} .vl_commit {background:url(../images/vlicon/commit_icon.png) 0px -2px no-repeat; padding-left:22px;weight:20px;height: 24px;}