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/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index 167fa124a..0cad795f8 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -30,6 +30,9 @@ class CalendarsController < ApplicationController helper :project_score def show + # 控制顶部导航样式 + @project_menu_type = 8 + if params[:year] and params[:year].to_i > 1900 @year = params[:year].to_i if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 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 diff --git a/app/controllers/gantts_controller.rb b/app/controllers/gantts_controller.rb index 710bb2f47..9d6b70d93 100644 --- a/app/controllers/gantts_controller.rb +++ b/app/controllers/gantts_controller.rb @@ -32,12 +32,14 @@ class GanttsController < ApplicationController helper :project_score def show + # 控制顶部导航样式 + @project_menu_type = 9 + @gantt = Redmine::Helpers::Gantt.new(params) @gantt.project = @project retrieve_query @query.group_by = nil @gantt.query = @query if @query.valid? - basename = (@project ? "#{@project.identifier}-" : '') + 'gantt' respond_to do |format| 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/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 653f6b23c..ebac846d5 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -358,7 +358,7 @@ class ProjectsController < ApplicationController def settings # 顶部导航 - @project_menu_type = 9 + @project_menu_type = 10 # 修改查看消息状态 applied_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type =? and viewed =?", User.current.id, @project, "AppliedProject", 0) @@ -702,11 +702,27 @@ 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 + unless @project.archive + + end end if params[:type] == "project" redirect_to user_path(User.current) 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/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/_attachment_history_popub.html.erb b/app/views/files/_attachment_history_popub.html.erb index 02da5857f..4b3b68c04 100644 --- a/app/views/files/_attachment_history_popub.html.erb +++ b/app/views/files/_attachment_history_popub.html.erb @@ -10,11 +10,11 @@ - + 当前版本 <%= @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 %> @@ -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 %> + + 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 %>
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_project_top.html.erb b/app/views/layouts/_base_project_top.html.erb index b2ca55d88..542c9ee73 100644 --- a/app/views/layouts/_base_project_top.html.erb +++ b/app/views/layouts/_base_project_top.html.erb @@ -87,7 +87,7 @@ <% end %> <% if User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project) %> -
  • +
  • <%= link_to "#{l(:button_configure)}", settings_project_path(@project), :class => "pro_new_proname" %>
  • <% end %> @@ -97,11 +97,8 @@ \ 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/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%> 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 @@ +
    +

    提示

    + +
    +
    +
    + +
    + + 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/app/views/projects/settings/_new_edit.html.erb b/app/views/projects/settings/_new_edit.html.erb index 345d6bd1e..0e25fc660 100644 --- a/app/views/projects/settings/_new_edit.html.erb +++ b/app/views/projects/settings/_new_edit.html.erb @@ -40,5 +40,14 @@ 保存 - <% end %> -
    +<% end %> +<% if User.current.member_of?(@project) && Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.to_s.include?("Manager") %> +
    + + <%= link_to(l(:button_delete_project), { :controller => 'projects', :action => 'archive', :id => @project, :status => params[:status], :type =>"project" }, + :data => {:confirm => l(:text_delete_project_are_you_sure)}, :method => :post) unless @project.archived? %> + <%#=link_to "删除该课程", course_path(@course), :method => :delete, :confirm=>"确认要删除该课程吗?" %> + (友情提示:删除该项目后如果您想恢复该项目,请联系系统管理员!) +
    +<% end %> +
    diff --git a/app/views/users/import_resources.js.erb b/app/views/users/import_resources.js.erb index b07f534e7..0b51af592 100644 --- a/app/views/users/import_resources.js.erb +++ b/app/views/users/import_resources.js.erb @@ -15,4 +15,9 @@ $('#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",""); +$('#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 %> 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: 您确定要删除所有文件吗 diff --git a/config/routes.rb b/config/routes.rb index cae404c7b..457d76d76 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/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/migrate/20161015102324_update_all_rake.rb b/db/migrate/20161015102324_update_all_rake.rb new file mode 100644 index 000000000..4329ab0dd --- /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 diff --git a/db/schema.rb b/db/schema.rb index 1f763c39e..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 => 20161011012114) do +ActiveRecord::Schema.define(:version => 20161015102324) 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" 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 440c04a09..dac3c11af 100644 --- a/lib/tasks/homework_publishtime.rake +++ b/lib/tasks/homework_publishtime.rake @@ -3,6 +3,8 @@ 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 @@ -35,9 +37,13 @@ namespace :homework_publishtime do Mailer.run.homework_added(homework) end end + Rails.logger.info("log--------------------------------homework_publish end") + puts "--------------------------------homework_publish end" 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 @@ -47,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 diff --git a/lib/tasks/resource_publish.rake b/lib/tasks/resource_publish.rake index 2df0c6145..7584de4d3 100644 --- a/lib/tasks/resource_publish.rake +++ b/lib/tasks/resource_publish.rake @@ -3,9 +3,13 @@ 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 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/common.css b/public/stylesheets/css/common.css index 26dbf2767..a70365283 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;} 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;} diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index 2acc0f454..18d1e42ce 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; max-width:360px; overflow:hidden;white-space: nowrap; text-overflow:ellipsis;}