diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb
new file mode 100644
index 000000000..f58896434
--- /dev/null
+++ b/app/helpers/files_helper.rb
@@ -0,0 +1,47 @@
+# encoding: utf-8
+module FilesHelper
+
+ def downloadAll containers
+ paths = []
+ files = []
+ tmpfile = "tmp.zip"
+
+ containers.each do |container|
+ next if container.attachments.empty?
+ if container.is_a?(Version);end
+ container.attachments.each do |attachment|
+ paths << attachment.diskfile
+ file = attachment.diskfile
+ # logger.error "[FilesHelper] downloadAll: #{e}"
+ begin
+ File.new(file, "r")
+ rescue Exception => e
+ logger.error e
+ next
+ end
+ files << file
+ # zip.add(file.path.dup.sub(directory, ''), file.path)
+ end
+ end
+
+ zipfile_name = "archive.zip"
+ if File.exists? File.open(zipfile_name, "w+")
+ ff = File.open(zipfile_name, "w+")
+ ff.close
+ File.delete ff
+ end
+ Zip::ZipFile.open(zipfile_name, Zip::ZipFile::CREATE) do |zipfile|
+ files.each do |filename|
+ directory = File.dirname filename
+ # Two arguments:
+ # - The name of the file as it will appear in the archive
+ # - The original file, including the path to find it
+ dir = filename.sub(directory+"/", '')
+ zipfile.add(dir, filename)
+
+ end
+ end
+ File.new(zipfile_name,'w+')
+ end
+
+end
\ No newline at end of file
diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb
index bf42c5dbd..9043817e0 100644
--- a/app/views/files/index.html.erb
+++ b/app/views/files/index.html.erb
@@ -1,12 +1,13 @@
<% if @project.project_type == 1 %>
<% if User.current.member_of?(@project) %>
-<%= link_to(l(:label_file_upload), new_project_file_path(@project), :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
- <% end %>
+ <%= link_to(l(:label_file_upload), new_project_file_path(@project), :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
+ <% end %>
<% else %>
-<%= link_to(l(:label_attachment_new), new_project_file_path(@project), :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
+
+ <%= link_to(l(:label_attachment_new), new_project_file_path(@project), :class => 'icon icon-add') if User.current.member_of?(@project) %>
<% end %>
@@ -24,30 +25,33 @@
|
-<% @containers.each do |container| %>
- <% next if container.attachments.empty? -%>
- <% if container.is_a?(Version) -%>
-
-
- <%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package") %>
- |
-
- <% end -%>
- <% container.attachments.each do |file| %>
- ">
- <%= link_to_attachment file, :download => true, :title => file.description %> |
- <%= format_time(file.created_on) %> |
- <%= number_to_human_size(file.filesize) %> |
-
- <%= file.description %> |
-
- <%= link_to(image_tag('delete.png'), attachment_path(file),
- :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
- |
-
- <% end
- reset_cycle %>
-<% end %>
+ <% @containers.each do |container| %>
+ <% next if container.attachments.empty? -%>
+ <% if container.is_a?(Version) -%>
+
+
+ <%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package") %>
+ |
+
+ <% end -%>
+ <% container.attachments.each do |file| %>
+ ">
+ <%= link_to_attachment file, :download => true, :title => file.description %> |
+ <%= format_time(file.created_on) %> |
+ <%= number_to_human_size(file.filesize) %> |
+
+ <%= file.description %> |
+
+ <%= link_to(image_tag('delete.png'), attachment_path(file),
+ :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
+ |
+
+ <% end %>
+ <% reset_cycle %>
+ <% end %>
+
+
+
diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb
index 721665d87..1687ff34c 100644
--- a/app/views/layouts/base.html.erb
+++ b/app/views/layouts/base.html.erb
@@ -7,7 +7,7 @@
<%= csrf_meta_tag %>
<%= favicon %>
-<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', :media => 'all' %>
+<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= heads_for_theme %>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 128f63afa..ca3de4f77 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -1641,7 +1641,8 @@ zh:
label_in_course: 在课程中
label_assign_homework: 中布置了作业
label_noawards: 未评奖
- label_module_share: dts测试工具
label_homework_prompt: 贴心小提示:
label_homework_prompt_content: 亲,在这里我们的作业将以项目的形式提交,如果小伙伴们还没有创建项目,请先创建一个项目。项目创建成功后,就可以
- label_create_homework: 布置了作业:
\ No newline at end of file
+ label_create_homework: 布置了作业:
+
+ label_module_share: DTS测试工具
diff --git a/public/stylesheets/nyan_css.css b/public/stylesheets/nyan.css
similarity index 96%
rename from public/stylesheets/nyan_css.css
rename to public/stylesheets/nyan.css
index 2fcd1f8fd..f15ea4ac2 100644
--- a/public/stylesheets/nyan_css.css
+++ b/public/stylesheets/nyan.css
@@ -48,3 +48,8 @@
position:relative;
top:1px;
}
+
+#share_project_id {
+ float: right;
+ width: 100%;
+}
\ No newline at end of file