Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
|
@ -141,6 +141,23 @@ class AttachmentsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_file_dense
|
||||||
|
@attachment = Attachment.find(params[:attachmentid])
|
||||||
|
if @attachment != nil
|
||||||
|
filedense = params[:newtype].to_s
|
||||||
|
if filedense == "1"
|
||||||
|
@attachment.is_public = 1
|
||||||
|
else
|
||||||
|
@attachment.is_public = 0
|
||||||
|
end
|
||||||
|
@attachment.save
|
||||||
|
@newfiledense = filedense
|
||||||
|
end
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
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)
|
||||||
|
@ -326,6 +343,35 @@ class AttachmentsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def add_exist_file_to_courses
|
||||||
|
file = Attachment.find(params[:file_id])
|
||||||
|
courses = params[:courses][:course]
|
||||||
|
courses.each do |course|
|
||||||
|
c = Course.find(course);
|
||||||
|
attach_copied_obj = file.copy
|
||||||
|
attach_copied_obj.tag_list.add(file.tag_list) # tag关联
|
||||||
|
attach_copied_obj.container = c
|
||||||
|
attach_copied_obj.created_on = Time.now
|
||||||
|
attach_copied_obj.author_id = User.current.id
|
||||||
|
attach_copied_obj.copy_from = file.copy_from.nil? ? file.id : file.copy_from
|
||||||
|
if attach_copied_obj.attachtype == nil
|
||||||
|
attach_copied_obj.attachtype = 4
|
||||||
|
end
|
||||||
|
@obj = c
|
||||||
|
@save_flag = attach_copied_obj.save
|
||||||
|
@save_message = attach_copied_obj.errors.full_messages
|
||||||
|
end
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
rescue NoMethodError
|
||||||
|
@save_flag = false
|
||||||
|
@save_message = [] << l(:error_attachment_empty)
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def find_project
|
def find_project
|
||||||
@attachment = Attachment.find(params[:id])
|
@attachment = Attachment.find(params[:id])
|
||||||
|
|
|
@ -22,22 +22,55 @@ class FilesController < ApplicationController
|
||||||
menu_item :files
|
menu_item :files
|
||||||
|
|
||||||
before_filter :find_project_by_project_id#, :except => [:getattachtype]
|
before_filter :find_project_by_project_id#, :except => [:getattachtype]
|
||||||
before_filter :authorize, :except => [:getattachtype]
|
before_filter :authorize, :except => [:getattachtype,:quote_resource_show,:search]
|
||||||
|
|
||||||
helper :sort
|
helper :sort
|
||||||
include SortHelper
|
include SortHelper
|
||||||
helper :project_score
|
helper :project_score
|
||||||
|
|
||||||
def show_attachments obj
|
def show_attachments obj
|
||||||
all_attachments = []
|
@all_attachments = []
|
||||||
obj.each do |container|
|
obj.each do |container|
|
||||||
all_attachments += container.attachments
|
@all_attachments += container.attachments
|
||||||
end
|
end
|
||||||
@limit = 10
|
@limit = 10
|
||||||
@feedback_count = all_attachments.count
|
@feedback_count = @all_attachments.count
|
||||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||||
@offset ||= @feedback_pages.offset
|
@offset ||= @feedback_pages.offset
|
||||||
@curse_attachments = all_attachments[@offset, @limit]
|
@curse_attachments_all = @all_attachments[@offset, @limit]
|
||||||
|
@curse_attachments = paginateHelper @all_attachments,10
|
||||||
|
end
|
||||||
|
|
||||||
|
def search
|
||||||
|
begin
|
||||||
|
@is_remote = true
|
||||||
|
q = "%#{params[:name].strip}%"
|
||||||
|
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
|
||||||
|
if params[:insite]
|
||||||
|
@result = find_public_attache q
|
||||||
|
@searched_attach = paginateHelper @result,10
|
||||||
|
else
|
||||||
|
@result = find_course_attache q,@course
|
||||||
|
@searched_attach = paginateHelper @result,10
|
||||||
|
end
|
||||||
|
|
||||||
|
rescue Exception => e
|
||||||
|
#render 'stores'
|
||||||
|
redirect_to stores_url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_course_attache keywords,course
|
||||||
|
resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").
|
||||||
|
reorder("created_on DESC")
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_public_attache keywords
|
||||||
|
# StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map
|
||||||
|
# 此时内容不多速度还可,但文件增长,每条判断多则进行3-4次表连接。
|
||||||
|
# 现在还木有思路 药丸
|
||||||
|
resultSet = Attachment.where("attachments.container_type IS NOT NULL AND (is_public = 1 OR author_id = #{User.current.id}) AND filename LIKE :like ", like: "%#{keywords}%").
|
||||||
|
reorder("created_on DESC")
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@ -48,7 +81,9 @@ class FilesController < ApplicationController
|
||||||
'size' => "#{Attachment.table_name}.filesize",
|
'size' => "#{Attachment.table_name}.filesize",
|
||||||
'downloads' => "#{Attachment.table_name}.downloads"
|
'downloads' => "#{Attachment.table_name}.downloads"
|
||||||
sort = ""
|
sort = ""
|
||||||
|
@sort = ""
|
||||||
|
@order = ""
|
||||||
|
@is_remote = false
|
||||||
if params[:project_id]
|
if params[:project_id]
|
||||||
@isproject = true
|
@isproject = true
|
||||||
|
|
||||||
|
@ -113,7 +148,8 @@ class FilesController < ApplicationController
|
||||||
when "created_on"
|
when "created_on"
|
||||||
attribute = "created_on"
|
attribute = "created_on"
|
||||||
end
|
end
|
||||||
|
@sort = order_by[0]
|
||||||
|
@order = order_by[1]
|
||||||
if order_by.count == 1
|
if order_by.count == 1
|
||||||
sort += "#{Attachment.table_name}.#{attribute} asc "
|
sort += "#{Attachment.table_name}.#{attribute} asc "
|
||||||
elsif order_by.count == 2
|
elsif order_by.count == 2
|
||||||
|
@ -134,6 +170,10 @@ class FilesController < ApplicationController
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def quote_resource_show
|
||||||
|
@file = Attachment.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@versions = @project.versions.sort
|
@versions = @project.versions.sort
|
||||||
@course_tag = @project.project_type
|
@course_tag = @project.project_type
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
class IssuesController < ApplicationController
|
class IssuesController < ApplicationController
|
||||||
layout 'base_projects'#Added by young
|
layout 'base_projects'#Added by young
|
||||||
menu_item :new_issue, :only => [:new, :create]
|
|
||||||
default_search_scope :issues
|
default_search_scope :issues
|
||||||
|
|
||||||
before_filter :find_issue, :only => [:show, :edit, :update]
|
before_filter :find_issue, :only => [:show, :edit, :update]
|
||||||
|
|
|
@ -19,7 +19,7 @@ class MemosController < ApplicationController
|
||||||
|
|
||||||
@content = "#{ll(Setting.default_language, :text_user_wrote, @memo.author)} <br/> "
|
@content = "#{ll(Setting.default_language, :text_user_wrote, @memo.author)} <br/> "
|
||||||
@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "</blockquote>\n\n<br/>"
|
@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "</blockquote>\n\n<br/>"
|
||||||
@content = "<blockquote>" << @content
|
@content = "<blockquote style='word-break: break-all;word-wrap: break-word;'>" << @content
|
||||||
#@content = "> #{ll(Setting.default_language, :text_user_wrote, @memo.author)}\n> "
|
#@content = "> #{ll(Setting.default_language, :text_user_wrote, @memo.author)}\n> "
|
||||||
#@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
#@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||||
#@content_html = textilizable(@content)
|
#@content_html = textilizable(@content)
|
||||||
|
|
|
@ -14,12 +14,14 @@ class TagsController < ApplicationController
|
||||||
include AttachmentsHelper
|
include AttachmentsHelper
|
||||||
include ContestsHelper
|
include ContestsHelper
|
||||||
include ActsAsTaggableOn::TagsHelper
|
include ActsAsTaggableOn::TagsHelper
|
||||||
|
include TagsHelper
|
||||||
helper :projects
|
helper :projects
|
||||||
helper :courses
|
helper :courses
|
||||||
helper :tags
|
helper :tags
|
||||||
include OpenSourceProjectsHelper
|
include OpenSourceProjectsHelper
|
||||||
|
|
||||||
before_filter :require_admin,:only => [:delete,:show_all]
|
before_filter :require_admin,:only => [:delete,:show_all]
|
||||||
|
before_filter :require_login,:only => [:tag_save]
|
||||||
|
|
||||||
# $selected_tags = Array.new
|
# $selected_tags = Array.new
|
||||||
# $related_tags = Array.new
|
# $related_tags = Array.new
|
||||||
|
@ -188,6 +190,83 @@ class TagsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 只删除某个对象的该tag
|
||||||
|
def remove_tag_new
|
||||||
|
@obj = nil
|
||||||
|
@object_flag = nil
|
||||||
|
|
||||||
|
if request.get?
|
||||||
|
# 获取传过来的tag_id taggable_id 和 taggable_type,通过2者确定要删除tag的对象
|
||||||
|
@tag_name = params[:tag_name]
|
||||||
|
@tag_id = (ActsAsTaggableOn::Tag.find_by_name(@tag_name)).id
|
||||||
|
@taggable_id = params[:taggable_id] # 当做参数传时对象会变成字符串
|
||||||
|
@taggable_type = numbers_to_object_type(params[:taggable_type])
|
||||||
|
|
||||||
|
@obj = get_object(@taggable_id,params[:taggable_type])
|
||||||
|
@object_flag = params[:taggable_type]
|
||||||
|
|
||||||
|
# if can_remove_tag?(User.current,@taggable_id,@taggable_type)
|
||||||
|
|
||||||
|
@taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type)
|
||||||
|
|
||||||
|
unless @taggings.nil?
|
||||||
|
@taggings.delete
|
||||||
|
end
|
||||||
|
|
||||||
|
# 是否还有其他记录 引用了 tag_id
|
||||||
|
@tagging = ActsAsTaggableOn::Tagging.find_by_tag_id(@tag_id)
|
||||||
|
# 如果taggings表中记录已经不存在 ,那么检查tags表 作删除动作
|
||||||
|
if @tagging.nil?
|
||||||
|
@tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id)
|
||||||
|
@tag.delete unless @tag.nil?
|
||||||
|
end
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def tag_save
|
||||||
|
@tags = params[:tag_for_save][:name]
|
||||||
|
@obj_id = params[:tag_for_save][:object_id]
|
||||||
|
@obj_flag = params[:tag_for_save][:object_flag]
|
||||||
|
|
||||||
|
case @obj_flag
|
||||||
|
when '1' then
|
||||||
|
@obj = User.find_by_id(@obj_id)
|
||||||
|
when '2' then
|
||||||
|
@obj = Project.find_by_id(@obj_id)
|
||||||
|
when '3' then
|
||||||
|
@obj = Issue.find_by_id(@obj_id)
|
||||||
|
when '4' then
|
||||||
|
@obj = Bid.find_by_id(@obj_id)
|
||||||
|
when '5' then
|
||||||
|
@obj = Forum.find_by_id(@obj_id)
|
||||||
|
when '6'
|
||||||
|
@obj = Attachment.find_by_id(@obj_id)
|
||||||
|
when '7' then
|
||||||
|
@obj = Contest.find_by_id(@obj_id)
|
||||||
|
when '8'
|
||||||
|
@obj = OpenSourceProject.find_by_id(@obj_id)
|
||||||
|
when '9'
|
||||||
|
@obj = Course.find_by_id(@obj_id)
|
||||||
|
else
|
||||||
|
@obj = nil
|
||||||
|
end
|
||||||
|
unless @obj.nil?
|
||||||
|
@obj.tag_list.add(@tags.split(","))
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if @obj.save
|
||||||
|
logger.debug "#{__FILE__}:#{__LINE__} ===> #{@obj.to_json}"
|
||||||
|
else
|
||||||
|
logger.error "#{__FILE__}:#{__LINE__} ===> #{@obj.errors.try(:full_messages)}"
|
||||||
|
end
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
format.html
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# 这里用来刷新搜索结果的区域
|
# 这里用来刷新搜索结果的区域
|
||||||
# 函数的返回值 前2字段用来处理获取其他tag和分页 ,另外4个返回值为过滤结果
|
# 函数的返回值 前2字段用来处理获取其他tag和分页 ,另外4个返回值为过滤结果
|
||||||
|
@ -308,4 +387,6 @@ class TagsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -177,6 +177,8 @@ module AttachmentsHelper
|
||||||
s.html_safe
|
s.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Modified by Longjun
|
# Modified by Longjun
|
||||||
# 有参数的方法要加()
|
# 有参数的方法要加()
|
||||||
def private_filter(resultSet)
|
def private_filter(resultSet)
|
||||||
|
|
|
@ -328,7 +328,7 @@ module CoursesHelper
|
||||||
#当前用户是不是指定课程的学生
|
#当前用户是不是指定课程的学生
|
||||||
def is_cur_course_student course
|
def is_cur_course_student course
|
||||||
#course.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and members.user_id = #{User.current.id}", {:role_id => StudentRoles}).count != 0
|
#course.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and members.user_id = #{User.current.id}", {:role_id => StudentRoles}).count != 0
|
||||||
!(User.current.allowed_to?(:as_teacher,course))
|
User.current.logged? && User.current.member_of_course?(course) && !(User.current.allowed_to?(:as_teacher,course))
|
||||||
#修改:能新建占位且不能新建任务的角色判定为学生
|
#修改:能新建占位且不能新建任务的角色判定为学生
|
||||||
#is_student = false
|
#is_student = false
|
||||||
#@membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
|
#@membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||||
|
|
|
@ -44,6 +44,16 @@ module FilesHelper
|
||||||
File.new(zipfile_name,'w+')
|
File.new(zipfile_name,'w+')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def courses_check_box_tags(name,courses,current_course)
|
||||||
|
s = ''
|
||||||
|
courses.each do |course|
|
||||||
|
if course.id != current_course.id && is_course_teacher(User.current,course)
|
||||||
|
s << "<label>#{ check_box_tag name, course.id, false, :id => nil } #{h course.name}</label><br/>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
s.html_safe
|
||||||
|
end
|
||||||
|
|
||||||
# 判断指定的资源时候符合类型
|
# 判断指定的资源时候符合类型
|
||||||
def isTypeOk(attachment, type, contentType)
|
def isTypeOk(attachment, type, contentType)
|
||||||
result = false
|
result = false
|
||||||
|
|
|
@ -88,7 +88,7 @@ class Memo < ActiveRecord::Base
|
||||||
|
|
||||||
def editable_by? user
|
def editable_by? user
|
||||||
# user && user.logged? || (self.author == usr && usr.allowed_to?(:edit_own_messages, project))
|
# user && user.logged? || (self.author == usr && usr.allowed_to?(:edit_own_messages, project))
|
||||||
(user && self.author == user) || user.admin?
|
user.admin? || self.author == user
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroyable_by? user
|
def destroyable_by? user
|
||||||
|
|
|
@ -22,12 +22,12 @@
|
||||||
<p><%= f.password_field :password, :size => 25, :required => true %>
|
<p><%= f.password_field :password, :size => 25, :required => true %>
|
||||||
<em class="info" style="color: #acaeb1"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
|
<em class="info" style="color: #acaeb1"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
|
||||||
</p>
|
</p>
|
||||||
<p><%= f.password_field :password_confirmation, :size => 25, :required => true %><span id="valid_password"></span></p>
|
<p><%= f.password_field :password_confirmation, :size => 25, :required => true %><span id="valid_password" style="padding-left: 10px;"></span></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<%= f.text_field :mail,:size => 25, :required => true %>
|
<%= f.text_field :mail,:size => 25, :required => true %>
|
||||||
<span id="valid_user_mail"></span>
|
<span id="valid_user_mail" ></span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<em class="info" style="color: #acaeb1">
|
<em class="info" style="color: #acaeb1">
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="created_on" align="center" title='<%=format_time(user.created_on)%>'><%= format_time(user.created_on) %></td>
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="created_on" align="center" title='<%=format_time(user.created_on)%>'><%= format_time(user.created_on) %></td>
|
||||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="last_login_on" align="center" title='<%= format_time(user.last_login_on)%>'><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="last_login_on" align="center" title='<%= format_time(user.last_login_on)%>'><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
|
||||||
<td class="buttons"> <%= change_status_link(user) %>
|
<td class="buttons"> <%= change_status_link(user) %>
|
||||||
<%= delete_link user_path(user, :back_url => admin_users_path(params)) unless User.current == user %> </td>
|
<%= delete_link user_path(user, :back_url => admin_search_path(params)) unless User.current == user %> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<% if !@save_flag%>
|
||||||
|
$("#error_show").html("<%= @save_message.join(', ') %>");
|
||||||
|
<% else %>
|
||||||
|
closeModal();
|
||||||
|
<% end %>
|
|
@ -0,0 +1,2 @@
|
||||||
|
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)),
|
||||||
|
:remote=>true,:class=>"f_l re_open",:method => :post) %>");
|
|
@ -0,0 +1,10 @@
|
||||||
|
<!-- sort: @sort,order:@order,current:"created_on" -->
|
||||||
|
<% if sort == current %>
|
||||||
|
<% if order =="asc" %>
|
||||||
|
↑
|
||||||
|
<% elsif order == "desc" %>
|
||||||
|
↓
|
||||||
|
<% else %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,46 @@
|
||||||
|
<div>
|
||||||
|
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
|
||||||
|
<% if defined?(container) && container && container.saved_attachments %>
|
||||||
|
<% container.attachments.each_with_index do |attachment, i| %>
|
||||||
|
<span id="attachments_p<%= i %>" class="attachment">
|
||||||
|
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
|
||||||
|
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
|
||||||
|
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
|
||||||
|
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
|
||||||
|
<%= if attachment.id.nil?
|
||||||
|
#待补充代码
|
||||||
|
else
|
||||||
|
link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
|
||||||
|
|
||||||
|
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button name="button" class="f_l ml10" onclick="_file.click()" onmouseover="this.focus()" type="button" style="width:80px; height:26px;">上传文件</button>
|
||||||
|
<%= file_field_tag 'attachments[dummy][file]',
|
||||||
|
:id => '_file',
|
||||||
|
:class => 'file_selector',
|
||||||
|
:multiple => true,
|
||||||
|
:onchange => 'addInputFiles(this);',
|
||||||
|
:style => 'display:none',
|
||||||
|
:data => {
|
||||||
|
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||||
|
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||||
|
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||||
|
:upload_path => uploads_path(:format => 'js'),
|
||||||
|
:description_placeholder => l(:label_optional_description)
|
||||||
|
} %>
|
||||||
|
<!--<input type="submit" name="" value="上传文件" class="f_l ml10" style="width:80px; height:26px;">-->
|
||||||
|
<label class="f_l ml10 c_grey">
|
||||||
|
<span id="upload_file_count">
|
||||||
|
<%= l(:label_no_file_uploaded)%>
|
||||||
|
</span>
|
||||||
|
(<%= l(:label_max_size) %>:
|
||||||
|
<%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
||||||
|
</label>
|
|
@ -2,84 +2,43 @@
|
||||||
<% sufixtypes = @course.contenttypes %>
|
<% sufixtypes = @course.contenttypes %>
|
||||||
|
|
||||||
|
|
||||||
<span class="borad-title"><%= t(:label_user_course) %>资源共享区</span>
|
<%= stylesheet_link_tag 'resource', :media => 'all' %>
|
||||||
|
<script>
|
||||||
|
function show_upload()
|
||||||
|
{
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course}) %>');
|
||||||
|
showModal('ajax-modal', '513px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||||
|
$('#ajax-modal').parent().css("top","5").css("left","511");
|
||||||
|
}
|
||||||
|
|
||||||
<div class="content-title-top">
|
function closeModal()
|
||||||
|
{
|
||||||
|
hideModal($("#popbox_upload"));
|
||||||
|
}
|
||||||
|
|
||||||
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @course) %>
|
</script>
|
||||||
<div class="clearfix"></div>
|
|
||||||
<div id="file_buttons" class="nhidden">
|
|
||||||
|
|
||||||
<%= 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, @course) %>
|
<div class="container">
|
||||||
<%= 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, @course) %>
|
<div class="resource"><!--资源库内容开始--->
|
||||||
<p></p>
|
<div class="re_top">
|
||||||
<div id="upload_file_div" class="relation_file_div hidden">
|
<%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %>
|
||||||
<%= render :partial => 'course_new', locals: {course: @course} %>
|
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
|
||||||
</div>
|
<%= submit_tag "课内搜索", :class => "re_schbtn b_dblue",:name => "incourse"%>
|
||||||
|
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite" %>
|
||||||
|
<% end %>
|
||||||
|
<% if is_course_teacher(User.current,@course) %>
|
||||||
|
<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload()">上传资源</a>
|
||||||
|
<% end %>
|
||||||
|
</div><!---re_top end-->
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
<div id="relation_file_div" class="relation_file_div hidden">
|
<div class="re_con" id="course_list">
|
||||||
<fieldset>
|
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@curse_attachments} %>
|
||||||
<legend>搜索</legend>
|
</div><!---re_con end-->
|
||||||
<%= form_tag(
|
|
||||||
attachments_autocomplete_path(:format => 'js'),
|
|
||||||
:remote => true,
|
|
||||||
:method => :post) do %>
|
|
||||||
<%= label_tag(:attach_search, "按关键字搜索:") %>
|
|
||||||
<%= text_field_tag(:attach_search) %>
|
|
||||||
<%#= submit_tag("Search") %>
|
|
||||||
<% end -%>
|
|
||||||
<%= form_tag course_attach_relation_path(:format => 'js'),
|
|
||||||
method: :post,
|
|
||||||
remote: true,
|
|
||||||
id: "relation_file_form",
|
|
||||||
:class => 'hidden' do %>
|
|
||||||
<%= hidden_field_tag(:class_name, 'course') %>
|
|
||||||
<%= hidden_field_tag(:class_id, params[:course_id]) %>
|
|
||||||
<div id="relation_file">
|
|
||||||
</div>
|
|
||||||
<div class="kclearfix" style='margin-top: 10px;'>
|
|
||||||
<%= submit_tag(l(:button_add)) -%>
|
|
||||||
</div>
|
|
||||||
<% end -%>
|
|
||||||
</fieldset>
|
|
||||||
<div class="line_under" style="margin:20px 0px;"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="box" id="files-box">
|
|
||||||
<label for="files-box" style="font-weight:bold;"> <%= l(:label_files_filter) %></label>
|
|
||||||
<% if attachmenttypes.any? %>
|
|
||||||
|
|
||||||
<label for="attachment_browse_label"><%= l(:attachment_browse) %></label>
|
|
||||||
<%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0' ) +options_from_collection_for_select(attachmenttypes, "id", "typeName", params[:type]),
|
|
||||||
|
|
||||||
:onchange => "course_attachmenttypes_searchex(this.value)" %>
|
|
||||||
<% end %>
|
|
||||||
<% if sufixtypes.any? %>
|
|
||||||
|
|
||||||
<label for="attach_sufix_browse_label"><%= l(:attachment_sufix_browse) %></label>
|
|
||||||
<%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes),
|
|
||||||
:onchange => "course_attachment_contenttypes_searchex(this.value)" %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<%= javascript_tag "observeSearchfield('attach_search', null, '#{ escape_javascript attachments_autocomplete_path(:course_id => @course.id, :format => 'js') }')" %>
|
|
||||||
|
|
||||||
|
|
||||||
<% delete_allowed = User.current.allowed_to?(:manage_files, @course) %>
|
|
||||||
|
|
||||||
<div id="all_browse_div" class="all_browse_div">
|
|
||||||
<%#= render :partial => 'course_show_all_attachment' %>
|
|
||||||
<% if (@attachtype==0 && @contenttype=='0') || (@attachtype.nil? && @contenttype.nil?) %>
|
|
||||||
|
|
||||||
<%= render partial: "course_show_all_attachment"%>
|
|
||||||
|
|
||||||
<%else%>
|
|
||||||
|
|
||||||
<%= render partial: "course_sort_by_attachtypel"%>
|
|
||||||
|
|
||||||
<%end%>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% html_title(l(:label_attachment_plural)) -%>
|
<% html_title(l(:label_attachment_plural)) -%>
|
|
@ -0,0 +1,56 @@
|
||||||
|
<% delete_allowed = User.current.allowed_to?(:manage_files, course) %>
|
||||||
|
<div class="re_con_top">
|
||||||
|
<p class="f_l c_blue f_b f_14">共有 <%= User.current.member_of_course?(course) ? all_attachments.count : 0 %> 个资源</p>
|
||||||
|
<!-- <p class="f_r">
|
||||||
|
<#% if @order == "asc" %>
|
||||||
|
按 <#%= link_to "时间",course_files_path(course,:sort=>"created_on:desc"),:class => "f_b c_grey" %><#%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||||
|
<#%= link_to "下载次数",course_files_path(course,:sort=>"downloads:desc"),:class => "f_b c_grey" %><#%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||||
|
<a href="#" class="f_b c_grey">引用次数</a> 排序
|
||||||
|
<#%else%>
|
||||||
|
按 <#%= link_to "时间",course_files_path(course,:sort=>"created_on:asc"),:class => "f_b c_grey" %><#%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||||
|
<#%= link_to "下载次数",course_files_path(course,:sort=>"downloads:asc"),:class => "f_b c_grey" %><#%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||||
|
<a href="#" class="f_b c_grey">引用次数</a> 排序
|
||||||
|
<#% end %>
|
||||||
|
</p>-->
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<% curse_attachments.each do |file| %>
|
||||||
|
<%if file.is_public == 0 && !User.current.member_of_course?(@course)%>
|
||||||
|
<%next%>
|
||||||
|
<%end%>
|
||||||
|
<div class="re_con_box">
|
||||||
|
<div class=" ">
|
||||||
|
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :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 is_course_teacher(User.current,@course) %>
|
||||||
|
<%= link_to "选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true %>
|
||||||
|
<% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
|
||||||
|
<span id="is_public_<%= file.id %>">
|
||||||
|
<%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open",:method => :post %>
|
||||||
|
</span>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% else %>
|
||||||
|
<%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div class="">
|
||||||
|
<p class="f_l c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||||
|
<%= link_to( l(:button_delete), attachment_path(file),
|
||||||
|
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%>
|
||||||
|
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用0 </p>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div class="tag_h">
|
||||||
|
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %>
|
||||||
|
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div><!---re_con_box end-->
|
||||||
|
<% end %>
|
||||||
|
<ul class="wlist">
|
||||||
|
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
|
||||||
|
</ul>
|
||||||
|
<div class="cl"></div>
|
|
@ -0,0 +1,24 @@
|
||||||
|
<div id="popbox_upload" style="margin-top: -30px;margin-left: -20px;margin-right: -10px;">
|
||||||
|
<div class="upload_con">
|
||||||
|
<div id="error_show"></div>
|
||||||
|
<h2>将此课件引入我的课程资源库</h2>
|
||||||
|
<div class="upload_box">
|
||||||
|
<%= form_tag course_attach_relations_path,
|
||||||
|
method: :post,
|
||||||
|
remote: true,
|
||||||
|
id: "relation_file_form" do %>
|
||||||
|
<%= hidden_field_tag(:file_id, file.id) %>
|
||||||
|
<%= content_tag('div', courses_check_box_tags('courses[course][]', User.current.courses,course), :id => 'courses')%>
|
||||||
|
<a id="submit_quote" href="javascript:void(0)" class="upload_btn" onclick="submit_quote();">引 用</a><a href="javascript:void(0)" class="upload_btn upload_btn_grey" onclick="closeModal();">取 消</a>
|
||||||
|
<% end -%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function submit_quote()
|
||||||
|
{
|
||||||
|
$('#submit_quote').parent().submit();
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<div id="popbox_upload" style="margin-top: -30px;margin-left: -20px;margin-right: -10px;">
|
||||||
|
<div class="upload_con">
|
||||||
|
<h2>上传资源</h2>
|
||||||
|
<div class="upload_box">
|
||||||
|
<%= error_messages_for 'attachment' %>
|
||||||
|
<div id="network_issue" style="color: red; display: none;">上传出现错误,请您检查您的网络环境,并刷新页面重新上传。</div>
|
||||||
|
<%= form_tag(course_files_path(course), :multipart => true,:remote => true,:method => :post,:name=>"upload_form") do %>
|
||||||
|
<label style="margin-top:3px;">文件浏览:</label>
|
||||||
|
<%= render :partial => 'attachement_list',:locals => {:course => course} %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<a id="submit_resource" href="javascript:void(0);" class="upload_btn" onclick="submit_resource();">上传资源</a><a href="javascript:void(0);" class="upload_btn upload_btn_grey" onclick="closeModal();">取 消</a>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<% content_for :header_tags do %>
|
||||||
|
<%= javascript_include_tag 'attachments' %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function submit_resource()
|
||||||
|
{
|
||||||
|
$('#submit_resource').parent().submit();
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -27,6 +27,8 @@ $('#upload_file_div').slideToggle('slow');
|
||||||
$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>');
|
$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>');
|
||||||
<%elsif @course%>
|
<%elsif @course%>
|
||||||
$("#all_browse_div").html('<%= j(render partial: "course_show_all_attachment")%>');
|
$("#all_browse_div").html('<%= j(render partial: "course_show_all_attachment")%>');
|
||||||
|
closeModal();
|
||||||
|
$("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>');
|
||||||
<%end%>
|
<%end%>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<!-- <h3> --><!-- %=l(:label_attachment_plural)%></h3 -->
|
<!-- <h3> --><!-- %=l(:label_attachment_plural)%></h3 -->
|
||||||
|
<div id="resource_list">
|
||||||
<% if @isproject %>
|
<% if @isproject %>
|
||||||
<%= render :partial => 'project_file', locals: {project: @project} %>
|
<%= render :partial => 'project_file', locals: {project: @project} %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= render :partial => 'course_file', locals: {course: @course} %>
|
<%= render :partial => 'course_file', locals: {course: @course} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
var slideHeight = 29;
|
var slideHeight = 29;
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource',:locals => {:course => @course,:file => @file}) %>');
|
||||||
|
showModal('ajax-modal', '513px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||||
|
$('#ajax-modal').parent().css("top","5").css("left","511");
|
|
@ -0,0 +1 @@
|
||||||
|
$("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:"create_on",order:"",curse_attachments:@searched_attach})%>");
|
|
@ -0,0 +1,10 @@
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {}) %>');
|
||||||
|
showModal('ajax-modal', '513px');
|
||||||
|
$('#ajax-modal').css('height','569px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
//$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
|
||||||
|
// "<a href='#' onclick='hidden_homework_atert_form("+
|
||||||
|
// <#%= @cur_page%> + "," + <#%= @cur_type%> +
|
||||||
|
// ");'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||||
|
$('#ajax-modal').parent().css("top","").css("left","");
|
||||||
|
$('#ajax-modal').parent().addClass("alert_box");
|
|
@ -4,23 +4,54 @@
|
||||||
<% forums.each do |forum| %>
|
<% forums.each do |forum| %>
|
||||||
<div class="forums-index">
|
<div class="forums-index">
|
||||||
<div class="forums-inex-avatar">
|
<div class="forums-inex-avatar">
|
||||||
<%= forum.creator.nil? ? (link_to image_tag(url_to_avatar(forum.creator), :class => "avatar")) : (link_to image_tag(url_to_avatar(forum.creator), :class => "avatar"), user_path(forum.creator)) %>
|
<%= forum.creator.nil? ? (link_to image_tag(url_to_avatar(forum.creator), :class => "avatar")) : (link_to image_tag(url_to_avatar(forum.creator), :class => "avatar"), user_path(forum.creator)) %>
|
||||||
</div>
|
</div>
|
||||||
<div class="forums-index-content">
|
<div class="forums-index-content">
|
||||||
<table class="content-text-list">
|
<table class="content-text-list" style="table-layout: fixed;">
|
||||||
<tr><td valign="top" width="500px" class=" <%= forum.sticky? ? 'sticky' : '' %>
|
<tr>
|
||||||
<%= forum.locked? ? 'locked' : '' %>">
|
<td valign="top" width="500px" class=" <%= forum.sticky? ? 'sticky' : '' %><%= forum.locked? ? 'locked' : '' %>" style="word-break: break-all;word-wrap: break-word;">
|
||||||
<p ><%= link_to h(forum.name), forum_path(forum) %></p></td></tr>
|
<p >
|
||||||
<tr><td><p ><%= textAreailizable forum.description%></p></td></tr>
|
<%= link_to h(forum.name), forum_path(forum) %>
|
||||||
<tr><td><p ><%= authoring forum.created_at, forum.creator %></p></td></tr>
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="word-break: break-all;word-wrap: break-word;">
|
||||||
|
<p>
|
||||||
|
<%= textAreailizable forum.description%>
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="word-break: break-all;word-wrap: break-word;">
|
||||||
|
<p >
|
||||||
|
<%= authoring forum.created_at, forum.creator %>
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="forums-index-count">
|
<div class="forums-index-count">
|
||||||
<table class="forums-count-color"><tr class="forums-count-color" align="center"><td><%= link_to (forum.memo_count), forum_path(forum) %></td><td><%= link_to (forum.topic_count), forum_path(forum) %></td></tr>
|
<table class="forums-count-color">
|
||||||
<tr align="center"><td>回答</td><td>帖子</td></tr></table></div>
|
<tr class="forums-count-color" align="center">
|
||||||
|
<td>
|
||||||
|
<%= link_to (forum.memo_count), forum_path(forum) %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= link_to (forum.topic_count), forum_path(forum) %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr align="center">
|
||||||
|
<td>回答</td>
|
||||||
|
<td>帖子</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="pagination"><%= pagination_links_full @forums_pages, @forums_count %></div>
|
<div class="pagination">
|
||||||
|
<%= pagination_links_full @forums_pages, @forums_count %>
|
||||||
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
|
@ -24,7 +24,7 @@
|
||||||
</head>
|
</head>
|
||||||
<!--add by huang-->
|
<!--add by huang-->
|
||||||
<body class="<%= h body_css_classes %>">
|
<body class="<%= h body_css_classes %>">
|
||||||
<%= render :partial => 'courses/course_ad' %>
|
<!-- <#%= render :partial => 'courses/course_ad' %> -->
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<div id="wrapper2">
|
<div id="wrapper2">
|
||||||
<div id="wrapper3">
|
<div id="wrapper3">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<%= form_for(@memo_new, url: forum_memos_path, :html => {:multipart => true}) do |f| %>
|
<%= form_for(@memo_new, url: forum_memos_path, :html => {:multipart => true}) do |f| %>
|
||||||
<%= f.hidden_field :subject, :required => true, value: "RE: "+@memo.subject %>
|
<%= f.hidden_field :subject, :required => true, value: @memo.subject %>
|
||||||
<%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %>
|
<%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %>
|
||||||
<%= f.hidden_field :parent_id, :required => true, value: @memo.id %>
|
<%= f.hidden_field :parent_id, :required => true, value: @memo.id %>
|
||||||
<div id="message_quote" class="wiki"></div>
|
<div id="message_quote" class="wiki"></div>
|
||||||
|
@ -7,11 +7,12 @@
|
||||||
<%= hidden_field_tag :quote,"",:required => false,:style => 'display:none' %>
|
<%= hidden_field_tag :quote,"",:required => false,:style => 'display:none' %>
|
||||||
<%= label_tag(l(:label_reply_plural)) %>:
|
<%= label_tag(l(:label_reply_plural)) %>:
|
||||||
<!-- <p> < %= f.text_area :content, :required => true, :size => "75%", :resize => "none", id: 'editor01' %> </p> -->
|
<!-- <p> < %= f.text_area :content, :required => true, :size => "75%", :resize => "none", id: 'editor01' %> </p> -->
|
||||||
<%= f.text_area :content, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'editor01', :value => @content %></p>
|
<%= f.text_area :content, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'editor01', :value => @content %>
|
||||||
|
|
||||||
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script>
|
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script>
|
||||||
<p><%= l(:label_attachment_plural) %><br />
|
<p>
|
||||||
<%= render :partial => 'attachments/form' %>
|
<%= l(:label_attachment_plural) %>
|
||||||
|
<br />
|
||||||
|
<%= render :partial => 'attachments/form' %>
|
||||||
</p>
|
</p>
|
||||||
<%= f.submit value: l(:label_reply_plural), class: "replies" %>
|
<%= f.submit value: l(:label_reply_plural), class: "replies" %>
|
||||||
<% end %>
|
<% end %>
|
|
@ -117,28 +117,34 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<table class="borad-text-list">
|
<table class="borad-text-list" style="table-layout: fixed;">
|
||||||
<tr>
|
<tr>
|
||||||
<td rowspan="3" valign="top" width="60px">
|
<td rowspan="3" valign="top" width="60px">
|
||||||
<%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %>
|
<%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %>
|
||||||
</td>
|
</td>
|
||||||
<td class="comments">
|
<td class="comments" style="word-wrap: break-word;word-break: break-all;">
|
||||||
<div class="reply_content" ><%=h sanitize(reply.content.html_safe) %></div>
|
<div class="reply_content" >
|
||||||
|
<%=h sanitize(reply.content.html_safe) %>
|
||||||
|
</div>
|
||||||
<p>
|
<p>
|
||||||
<% if reply.attachments.any?%>
|
<% if reply.attachments.any?%>
|
||||||
<% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %>
|
<% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %>
|
||||||
<%= render :partial => 'attachments/links', :locals => {:attachments => reply.attachments, :options => options} %>
|
<%= render :partial => 'attachments/links', :locals => {:attachments => reply.attachments, :options => options} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font_lighter" style="float:right"><%= authoring reply.created_at, reply.author %></td>
|
<td class="font_lighter" style="float:right">
|
||||||
|
<%= authoring reply.created_at, reply.author %>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="pagination"><%= pagination_links_full @reply_pages, @reply_count, :per_page_links => false %></div>
|
<div class="pagination">
|
||||||
|
<%= pagination_links_full @reply_pages, @reply_count, :per_page_links => false %>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if User.current.login? %>
|
<% if User.current.login? %>
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<%= link_to '+ 添加标签', 'javascript:void(0);',
|
||||||
|
:class => "yellowBtn f_l",
|
||||||
|
:onclick=>"$('#add_tag_#{obj.id}').slideToggle();" if User.current.logged? %> <!-- $('#put-tag-form-#{obj.class}-#{obj.id}').toggle(); readmore(this); -->
|
||||||
|
<span id="add_tag_<%= obj.id %>" style="display:none; vertical-align: middle;" class="ml10 f_l">
|
||||||
|
<%= form_for "tag_for_save",:remote=>true,:url => save_tag_path,
|
||||||
|
:update => "tags_show",
|
||||||
|
:complete => '$("#put-tag-form").hide();' do |f| %>
|
||||||
|
<%= f.text_field :name ,:id => "tags_name_#{obj.id}",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:class => "isTxt w90 f_l" %>
|
||||||
|
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
|
||||||
|
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
|
||||||
|
<%= f.submit "",:class => "submit f_l" %>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
|
@ -0,0 +1,20 @@
|
||||||
|
<% @tags = obj.reload.tag_list %>
|
||||||
|
|
||||||
|
<% if @tags.size > 0 %>
|
||||||
|
<% @tags.each do |tag| %>
|
||||||
|
<span class="re_tag f_l"> <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %>
|
||||||
|
<!-- 对用户主页 是本人 ,对项目,需求,问题是管理员 -->
|
||||||
|
<% case object_flag %>
|
||||||
|
<% when '6' %>
|
||||||
|
<% if obj.author_id == User.current.id || User.current.admin?%>
|
||||||
|
<span class='del'> <%= link_to 'x', :controller => "tags", :action => "remove_tag_new", :remote => true, :tag_name => tag,
|
||||||
|
:taggable_id => obj.id, :taggable_type => object_flag %> </span>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<span style="color:#8c8a8a" class="f_l">
|
||||||
|
<%= l(:label_tags_no) %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,24 @@
|
||||||
|
<%#begin
|
||||||
|
1 代表是user类型
|
||||||
|
2 代表是project类型
|
||||||
|
3 代表是issue类型
|
||||||
|
4 代表是bid类型
|
||||||
|
5 代表是forum类型
|
||||||
|
6 代表是Attachment类型
|
||||||
|
7 代表是contest类型
|
||||||
|
8 代表是OpenSourceProject类型
|
||||||
|
9 代表是RelativeMemo类型
|
||||||
|
#end%>
|
||||||
|
<!-- 3 代表的是issue 当是issue是 处理方式与前2个对象不同 -->
|
||||||
|
<% if object_flag == '3' %>
|
||||||
|
|
||||||
|
<% elsif object_flag == '6' %>
|
||||||
|
<div id="tags_show-<%=obj.class%>-<%=obj.id%>" style="display:inline; ">
|
||||||
|
<%= render :partial => "tags/tag_list",:locals => {:obj => obj,:object_flag => object_flag} %>
|
||||||
|
</div>
|
||||||
|
<div id="put-tag-form-<%=obj.class%>-<%=obj.id%>" style="display: none;height: 100px;">
|
||||||
|
<%= render :partial => "courses/course_resources_html", :locals => {:obj => obj ,:object_flag => object_flag } %>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
|
||||||
|
<% end %>
|
|
@ -0,0 +1,6 @@
|
||||||
|
//本js使用的新的tag显示方法
|
||||||
|
<% if @object_flag == "6"%>
|
||||||
|
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
|
||||||
|
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list',
|
||||||
|
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>');
|
||||||
|
<% end %>
|
|
@ -0,0 +1,9 @@
|
||||||
|
//本js使用的新的tag显示方法
|
||||||
|
<% if @obj_flag == '6'%>
|
||||||
|
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
|
||||||
|
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list',
|
||||||
|
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
|
||||||
|
//$("#put-tag-form-<%#=@obj.class%>-<%#=@obj.id%>").hide();
|
||||||
|
$("#tags_name_<%= @obj.id%>").val("");
|
||||||
|
//$('#put-tag-form').hide();
|
||||||
|
<% end %>
|
|
@ -558,11 +558,13 @@ RedmineApp::Application.routes.draw do
|
||||||
match 'attachments/autocomplete', :to => 'attachments#autocomplete', :via => [:post]
|
match 'attachments/autocomplete', :to => 'attachments#autocomplete', :via => [:post]
|
||||||
post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation'
|
post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation'
|
||||||
post 'attachments/courserelationfile', to: 'attachments#add_exist_file_to_course', as: 'course_attach_relation'
|
post 'attachments/courserelationfile', to: 'attachments#add_exist_file_to_course', as: 'course_attach_relation'
|
||||||
|
post 'attachments/courserelationfiles', to: 'attachments#add_exist_file_to_courses', as: 'course_attach_relations'
|
||||||
get 'attachments/renderTag/:attchmentId', :to => 'attachments#renderTag', :attchmentId => /\d+/
|
get 'attachments/renderTag/:attchmentId', :to => 'attachments#renderTag', :attchmentId => /\d+/
|
||||||
resources :attachments, :only => [:show, :destroy] do
|
resources :attachments, :only => [:show, :destroy] do
|
||||||
collection do
|
collection do
|
||||||
match "updateType" , :via => [:get, :post]
|
match "updateType" , :via => [:get, :post]
|
||||||
match "updateFileDense" , :via => [:get, :post]
|
match "updateFileDense" , :via => [:get, :post]
|
||||||
|
match "update_file_dense", :via => [:post]
|
||||||
match "renderTag" , :via => [:get, :post]
|
match "renderTag" , :via => [:get, :post]
|
||||||
match 'delete_softapplications', :via => [:get, :post]
|
match 'delete_softapplications', :via => [:get, :post]
|
||||||
end
|
end
|
||||||
|
@ -652,6 +654,10 @@ RedmineApp::Application.routes.draw do
|
||||||
resources :files, :only => [:index, :new, :create] do
|
resources :files, :only => [:index, :new, :create] do
|
||||||
collection do
|
collection do
|
||||||
match "getattachtype", :via => [:get, :post]
|
match "getattachtype", :via => [:get, :post]
|
||||||
|
match "search",:via => [:post,:get]
|
||||||
|
end
|
||||||
|
member do
|
||||||
|
match "quote_resource_show", :via => [:get]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
|
resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
|
||||||
|
@ -792,6 +798,8 @@ RedmineApp::Application.routes.draw do
|
||||||
match 'parise_tread/tread_plus', :as=>"tread"
|
match 'parise_tread/tread_plus', :as=>"tread"
|
||||||
match 'tags/delete'
|
match 'tags/delete'
|
||||||
match 'tags/remove_tag', :as=>"remove_tag"
|
match 'tags/remove_tag', :as=>"remove_tag"
|
||||||
|
match 'tags/remove_tag_new', :as=>"remove_tag_new"
|
||||||
|
match 'tags/tag_save', :as => "save_tag"
|
||||||
|
|
||||||
match 'words/add_brief_introdution'
|
match 'words/add_brief_introdution'
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddColumnCopyfromToAttachment < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column("attachments","copy_from",:integer)
|
||||||
|
end
|
||||||
|
end
|
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 958 B |
After Width: | Height: | Size: 215 B |
After Width: | Height: | Size: 215 B |
After Width: | Height: | Size: 225 B |
After Width: | Height: | Size: 225 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 958 B |
After Width: | Height: | Size: 215 B |
After Width: | Height: | Size: 215 B |
After Width: | Height: | Size: 225 B |
After Width: | Height: | Size: 225 B |
|
@ -15,7 +15,7 @@ span[id^=valid_user] {
|
||||||
}
|
}
|
||||||
|
|
||||||
.red {
|
.red {
|
||||||
color: red;margin-left: 10px;margin-right: 10px;text-align: right;
|
color: red;margin-right: 10px;text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.green {
|
.green {
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
|
||||||
|
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,form,span,textarea{ margin:0; padding:0;}
|
||||||
|
div,img,tr,td,textarea{ border:0;}
|
||||||
|
table,tr,td{border:0; cellspacing:0; cellpadding:0;}
|
||||||
|
ul,li{ list-style-type:none}
|
||||||
|
.cl{ clear:both; overflow:hidden; }
|
||||||
|
a{ text-decoration:none; text-align:center; }
|
||||||
|
a:hover{ text-decoration:underline;}
|
||||||
|
/**** 常用***/
|
||||||
|
.f_l{ float:left;}
|
||||||
|
.f_r{ float:right;}
|
||||||
|
.b_lblue{ background:#64bdd9 !important;}
|
||||||
|
.b_dblue{ background:#55a1b9 !important; cursor:pointer !important;}
|
||||||
|
.f_b{ font-weight: bold !important;}
|
||||||
|
.c_blue{ color:#64bdd9;}
|
||||||
|
.c_grey{ color:#999999 !important;}
|
||||||
|
.c_grey02{ color:#666666 !important;}
|
||||||
|
.f_14{ font-size:14px ;}
|
||||||
|
.c_dblue{ color:#3e6d8e;}
|
||||||
|
.w90{width:90px;}
|
||||||
|
.ml10{margin-left:10px;}
|
||||||
|
.ml5{margin-left:5px;}
|
||||||
|
.b_grey{ background:#a3a3a3;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.container{ }
|
||||||
|
|
||||||
|
/****搜索***/
|
||||||
|
.resource{ width:693px;}
|
||||||
|
.re_top{width:688px; height:50px; margin-left:5px; background:#eaeaea;}
|
||||||
|
.re_top input{ float:left;}
|
||||||
|
.re_search{ margin:12px;}
|
||||||
|
.re_schbox{ width:240px; height:24px; border:1px solid #64bdd9 !important; color:#666666;}
|
||||||
|
.re_schbtn
|
||||||
|
{
|
||||||
|
width:60px !important;
|
||||||
|
height:26px !important;
|
||||||
|
color:#fff !important;
|
||||||
|
margin-right:5px !important;
|
||||||
|
border:none !important;
|
||||||
|
margin-left:0px !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
padding: 0px !important;
|
||||||
|
border-radius: 0 !important;
|
||||||
|
text-shadow: none !important;
|
||||||
|
}
|
||||||
|
a.re_fabu { display:block; width:90px; height:35px; font-size:14px; color:#fff; text-align:center; padding-top:5px; margin:5px; }
|
||||||
|
a:hover.re_fabu{background:#55a1b9;}
|
||||||
|
/****列表***/
|
||||||
|
.re_con{ margin:5px; width:683px;}
|
||||||
|
.re_con_top{color:#494949; }
|
||||||
|
.re_con_top span{ color:#999999; font-weight:bold;}
|
||||||
|
a.re_select{ display:block; width:88px; height:22px; background:url(images/pic_select01.png) 0 0 no-repeat; color:#fff; font-weight:bold; margin-left:10px;}
|
||||||
|
a:hover.re_select{background:url(images/pic_select02.png) 0 0 no-repeat;}
|
||||||
|
.re_open{display:block; width:46px; height:22px; background:url(images/pic_open01.png) 0 0 no-repeat; color:#fff; font-weight:bold; margin-left:10px;}
|
||||||
|
a:hover.re_open{background:url(images/pic_open02.png) 0 0 no-repeat;}
|
||||||
|
a.re_de{ color:#6883b6; margin-left:15px;}
|
||||||
|
.re_con_box{ border-bottom:1px dashed #dadada; padding:10px 0;}
|
||||||
|
/****翻页***/
|
||||||
|
ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
|
||||||
|
.wlist li{float: left;}
|
||||||
|
.wlist span{ border:1px solid #15bccf; padding:0 5px; margin-left:3px;}
|
||||||
|
.wlist a{display: block; border:1px solid #15bccf; padding:0 5px; margin-left:3px;}
|
||||||
|
.wlist a:hover{ background:#15bccf; color:#fff; text-decoration:none;}
|
||||||
|
.wlist_select { background-color:#64bdd9; color:#fff; padding:0 5px; margin-left:3px; border:1px solid #64bdd9;}
|
||||||
|
/****标签***/
|
||||||
|
a.yellowBtn{ display:inline-block;color:#0d90c3; height:22px;}
|
||||||
|
.submit
|
||||||
|
{
|
||||||
|
height:21px !important;
|
||||||
|
border:0 !important;
|
||||||
|
cursor:pointer !important;
|
||||||
|
background:url(images/btn.png) no-repeat 0 0 !important;
|
||||||
|
width:42px !important;
|
||||||
|
margin-top:2px !important;
|
||||||
|
margin-left:3px !important;
|
||||||
|
border:none !important;
|
||||||
|
margin-left:0px !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
padding: 0px !important;
|
||||||
|
border-radius: 0 !important;
|
||||||
|
text-shadow: none !important;
|
||||||
|
}
|
||||||
|
.isTxt{background:#fbfbfb url(images/inputBg.png) repeat-x left top !important;height:22px !important;line-height:22px !important;border:1px solid #c1c1c1 !important;padding:0 5px !important;color:#666666 !important;}
|
||||||
|
.re_tag{ width: auto; padding:0 5px; height:22px; border:1px solid #f8df8c; background:#fffce6; margin-right:10px;}
|
||||||
|
.re_tag a{ color:#0d90c3;}
|
||||||
|
.tag_h span,.tag_h a{ margin-bottom:5px;}
|
||||||
|
|
||||||
|
/***弹框***/
|
||||||
|
.alert .close02{width:26px;height:26px;overflow:hidden;position:absolute;top:-10px;right:-490px;background:url(images/close.png) no-repeat;cursor:pointer;}
|
||||||
|
.upload_con { }
|
||||||
|
.upload_con h2{ display:block; background:#eaeaea; font-size:14px; color:#343333; height:31px; width: auto; margin-top:25px; padding-left:20px; padding-top:5px;}
|
||||||
|
.upload_box{ width:430px; margin:15px auto;}
|
||||||
|
a.upload_btn{ display:block; float:left; margin-top:15px; width:80px; height:30px; text-align: center; color:#fff; font-size:14px; background:#15bccf; margin-right:15px;}
|
||||||
|
a:hover.upload_btn{ background:#55a1b9;}
|
||||||
|
a.upload_btn_grey{background:#a3a3a3;}
|
||||||
|
a:hover.upload_btn_grey{background:#8a8a8a;}
|
||||||
|
.upload_con p{ color:#808181;}
|
||||||
|
.upload_con a:hover{ text-decoration:none;}
|
||||||
|
#upload_file_count #count {
|
||||||
|
color: #F00;
|
||||||
|
font-size: 1.1em;
|
||||||
|
}
|
||||||
|
|