diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index f2e197cd8..557c0ae54 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -26,6 +26,8 @@ class BidsController < ApplicationController else @bids = Bid.visible.where('reward_type = ?', 1) end + + @bids = @bids.like(params[:name]) if params[:name].present? @bid_count = @bids.count diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2998eb2a1..c4b42c8df 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -282,13 +282,13 @@ class UsersController < ApplicationController when '1' @offset ||= @user_pages.reverse_offset unless @offset == 0 - @users_statuses = scope.reorder('changesets_count').offset(@offset).limit(@limit).all.reverse + @users_statuses = scope.reorder('grade').offset(@offset).limit(@limit).all.reverse else limit = @user_count % @limit if limit == 0 limit = @limit end - @users_statuses = scope.reorder('changesets_count').offset(@offset).limit(limit).all.reverse + @users_statuses = scope.reorder('grade').offset(@offset).limit(limit).all.reverse end @s_type = 1 #sort {|x,y| y.user_status.changesets_count <=> x.user_status.changesets_count} 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/bids/_list_projects.html.erb b/app/views/bids/_list_projects.html.erb index 06a7a85f3..74207a315 100644 --- a/app/views/bids/_list_projects.html.erb +++ b/app/views/bids/_list_projects.html.erb @@ -21,7 +21,7 @@ - + <%= l(:label_system_grade) %>:<%= (b_project.project.project_status.grade.nil? ? 0 : b_project.project.project_status.grade) unless (b_project.project.project_status.nil? && b_project.project.nil?) %> <% if get_prize(b_project).nil? or get_prize(b_project) == "" %> diff --git a/app/views/bids/contest.html.erb b/app/views/bids/contest.html.erb index 576323cbc..28116c641 100644 --- a/app/views/bids/contest.html.erb +++ b/app/views/bids/contest.html.erb @@ -1,5 +1,5 @@ -<%= form_tag(calls_path, :method => :get) do %> +<%= form_tag(:controller => 'bids', :action => 'contest', :method => :get) do %>
@@ -19,7 +19,7 @@ diff --git a/app/views/bids/index.html.erb b/app/views/bids/index.html.erb index 3ef6c4772..5737acf29 100644 --- a/app/views/bids/index.html.erb +++ b/app/views/bids/index.html.erb @@ -23,6 +23,9 @@ diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index bf42c5dbd..6f1a4bb82 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -1,12 +1,14 @@ <% 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.member_of?(@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.allowed_to?(:manage_files, @project) %> +
<% end %> @@ -24,30 +26,33 @@ -<% @containers.each do |container| %> - <% next if container.attachments.empty? -%> - <% if container.is_a?(Version) -%> - - - - <% end -%> - <% container.attachments.each do |file| %> - "> - - - - - - - - <% end - reset_cycle %> -<% end %> + <% @containers.each do |container| %> + <% next if container.attachments.empty? -%> + <% if container.is_a?(Version) -%> + + + + <% end -%> + <% container.attachments.each do |file| %> + "> + + + + + + + + <% end %> + <% reset_cycle %> + <% end %> + + +
- <%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package") %> -
<%= 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 %> -
+ <%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package") %> +
<%= 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 %> +
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/app/views/projects/_member_list.html.erb b/app/views/projects/_member_list.html.erb new file mode 100644 index 000000000..5eb994c86 --- /dev/null +++ b/app/views/projects/_member_list.html.erb @@ -0,0 +1,45 @@ +<% if members.any? %> + <% members.each do |member| %> +
+ <% next if member.new_record? %> + <% unless member.created_on.nil? %> + <%= content_tag "p", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "float_right member_since" %> + <% end %> + <%= member.user.nil? ? '' : (link_to image_tag(url_to_avatar(member.user), :class => 'avatar'), :class => "avatar") %> + <%= content_tag "div", link_to_user(member.principal), :class => "nomargin avatar_name" %> + + <% if @project.project_type == 1 %> +
+

+ <% if member.roles.sort.collect(&:to_s).join(', ') =='Manager' %> + <%= l(:label_teacher) %> + <% elsif member.roles.sort.collect(&:to_s).join(', ') =='Reporter' %> + <%= l(:label_student) %> + <% elsif member.roles.sort.collect(&:to_s).join(', ') =='TA' %> + <%= l(:label_TA) %> + <% else %> + + <% end %> +

+
+ <% else%> + <%= content_tag "div", content_tag("p", member.roles.sort.collect(&:to_s).join(', ')), :class => "clear avatar_name" %> + <% users.each do |user|%> + <% if user[:user_id] == member[:user_id]%> +
+

+ <%= l(:label_user_for_project_grade) %>: <%= user[:grade] %> +

+
+ <% end %> + <% end %> + <% end %> + + <%= call_hook(:view_projects_settings_members_table_row, { :project => @project, :member => member}) %> +
+ <% end; reset_cycle %> +<% else %> +

+ <%= l(:label_no_data) %> +

+<% end %> \ No newline at end of file diff --git a/app/views/projects/_project.html.erb b/app/views/projects/_project.html.erb index 0a4f0b0e7..d7c454bc3 100644 --- a/app/views/projects/_project.html.erb +++ b/app/views/projects/_project.html.erb @@ -88,7 +88,9 @@ <%= content_tag('span', "#{l(:label_create_time)}: ") %><%= content_tag('span', format_time(@project.created_on)) %>
+ <% if @project.project_type !=1 %> <%= content_tag('span', "#{l(:label_project_grade)}: ")%><%= @project.project_status.grade%> + <% end %>
diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index c8f118296..b9f70cfd4 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -14,8 +14,7 @@ diff --git a/app/views/projects/member.html.erb b/app/views/projects/member.html.erb index a3cd24cee..4977c12a8 100644 --- a/app/views/projects/member.html.erb +++ b/app/views/projects/member.html.erb @@ -1,66 +1,31 @@ - -

<%= l(:label_member_list)%>

-
-<%= error_messages_for 'member' %> -<% roles = Role.find_all_givable - members = @project.member_principals.includes(:roles, :principal).all.sort %> - <% - users = UserGrade.find_by_sql("select * from user_grades where project_id = #{@project.id}").sort {|a,b| a[:grade] <=> b[:grade]} - %> - <% temp = [] %> - <% users.each do |user|%> - <% members.each do |member|%> - <% if member[:user_id] == user[:user_id] %> - <% temp << member%> - <% end %> - <% end %> - <% end %> - <% temps = temp.reverse %> -<% if temps.any? %> -<% temps.each do |member| %> -
- - <% next if member.new_record? %> - <% unless member.created_on.nil? %> - <%= content_tag "p", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "float_right member_since" %> - <% end %> - <%= member.user.nil? ? '' : (link_to image_tag(url_to_avatar(member.user), :class => 'avatar'), :class => "avatar") %> - <%= content_tag "div", link_to_user(member.principal), :class => "nomargin avatar_name" %> - - - <% if @project.project_type == 1 %> -

- <% if member.roles.sort.collect(&:to_s).join(', ') =='Manager' %> - <%= l(:label_teacher) %> - <% elsif member.roles.sort.collect(&:to_s).join(', ') =='Reporter' %> - <%= l(:label_student) %> - <% elsif member.roles.sort.collect(&:to_s).join(', ') =='TA' %> - <%= l(:label_TA) %> - <% else %> - - <% end %> -

-
- <% else%> - <%= content_tag "div", content_tag("p", member.roles.sort.collect(&:to_s).join(', ')), :class => "clear avatar_name" %> - <% users.each do |user|%> - <% if user[:user_id] == member[:user_id]%> -
-

<%= l(:label_user_for_project_grade) %>: <%= user[:grade] %>

-
- <% end %> - <% end %> - <% end %> - - <%= call_hook(:view_projects_settings_members_table_row, { :project => @project, :member => member}) %> - -
-<% end; reset_cycle %> -<% else %> -

- <%= l(:label_no_data) %> -

- <% end %> +
+

+ <%= l(:label_member_list)%> +

+
+ <%= error_messages_for 'member' %> + <% roles = Role.find_all_givable + members = @project.member_principals.includes(:roles, :principal).all.sort %> + <% if @project.project_type == 1 %> + <% else %> + <% users = UserGrade.find_by_sql("select * from user_grades where project_id = #{@project.id}")%> + <% if users %> + <% users.sort {|a,b| a[:grade] <=> b[:grade]} %> + + <% temp = [] %> + <% users.each do |user|%> + <% members.each do |member|%> + <% if member[:user_id] == user[:user_id] %> + <% temp << member%> + <% end %> + <% end %> + <% end %> + <% members = temp.reverse %> + <% end %> + <% end %> + <%= render :partial => 'member_list', :locals => {:members => members} %> + +
diff --git a/app/views/projects/share.html.erb b/app/views/projects/share.html.erb index e3cb92fc8..81a157a42 100644 --- a/app/views/projects/share.html.erb +++ b/app/views/projects/share.html.erb @@ -1,7 +1,7 @@ -

- 进入测试平台 +

+ 进入测试平台

<% @shares.each do |share| %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 9861ccc9b..8f010d7de 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -117,6 +117,10 @@
<%= link_to image_tag(url_to_avatar(user), :class => 'avatar'), user_path(user) %> <%= content_tag "span", link_to_user(user), :class => "nomargin avatar_name" %> +
+ <%= l(:label_user_grade) %>: <%= user.user_status.grade %> +
+
@@ -125,9 +129,9 @@ <%= l(:label_has_watchers,:count=>User.watched_by(user.id).count) %>
-
+
<% unless user.memberships.empty? %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index e592e170f..380cbb059 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1641,6 +1641,7 @@ zh: label_in_course: 在课程中 label_assign_homework: 中布置了作业 label_noawards: 未评奖 + label_course_modify_settings: 配置课程 label_module_share: dts测试工具 label_homework_prompt: 贴心小提示: diff --git a/lib/redmine.rb b/lib/redmine.rb index 1b674d662..38b1a063e 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -237,7 +237,7 @@ end Redmine::MenuManager.map :top_college_menu do |menu| menu.push :home, :home_path - menu.push :new_course, {:controller => 'projects', :action => 'course', :project_type => 1 } + menu.push :new_course, {:controller => 'projects', :action => 'course', :project_type => 1} menu.push :new_homework, {:controller => 'bids', :action => 'index', :project_type => 1 } menu.push :new_contest, {:controller => 'bids', :action => 'contest', :project_type => 1} menu.push :projects, { :controller => 'projects', :action => 'index', :project_type => 0 }, :caption => :label_project_plural 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