|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
#encoding: utf-8
|
|
|
|
# Redmine - project management software
|
|
|
|
# Redmine - project management software
|
|
|
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
|
|
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
|
|
|
#
|
|
|
|
#
|
|
|
@ -203,16 +204,49 @@ class AttachmentsController < ApplicationController
|
|
|
|
@attachment.save
|
|
|
|
@attachment.save
|
|
|
|
@newfiledense = filedense
|
|
|
|
@newfiledense = filedense
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if @project
|
|
|
|
tip_attachment_update
|
|
|
|
|
|
|
|
|
|
|
|
elsif @course
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
|
format.js
|
|
|
|
format.js
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def tip_attachment_update
|
|
|
|
|
|
|
|
if params[:course_id]
|
|
|
|
|
|
|
|
@tip_all_attachments = Attachment.where(:container_type => "Course", :container_id => params[:project_id])
|
|
|
|
|
|
|
|
@tip_all_public_attachments = Attachment.where(:container_type => "Course", :container_id => params[:project_id], :is_public => 1)
|
|
|
|
|
|
|
|
@tip_all_private_attachments = Attachment.where(:container_type => "Course", :container_id => params[:project_id], :is_public => 0)
|
|
|
|
|
|
|
|
@course = Course.find(params[:course_id])
|
|
|
|
|
|
|
|
elsif params[:project_id]
|
|
|
|
|
|
|
|
@tip_all_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id])
|
|
|
|
|
|
|
|
@tip_all_public_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id], :is_public => 1)
|
|
|
|
|
|
|
|
@tip_all_private_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id], :is_public => 0)
|
|
|
|
|
|
|
|
@project = Project.find(params[:project_id])
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
@tag_name = params[:tag_name]
|
|
|
|
|
|
|
|
@other = params[:other]
|
|
|
|
|
|
|
|
unless @tag_name.blank?
|
|
|
|
|
|
|
|
if @other
|
|
|
|
|
|
|
|
if @project
|
|
|
|
|
|
|
|
@tip_all_attachments = @tip_all_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') }
|
|
|
|
|
|
|
|
@tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') }
|
|
|
|
|
|
|
|
@tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') }
|
|
|
|
|
|
|
|
elsif @course
|
|
|
|
|
|
|
|
@tip_all_attachments = @tip_all_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') }
|
|
|
|
|
|
|
|
@tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') }
|
|
|
|
|
|
|
|
@tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') }
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
@tip_all_attachments = @tip_all_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)}
|
|
|
|
|
|
|
|
@tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)}
|
|
|
|
|
|
|
|
@tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)}
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
@tip_all_attachments = @tip_all_attachments.count
|
|
|
|
|
|
|
|
@tip_all_public_attachments = @tip_all_public_attachments.count
|
|
|
|
|
|
|
|
@tip_all_private_attachments = @tip_all_private_attachments.count
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def thumbnail
|
|
|
|
def thumbnail
|
|
|
|
if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size])
|
|
|
|
if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size])
|
|
|
|
if stale?(:etag => thumbnail)
|
|
|
|
if stale?(:etag => thumbnail)
|
|
|
@ -281,6 +315,7 @@ class AttachmentsController < ApplicationController
|
|
|
|
@attachment.delete
|
|
|
|
@attachment.delete
|
|
|
|
@flag = true
|
|
|
|
@flag = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# tip_attachment_update
|
|
|
|
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
|
format.js
|
|
|
|
format.js
|
|
|
@ -591,6 +626,7 @@ class AttachmentsController < ApplicationController
|
|
|
|
def attachment_versions
|
|
|
|
def attachment_versions
|
|
|
|
@attachment = Attachment.find(params[:id])
|
|
|
|
@attachment = Attachment.find(params[:id])
|
|
|
|
@attachment_histories = @attachment.attachment_histories
|
|
|
|
@attachment_histories = @attachment.attachment_histories
|
|
|
|
|
|
|
|
@container_tip = Project.find(params[:project_id])
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
|
format.js
|
|
|
|
format.js
|
|
|
|
end
|
|
|
|
end
|
|
|
|