diff --git a/app/controllers/attachment_type_edit_controller.rb b/app/controllers/attachment_type_edit_controller.rb deleted file mode 100644 index 91e14f65a..000000000 --- a/app/controllers/attachment_type_edit_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ - #资源类型编辑control -class AttachmentTypeEditController < ApplicationController - def index - - end -end diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index d341f0f6e..900487364 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -62,6 +62,17 @@ class AttachmentsController < ApplicationController end end + #更新资源文件类型 + def updateType + @attachment = Attachment.find(params[:attachmentid]) + if @attachment != nil + @attachment.attachtype = params[:newtype] + @attachment.save + render :text =>'success' + else + render :text=>'error' + end + end def thumbnail if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size]) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d4248e3cc..b18497548 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -548,6 +548,14 @@ class UsersController < ApplicationController format.api { render_validation_errors(@user) } end end + + unless @user.id.nil? + #后台注册的用户默认权限为男性开发员 + ue = UserExtensions.create(:identity => 3, + :gender => 0, + :user_id => @user.id) + ue.save + end end def edit diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index aeacae866..6b8525a00 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -390,6 +390,16 @@ module ApplicationHelper s.html_safe end + #扩展的checkbox生成 + def principals_check_box_tags_ex(name, principals) + s = '' + principals.each do |principal| + s << "\n" + end + s.html_safe + end + + # Returns a string for users/groups option tags def principals_options_for_select(collection, selected=nil) s = '' diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index 16a3d8b58..052aae468 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -55,9 +55,9 @@ module FilesHelper result = true end if result - if contentType != l(:attachment_all) && contentType != attachment.suffix_type + if contentType != '0' && contentType != attachment.suffix_type result = false - end + end end result end diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index 915e02627..75676f475 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -24,7 +24,7 @@ module MembersHelper principal_pages = Redmine::Pagination::Paginator.new principal_count, 10, params['page'] #by young principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all - s = content_tag('div', principals_check_box_tags('membership[user_ids][]', principals), :id => 'principals') + s = content_tag('div', principals_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals') links = pagination_links_full(principal_pages, principal_count, :per_page_links => false) {|text, parameters, options| link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 3bfd705f9..661762e5c 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -285,6 +285,7 @@ class Attachment < ActiveRecord::Base result end + def self.attach_filesex(obj, attachments,attachment_type) result = obj.save_attachmentsex(attachments, User.current,attachment_type) obj.attach_saved_attachments diff --git a/app/models/user.rb b/app/models/user.rb index 20624888a..d16d790d2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -190,7 +190,11 @@ class User < Principal where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern) end } - + + #选择项目成员时显示的用户信息文字 + def userInfo + info=self.name + ' (' + self.login + ')'; + end ###添加留言 fq def add_jour(user, notes, reference_user_id = 0, options = {}) diff --git a/app/views/attachment_type_edit/_show_attchment_type.html.erb b/app/views/attachment_type_edit/_show_attchment_type.html.erb deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/views/attachments/_type_edit.html.erb b/app/views/attachments/_type_edit.html.erb new file mode 100644 index 000000000..5d9278823 --- /dev/null +++ b/app/views/attachments/_type_edit.html.erb @@ -0,0 +1,14 @@ +<% edit_allowed = User.current.allowed_to?(:manage_files, @project) %> +<% if attachmenttypes.any? %> + + <%= link_to(image_tag('edit/edit.png'), 'javascript:void(0);',:style=>"white-space:nowrap;", :id=>"edit_box"+attachment.id.to_s , + :onclick =>"$('#put-tag-form-" +attachment.id.to_s+ "').show(); + $('#attach_type_id_label" +attachment.id.to_s+ "').hide(); + $('#edit_box" +attachment.id.to_s+ "').hide();") if edit_allowed %> + +<% end %> + diff --git a/app/views/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb index 57ac897d2..07dc6a27f 100644 --- a/app/views/files/_show_all_attachment.html.erb +++ b/app/views/files/_show_all_attachment.html.erb @@ -1,64 +1,72 @@ +<% selAttachType =@attachtype %> +<% selContentType =@contenttype %> +<% attachmenttypes = @project.attachmenttypes %> <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> <% edit_allowed = User.current.allowed_to?(:manage_files, @project) %> - + + diff --git a/app/views/files/_sort_by_attachtypel.html.erb b/app/views/files/_sort_by_attachtypel.html.erb index 5d5f28653..01c57c490 100644 --- a/app/views/files/_sort_by_attachtypel.html.erb +++ b/app/views/files/_sort_by_attachtypel.html.erb @@ -1,66 +1,71 @@ <% selAttachType =@attachtype %> <% selContentType =@contenttype %> +<% attachmenttypes = @project.attachmenttypes %> <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> <% edit_allowed = User.current.allowed_to?(:manage_files, @project) %> -
- -
\ No newline at end of file diff --git a/app/views/files/getattachtype.js.erb b/app/views/files/getattachtype.js.erb index fe8458e20..3bc9863b2 100644 --- a/app/views/files/getattachtype.js.erb +++ b/app/views/files/getattachtype.js.erb @@ -1,5 +1,5 @@ - <% 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")%>'); - <%end%> +<% if @attachtype==0 && @contenttype=='0' %> +$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>'); +<%else%> +$("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>'); +<%end%> diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index a43b2ae07..978b4420a 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -1,225 +1,54 @@ <% attachmenttypes = @project.attachmenttypes %> <% sufixtypes = @project.contenttypes %> - - -<%=(@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>资源共享区 +<%= (@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>资源共享区
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
<%#= link_to('上传文件', new_project_file_path(@project), :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %> - <%= link_to( l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %> + <%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %> <%= 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',l(:attachment_all)) +options_from_collection_for_select(attachmenttypes, "id", "typeName"), - :onchange=>"attachmenttypes_searchex(this.value)"%> - <% end %> - <% if sufixtypes.any? %> + + <%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +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', l(:attachment_all)) +options_for_select(sufixtypes), - :onchange=>"attachment_contenttypes_searchex(this.value)"%> + + <%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes), + :onchange => "attachment_contenttypes_searchex(this.value)" %> <% end %> -