From 3360a25a425b575c93b44834832e12b452e5bd00 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Tue, 3 Nov 2015 10:28:13 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=20=E4=B8=BB=E9=A1=B5=20?=
=?UTF-8?q?=E8=B5=84=E6=BA=90=E4=B8=8A=E4=BC=A0=20=E4=B8=8D=E8=A6=81?=
=?UTF-8?q?=E7=BF=BB=E9=A1=B5=EF=BC=8C=E7=9B=B4=E6=8E=A5=E5=BC=B9=E5=87=BA?=
=?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BC=B9=E5=87=BA=E6=A1=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/files_controller.rb | 3 +
app/views/files/_attachement_list.html.erb | 48 +++++-----
app/views/files/_course_file.html.erb | 4 +
.../files/_new_style_attachment_list.html.erb | 71 +++++++++++++++
app/views/files/_upload_course_files.erb | 42 +++++++++
app/views/files/_upload_show.html.erb | 4 +-
app/views/files/_upload_show_project.html.erb | 4 +-
app/views/layouts/base_courses.html.erb | 14 ++-
public/javascripts/attachments.js | 88 +++++++++----------
public/stylesheets/courses.css | 5 +-
public/stylesheets/new_user.css | 1 +
public/stylesheets/project.css | 2 +-
12 files changed, 212 insertions(+), 74 deletions(-)
create mode 100644 app/views/files/_new_style_attachment_list.html.erb
create mode 100644 app/views/files/_upload_course_files.erb
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 057d962c8..1cd5b0f15 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -1,3 +1,4 @@
+#encoding: utf-8
# Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang
#
@@ -378,6 +379,8 @@ class FilesController < ApplicationController
tag_name = l(:label_media)
when "4"
tag_name = l(:label_code)
+ when "6"
+ tag_name = "论文"
else
tag_name = ""
end
diff --git a/app/views/files/_attachement_list.html.erb b/app/views/files/_attachement_list.html.erb
index 4c631d22f..01e5dca5f 100644
--- a/app/views/files/_attachement_list.html.erb
+++ b/app/views/files/_attachement_list.html.erb
@@ -1,26 +1,4 @@
-
-
-<% if defined?(container) && container && container.saved_attachments %>
- <% container.attachments.each_with_index do |attachment, i| %>
-
- <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
- <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
- <%= l(:field_is_public)%>:
- <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
- <%= if attachment.id.nil?
- #待补充代码
- else
- link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
- end
- %>
- <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
- <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
-
- <% end %>
-<% end %>
-
-
<% checkBox = (@course.present? && @course.is_public?) ? 'public' : 'private'%>
<%= l(:label_browse) %>
<% if @course %>
@@ -68,3 +46,29 @@
(<%= l(:label_max_size) %>:
<%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
+
+
+
+
+<% if defined?(container) && container && container.saved_attachments %>
+ <% container.attachments.each_with_index do |attachment, i| %>
+
+ <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
+ <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
+ <%= l(:field_is_public)%>:
+ <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
+ <%= if attachment.id.nil?
+ #待补充代码
+ else
+ link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
+ end
+ %>
+ <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
+
+ <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
+
+ <% end %>
+<% end %>
+
+
+
\ 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 8283e15b7..4176b72d0 100644
--- a/app/views/files/_course_file.html.erb
+++ b/app/views/files/_course_file.html.erb
@@ -26,6 +26,9 @@
case 4:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 4}) %>');
break;
+ case 6:
+ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 6}) %>');
+ break;
default:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 5}) %>');
}
@@ -77,6 +80,7 @@
软件 |
媒体 |
代码 |
+ 论文 |
其他
<% end %>
diff --git a/app/views/files/_new_style_attachment_list.html.erb b/app/views/files/_new_style_attachment_list.html.erb
new file mode 100644
index 000000000..022486413
--- /dev/null
+++ b/app/views/files/_new_style_attachment_list.html.erb
@@ -0,0 +1,71 @@
+<% checkBox = (@course.present? && @course.is_public?) ? 'public' : 'private'%>
+<%= l(:label_browse) %>
+<% if @course %>
+ <%= file_field_tag 'attachments[dummy][file]',
+ :id => '_file',
+ :class => ie8? ? '':'file_selector',
+ :multiple => true,
+ :onchange => 'addInputFilesCourseSource(this,"'+ checkBox.to_s+'");',
+ :style => ie8? ? '': 'display:none',
+ :data => {
+ :max_file_size => Setting.attachment_max_size.to_i.kilobytes,
+ :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
+ :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
+ :upload_path => uploads_path(:format => 'js'),
+ :description_placeholder => l(:label_optional_description),
+ :field_is_public => l(:field_is_public),
+ :are_you_sure => l(:text_are_you_sure),
+ :file_count => l(:label_file_count),
+ :delete_all_files => l(:text_are_you_sure_all)
+ } %>
+<% else %>
+ <%= file_field_tag 'attachments[dummy][file]',
+ :id => '_file',
+ :class => ie8? ? '':'file_selector',
+ :multiple => true,
+ :onchange => 'addInputFiles(this);',
+ :style => ie8? ? '': 'display:none',
+ :data => {
+ :max_file_size => Setting.attachment_max_size.to_i.kilobytes,
+ :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
+ :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
+ :upload_path => uploads_path(:format => 'js'),
+ :description_placeholder => l(:label_optional_description),
+ :field_is_public => l(:field_is_public),
+ :are_you_sure => l(:text_are_you_sure),
+ :file_count => l(:label_file_count),
+ :delete_all_files => l(:text_are_you_sure_all)
+ } %>
+<% end %>
+
+
+
+
+ <%= l(:label_no_file_uploaded)%>
+
+(<%= l(:label_max_size) %>:
+<%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
+
+
+
+<% if defined?(container) && container && container.saved_attachments %>
+ <% container.attachments.each_with_index do |attachment, i| %>
+
+ <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
+ <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
+ <%= l(:field_is_public)%>:
+ <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
+ <%= if attachment.id.nil?
+ #待补充代码
+ else
+ link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
+ end
+ %>
+ <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
+
+ <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
+
+ <% end %>
+<% end %>
+
+
\ No newline at end of file
diff --git a/app/views/files/_upload_course_files.erb b/app/views/files/_upload_course_files.erb
new file mode 100644
index 000000000..7eafcaabc
--- /dev/null
+++ b/app/views/files/_upload_course_files.erb
@@ -0,0 +1,42 @@
+
+
+
+
<%= l(:label_upload_files)%>
+
+
+
+ <% content_for :header_tags do %>
+ <%= javascript_include_tag 'attachments' %>
+ <% end %>
+
+
+
\ No newline at end of file
diff --git a/app/views/files/_upload_show.html.erb b/app/views/files/_upload_show.html.erb
index e11a4bf38..21cd94d8d 100644
--- a/app/views/files/_upload_show.html.erb
+++ b/app/views/files/_upload_show.html.erb
@@ -1,7 +1,7 @@
-
+
-
<%= l(:label_upload_files)%>
+
<%= l(:label_upload_files)%>
<%= error_messages_for 'attachment' %>
<%= l(:label_file_upload_error_messages)%>
diff --git a/app/views/files/_upload_show_project.html.erb b/app/views/files/_upload_show_project.html.erb
index 273aaec08..8223f071e 100644
--- a/app/views/files/_upload_show_project.html.erb
+++ b/app/views/files/_upload_show_project.html.erb
@@ -1,7 +1,7 @@
-
+
-
<%= l(:label_upload_files)%>
+
<%= l(:label_upload_files)%>
<%= error_messages_for 'attachment' %>
<%= l(:label_file_upload_error_messages)%>
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb
index 98e8f378d..11eeb8659 100644
--- a/app/views/layouts/base_courses.html.erb
+++ b/app/views/layouts/base_courses.html.erb
@@ -138,7 +138,10 @@
<%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{course_file_num})", course_files_path(@course), :class => "subnav_num c_orange",:id=>'courses_files_count_nav' %>
- <%= link_to( "+#{l(:label_upload_files)}", course_files_path(@course), :class => 'subnav_green ml95 c_white') if is_teacher %>
+ <% if is_teacher %>
+
+
+上传资源
+ <% end %>
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %>
@@ -246,6 +249,15 @@
})
+ function course_files_upload(){
+ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_course_files',:locals => {:course => @course,:course_attachment_type => 1}) %>');
+ showModal('ajax-modal', '513px');
+ $('#ajax-modal').siblings().remove();
+ $('#ajax-modal').before("
");
+ $('#ajax-modal').parent().css("top","").css("left","");
+ $('#ajax-modal').parent().addClass("popbox_polls");
+ }
+