diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 059bcbe91..4939d1798 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -70,14 +70,37 @@ class AttachmentsController < ApplicationController file.downcase.end_with?(".pdf") end + def upload_atta + @course = Course.find params[:course_id] + end + def batch_setting @course = Course.find params[:course_id] @attachments = @course.attachments.reorder("created_on desc") - @limit = 10 + @all_attachment_ids = @attachments.map(&:id).join(",") + @limit = 8 @attachment_count = @attachments.count @attachment_pages = Paginator.new @attachment_count, @limit, params['page'] || 1 @offset ||= @attachment_pages.offset - @attachments = paginateHelper @attachments,10 + @attachments = paginateHelper @attachments, @limit + end + + def resource_batch_setting + @course = Course.find params[:course_id] + attachments = Attachment.where(:id => params[:choose_ids].split(',')) + if params[:is_delete] && params[:is_delete] == "1" + attachments.each do |attachment| + attachment.container.attachments.delete(attachment) + end + else + unless params[:publish_time] == "" + attachments.update_all(:publish_time => params[:publish_time], :is_publish => 0) + end + if params[:is_public] + attachments.update_all(:is_public => 1) + end + end + redirect_to course_files_path(@course) end def direct_download diff --git a/app/views/attachments/_batch_setting.html.erb b/app/views/attachments/_batch_setting.html.erb index de09aef37..ebb834e98 100644 --- a/app/views/attachments/_batch_setting.html.erb +++ b/app/views/attachments/_batch_setting.html.erb @@ -1,116 +1,124 @@ +

资源发布批量设置

- +
-
-
-
- - - - - - - - - <% @attachments.each do |attachment| %> - - - - <% end %> - -
资源名称上传者
<%= attachment.filename %><%= attachment.author.show_name %>/td> -
-
-
-
- 删除 +
+ <%= form_tag(resource_batch_setting_attachments_path(:course_id => @course), :id => 'batch_setting_form', :method => 'post') do %> + + + +
+
+ <%= render :partial => "attachments/batch_setting_resources" %> +
-
    -
  • -
  • 1
  • -
  • 2
  • -
  • +
      +
    • + +
      + +
      + +
      + +
    • +
    • + + + + + +
    -
-
-
    -
  • - - - - - -
  • -
  • - -
    - -
    - -
    - - -
  • -
-

- 发  送 - 取  消 -

+

+ 保  存 + 取  消 +

+ <% end %>
\ No newline at end of file diff --git a/app/views/attachments/_batch_setting_resources.html.erb b/app/views/attachments/_batch_setting_resources.html.erb new file mode 100644 index 000000000..f8e4add55 --- /dev/null +++ b/app/views/attachments/_batch_setting_resources.html.erb @@ -0,0 +1,60 @@ + + + + + + + + + <% @attachments.each do |attachment| %> + + + + + <% end %> + +
资源名称上传者
+ + + <%= attachment.author.show_name %>
+ +
+ 请至少选择一个资源 +
+
+ 删除 +
+
+
    + <%= pagination_links_full @attachment_pages, @attachment_count, :per_page_links => false, :remote => true, :flag => true %> +
+
+
+ + \ No newline at end of file diff --git a/app/views/attachments/batch_setting.js.erb b/app/views/attachments/batch_setting.js.erb index 0527506bb..3fe0d241b 100644 --- a/app/views/attachments/batch_setting.js.erb +++ b/app/views/attachments/batch_setting.js.erb @@ -1,2 +1,6 @@ -var htmlvalue = "<%= j(render :partial => 'attachments/batch_setting') %>"; -pop_box_new(htmlvalue, 500, 500); \ No newline at end of file +<% if params[:page] %> +$("#source_list").html("<%= escape_javascript(render :partial => 'attachments/batch_setting_resources') %>"); +<% else %> +var htmlvalue = "<%= escape_javascript(render :partial => 'attachments/batch_setting') %>"; +pop_box_new(htmlvalue, 530, 500); +<% end %> \ No newline at end of file diff --git a/app/views/attachments/upload_atta.js.erb b/app/views/attachments/upload_atta.js.erb new file mode 100644 index 000000000..ae4117541 --- /dev/null +++ b/app/views/attachments/upload_atta.js.erb @@ -0,0 +1,2 @@ +var htmlvalue = '<%= escape_javascript(render :partial => 'files/upload_course_files',:locals => {:course => @course,:course_attachment_type => 1}) %>'; +pop_box_new(htmlvalue, 450, 275); \ No newline at end of file diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index ae6744fce..33e8b2748 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -103,8 +103,8 @@ <%= submit_tag "班内搜索", :class => "blueBtn mr5 fl",:name => "incourse",:id => "incourse" %> <%#= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite" %> <% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %> - <%#= link_to("批量设置", batch_setting_attachments_path(:course_id => @course.id), :class => "blue-btn fr mr5", :remote => true) %> - 上传资源 + <%= link_to("批量设置", batch_setting_attachments_path(:course_id => @course.id), :class => "blue-btn fr mr5", :remote => true) %> + <%= link_to("上传资源", upload_atta_attachments_path(:course_id => @course.id), :class => "blue-btn fr mr5", :remote => true) %> <%= link_to("导入资源", import_resources_user_path(User.current, :type => 6, :course_id => @course.id), :class => "blue-btn fr mr5", :remote => true) %> <% end %> <% end %> diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 2aa711475..267b5082e 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -242,10 +242,10 @@ }); //资源库上传附件 - function course_files_upload(){ - var htmlvalue = '<%= escape_javascript(render :partial => 'files/upload_course_files',:locals => {:course => @course,:course_attachment_type => 1}) %>'; - pop_box_new(htmlvalue, 450, 275); - } +// function course_files_upload(){ +// var htmlvalue = '<%#= escape_javascript(render :partial => 'files/upload_course_files',:locals => {:course => @course,:course_attachment_type => 1}) %>'; +// pop_box_new(htmlvalue, 450, 275); +// } // 鼠标经过的时候显示内容 function message_titile_show(obj,e) { diff --git a/config/routes.rb b/config/routes.rb index 9b5fc8a65..d5edc03ae 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1240,6 +1240,8 @@ RedmineApp::Application.routes.draw do match "renderTag" , :via => [:get, :post] match 'delete_softapplications', :via => [:get, :post] get 'batch_setting' + post 'resource_batch_setting' + get 'upload_atta' end end resources :groups do diff --git a/public/stylesheets/css/courses.css b/public/stylesheets/css/courses.css index dc7cd9313..73b326068 100644 --- a/public/stylesheets/css/courses.css +++ b/public/stylesheets/css/courses.css @@ -548,4 +548,9 @@ a.question_choice_blue{ background: #3b94d6; color: #fff; width: 34px; height: 3 .question_choice_dash{ background: #fff; color: #000000; width: 34px; height: 30px; border: 1px dashed #ddd; text-align: center; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} .question_answer_span{ background: #fff; color: #000000; padding: 6px 10px; border: 1px solid #c8cbce; text-align: center; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} .bg_blue{ background: #3b94d6;} -.score_input{ width: 40px; border: 1px solid #d8d3d3;} \ No newline at end of file +.score_input{ width: 40px; border: 1px solid #d8d3d3;} + +.sy_new_table tbody tr td{overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.ul-align{width: 100%;} +.ul-align li{height: 40px;line-height: 40px;font-size: 14px;} +.ul-align li label{width: 15%;text-align: right;} \ No newline at end of file