diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 1c05399c4..f06725d01 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -483,6 +483,7 @@ class FilesController < ApplicationController if !attachments.empty? && attachments[:files] && tag_name != "" attachments[:files].each do |attachment| attachment.tag_list.add(tag_name) + attachment.description = params[:description] attachment.save end end @@ -493,6 +494,7 @@ class FilesController < ApplicationController if !attachments.empty? && attachments[:files] && tag_name != "" attachments[:files].each do |attachment| attachment.tag_list.add(tag_name) + attachment.description = params[:description] attachment.save end end @@ -600,6 +602,7 @@ class FilesController < ApplicationController if !attachments.empty? && attachments[:files] && tag_name != "" attachments[:files].each do |attachment| attachment.tag_list.add(tag_name) + attachment.description = params[:description] attachment.save end end @@ -610,6 +613,7 @@ class FilesController < ApplicationController if !attachments.empty? && attachments[:files] && tag_name != "" attachments[:files].each do |attachment| attachment.tag_list.add(tag_name) + attachment.description = params[:description] attachment.save end end diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb index a3337b1ce..2b0dce4fa 100644 --- a/app/views/files/_org_subfield_list.html.erb +++ b/app/views/files/_org_subfield_list.html.erb @@ -36,6 +36,25 @@

文件大小:<%= number_to_human_size(file.filesize) %>

下载<%= file.downloads%>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

+
+ + <% if User.current.logged? && ((delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" )%> +
+
+ <%= render :partial => 'files/file_description', :locals => {:file => file} %> +
+ +
+ <% else %> +
+ <% unless file.description.blank? %> +
+
资源描述:<%= file.description %>
+ <% end %> +
+ <% end %> +
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %> diff --git a/app/views/files/_project_file_list.html.erb b/app/views/files/_project_file_list.html.erb index 6dc5b6753..b8b38f7b9 100644 --- a/app/views/files/_project_file_list.html.erb +++ b/app/views/files/_project_file_list.html.erb @@ -21,8 +21,8 @@ <%= link_to truncate(file.filename,length: 35, omission: '...'), download_named_attachment_path(file.id, file.filename), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %> - <% if User.current.logged? %> - <% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %> + <% if User.current.logged? || User.current.admin? %> + <% if ((manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file)) || User.current.admin? %> <%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %> <% if authority_pubilic_for_files(project, file) && delete_allowed %> @@ -43,6 +43,22 @@

<%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>  |  下载<%= file.downloads %>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

+ <% if User.current.admin? || ( User.current.logged? && ( (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file))) %> +
+
+ <%= render :partial => 'files/file_description', :locals => {:file => file} %> +
+ +
+ <% else %> +
+ <% unless file.description.blank? %> +
+
资源描述:<%= file.description %>
+ <% end %> +
+ <% end %>
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %> diff --git a/app/views/files/_project_list.html.erb b/app/views/files/_project_list.html.erb index 831dc0e68..48fb4c86f 100644 --- a/app/views/files/_project_list.html.erb +++ b/app/views/files/_project_list.html.erb @@ -35,6 +35,22 @@

下载<%= file.downloads%>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

+ <% if User.current.admin? || (User.current.logged? && ( (is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file)) && ((delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project")) %> +
+
+ <%= render :partial => 'files/file_description', :locals => {:file => file} %> +
+ +
+ <% else %> +
+ <% unless file.description.blank? %> +
+
资源描述:<%= file.description %>
+ <% end %> +
+ <% end %>
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> diff --git a/app/views/files/_resource_detail.html.erb b/app/views/files/_resource_detail.html.erb index e7d43a9d4..8aedc3c03 100644 --- a/app/views/files/_resource_detail.html.erb +++ b/app/views/files/_resource_detail.html.erb @@ -37,7 +37,7 @@
<%# unless file.description.blank? %>
- <% if User.current.logged? && ((is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file)) && ((delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course") %> + <% if User.current.admin? || ( User.current.logged? && ((is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file)) && ((delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course")) %>
<%= render :partial => 'files/file_description', :locals => {:file => file} %> @@ -63,9 +63,9 @@
  • - <% if User.current.logged? %> - <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> - <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %> + <% if User.current.logged? || User.current.admin? %> + <% if User.current.admin? || ((is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file)) %> + <% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course") %>
    • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
    • <%= link_to '延期发布',file_hidden_course_file_path(@course,file),:class => "postOptionLink",:remote=>true %>
    • diff --git a/app/views/files/_tool_settings.html.erb b/app/views/files/_tool_settings.html.erb index 41d74b7df..a0ce42eac 100644 --- a/app/views/files/_tool_settings.html.erb +++ b/app/views/files/_tool_settings.html.erb @@ -1,8 +1,8 @@
      • - <% if User.current.logged? %> - <% if (is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file) %> - <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project" %> + <% if User.current.admin? || (User.current.logged? ) %> + <% if User.current.admin? || ((is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file)) %> + <% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project") %>
        • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
        • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
        • diff --git a/app/views/files/_upload_project_files.erb b/app/views/files/_upload_project_files.erb index ed68e3b2d..478297af5 100644 --- a/app/views/files/_upload_project_files.erb +++ b/app/views/files/_upload_project_files.erb @@ -22,6 +22,13 @@ <%= render :partial => 'files/new_style_attachment_list',:locals => {:container => project} %>
+
+ +
+ +
+
+
<%= l(:button_cancel)%> diff --git a/app/views/files/_upload_subfield_file.html.erb b/app/views/files/_upload_subfield_file.html.erb index 3f8f1359a..8dcfe2dd5 100644 --- a/app/views/files/_upload_subfield_file.html.erb +++ b/app/views/files/_upload_subfield_file.html.erb @@ -16,6 +16,13 @@ <%= render :partial => 'files/org_subfield_upload_attachment_list', :locals => {:container => org_subfield}%>
+
+ +
+ +
+
+
<%= l(:button_cancel)%> <%= l(:button_confirm)%> <% end %> diff --git a/app/views/organizations/courses.html.erb b/app/views/organizations/courses.html.erb index 875fc3340..6abc6e127 100644 --- a/app/views/organizations/courses.html.erb +++ b/app/views/organizations/courses.html.erb @@ -14,9 +14,11 @@ <%= submit_tag '', :class => 'homepageSearchIcon', :onfocus => 'this.blur();', :class => "teacher-search-icon fl" %> <% end %> -
- <%= link_to "精品课程", courses_organization_path(@organization, :type => "famous", :org_subfield_id => @field.id), :class => "fontGrey2" %> -
+ <% if User.current.admin? %> +
+ <%= link_to "精品课程", courses_organization_path(@organization, :type => "famous", :org_subfield_id => @field.id), :class => "fontGrey2" %> +
+ <% end %>
diff --git a/app/views/organizations/projects.html.erb b/app/views/organizations/projects.html.erb index 1c6cfa1d1..427443950 100644 --- a/app/views/organizations/projects.html.erb +++ b/app/views/organizations/projects.html.erb @@ -14,9 +14,11 @@ <%= submit_tag '', :class => 'homepageSearchIcon', :onfocus => 'this.blur();', :class => "teacher-search-icon fl" %> <% end %> -
- <%= link_to "热门项目", projects_organization_path(@organization, :type => "famous", :org_subfield_id => @field.id), :class => "fontGrey2" %> -
+ <% if User.current.admin? %> +
+ <%= link_to "热门项目", projects_organization_path(@organization, :type => "famous", :org_subfield_id => @field.id), :class => "fontGrey2" %> +
+ <% end %>
diff --git a/app/views/organizations/students.html.erb b/app/views/organizations/students.html.erb index 770967210..bfc51fd50 100644 --- a/app/views/organizations/students.html.erb +++ b/app/views/organizations/students.html.erb @@ -14,9 +14,11 @@ <%= submit_tag '', :class => 'homepageSearchIcon', :onfocus => 'this.blur();', :class => "teacher-search-icon fl" %> <% end %> -
- <%= link_to "学霸列表", students_organization_path(@organization, :type => "famous", :org_subfield_id => @field.id), :class => "fontGrey2" %> -
+ <% if User.current.admin? %> +
+ <%= link_to "学霸列表", students_organization_path(@organization, :type => "famous", :org_subfield_id => @field.id), :class => "fontGrey2" %> +
+ <% end %>
diff --git a/app/views/organizations/teachers.html.erb b/app/views/organizations/teachers.html.erb index dac36f7a5..03334f14f 100644 --- a/app/views/organizations/teachers.html.erb +++ b/app/views/organizations/teachers.html.erb @@ -22,9 +22,11 @@ -
- <%= link_to "名师列表", teachers_organization_path(@organization, :type => "famous", :org_subfield_id => @field.id), :class => "fontGrey2" %> -
+ <% if User.current.admin? %> +
+ <%= link_to "名师列表", teachers_organization_path(@organization, :type => "famous", :org_subfield_id => @field.id), :class => "fontGrey2" %> +
+ <% end %>
diff --git a/config/routes.rb b/config/routes.rb index a778a8016..10c3cb870 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -130,6 +130,7 @@ RedmineApp::Application.routes.draw do end member do match "quote_resource_show_org_subfield", :via => [:get] + get "update_file_description" end end @@ -779,6 +780,7 @@ RedmineApp::Application.routes.draw do member do match "quote_resource_show", :via => [:get] get "file_hidden" + get "update_file_description" end end diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 0437125e8..22483c1d5 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1045,6 +1045,12 @@ function showNormalImage(id) { $(image).attr('src',_src); return; } + + //已被加链接则不处理 + if ($(image).parent() && $(image).parent().attr('href')){ + return; + } + //无格式的图片不让点击显示大图,显示的话会有问题 var tmpsrc = image.attr('src'); if (tmpsrc.indexOf('.gif') >= 0 || tmpsrc.indexOf('.jpg') >= 0 || tmpsrc.indexOf('.jpeg') >= 0 || tmpsrc.indexOf('.png') >= 0 || tmpsrc.indexOf('.bmp') >= 0 || tmpsrc.indexOf('.png') >= 0 || tmpsrc.indexOf('.BMP') >= 0 || tmpsrc.indexOf('.JPEG') >= 0 || tmpsrc.indexOf('.JPG') >= 0 || tmpsrc.indexOf('.PNG') >= 0 || tmpsrc.indexOf('.GIF') >= 0) {