From 64d446e480b861e4c7a422021739eb569a2b5a42 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 14 Oct 2016 20:35:51 +0800 Subject: [PATCH 01/20] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E4=B8=80=E7=BA=A7=E6=A0=8F=E7=9B=AE=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_org_left_subfield_list.html.erb | 17 ++++++++++------- app/views/organizations/_org_subdomain.html.erb | 12 ++++++------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index ee467067b..1d245b809 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -43,11 +43,12 @@ $(this).prev().css("color","#808080"); $(this).css("z-index", "1"); }); + //二级菜单滑动时箭头方向控制 $(".homepageLeftMenuMoreIcon").toggle(function(){ - $(this).css("background","url(/images/homepage_icon.png) -74px -240px no-repeat"); - },function(){ $(this).css("background","url(/images/homepage_icon.png) 100px -624px no-repeat"); + },function(){ + $(this).css("background","url(/images/homepage_icon.png) -74px -240px no-repeat"); }); }) @@ -55,7 +56,7 @@ <% organization.org_subfields.order("priority").each do |field| %> <% if is_default_field?(field) %> <% case field.name %> - <% when 'activity' %> +<% when 'activity' %>
<%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %>
@@ -102,15 +103,17 @@ <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> <% end %> <% else %> - <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> + + <%= field.name %> <% end %> <% if User.current.logged? and User.current.admin_of_org?(organization) %> <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子" %> <% end %> -
+
+
@@ -136,7 +139,7 @@
<% elsif field.field_type == "Resource" %>
- <% if !field.subfield_subdomain_dir.nil? %> + <% if !field.subfield_subdomain_dir.nil? %> <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", organization.id).map(&:subname).include?(request.subdomain) %> <%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText homepageMenuControl hidden" %> <% else %> diff --git a/app/views/organizations/_org_subdomain.html.erb b/app/views/organizations/_org_subdomain.html.erb index 8b8807533..fe73cfa4e 100644 --- a/app/views/organizations/_org_subdomain.html.erb +++ b/app/views/organizations/_org_subdomain.html.erb @@ -3,10 +3,10 @@ <%= link_to subdomain.name, org_subfield_sub_domain_sub_document_comments_path(subdomain, :org_subfield_id => org_subfield_id), :class => "coursesLineGrey hidden", :title => subdomain.name %> <% end %> -<% if subdomains.size == 5 %> -
  • - - -
  • -<% end%> +<%# if subdomains.size == 5 %> + + + + +<%# end%> From 3ceee6522b9b3320f33e4765b4a787eb54b11a1e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 14 Oct 2016 21:05:40 +0800 Subject: [PATCH 02/20] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E8=B4=B4=E5=90=A7=E6=8A=A5=E8=B4=B4=E5=90=A7=E5=90=8D=E5=B7=B2?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/forums_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 6ebe6b9eb..3332f1207 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -296,12 +296,12 @@ class ForumsController < ApplicationController #检查forum的名字 def check_forum_name - forum_name_exist = false - # 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 = 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 + end render :text => forum_name_exist end From da7de2c2a2163bec7846b98b3f1a7afeb5fd33cf Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 15 Oct 2016 11:12:12 +0800 Subject: [PATCH 03/20] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=B8=AD=E9=9A=90=E8=97=8F=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../files/_attachment_history_popub.html.erb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/files/_attachment_history_popub.html.erb b/app/views/files/_attachment_history_popub.html.erb index 02da5857f..fac1e2e36 100644 --- a/app/views/files/_attachment_history_popub.html.erb +++ b/app/views/files/_attachment_history_popub.html.erb @@ -14,7 +14,7 @@ <%= @attachment.downloads %> <%= @attachment.try(:quotes).to_i %> <%= format_time(@attachment.created_on) %> - + <% @attachment_histories.each do |history| %> @@ -24,14 +24,14 @@ <%= history.downloads %> <%= history.try(:quotes).to_i %> <%= format_time(history.created_on) %> - - <%= link_to( '删除资源', attachment_path(history.attachment, :history_id => history, :type => "history"), - :remote => true, - :data => {:confirm => l(:text_are_you_sure)}, - :method => :delete, - :class => "postOptionLink", + + <%#= link_to( '删除资源', attachment_path(history.attachment, :history_id => history, :type => "history"), +# :remote => true, +# :data => {:confirm => l(:text_are_you_sure)}, +# :method => :delete, +# :class => "postOptionLink", :class => "btn") if allow_to_delete_attachment(history) %> - + <% end %> From 50ba2fb04f4ed0285fc1e2c2b2bb11db76581746 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 15 Oct 2016 11:31:15 +0800 Subject: [PATCH 04/20] =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=92=8C=E6=B2=A1=E6=9C=89=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=88=A0=E9=99=A4=E9=99=84=E4=BB=B6=E6=8F=90?= =?UTF-8?q?=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 2 ++ app/views/files/_attachment_history_popub_delete.html.erb | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 211b8da57..e7a5d3164 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -348,6 +348,7 @@ class AttachmentsController < ApplicationController @is_history_delete = true @is_history_destroy = false @attachment_histories = @attachment.attachment_histories + @attachment_histories_count = @attachment_histories.count rescue Exception => e puts e end @@ -667,6 +668,7 @@ class AttachmentsController < ApplicationController def attachment_versions_delete @attachment = Attachment.find(params[:id]) @attachment_histories = @attachment.attachment_histories + @attachment_histories_count = @attachment_histories.count respond_to do |format| format.js end diff --git a/app/views/files/_attachment_history_popub_delete.html.erb b/app/views/files/_attachment_history_popub_delete.html.erb index 0f9624119..69c0d58b1 100644 --- a/app/views/files/_attachment_history_popub_delete.html.erb +++ b/app/views/files/_attachment_history_popub_delete.html.erb @@ -39,11 +39,11 @@
    <% if @attachment.container_type == "Project" %> - <%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => l(:text_history_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (is_project_manager?(User.current.id, @attachment.container_id) || User.current.id == @attachment.author_id || User.current.admin?) %> + <%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (is_project_manager?(User.current.id, @attachment.container_id) || User.current.id == @attachment.author_id || User.current.admin?) %> <% elsif @attachment.container_type == "Course" %> - <%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => l(:text_history_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.allowed_to?(:as_teacher, @attachment.container) || User.current.id == @attachment.author_id || User.current.admin?) %> + <%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.allowed_to?(:as_teacher, @attachment.container) || User.current.id == @attachment.author_id || User.current.admin?) %> <% elsif @attachment.container_type == "OrgSubfield" %> - <%= link_to( '删除所有资源', attachment_path(@attachment, :history => true), :data => {:confirm => l(:text_history_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.id == @attachment.author_id || User.current.admin_of_org?(@attachment) || User.current.admin?) %> + <%= link_to( '删除所有资源', attachment_path(@attachment, :history => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.id == @attachment.author_id || User.current.admin_of_org?(@attachment) || User.current.admin?) %> <% end %>
    From 6dbb50f803699cc323fad05b689039a94db79b17 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 15 Oct 2016 11:34:06 +0800 Subject: [PATCH 05/20] =?UTF-8?q?=E7=A1=AE=E5=AE=9A=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=8F=98=E6=88=90=E6=89=8B=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_attachment_history_popub.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/files/_attachment_history_popub.html.erb b/app/views/files/_attachment_history_popub.html.erb index fac1e2e36..4ec1d3c55 100644 --- a/app/views/files/_attachment_history_popub.html.erb +++ b/app/views/files/_attachment_history_popub.html.erb @@ -54,6 +54,6 @@
    取消 <%#= submit_tag '确定', :onclick => 'upload_attachment_version(event);', :onfocus => 'this.blur()', :id => 'upload_files_submit_btn', :class => 'btn btn-blue fr mr5' %> - 确定 + 确定
    <% end %> From 8005958f032bc18144c9205d26bdb2ef0d406700 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 15 Oct 2016 12:35:36 +0800 Subject: [PATCH 06/20] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attachments/_show_attachment_history_delete.html.erb | 9 ++++++++- app/views/files/_attachment_history_popub.html.erb | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/views/attachments/_show_attachment_history_delete.html.erb b/app/views/attachments/_show_attachment_history_delete.html.erb index 489eaeed0..6a73f057a 100644 --- a/app/views/attachments/_show_attachment_history_delete.html.erb +++ b/app/views/attachments/_show_attachment_history_delete.html.erb @@ -1,6 +1,6 @@

    删除资源

    - +
    @@ -9,3 +9,10 @@ <%= render :partial => "files/attachment_history_popub_delete" %>
    + + diff --git a/app/views/files/_attachment_history_popub.html.erb b/app/views/files/_attachment_history_popub.html.erb index 4ec1d3c55..c0a833030 100644 --- a/app/views/files/_attachment_history_popub.html.erb +++ b/app/views/files/_attachment_history_popub.html.erb @@ -52,8 +52,15 @@
    - 取消 + 取消 <%#= submit_tag '确定', :onclick => 'upload_attachment_version(event);', :onfocus => 'this.blur()', :id => 'upload_files_submit_btn', :class => 'btn btn-blue fr mr5' %> 确定
    <% end %> + + From 5aab3fdb75639bfefe9e1209d028a7f8071d23df Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 15 Oct 2016 12:36:07 +0800 Subject: [PATCH 07/20] =?UTF-8?q?rake=E4=B8=AD=E5=8A=A0=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/homework_publishtime.rake | 2 ++ lib/tasks/resource_publish.rake | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/tasks/homework_publishtime.rake b/lib/tasks/homework_publishtime.rake index 440c04a09..75e6a8912 100644 --- a/lib/tasks/homework_publishtime.rake +++ b/lib/tasks/homework_publishtime.rake @@ -3,6 +3,7 @@ namespace :homework_publishtime do desc "start publish homework and end homework" task :publish => :environment do + puts "--------------------------------homework_publish start" homework_commons = HomeworkCommon.where("publish_time = '#{Date.today}'") homework_commons.each do |homework| homework_detail_manual = homework.homework_detail_manual @@ -35,6 +36,7 @@ namespace :homework_publishtime do Mailer.run.homework_added(homework) end end + puts "--------------------------------homework_publish end" end task :end => :environment do diff --git a/lib/tasks/resource_publish.rake b/lib/tasks/resource_publish.rake index 2df0c6145..ee39cfcc5 100644 --- a/lib/tasks/resource_publish.rake +++ b/lib/tasks/resource_publish.rake @@ -3,9 +3,11 @@ namespace :resource_publish do desc "start publish resource" task :publish => :environment do + puts "--------------------------------resource_publish start" attachments = Attachment.where("publish_time = '#{Date.today}'") attachments.each do |attachment| attachment.update_column('is_publish', 1) end + puts "--------------------------------resource_publish end" end end \ No newline at end of file From bc37d09edf06b270d0359972b3cbfa98e369ae10 Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 15 Oct 2016 13:41:33 +0800 Subject: [PATCH 08/20] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=89=88=E6=9C=ACtitle=E9=95=BF=E5=BA=A6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_attachment_history_popub.html.erb | 2 +- public/stylesheets/css/project.css | 3 --- public/stylesheets/css/public.css | 3 +++ 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/files/_attachment_history_popub.html.erb b/app/views/files/_attachment_history_popub.html.erb index 609ad8964..06de9f589 100644 --- a/app/views/files/_attachment_history_popub.html.erb +++ b/app/views/files/_attachment_history_popub.html.erb @@ -10,7 +10,7 @@ - + 当前版本 <%= @attachment.downloads %> <%= @attachment.try(:quotes).to_i %> <%= format_time(@attachment.created_on) %> diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index ae4b09103..a96147bf0 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -660,6 +660,3 @@ a:hover.sy_btn_pink{ background: #e64c4c;} } .sy_class_titbox{margin-bottom:5px; padding-top:10px; } - -/*项目历史版本删除功能*/ -.popup_ziyuan_title{ display: block; margin-left: 10px; text-align: left;width:360px; overflow:hidden;white-space: nowrap; text-overflow:ellipsis;} diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index 2acc0f454..a53d43097 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -1512,3 +1512,6 @@ a.syllabusbox_a_blue{ /*20160912问卷调查*/ .dash-block {border:1px dashed #ddd;} + +/*历史版本删除功能*/ +.popup_ziyuan_title{ display: block; margin-left: 10px; text-align: left;width:360px; overflow:hidden;white-space: nowrap; text-overflow:ellipsis;} From c94f986ba27bfc13c097c12a41436e3d278c4ec0 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 15 Oct 2016 14:20:54 +0800 Subject: [PATCH 09/20] =?UTF-8?q?=E5=B0=86=E6=9C=AA=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E7=9A=84=E4=BD=9C=E4=B8=9A=E6=81=A2=E5=A4=8D=E6=88=90=E5=B7=B2?= =?UTF-8?q?=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...15054820_update_homework_comment_status.rb | 20 +++++++++++++++++++ db/schema.rb | 16 ++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20161015054820_update_homework_comment_status.rb diff --git a/db/migrate/20161015054820_update_homework_comment_status.rb b/db/migrate/20161015054820_update_homework_comment_status.rb new file mode 100644 index 000000000..7196c095a --- /dev/null +++ b/db/migrate/20161015054820_update_homework_comment_status.rb @@ -0,0 +1,20 @@ +class UpdateHomeworkCommentStatus < ActiveRecord::Migration + def up + homeworks = HomeworkCommon.joins(:homework_detail_manual).where("publish_time is not NULL and publish_time <= '#{Date.today}' and homework_detail_manuals.comment_status = 0") + homeworks.each do |homework| + hw_dm = homework.homework_detail_manual + if hw_dm && hw_dm.comment_status == 0 + if hw_dm.evaluation_end < Date.today && homework.anonymous_comment == 0 + hw_dm.update_column("comment_status", 3) + elsif homework.anonymous_comment == 0 && hw_dm.evaluation_end >= Date.today && hw_dm.evaluation_start <= Date.today + hw_dm.update_column("comment_status", 2) + else + hw_dm.update_column("comment_status", 1) + end + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 1f763c39e..66a6c1710 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 => 20161011012114) do +ActiveRecord::Schema.define(:version => 20161015054820) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -142,7 +142,7 @@ ActiveRecord::Schema.define(:version => 20161011012114) do t.integer "downloads", :default => 0 t.integer "author_id" t.datetime "created_on" - t.string "description" + t.text "description" t.string "disk_directory" t.integer "attachtype" t.integer "is_public" @@ -313,14 +313,16 @@ ActiveRecord::Schema.define(:version => 20161011012114) do add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" create_table "changesets", :force => true do |t| - t.integer "repository_id", :null => false - t.string "revision", :null => false + t.integer "repository_id", :null => false + t.string "revision", :null => false t.string "committer" - t.datetime "committed_on", :null => false + t.datetime "committed_on", :null => false t.text "comments" t.date "commit_date" t.string "scmid" t.integer "user_id" + t.integer "project_id" + t.integer "type", :default => 0 end add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" @@ -971,6 +973,10 @@ ActiveRecord::Schema.define(:version => 20161011012114) do t.datetime "updated_at", :null => false end + create_table "innodb_monitor", :id => false, :force => true do |t| + t.integer "a" + end + create_table "invite_lists", :force => true do |t| t.integer "project_id" t.integer "user_id" From 3f667a7afcf20df82b66f560f719328bb5b7f445 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 15 Oct 2016 15:13:15 +0800 Subject: [PATCH 10/20] =?UTF-8?q?rake=E4=BB=BB=E5=8A=A1=E6=B7=BB=E5=8A=A0l?= =?UTF-8?q?og?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/homework_publishtime.rake | 2 ++ lib/tasks/resource_publish.rake | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/tasks/homework_publishtime.rake b/lib/tasks/homework_publishtime.rake index 75e6a8912..df996ab9e 100644 --- a/lib/tasks/homework_publishtime.rake +++ b/lib/tasks/homework_publishtime.rake @@ -4,6 +4,7 @@ namespace :homework_publishtime do desc "start publish homework and end homework" task :publish => :environment do puts "--------------------------------homework_publish start" + Rails.logger.info("log--------------------------------homework_publish start") homework_commons = HomeworkCommon.where("publish_time = '#{Date.today}'") homework_commons.each do |homework| homework_detail_manual = homework.homework_detail_manual @@ -36,6 +37,7 @@ namespace :homework_publishtime do Mailer.run.homework_added(homework) end end + Rails.logger.info("log--------------------------------homework_publish end") puts "--------------------------------homework_publish end" end diff --git a/lib/tasks/resource_publish.rake b/lib/tasks/resource_publish.rake index ee39cfcc5..7584de4d3 100644 --- a/lib/tasks/resource_publish.rake +++ b/lib/tasks/resource_publish.rake @@ -4,10 +4,12 @@ namespace :resource_publish do desc "start publish resource" task :publish => :environment do puts "--------------------------------resource_publish start" + Rails.logger.info("log--------------------------------resource_publish start") attachments = Attachment.where("publish_time = '#{Date.today}'") attachments.each do |attachment| attachment.update_column('is_publish', 1) end + Rails.logger.info("log--------------------------------resource_publish end") puts "--------------------------------resource_publish end" end end \ No newline at end of file From a289a2cee03f7786b790db81822e69686e3ab6ae Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 15 Oct 2016 15:16:21 +0800 Subject: [PATCH 11/20] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E9=97=AE=E5=8D=B7?= =?UTF-8?q?=EF=BC=9A=E6=96=B0=E5=BB=BA=E6=97=B6=E5=8F=AA=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=B9=B6=E8=AE=BE=E7=BD=AE=E5=AD=A6=E7=94=9F=E5=8F=AF=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E7=BB=9F=E8=AE=A1=E5=88=97=E8=A1=A8=EF=BC=8C=E5=86=8D?= =?UTF-8?q?=E5=88=B0=E9=97=AE=E5=8D=B7=E5=88=97=E8=A1=A8=E4=B8=AD=E5=8E=BB?= =?UTF-8?q?=E5=8F=91=E5=B8=83=EF=BC=8C=E4=BD=86=E5=AE=9E=E9=99=85=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=E4=B8=8D=E8=83=BD=E6=9F=A5=E7=9C=8B=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 18 ++++++++++++++---- app/views/poll/_poll_form.html.erb | 10 +++++++++- app/views/poll/_poll_save.html.erb | 21 +++++++++++++++++++++ app/views/poll/save_poll.js.erb | 2 ++ config/routes.rb | 1 + public/stylesheets/css/common.css | 2 +- 6 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 app/views/poll/_poll_save.html.erb create mode 100644 app/views/poll/save_poll.js.erb diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index f06f9c855..c284b2c7a 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -1,10 +1,10 @@ #encoding utf-8 class PollController < ApplicationController - before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll] + before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll,:save_poll] before_filter :find_container, :only => [:new,:create, :index] - before_filter :is_logged, :only => [:index, :show, :poll_result,:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll,:commit_answer,:commit_poll,:statistics_result] + before_filter :is_logged, :only => [:index, :show, :poll_result,:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll,:commit_answer,:commit_poll,:statistics_result,:save_poll] before_filter :is_member_of_course, :only => [:index,:show,:poll_result] - before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll] + before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll,:save_poll] include PollHelper def index if @course @@ -245,7 +245,7 @@ class PollController < ApplicationController def publish_poll @poll.polls_status = 2 @poll.published_at = Time.now - @poll.show_result = params[:show_result] + @poll.show_result = params[:show_result].to_i if params[:show_result] if @poll.save if params[:is_remote] redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id) @@ -257,6 +257,16 @@ class PollController < ApplicationController end end + #保存问卷 + def save_poll + @poll.show_result = params[:show_result].to_i + if @poll.save + respond_to do |format| + format.js + end + end + end + #提交答案 def commit_answer pq = PollQuestion.find(params[:poll_question_id]) diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index 6edea0362..8f6f53a23 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -497,7 +497,15 @@ function insert_MCQ(quest_type,quest_num,quest_id){ }else if(forms.length > 0){ alert("请先保存正在编辑的题目。"); } else { - window.location.href = "<%=edit_poll_path(@poll) %>"; + if($("#show_result").is(":checked")) { + $.get( + '<%= save_poll_poll_path(@poll.id) %>'+'?show_result=1' + ) + } else{ + $.get( + '<%= save_poll_poll_path(@poll.id) %>'+'?show_result=0' + ) + } } } function poll_submit() diff --git a/app/views/poll/_poll_save.html.erb b/app/views/poll/_poll_save.html.erb new file mode 100644 index 000000000..cae1828e2 --- /dev/null +++ b/app/views/poll/_poll_save.html.erb @@ -0,0 +1,21 @@ +
    +

    提示

    + +
    +
    +
    +
      +
    • +

      + 问卷保存成功 +

      +
    • +
    • + + <%= link_to('确 定', edit_poll_path(@poll), :class => "sy_btn_blue fl") %> +
      +
    • +
    +
    + + diff --git a/app/views/poll/save_poll.js.erb b/app/views/poll/save_poll.js.erb new file mode 100644 index 000000000..68f7286f0 --- /dev/null +++ b/app/views/poll/save_poll.js.erb @@ -0,0 +1,2 @@ +var htmlvalue = "<%= escape_javascript(render :partial => 'poll_save', locals: { :poll => @poll,:is_remote => false,:show_result=> 1}) %>"; +pop_box_new(htmlvalue,460,190); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index d8b4b8cf4..c7b097730 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -263,6 +263,7 @@ RedmineApp::Application.routes.draw do post 'create_poll_question' post 'commit_poll' get 'publish_poll' + get 'save_poll' get 'republish_poll' get 'poll_result' get 'close_poll' diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index ac528cc08..b6dc8b202 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -265,7 +265,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/ .w557{ width:557px;} .w570 {width:570px !important;} .w576{ width:576px;} -.w590{ width:590px; !important;} +.w590{ width:590px !important;} .w607 {width:607px;} .w664{ width:664px;} .w683{ width:683px;} From ee03cda8a61d5a085d9676fb45110f8a9fbdd15e Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 15 Oct 2016 15:34:33 +0800 Subject: [PATCH 12/20] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=BA=93=E5=BC=B9=E7=AA=97=E6=A0=B7=E5=BC=8F=E5=8F=8A=E4=BD=8D?= =?UTF-8?q?=E7=BD=AEjs=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attachment_history_download.js.erb | 17 ++++++++++------- app/views/files/file_hidden.js.erb | 15 +++++++++------ app/views/layouts/base_courses.html.erb | 3 +++ app/views/users/import_resources.js.erb | 4 ++++ public/javascripts/application.js | 1 + public/stylesheets/css/popup.css | 4 +--- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/app/views/attachments/attachment_history_download.js.erb b/app/views/attachments/attachment_history_download.js.erb index 352a2ef93..a20cd8563 100644 --- a/app/views/attachments/attachment_history_download.js.erb +++ b/app/views/attachments/attachment_history_download.js.erb @@ -1,7 +1,10 @@ -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/attachment_history_download' )%>'); -showModal('ajax-modal', '452px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","40%").css("left","50%"); -$('#ajax-modal').parent().addClass("resourceUploadPopup"); -$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); \ No newline at end of file +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/attachment_history_download' )%>'); +showModal('ajax-modal', '452px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","40%").css("left","50%"); +$('#ajax-modal').parent().addClass("resourceUploadPopup"); +$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); +//与更新版本弹窗js冲突新增样式代码 +$('#ajax-modal').parent().css({"border":"3px solid #269ac9", "padding":"4px"}); +$('#ajax-modal').css("padding","6.6px 13.2px 16px 16px"); \ No newline at end of file diff --git a/app/views/files/file_hidden.js.erb b/app/views/files/file_hidden.js.erb index b95ab5104..ab7333b86 100644 --- a/app/views/files/file_hidden.js.erb +++ b/app/views/files/file_hidden.js.erb @@ -1,6 +1,9 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/hidden_file',:locals => {:course => @course,:course_attachment_type => 1}) %>'); -showModal('ajax-modal', '311px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); -$('#ajax-modal').parent().addClass("popbox_polls"); \ No newline at end of file +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/hidden_file',:locals => {:course => @course,:course_attachment_type => 1}) %>'); +showModal('ajax-modal', '311px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); +$('#ajax-modal').parent().addClass("popbox_polls").removeClass("resourceUploadPopup popbox"); +//与更新版本弹窗js冲突新增样式代码 +$('#ajax-modal').parent().css({"border":"3px solid #269ac9", "padding":"4px"}); +$('#ajax-modal').css({"padding":"","min-height":""}); \ No newline at end of file diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 711379b5f..964d0d23e 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -230,6 +230,9 @@ $('#ajax-modal').before(""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); + //与更新版本弹窗js冲突新增样式代码 + $('#ajax-modal').parent().css({"border":"3px solid #269ac9", "padding":"4px"}); + $('#ajax-modal').css("padding",""); } // 鼠标经过的时候显示内容 function message_titile_show(obj,e) diff --git a/app/views/users/import_resources.js.erb b/app/views/users/import_resources.js.erb index b07f534e7..ead387767 100644 --- a/app/views/users/import_resources.js.erb +++ b/app/views/users/import_resources.js.erb @@ -15,4 +15,8 @@ $('#ajax-modal').parent().css("top","20%").css("left","42%").css("border","3px s <% end %> $('#ajax-modal').parent().addClass("popbox_polls"); +//与更新版本弹窗js冲突新增样式代码 +$('#ajax-modal').parent().css({"border":"3px solid #269ac9", "padding":"4px"}); +$('#ajax-modal').css("padding",""); + diff --git a/public/javascripts/application.js b/public/javascripts/application.js index b0f11fc75..cb7ba4b63 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1550,6 +1550,7 @@ function pop_box_new(value, Width, Height){ showModal('ajax-modal', Width + 'px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').parent().css({"top": h+"px","left": w+"px","padding":"0","border":"none","position":"fixed"}); + $('#ajax-modal').parent().removeClass("resourceUploadPopup popbox_polls popbox"); $('#ajax-modal').css({"padding":"0","overflow":"hidden"}); $('#ajax-modal').parent().attr("id","popupWrap"); diff --git a/public/stylesheets/css/popup.css b/public/stylesheets/css/popup.css index 20d08e508..a7354f645 100644 --- a/public/stylesheets/css/popup.css +++ b/public/stylesheets/css/popup.css @@ -41,7 +41,6 @@ input.sendSourceText:hover {background-color:#297fb8;} .resourcesSendTo {float:left; height:20px; margin-top:15px;} .resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;} .courseReferContainer {float:left; max-height:120px;margin-right:16px;margin-bottom:10px; overflow:auto; overflow-x:hidden;} -.popbox{/* width:300px; *//* height:100px; */position:fixed !important;/* z-index:100; */left:50%;top:50%;margin:-100px 0 0 -150px; /* background:#fff; */ -moz-border-radius:5px; /* -webkit-border-radius:5px; */ /* border-radius:5px; */ /* box-shadow:0px 0px 8px #194a81; */ /* overflow:auto; */} /*上传资源弹窗*/ .resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:fixed; top:50%; left:50%; margin-left:-200px; z-index:1000;} @@ -74,7 +73,7 @@ div.disable_link {background-color: #c1c1c1 !important;} .homeworkListForm{height: 160px;width: 550px;overflow: scroll;overflow-x: hidden;} /*引用资源库弹窗*/ -.popbox{position:fixed !important;left:50%;top:50%;margin:-100px 0 0 -150px; -moz-border-radius:5px;} +.popbox{position:fixed !important; left:50%; top:50% ;margin:-100px 0 0 -150px; -moz-border-radius:5px;} .referenceResourcesPopup {width:750px !important; height:500px !important; border:3px solid #269ac9 !important; padding:0 16px 16px 16px !important; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-375px; z-index:1000;} .referenceText {font-size:16px; color:#269ac9; line-height:16px; display:inline-block; font-weight:bold;} .referenceSearchBox {border:1px solid #e6e6e6; width:235px; height:32px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;} @@ -163,7 +162,6 @@ a:hover.CloseBtn{background:url(/images/CloseBtn.png) 0px -24px no-repeat; } .popClose {background:url(/images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:2px; top:3px;} /****评分弹框****/ -/*#popbox{width:488px;height:550px;position:absolute;z-index:100;left:50%;top:40%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; padding:5px; overflow:auto; }*/ .alert .close{width:26px;height:26px;overflow:hidden;position:absolute;top:-10px;right:-502px;background:url(/images/close.png) no-repeat;cursor:pointer;} .alert .C{width:476px;height:296px;position:absolute;left:5px;top:5px; } .ping_con{ margin:5px; border-bottom:1px dashed #CCC; padding-bottom:5px;} From 16bedc3d8f9943638cda04296b09e912a989861b Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 15 Oct 2016 15:47:48 +0800 Subject: [PATCH 13/20] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=BA=93=E5=BC=B9=E7=AA=97=E4=BD=8D=E7=BD=AE=E5=8F=8A=E6=A0=B7?= =?UTF-8?q?=E5=BC=8Fjs=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/import_resources.js.erb | 1 + app/views/users/search_user_course.js.erb | 2 + app/views/users/search_user_org.js.erb | 50 ++++++++++---------- app/views/users/search_user_project.js.erb | 54 +++++++++++----------- 4 files changed, 57 insertions(+), 50 deletions(-) diff --git a/app/views/users/import_resources.js.erb b/app/views/users/import_resources.js.erb index ead387767..0b51af592 100644 --- a/app/views/users/import_resources.js.erb +++ b/app/views/users/import_resources.js.erb @@ -18,5 +18,6 @@ $('#ajax-modal').parent().addClass("popbox_polls"); //与更新版本弹窗js冲突新增样式代码 $('#ajax-modal').parent().css({"border":"3px solid #269ac9", "padding":"4px"}); $('#ajax-modal').css("padding",""); +$('#ajax-modal').parent().removeClass(" popbox resourceUploadPopup shareDP"); diff --git a/app/views/users/search_user_course.js.erb b/app/views/users/search_user_course.js.erb index f30970dc4..1a289e17a 100644 --- a/app/views/users/search_user_course.js.erb +++ b/app/views/users/search_user_course.js.erb @@ -23,6 +23,8 @@ $('#ajax-modal').parent().css("top","50%").css("left","50%"); $('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); + //与更新版本弹窗js冲突新增样式代码 + $('#ajax-modal').parent().css({"border":"3px solid #269ac9", "padding":"4px"}); var val = $("#search_course_input").val(); $("#search_course_input").val("").focus().val(val); <% else %> diff --git a/app/views/users/search_user_org.js.erb b/app/views/users/search_user_org.js.erb index f2caf8b41..1eed1a4e5 100644 --- a/app/views/users/search_user_org.js.erb +++ b/app/views/users/search_user_org.js.erb @@ -1,25 +1,27 @@ -<% if params[:is_observe].nil? %> -<% if params[:send_type].present? && params[:send_type] == 'news' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); -<% elsif params[:send_type] == 'file' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids,:type => @type})%>'); -<% elsif params[:send_type] == 'message' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); -<% end %> -showModal('ajax-modal', '452px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","50%").css("left","50%"); -$('#ajax-modal').parent().addClass("popbox").addClass("shareDP"); -$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); -var val = $("#search_org_input").val(); -$("#search_org_input").val("").focus().val(val); -<% else %> - <% if params[:send_type] == 'news' %> - $("#org_news_form").html("<%= escape_javascript(render :partial => 'users/org_news_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>"); - <% elsif params[:send_type] == 'file' %> - $("#org_file_form").html("<%= escape_javascript(render :partial => 'users/org_file_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>"); - <% elsif params[:send_type] == 'message' %> - $("#org_message_form").html("<%= escape_javascript(render :partial => 'users/org_message_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>"); - <% end %> +<% if params[:is_observe].nil? %> +<% if params[:send_type].present? && params[:send_type] == 'news' %> +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% elsif params[:send_type] == 'file' %> +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids,:type => @type})%>'); +<% elsif params[:send_type] == 'message' %> +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% end %> +showModal('ajax-modal', '452px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","50%").css("left","50%"); +$('#ajax-modal').parent().addClass("popbox").addClass("shareDP"); +$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); +//与更新版本弹窗js冲突新增样式代码 +$('#ajax-modal').parent().css({"border":"3px solid #269ac9", "padding":"4px"}); +var val = $("#search_org_input").val(); +$("#search_org_input").val("").focus().val(val); +<% else %> + <% if params[:send_type] == 'news' %> + $("#org_news_form").html("<%= escape_javascript(render :partial => 'users/org_news_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>"); + <% elsif params[:send_type] == 'file' %> + $("#org_file_form").html("<%= escape_javascript(render :partial => 'users/org_file_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>"); + <% elsif params[:send_type] == 'message' %> + $("#org_message_form").html("<%= escape_javascript(render :partial => 'users/org_message_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>"); + <% end %> <% end %> \ No newline at end of file diff --git a/app/views/users/search_user_project.js.erb b/app/views/users/search_user_project.js.erb index 37d078662..3357f8a7b 100644 --- a/app/views/users/search_user_project.js.erb +++ b/app/views/users/search_user_project.js.erb @@ -1,26 +1,28 @@ -<% if params[:is_observe].nil? %> -<% if params[:send_type].present? && params[:send_type] == 'news' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); -<% elsif params[:send_type] == 'file' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids,:type => @type}) %>'); -<% elsif params[:send_type] == 'message' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); -<% end %> -showModal('ajax-modal', '452px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","50%").css("left","50%"); -$('#ajax-modal').parent().addClass("resourceUploadPopup").addClass("popbox") -$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); -//$("#search_project_input").focus(); -var val = $("#search_project_input").val(); -$("#search_project_input").val("").focus().val(val); -<% else %> -<% if params[:send_type] == 'news' %> -$("#project_news_form").html("<%= escape_javascript(render :partial => 'users/project_news_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>"); -<% elsif params[:send_type] == 'file' %> -$("#project_file_form").html("<%= escape_javascript(render :partial => 'users/project_file_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>"); -<% elsif params[:send_type] == 'message' %> -$("#project_message_form").html("<%= escape_javascript(render :partial => 'users/project_message_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>"); -<% end %> -<% end %> +<% if params[:is_observe].nil? %> +<% if params[:send_type].present? && params[:send_type] == 'news' %> +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% elsif params[:send_type] == 'file' %> +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids,:type => @type}) %>'); +<% elsif params[:send_type] == 'message' %> +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% end %> +showModal('ajax-modal', '452px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","50%").css("left","50%"); +$('#ajax-modal').parent().addClass("resourceUploadPopup").addClass("popbox") +$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); +//与更新版本弹窗js冲突新增样式代码 +$('#ajax-modal').parent().css({"border":"3px solid #269ac9", "padding":"4px"}); +//$("#search_project_input").focus(); +var val = $("#search_project_input").val(); +$("#search_project_input").val("").focus().val(val); +<% else %> +<% if params[:send_type] == 'news' %> +$("#project_news_form").html("<%= escape_javascript(render :partial => 'users/project_news_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>"); +<% elsif params[:send_type] == 'file' %> +$("#project_file_form").html("<%= escape_javascript(render :partial => 'users/project_file_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>"); +<% elsif params[:send_type] == 'message' %> +$("#project_message_form").html("<%= escape_javascript(render :partial => 'users/project_message_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>"); +<% end %> +<% end %> From 1d7529b8d299d31abfb56ad1a06b65f287729c19 Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 15 Oct 2016 16:09:21 +0800 Subject: [PATCH 14/20] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/exercise_publish.rake | 4 ++++ lib/tasks/homework_evaluation.rake | 5 +++++ lib/tasks/homework_publishtime.rake | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/lib/tasks/exercise_publish.rake b/lib/tasks/exercise_publish.rake index 13ae8c484..de93b3861 100644 --- a/lib/tasks/exercise_publish.rake +++ b/lib/tasks/exercise_publish.rake @@ -3,6 +3,8 @@ namespace :exercise_publish do desc "publish exercise and end exercise" task :publish => :environment do + Rails.logger.info("log--------------------------------exercise_publish start") + puts "--------------------------------exercise_publish start" exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) exercises.each do |exercise| exercise.update_column('exercise_status', 2) @@ -11,6 +13,8 @@ namespace :exercise_publish do exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) end end + Rails.logger.info("log--------------------------------exercise_publish end") + puts "--------------------------------exercise_publish end" end task :end => :environment do diff --git a/lib/tasks/homework_evaluation.rake b/lib/tasks/homework_evaluation.rake index 448137441..dc0dec270 100644 --- a/lib/tasks/homework_evaluation.rake +++ b/lib/tasks/homework_evaluation.rake @@ -8,6 +8,8 @@ namespace :homework_evaluation do end #自动开启匿评的任务 task :start_evaluation => :environment do + Rails.logger.info("log--------------------------------start_evaluation start") + puts "--------------------------------start_evaluation start" homework_detail_manuals = HomeworkDetailManual.where("evaluation_start = '#{Date.today}'") homework_detail_manuals.each do |homework_detail_manual| homework_common = homework_detail_manual.homework_common @@ -67,6 +69,9 @@ namespace :homework_evaluation do end end end + + Rails.logger.info("log--------------------------------start_evaluation end") + puts "--------------------------------start_evaluation end" end #自动关闭匿评的任务 diff --git a/lib/tasks/homework_publishtime.rake b/lib/tasks/homework_publishtime.rake index df996ab9e..dac3c11af 100644 --- a/lib/tasks/homework_publishtime.rake +++ b/lib/tasks/homework_publishtime.rake @@ -42,6 +42,8 @@ namespace :homework_publishtime do end task :end => :environment do + puts "--------------------------------homework_publish_end start" + Rails.logger.info("log--------------------------------homework_publish_end start") homework_commons = HomeworkCommon.where("end_time = '#{Date.today}'") homework_commons.each do |homework| if homework.anonymous_comment == 1 @@ -51,5 +53,7 @@ namespace :homework_publishtime do end end end + Rails.logger.info("log--------------------------------homework_publish_end end") + puts "--------------------------------homework_publish_end end" end end \ No newline at end of file From bde2f6b65d0f821d7c23a75adad00afffea7866f Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 15 Oct 2016 16:45:41 +0800 Subject: [PATCH 15/20] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BC=B9=E6=A1=86=E6=A0=B7=E5=BC=8Fjs?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=EF=BC=9B=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=E8=B5=84=E6=BA=90=E5=90=8D=E9=95=BF=E5=BA=A6?= =?UTF-8?q?=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_attachment_history_popub.html.erb | 2 +- app/views/layouts/base_projects.html.erb | 3 +++ public/stylesheets/css/public.css | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/views/files/_attachment_history_popub.html.erb b/app/views/files/_attachment_history_popub.html.erb index 6fed80053..4b3b68c04 100644 --- a/app/views/files/_attachment_history_popub.html.erb +++ b/app/views/files/_attachment_history_popub.html.erb @@ -10,7 +10,7 @@ - 当前版本 + 当前版本 <%= @attachment.downloads %> <%= @attachment.try(:quotes).to_i %> <%= format_time(@attachment.created_on) %> diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 218ef3fcf..d0f88f661 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -172,6 +172,9 @@ $('#ajax-modal').before(""); $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); + //与更新版本弹窗js冲突新增样式代码 + $('#ajax-modal').parent().css({"border":"3px solid #269ac9", "padding":"4px"}); + $('#ajax-modal').css("padding",""); } $("#expand_tools_expand").click(function(){ diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index a53d43097..18d1e42ce 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -1514,4 +1514,4 @@ a.syllabusbox_a_blue{ .dash-block {border:1px dashed #ddd;} /*历史版本删除功能*/ -.popup_ziyuan_title{ display: block; margin-left: 10px; text-align: left;width:360px; overflow:hidden;white-space: nowrap; text-overflow:ellipsis;} +.popup_ziyuan_title{ display: block; margin-left: 10px; text-align: left; max-width:360px; overflow:hidden;white-space: nowrap; text-overflow:ellipsis;} From 9acef363699c15fd14983f1915e81761ed5dc4a1 Mon Sep 17 00:00:00 2001 From: huang Date: Sun, 16 Oct 2016 15:44:42 +0800 Subject: [PATCH 16/20] =?UTF-8?q?gitlab.rake=E6=B7=BB=E5=8A=A0=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/gitlab.rake | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/tasks/gitlab.rake b/lib/tasks/gitlab.rake index 7893195ac..9328f5389 100644 --- a/lib/tasks/gitlab.rake +++ b/lib/tasks/gitlab.rake @@ -3,6 +3,7 @@ require 'trustie/gitlab/sync' namespace :gitlab do namespace :sync do desc "sync users to gitlab" + Rails.logger.info("--------------------------------sync users to gitlab") task :users => :environment do # User.where(username: 'root').find_each do |user| s = Trustie::Gitlab::Sync.new From 8bb483406e74358e9a70a508e0501fd5f9bad587 Mon Sep 17 00:00:00 2001 From: huang Date: Sun, 16 Oct 2016 16:16:18 +0800 Subject: [PATCH 17/20] =?UTF-8?q?=E5=8F=96=E6=B6=88gitlab=20rake=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/gitlab.rake | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/tasks/gitlab.rake b/lib/tasks/gitlab.rake index 9328f5389..7893195ac 100644 --- a/lib/tasks/gitlab.rake +++ b/lib/tasks/gitlab.rake @@ -3,7 +3,6 @@ require 'trustie/gitlab/sync' namespace :gitlab do namespace :sync do desc "sync users to gitlab" - Rails.logger.info("--------------------------------sync users to gitlab") task :users => :environment do # User.where(username: 'root').find_each do |user| s = Trustie::Gitlab::Sync.new From 1433bcb8ab76cd390fc1a88c23c49cc7018bf88c Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 15 Oct 2016 18:35:36 +0800 Subject: [PATCH 18/20] =?UTF-8?q?=E5=8E=86=E5=8F=B2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20161015102324_update_all_rake.rb | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 db/migrate/20161015102324_update_all_rake.rb diff --git a/db/migrate/20161015102324_update_all_rake.rb b/db/migrate/20161015102324_update_all_rake.rb new file mode 100644 index 000000000..af3934c0f --- /dev/null +++ b/db/migrate/20161015102324_update_all_rake.rb @@ -0,0 +1,23 @@ +class UpdateAllRake < ActiveRecord::Migration + def up + attachments = Attachment.where("is_publish = 0 and publish_time <= #{Date.today}") + attachments.update_all(:is_publish => 1) + + exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) + exercises.update_all(:exercise_status => 2) + + end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now) + end_exercises.each do |exercise| + course = exercise.course + exercise.update_column('exercise_status', 3) + course.student.each do |student| + if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,exercise.id).empty? + ExerciseUser.create(:user_id => student.student_id, :exercise_id => exercise.id, :start_at => exercise.end_time, :status => true,:score=>0) + end + end + end + end + + def down + end +end From a5375fc668d97dbb0172012fa959718726bfb06b Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 15 Oct 2016 18:39:17 +0800 Subject: [PATCH 19/20] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E7=9A=84=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20161015102324_update_all_rake.rb | 2 +- db/schema.rb | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/db/migrate/20161015102324_update_all_rake.rb b/db/migrate/20161015102324_update_all_rake.rb index af3934c0f..4329ab0dd 100644 --- a/db/migrate/20161015102324_update_all_rake.rb +++ b/db/migrate/20161015102324_update_all_rake.rb @@ -1,6 +1,6 @@ class UpdateAllRake < ActiveRecord::Migration def up - attachments = Attachment.where("is_publish = 0 and publish_time <= #{Date.today}") + attachments = Attachment.where("is_publish = 0 and publish_time <= '#{Date.today}'") attachments.update_all(:is_publish => 1) exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) diff --git a/db/schema.rb b/db/schema.rb index 66a6c1710..af81cc795 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 => 20161015054820) do +ActiveRecord::Schema.define(:version => 20161015102324) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -313,16 +313,14 @@ ActiveRecord::Schema.define(:version => 20161015054820) do add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" create_table "changesets", :force => true do |t| - t.integer "repository_id", :null => false - t.string "revision", :null => false + t.integer "repository_id", :null => false + t.string "revision", :null => false t.string "committer" - t.datetime "committed_on", :null => false + t.datetime "committed_on", :null => false t.text "comments" t.date "commit_date" t.string "scmid" t.integer "user_id" - t.integer "project_id" - t.integer "type", :default => 0 end add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" @@ -973,10 +971,6 @@ ActiveRecord::Schema.define(:version => 20161015054820) do t.datetime "updated_at", :null => false end - create_table "innodb_monitor", :id => false, :force => true do |t| - t.integer "a" - end - create_table "invite_lists", :force => true do |t| t.integer "project_id" t.integer "user_id" From cff887a2be6e0302291a084302caf68dc820c45b Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 19 Oct 2016 11:23:15 +0800 Subject: [PATCH 20/20] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E5=88=A0=E9=99=A4=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=BA=93=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 15 ++++++++++++++- app/views/projects/settings/_new_edit.html.erb | 2 +- config/locales/commons/zh.yml | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index df40eb378..b8165e56b 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -691,9 +691,22 @@ class ProjectsController < ApplicationController redirect_to settings_project_url(@project, :tab => 'modules') end + GITLABTYPE = "Repository::Gitlab" def archive if request.post? - unless @project.archive + if @project.archive + # 删除版本库信息 + begin + g = Gitlab.client + g.delete_project(@project.gpid) + rescue Exception => e + puts e + end + # 删除Trustie班额本库记录 + repoisitory = Repository.where(:project_id => @project.id, :type => GITLABTYPE).first + repoisitory.delete + @project.update_column(:gpid, nil) + else flash[:error] = l(:error_can_not_archive_project) end end diff --git a/app/views/projects/settings/_new_edit.html.erb b/app/views/projects/settings/_new_edit.html.erb index 3a2408504..a2ccbd967 100644 --- a/app/views/projects/settings/_new_edit.html.erb +++ b/app/views/projects/settings/_new_edit.html.erb @@ -41,7 +41,7 @@
    <%= link_to(l(:button_delete_project), { :controller => 'projects', :action => 'archive', :id => @project, :status => params[:status], :type =>"project" }, - :data => {:confirm => l(:text_are_you_sure)}, :method => :post) unless @project.archived? %> + :data => {:confirm => l(:text_delete_project_are_you_sure)}, :method => :post) unless @project.archived? %> <%#=link_to "删除该课程", course_path(@course), :method => :delete, :confirm=>"确认要删除该课程吗?" %> (友情提示:删除该项目后如果您想恢复该项目,请联系系统管理员!)
    diff --git a/config/locales/commons/zh.yml b/config/locales/commons/zh.yml index 985fd9bc3..ec65b24bb 100644 --- a/config/locales/commons/zh.yml +++ b/config/locales/commons/zh.yml @@ -189,6 +189,7 @@ zh: text_are_you_sure: 您确定要删除吗? #js 提示 text_history_are_you_sure: 本资源有多个版本,你确定要全部删除吗? + text_delete_project_are_you_sure: 本项目包含版本库,项目删除后,版本库将被彻底删除。您确定删除吗? text_are_you_sure_out: 你确定要退出该班级吗? text_are_you_sure_out_group: 你确定要退出该分班吗? text_are_you_sure_all: 您确定要删除所有文件吗