From f9f66bac7b42fdb4ffab4f863aba8c71688469ae Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 16 Jun 2016 14:15:46 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=8F=8F=E8=BF=B0=E4=B8=BA=E7=A9=BA=E6=97=B6?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_file_description.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/files/_file_description.html.erb b/app/views/files/_file_description.html.erb index 5d46eaaeb..bb838d415 100644 --- a/app/views/files/_file_description.html.erb +++ b/app/views/files/_file_description.html.erb @@ -1,5 +1,5 @@

')> - 资源描述:<% if file.description.blank? %>点击添加描述<% else %><%= file.description %><% end %> + 资源描述:<% if file.description.blank? %>双击添加描述<% else %><%= file.description %><% end %> <%#= file.description.blank? ? "该资源暂无描述" : file.description %> <%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);", :onclick => "show_edit_file_description("+file.id.to_s+");"%>

\ No newline at end of file From 70a762220a9dcd3e393126b5b679df53613674d1 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 16 Jun 2016 16:55:25 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=BB=84=E7=BB=87=E3=80=81=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=9A=84=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=8F=8F=E8=BF=B0=E4=BF=AE=E6=94=B9=E5=8F=8A=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=96=87=E4=BB=B6=E6=97=B6=E5=80=99=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=EF=BC=8C=E5=B9=B6=E4=B8=94=E6=89=80=E6=9C=89?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E5=AF=B9=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=BC=80=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 4 ++++ app/views/files/_org_subfield_list.html.erb | 19 ++++++++++++++++++ app/views/files/_project_file_list.html.erb | 20 +++++++++++++++++-- app/views/files/_project_list.html.erb | 16 +++++++++++++++ app/views/files/_resource_detail.html.erb | 8 ++++---- app/views/files/_tool_settings.html.erb | 6 +++--- app/views/files/_upload_project_files.erb | 7 +++++++ .../files/_upload_subfield_file.html.erb | 7 +++++++ config/routes.rb | 2 ++ 9 files changed, 80 insertions(+), 9 deletions(-) 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/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 From 3ae26a6530a22fff9e7db3db6b1b53509332c756 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 17 Jun 2016 11:23:49 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=BB=84=E7=BB=87=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=20=E5=90=8D=E5=B8=88=E5=88=97=E8=A1=A8=20?= =?UTF-8?q?=E7=83=AD=E9=97=A8=E9=A1=B9=E7=9B=AE=20=E5=AD=A6=E9=9C=B8=20?= =?UTF-8?q?=E7=B2=BE=E5=93=81=E8=AF=BE=E7=A8=8B=E7=9A=84=E5=8F=B3=E4=B8=8A?= =?UTF-8?q?=E8=A7=92=E5=AD=97=E6=A0=B7=E5=8F=AA=E5=AF=B9=E8=B6=85=E7=BA=A7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E6=98=BE=E7=A4=BA,=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=98=BE=E7=A4=BA=E6=97=B6=E5=A6=82=E6=9E=9C=E5=B7=B2?= =?UTF-8?q?=E7=BB=8F=E5=B8=A6=E4=BA=86=E9=93=BE=E6=8E=A5=E5=88=99=E4=B8=8D?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=82=B9=E5=87=BB=E5=BC=B9=E6=A1=86=E6=95=88?= =?UTF-8?q?=E6=9E=9C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/courses.html.erb | 8 +++++--- app/views/organizations/projects.html.erb | 8 +++++--- app/views/organizations/students.html.erb | 8 +++++--- app/views/organizations/teachers.html.erb | 8 +++++--- public/javascripts/application.js | 6 ++++++ 5 files changed, 26 insertions(+), 12 deletions(-) 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/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) {