diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index af501fdf9..33d988e35 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -21,7 +21,6 @@ class AccountController < ApplicationController
# prevents login action to be filtered by check_if_login_required application scope filter
skip_before_filter :check_if_login_required
-
# Login request and validation
def login
if request.get?
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index bb2138062..6387a97a4 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -663,7 +663,8 @@ class ApplicationController < ActionController::Base
if api_request?
logger.error "Form authenticity token is missing or is invalid. API calls must include a proper Content-type header (text/xml or text/json)."
end
- render_error "Invalid form authenticity token."
+ #render_error "Invalid form authenticity token."
+ redirect_to signin_path(:login=>true)
end
def render_feed(items, options={})
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 1cd5b0f15..dd8dc84c4 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -332,6 +332,9 @@ class FilesController < ApplicationController
#modify by nwb
if @project
@addTag=false
+ if params[:in_project_toolbar]
+ @in_project_toolbar = params[:in_project_toolbar]
+ end
container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id]))
attachments = Attachment.attach_filesex(container, params[:attachments], params[:attachment_type])
render_attachment_warning_if_needed(container)
@@ -363,6 +366,9 @@ class FilesController < ApplicationController
end
elsif @course
@addTag=false
+ if params[:in_course_toolbar]
+ @in_course_toolbar = params[:in_course_toolbar]
+ end
attachments = Attachment.attach_filesex(@course, params[:attachments], params[:attachment_type])
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
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..9ad46cd69 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
@@ -227,24 +221,36 @@ class StudentWorkController < ApplicationController
def update
if params[:student_work]
+ @submit_result = true
@work.name = params[:student_work][:name]
@work.description = params[:student_work][:description]
@work.project_id = params[:student_work][:project]
@work.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@work)
if @work.save
+=begin
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_edit)
redirect_to student_work_index_url(:homework => @homework.id)
}
+=end
+ @student_work = @work
+ respond_to do |format|
+ format.js
end
return
end
end
+=begin
respond_to do |format|
format.html{redirect_to edit_student_work_url(@work)}
end
+=end
+ @submit_result = false
+ respond_to do |format|
+ format.js
+ end
end
def show
diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb
index 6ad1a66b4..6cc622c49 100644
--- a/app/controllers/words_controller.rb
+++ b/app/controllers/words_controller.rb
@@ -60,6 +60,11 @@ class WordsController < ApplicationController
course_activity.updated_at = Time.now
course_activity.save
end
+ principal_activity = PrincipalActivity.where("principal_act_type='JournalsForMessage' and principal_act_id =#{parent_id}").first
+ if principal_activity
+ principal_activity.updated_at = Time.now
+ principal_activity.save
+ end
user_activity = UserActivity.where("act_type='JournalsForMessage' and act_id =#{parent_id}").first
if user_activity
user_activity.updated_at = Time.now
@@ -272,6 +277,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/models/journals_for_message.rb b/app/models/journals_for_message.rb
index faab129a6..5e40267cb 100644
--- a/app/models/journals_for_message.rb
+++ b/app/models/journals_for_message.rb
@@ -136,10 +136,8 @@ class JournalsForMessage < ActiveRecord::Base
#用户动态公共表记录
def act_as_principal_activity
- if self.jour_type == 'Principal'
- unless self.user_id == self.jour.id && self.user_id != self.reply_id && self.reply_id != 0
- self.principal_acts << PrincipalActivity.new(:user_id => self.user_id, :principal_id => self.jour_id)
- end
+ if self.jour_type == 'Principal' && self.m_parent_id.nil?
+ self.principal_acts << PrincipalActivity.new(:user_id => self.user_id, :principal_id => self.jour_id)
end
end
diff --git a/app/views/courses/_join_private_course.html.erb b/app/views/courses/_join_private_course.html.erb
index d37feeb57..873144afe 100644
--- a/app/views/courses/_join_private_course.html.erb
+++ b/app/views/courses/_join_private_course.html.erb
@@ -73,11 +73,18 @@
身 份:
-
- 教师
- 教辅
- 学生
-
+ <% if User.current.logged? && User.current.extensions && User.current.extensions.identity == 0%>
+
+ 教师
+ 教辅
+ 学生
+
+ <%else%>
+
+ 学生
+ 教辅
+
+ <%end%>
diff --git a/app/views/courses/set_course_outline.js.erb b/app/views/courses/set_course_outline.js.erb
index a43a62c7d..e920005cd 100644
--- a/app/views/courses/set_course_outline.js.erb
+++ b/app/views/courses/set_course_outline.js.erb
@@ -3,6 +3,6 @@ hideModal();
<% else %>
$("#course_outline_bar").html(' ')
<%end %>
-<%if @is_in_show_outline_page && @is_in_show_outline_page == 'Y'%>
+<%#if @is_in_show_outline_page && @is_in_show_outline_page == 'Y'%>
window.location.href='<%=syllabus_course_path(@course) %>';
-<% end %>
+<%# end %>
diff --git a/app/views/courses/syllabus.html.erb b/app/views/courses/syllabus.html.erb
index bf6980dd2..bb3421cba 100644
--- a/app/views/courses/syllabus.html.erb
+++ b/app/views/courses/syllabus.html.erb
@@ -58,7 +58,7 @@
'取消大纲',
{:controller => 'blog_comments',:action => 'destroy',:user_id=>BlogComment.find(@course.outline).author_id,:blog_id=>BlogComment.find(@course.outline).blog_id, :id => @course.outline,:course_id=>@course.id},
:method => :delete,
- :data => {:confirm => '确定取消么'},
+ :data => {:confirm => '您确定要取消么?'},
:class => 'postOptionLink'
) if User.current && User.current.id == @article.author.id %>
diff --git a/app/views/files/_upload_course_files.erb b/app/views/files/_upload_course_files.erb
index 62d5c68e4..3578d4eb9 100644
--- a/app/views/files/_upload_course_files.erb
+++ b/app/views/files/_upload_course_files.erb
@@ -7,7 +7,7 @@
<%= l(:label_file_upload_error_messages)%>
<%= form_tag(course_files_path(course), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
-
+
课件
|
diff --git a/app/views/files/_upload_show_project.html.erb b/app/views/files/_upload_show_project.html.erb
index 8223f071e..53c57b3c6 100644
--- a/app/views/files/_upload_show_project.html.erb
+++ b/app/views/files/_upload_show_project.html.erb
@@ -8,6 +8,7 @@
<%= form_tag(project_files_path(project), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
+
<%= render :partial => 'files/attachement_list',:locals => {:project => project} %>
<%= l(:button_cancel)%>
diff --git a/app/views/files/create.js.erb b/app/views/files/create.js.erb
index f24d60811..9de7aa042 100644
--- a/app/views/files/create.js.erb
+++ b/app/views/files/create.js.erb
@@ -23,26 +23,35 @@ $("#upload_file_count").text("未上传文件");
$('#upload_file_div').slideToggle('slow');
<% if @project %>
hideModal();
- $("#resource_list").html('<%= j(render partial: "project_file_new" ,locals: {project: @project}) %>');
- $("#project_files_count_info").html("<%= @all_attachments.count%>");
- $("#project_files_count_nav").html("(<%= @all_attachments.count%>)")
-// 添加文件上传成功提示
- <% unless params[:attachments].nil? %>
- var div = $('
文件上传成功!
');
- $("#course_list").prepend(div);
- setTimeout( function(){div.remove();},3000)
+ <%if @in_project_toolbar%>
+ window.location.href = '<%= project_files_path(@project)%>'
+ <%else%>
+
+ $("#resource_list").html('<%= j(render partial: "project_file_new" ,locals: {project: @project}) %>');
+ $("#project_files_count_info").html("<%= @all_attachments.count%>");
+ $("#project_files_count_nav").html("(<%= @all_attachments.count%>)")
+ // 添加文件上传成功提示
+ <% unless params[:attachments].nil? %>
+ var div = $('
文件上传成功!
');
+ $("#course_list").prepend(div);
+ setTimeout( function(){div.remove();},3000)
+ <% end %>
<% end %>
<%elsif @course%>
- closeModal();
- $("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>');
- $("#courses_files_count_info").html("<%= @all_attachments.count%>");
- $("#courses_files_count_nav").html("(<%= @all_attachments.count%>)")
- // 添加文件上传成功提示,
- <% unless params[:attachments].nil? %>
- var div = $('
文件上传成功!
');
- $("#course_list").prepend(div);
- setTimeout( function(){div.remove();},3000)
- <% end %>
+ hideModal();
+ <%if @in_course_toolbar %>
+ window.location.href='<%= course_files_path(@course)%>'
+ <%else%>
+ $("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>');
+ $("#courses_files_count_info").html("<%= @all_attachments.count%>");
+ $("#courses_files_count_nav").html("(<%= @all_attachments.count%>)")
+ // 添加文件上传成功提示,
+ <% unless params[:attachments].nil? %>
+ var div = $('
文件上传成功!
');
+ $("#course_list").prepend(div);
+ setTimeout( function(){div.remove();},3000)
+ <% end %>
+ <%end%>
<% end %>
<% end %>
$(document).ready(img_thumbnails);
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/_add_score.html.erb b/app/views/student_work/_add_score.html.erb
index 961f351de..0258b3b83 100644
--- a/app/views/student_work/_add_score.html.erb
+++ b/app/views/student_work/_add_score.html.erb
@@ -16,7 +16,7 @@
<%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %>
<%end%>
-
提交
+
提交
<% 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
index 8dec1fa31..0d55cb130 100644
--- a/app/views/student_work/_evaluation_un_work.html.erb
+++ b/app/views/student_work/_evaluation_un_work.html.erb
@@ -28,7 +28,7 @@
<% if student_work.created_at && @homework.end_time%>
<%= 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") %>
+ <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
[迟交]
<% end %>
<% end %>
diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb
index 253a6418a..aa6009466 100644
--- a/app/views/student_work/_evaluation_work.html.erb
+++ b/app/views/student_work/_evaluation_work.html.erb
@@ -48,7 +48,7 @@
<%= 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") %>
+ <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
[迟交]
<% end %>
@@ -58,6 +58,6 @@
<%= my_score.nil? ? "--" : format("%.1f",my_score.score)%>
-
点击查看详情
+
点击查看详情
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..64f097114 100644
--- a/app/views/student_work/_student_work_list.html.erb
+++ b/app/views/student_work/_student_work_list.html.erb
@@ -2,10 +2,10 @@
作品
- (<%= @student_work_count%>)
+ (已有<%= @student_work_count%>人提交)
<% if !@is_teacher && @stundet_works.empty?%>
- 未提交
+ 您尚未提交作品
<% end %>
<%if @is_teacher || @homework.homework_detail_manual.comment_status == 3%>
@@ -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..f8a55a03d 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%>
@@ -9,21 +9,25 @@
附 件:
- <% if @student_work.attachments.count == 0%>
- <%= "无附件"%>
+ <% if @student_work.attachments.empty? %>
+ <%= "无附件"%>
<% else %>
-
- <% @student_work.attachments.each do |attachment| %>
-
<%=attachment.filename %>
- <% end %>
+
+ <%= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %>
<% end %>
-
\ 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/edit.html.erb b/app/views/student_work/edit.html.erb
index 25a65f039..517a238b0 100644
--- a/app/views/student_work/edit.html.erb
+++ b/app/views/student_work/edit.html.erb
@@ -26,7 +26,7 @@
- <%= labelled_form_for @work,:html => { :multipart => true } do |f|%>
+ <%= labelled_form_for @work,:html => { :multipart => true },:remote=>true do |f|%>
提示:作品名称和描述中不要出现真实的姓名信息
@@ -52,7 +52,7 @@
-
确定
+
确定
或
<%= link_to "取消", student_work_index_path(:homework => @homework), :class => "fr mr10 mt3"%>
@@ -60,3 +60,12 @@
<% end%>
+
\ 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/student_work/new.html.erb b/app/views/student_work/new.html.erb
index db83fd432..fdf1e31a3 100644
--- a/app/views/student_work/new.html.erb
+++ b/app/views/student_work/new.html.erb
@@ -111,11 +111,20 @@
-
确定
+
确定
或
<%= link_to "取消", user_homeworks_user_path(User.current.id), :class => "fr mr10 mt3"%>
<% end%>
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/app/views/student_work/update.js.erb b/app/views/student_work/update.js.erb
new file mode 100644
index 000000000..79733db31
--- /dev/null
+++ b/app/views/student_work/update.js.erb
@@ -0,0 +1,16 @@
+<% 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 = '<%= edit_student_work_url(@work)%>';
+<% 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/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/_resources_list.html.erb b/app/views/users/_resources_list.html.erb
index f134e8f42..34d609487 100644
--- a/app/views/users/_resources_list.html.erb
+++ b/app/views/users/_resources_list.html.erb
@@ -5,7 +5,7 @@
<% else %>
<% attachments.each do |attach| %>
-
<% 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/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb
index b05afc63b..41c7c1eee 100644
--- a/app/views/users/_user_message_course.html.erb
+++ b/app/views/users/_user_message_course.html.erb
@@ -66,9 +66,9 @@
课程名称:<%= ma.course_message.course.name %>
(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
作业标题:<%= ma.course_message.name %>
-
提交截止:<%= ma.course_message.end_time %> 24点
-
匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 24点
-
匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 24点
+
提交截止:<%= ma.course_message.end_time %> 23:59
+
匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
+
匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
迟交扣分:<%= ma.course_message.late_penalty %>分
缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
@@ -81,9 +81,9 @@
课程名称:<%= ma.course_message.course.name %>
(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
作业标题:<%= ma.course_message.name %>
-
提交截止:<%= ma.course_message.end_time %> 24点
-
匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 24点
-
匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 24点
+
提交截止:<%= ma.course_message.end_time %> 23:59
+
匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
+
匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
迟交扣分:<%= ma.course_message.late_penalty %>分
缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
@@ -116,9 +116,9 @@
课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
作业标题:<%= ma.course_message.name %>
- 提交截止:<%= ma.course_message.end_time %> 24点
- 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 24点
- 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 24点
+ 提交截止:<%= ma.course_message.end_time %> 23:59
+ 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
+ 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
迟交扣分:<%= ma.course_message.late_penalty %>分
缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
请抓紧时间提交您的作品,谢谢!
@@ -154,7 +154,7 @@
课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
作业标题:<%= ma.course_message.name %>
缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
- 匿评截止:<%= ma.course_message.homework_detail_manual.evaluation_end %> 24点
+ 匿评截止:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
<% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%>
请您尽早完成匿评!如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。
@@ -215,7 +215,7 @@
失败原因:提交作品的人数低于2人
课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年' + ma.course_message.course.term %>)
作业标题:<%= ma.course_message.name %>
-
提交截止:<%= ma.course_message.end_time%> 24点
+
提交截止:<%= ma.course_message.end_time%> 23:59
<%= time_tag(ma.created_at).html_safe %>
@@ -314,7 +314,7 @@
<% end %>
- 本次作业将在<%= ma.course_message.student_work.homework_common.homework_detail_manual.evaluation_end %> 24点结束匿评,到时您将可以看到所有其他同学的作品啦!大家可以进一步互相学习。 期待您取得更大的进步!
+ 本次作业将在<%= ma.course_message.student_work.homework_common.homework_detail_manual.evaluation_end %> 23:59结束匿评,到时您将可以看到所有其他同学的作品啦!大家可以进一步互相学习。 期待您取得更大的进步!
<% end %>
@@ -397,7 +397,7 @@
课程名称:<%= ma.course_message.homework_common.course.name %>(<%= ma.course_message.homework_common.course.time.to_s + '年' + ma.course_message.homework_common.course.term %>)
作业标题:<%= ma.course_message.homework_common.name %>
- 提交截止:<%= ma.course_message.homework_common.end_time %> 24:00
+ 提交截止:<%= ma.course_message.homework_common.end_time %> 23:59
提交时间:<%= format_time(ma.course_message.created_at) %>
迟交扣分:<%= ma.course_message.homework_common.late_penalty %>分
diff --git a/app/views/users/new_user_commit_homework.html.erb b/app/views/users/new_user_commit_homework.html.erb
index c3a736058..0e2648509 100644
--- a/app/views/users/new_user_commit_homework.html.erb
+++ b/app/views/users/new_user_commit_homework.html.erb
@@ -112,7 +112,7 @@
<% if test.status.to_i == -2 %>
- <%= test.results.first %>
+ <%= test.results.first %>
<% else %>
diff --git a/app/views/users/user_commit_homework.html.erb b/app/views/users/user_commit_homework.html.erb
index a7416cf40..6f14ce05d 100644
--- a/app/views/users/user_commit_homework.html.erb
+++ b/app/views/users/user_commit_homework.html.erb
@@ -86,7 +86,7 @@
<% if test.status.to_i == -2 %>
- <%= test.results.first %>
+ <%= test.results.first %>
<% else %>
diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb
index 5c6339e59..f6bb3c8cb 100644
--- a/app/views/users/user_resource.html.erb
+++ b/app/views/users/user_resource.html.erb
@@ -145,7 +145,6 @@
var id; //资源id
var sendType; //发送到课程 1 发送到项目 2
var lastSendType; //保存上次发送的发送类型
- var last_op
$("#resources_list").mousedown(function(e) {
//如果是右键的话
if (3 == e.which) {
@@ -180,28 +179,6 @@
last_line = line;
}
});
-
- //鼠标经过时,背景颜色设为灰色
- $("#resources_list").mouseover(function(e){
- pageX = e.clientX;
- pageY = e.clientY;
- var ele = document.elementFromPoint(pageX,pageY);
- line = $(ele).parent();
- if(last_op != null){
- last_op.children().css("background-color", 'white');
- restore();
- last_op == null;
- }
- //如果当前的tag是li,那么还要li的父级元素
- if(line.get(0).tagName === 'LI'){
- line = line.parent();
- }
- //将当前的元素的所有子元素的背景色改为蓝色
- line.children().css("background-color", '#e1e1e1');
- //将当前元素赋给 上一个对象 保存起来。
- last_op = line;
- });
-
//元素包含关系计算
var contains = function(root, el) {
if (root.compareDocumentPosition)
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/db/migrate/20151109073857_delete_journals_activity.rb b/db/migrate/20151109073857_delete_journals_activity.rb
new file mode 100644
index 000000000..ae7074c9c
--- /dev/null
+++ b/db/migrate/20151109073857_delete_journals_activity.rb
@@ -0,0 +1,40 @@
+class DeleteJournalsActivity < ActiveRecord::Migration
+ def up
+ UserActivity.all.each do |activity|
+ if activity.act_type == 'JournalsForMessage'
+ if activity.act
+ unless activity.act.m_parent_id.nil?
+ parent_act = UserActivity.where("act_id = #{activity.act.m_parent_id} and act_type='JournalsForMessage' and container_type='Principal'").first
+ if parent_act
+ parent_act.created_at = activity.act.parent.children.maximum("created_on")
+ parent_act.save
+ activity.destroy
+ end
+ end
+ else
+ activity.destroy
+ end
+ end
+ end
+
+ PrincipalActivity.all.each do |activity|
+ if activity.principal_act_type == 'JournalsForMessage'
+ if activity.principal_act
+ unless activity.principal_act.m_parent_id.nil?
+ parent_act = PrincipalActivity.where("principal_act_id = #{activity.principal_act.m_parent_id} and principal_act_type='JournalsForMessage'").first
+ if parent_act
+ parent_act.created_at = activity.principal_act.parent.children.maximum("created_on")
+ parent_act.save
+ activity.destroy
+ end
+ end
+ else
+ activity.destroy
+ end
+ end
+ end
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20151109080256_alter_user_activities_update.rb b/db/migrate/20151109080256_alter_user_activities_update.rb
new file mode 100644
index 000000000..6e77c411f
--- /dev/null
+++ b/db/migrate/20151109080256_alter_user_activities_update.rb
@@ -0,0 +1,16 @@
+class AlterUserActivitiesUpdate < ActiveRecord::Migration
+ def up
+ count = UserActivity.all.count / 30 + 2
+ transaction do
+ for i in 1 ... count do i
+ UserActivity.page(i).per(30).each do |activity|
+ activity.updated_at = activity.created_at
+ activity.save
+ end
+ end
+ end
+ end
+
+ def down
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index b7e1bfa1c..7898b3f4d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20151102090519) do
+ActiveRecord::Schema.define(:version => 20151109080256) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
diff --git a/lib/tasks/gitlab_to_git.rake b/lib/tasks/gitlab_to_git.rake
index 3c7d119f2..c7b97e00d 100644
--- a/lib/tasks/gitlab_to_git.rake
+++ b/lib/tasks/gitlab_to_git.rake
@@ -4,8 +4,19 @@ 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
+ desc "forge and ossean's members"
+ task :sync_members => :environment do
+ projects = []
+ projects << Project.where("id =? ",2)
+ projects << Project.where("id =? ",299)
+ puts projects
+ s = Trustie::Gitlab::Sync.new
+ projects.each do |project|
+ s.only_members(project.first)
+ end
+ end
end
\ No newline at end of file
diff --git a/lib/tasks/sync_sigle_rep.rake b/lib/tasks/sync_sigle_rep.rake
index b99221c83..591dcce84 100644
--- a/lib/tasks/sync_sigle_rep.rake
+++ b/lib/tasks/sync_sigle_rep.rake
@@ -3,19 +3,27 @@
namespace :sync_rep do
desc "sync some projects which just have sigle repository"
task :sigle => :environment do
- projects = Project.all
+ projects = Project.where("user_id !=?",12)
projects.each do |project|
# 针对类型为Git并且只有一个版本库的项目
if project.repositories && project.repositories.count == 1 && project.repositories.first.type == "Repository::Git"
rep = project.repositories.first
- s = Trustie::Gitlab::Sync.new
- s.sync_project(project, path: rep.identifier, import_url: rep.url)
- rep.type = 'Repository::Gitlab'
- rep.save
- puts "*************************************"
- puts project.id
- puts rep.id
- puts rep.identifier
+ count = Repository.find_by_sql("SELECT * FROM `repositories` where identifier = '#{rep.identifier}'").count
+ puts count
+ unless count > 1
+ rep.identifier
+ puts "################################"
+ puts project.id
+ puts rep.id
+ s = Trustie::Gitlab::Sync.new
+ s.sync_project(project, path: rep.identifier, import_url: rep.url)
+ rep.type = 'Repository::Gitlab'
+ rep.save
+ puts "*************************************"
+ puts project.id
+ puts rep.id
+ puts rep.identifier
+ end
end
end
end
diff --git a/lib/trustie/gitlab/sync.rb b/lib/trustie/gitlab/sync.rb
index 8c84984ee..a303b22fb 100644
--- a/lib/trustie/gitlab/sync.rb
+++ b/lib/trustie/gitlab/sync.rb
@@ -69,6 +69,11 @@ module Trustie
# import url http://xianbo_trustie2:1234@repository.trustie.net/xianbo/trustie2.git
# can use password
+ puts "@@@@@@@@@@@@@@@@@@@@@@@"
+ puts path
+ puts project.description
+ puts gid
+ puts import_url
gproject = self.g.create_project(path,
path: path,
description: project.description,
@@ -81,6 +86,7 @@ module Trustie
user_id: gid,
import_url: import_url
)
+ puts "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
project.gpid = gproject.id
project.save!
puts "Successfully created #{project.name}"
@@ -100,6 +106,20 @@ module Trustie
end
end
+ def only_members(project)
+ project.members.each do |m|
+ begin
+ gid = m.user.gid
+ unless gid
+ gid = sync_user(m.user).id
+ end
+ self.g.add_team_member(project.gpid, gid, UserLevel::DEVELOPER)
+ rescue => e
+ puts e
+ end
+ end
+ end
+
def remove_project
end
end
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index 90d085ea3..84e087c49 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();
@@ -939,13 +954,19 @@ function regexStudentWorkDescription()
function new_student_work()
{
if(regexStudentWorkName()&®exStudentWorkDescription())
- {$("#new_student_work").submit();}
+ {
+ $("#new_student_work").submit();
+ $("#ajax-indicator").hide();
+ }
}
function edit_student_work(id)
{
if(regexStudentWorkName()&®exStudentWorkDescription())
- {$("#edit_student_work_" + id).submit();}
+ {
+ $("#edit_student_work_" + id).submit();
+ $("#ajax-indicator").hide();
+ }
}
//
diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js
index e99abd4f1..a0647b592 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();
@@ -235,13 +250,19 @@ function regex_evaluation_num(){
function new_student_work()
{
if(regexStudentWorkName()&®exStudentWorkDescription())
- {$("#new_student_work").submit();}
+ {
+ $("#new_student_work").submit();
+ $("#ajax-indicator").hide();
+ }
}
function edit_student_work(id)
{
if(regexStudentWorkName()&®exStudentWorkDescription())
- {$("#edit_student_work_" + id).submit();}
+ {
+ $("#edit_student_work_" + id).submit();
+ $("#ajax-indicator").hide();
+ }
}
//验证作品名称
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/courses.css b/public/stylesheets/courses.css
index 97af45fa2..efede841c 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -483,7 +483,7 @@ a.xls{ margin-left:5px; color:#136b3b;}
/* 开启匿评弹框 */
.anonymos{width:480px;height:180px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
.anonymos_work {position:fixed !important;left:60%;top:60%;margin:-215px 0 0 -300px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
-.ni_con { width:425px; margin:25px 30px;}
+.ni_con { width:425px; margin:25px 30px;font-family:"微软雅黑","宋体";}
.ni_con h2{ display:block; height:40px; width:425px; text-align:center; color:#3a3a3a;}
.ni_con p{ color:#808181; }
.ni_con a:hover{ text-decoration:none;}
@@ -494,6 +494,7 @@ a:hover.tijiao{ background:#0f99a9;}
.ni_con_work { width:300px; margin:25px 20px;}
.ni_con_work p{ color:#808181; }
a.xls{ margin-left:5px; color:#136b3b;}
+.grey_c{ color:#808181;}
/* 学生列表*/
.st_list{ width:670px;}
.st_search{ }
diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css
index 6114c1b4d..b740436f9 100644
--- a/public/stylesheets/css.css
+++ b/public/stylesheets/css.css
@@ -152,11 +152,12 @@ a:hover.tijiao{ background:#0f99a9 !important;}
/* 匿名评分弹框 */
.alert_praise{width:480px;height:200px;position:fixed;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
.alert .close02{width:26px;height:26px;overflow:hidden;position:absolute;top:-10px;right:-490px;background:url(images/close.png) no-repeat;cursor:pointer;}
-.ni_con { width:425px; margin:25px 30px;}
+.ni_con { width:425px; margin:25px 30px;font-family:"微软雅黑","宋体";}
.ni_con h2{ display:block; height:40px; width:188px; margin:0 auto;}
.ni_con p{ color:#808181;}
.ni_con a:hover{ text-decoration:none;}
+.grey_c{ color:#808181;}
/*弹框*/
.black_overlay{display:none;position:absolute;top:0%;left:0%;width:100%;height:100%;background-color:black;z-index:1001;-moz-opacity:0.3;opacity:.30;filter:alpha(opacity=30);}
.upload_box{display:none;position:absolute;top:25%;left:35%;width:30%;height: auto;padding:5px;border:3px solid #15bccf; background:#fff;z-index:1002;overflow:auto;}
diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css
index 0308ee748..7263c2f58 100644
--- a/public/stylesheets/new_user.css
+++ b/public/stylesheets/new_user.css
@@ -1297,7 +1297,7 @@ a:hover.SetUpIcon{background: url(../images/homepage_icon.png) 0px -486px no-rep
/* 开启匿评弹框 */
.anonymos{width:480px;height:180px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
.anonymos_work {position:fixed !important;left:60%;top:60%;margin:-215px 0 0 -300px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
-.ni_con { width:425px; margin:15px;}
+.ni_con { width:425px; margin:15px;font-family:"微软雅黑","宋体";}
.ni_con h2{ display:block; height:40px; width:425px; text-align:center; color:#3a3a3a;}
.ni_con p{ color:#808181; }
.ni_con a:hover{ text-decoration:none;}
@@ -1307,7 +1307,7 @@ a:hover.tijiao{ background:#297fb8;}
.c_pink{ color:#e65d5e;}
.ni_con_work { width:300px; margin:25px 20px;}
.ni_con_work p{ color:#808181; }
-
+.grey_c{ color:#808181;}
a.link_file_a{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; }
a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
.link_file_a{ display:block; max-width:450px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
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;}