diff --git a/app/controllers/attachment_type_edit_controller.rb b/app/controllers/attachment_type_edit_controller.rb new file mode 100644 index 000000000..91e14f65a --- /dev/null +++ b/app/controllers/attachment_type_edit_controller.rb @@ -0,0 +1,6 @@ + #资源类型编辑control +class AttachmentTypeEditController < ApplicationController + def index + + end +end diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 3136c5838..8f48d3857 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -715,13 +715,14 @@ class BidsController < ApplicationController def update @bid = Bid.find(params[:id]) + @project = @bid.courses.first if @bid.update_attributes(params[:bid]) flash[:notice] = l(:label_update_homework_succeed) - @project = Project.find(params[:course_id]) + #@project = Project.find(params[:course_id]) redirect_to project_homework_path(@project) else @bid.safe_attributes = params[:bid] - render :action => 'edit' + render :action => 'edit', :layout =>'base_courses' ,:bid_id=>@bid.id,:project_id =>@project end end diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 075a54f65..a2dd8c869 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -74,6 +74,7 @@ class FilesController < ApplicationController @containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort @attachtype = params[:type].to_i + @contenttype = params[:contentType].to_s respond_to do |format| format.js diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index ffa1348fd..16a3d8b58 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -44,9 +44,22 @@ module FilesHelper File.new(zipfile_name,'w+') end - def browseByCategory - isCategoryBrowser = 1 - #isCategoryBrowser + # 判断指定的资源时候符合类型 + def isTypeOk(attachment, type, contentType) + result = false + if type != 0 + if attachment.attachtype == type + result = true + end + else + result = true + end + if result + if contentType != l(:attachment_all) && contentType != attachment.suffix_type + result = false + end + end + result end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index bddf9d0d4..a42a626dc 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -32,7 +32,7 @@ module ProjectsHelper {:name => 'categories', :action => :manage_categories, :partial => 'projects/settings/issue_categories', :label => :label_issue_category_plural}, # {:name => 'wiki', :action => :manage_wiki, :partial => 'projects/settings/wiki', :label => :label_wiki}, {:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural}, - {:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural}, + #{:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural}, {:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities} ] tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)} @@ -145,7 +145,7 @@ module ProjectsHelper #Added by young def course_settings_tabs tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'}, - {:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural, :project_type => 1}, + #{:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural, :project_type => 1}, # {:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural}, {:name => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural} ] diff --git a/app/models/mailer.rb b/app/models/mailer.rb index d8e3d29bd..e5ede6285 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -63,7 +63,7 @@ class Mailer < ActionMailer::Base # Mailer.issue_add(issue).deliver => sends an email to issue recipients def issue_add(issue) redmine_headers 'Project' => issue.project.identifier, - 'Issue-Id' => issue.id, + 'Issue-Id' => (issue.project.issues.index(issue).to_i + 1).to_s, 'Issue-Author' => issue.author.login redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to message_id issue @@ -85,7 +85,7 @@ class Mailer < ActionMailer::Base def issue_edit(journal) issue = journal.journalized.reload redmine_headers 'Project' => issue.project.identifier, - 'Issue-Id' => issue.id, + 'Issue-Id' => (issue.project.issues.index(issue).to_i + 1).to_s, 'Issue-Author' => issue.author.login redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to message_id journal diff --git a/app/views/attachment_type_edit/_show_attchment_type.html.erb b/app/views/attachment_type_edit/_show_attchment_type.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/files/_new.html.erb b/app/views/files/_new.html.erb index fcb916e3b..4c1b97fa1 100644 --- a/app/views/files/_new.html.erb +++ b/app/views/files/_new.html.erb @@ -13,7 +13,7 @@ <% if attachmenttypes.any? %>

- <%= select_tag "attachment_type", content_tag('option', '') + + <%= select_tag "attachment_type", options_from_collection_for_select(attachmenttypes, "id", "typeName") %>

diff --git a/app/views/files/_sort_by_attachtypel.html.erb b/app/views/files/_sort_by_attachtypel.html.erb index 82d2a7b87..5d5f28653 100644 --- a/app/views/files/_sort_by_attachtypel.html.erb +++ b/app/views/files/_sort_by_attachtypel.html.erb @@ -1,4 +1,5 @@ <% selAttachType =@attachtype %> +<% selContentType =@contenttype %> <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> <% edit_allowed = User.current.allowed_to?(:manage_files, @project) %>
@@ -27,7 +28,7 @@ <% @containers.each do |container| %> <% next if container.attachments.empty? -%> <% container.attachments.each do |file| %> - <% if file.attachtype==selAttachType %> + <% if isTypeOk(file,selAttachType,selContentType) %> "> <%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %> <%= format_time(file.created_on) %> diff --git a/app/views/files/getattachtype.js.erb b/app/views/files/getattachtype.js.erb index 4f13cc883..fe8458e20 100644 --- a/app/views/files/getattachtype.js.erb +++ b/app/views/files/getattachtype.js.erb @@ -1,4 +1,4 @@ - <% if @attachtype==0%> + <% if @attachtype==0 && @contenttype==l(:attachment_all)%> $("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>'); <%else%> $("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>'); diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 5abacf294..a43b2ae07 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -184,13 +184,15 @@ <%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %> <% if attachmenttypes.any? %> - - <%= select_tag "attachment_browse", content_tag('option', '') +options_from_collection_for_select(attachmenttypes, "id", "typeName"), +       + + <%= select_tag "attachment_browse", content_tag('option',l(:attachment_all)) +options_from_collection_for_select(attachmenttypes, "id", "typeName"), :onchange=>"attachmenttypes_searchex(this.value)"%> <% end %> <% if sufixtypes.any? %> - - <%= select_tag "attach_sufix_browse", content_tag('option', '') +options_for_select(sufixtypes), +   + + <%= select_tag "attach_sufix_browse", content_tag('option', l(:attachment_all)) +options_for_select(sufixtypes), :onchange=>"attachment_contenttypes_searchex(this.value)"%> <% end %> @@ -204,8 +206,8 @@ attachments_autocomplete_path(:format => 'js'), :remote => true, :method => :post) do %> - <%= label_tag(:attach_search, "按关键字搜索:") %> - <%= text_field_tag(:attach_search) %> + <%= label_tag(:atext_field_tagttach_search, "按关键字搜索:") %> + <%= (:attach_search) %> <%#= submit_tag("Search") %> <% end -%> <%= form_tag attach_relation_path(:format => 'js'), @@ -286,7 +288,8 @@