Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
59a5541e45
|
@ -234,4 +234,96 @@ class AdminController < ApplicationController
|
|||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
#首页定制
|
||||
def first_page_made
|
||||
if request.get?
|
||||
@first_page = FirstPage.where("page_type = 'project'").first
|
||||
elsif request.post?
|
||||
@first_page = FirstPage.where("page_type = 'project'").first
|
||||
@first_page.web_title = params[:web_title]
|
||||
@first_page.description = params[:description]
|
||||
@first_page.title = params[:title]
|
||||
if @first_page.save
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to admin_first_page_made_path
|
||||
}
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
first_page_made
|
||||
render :action => 'first_page_made'
|
||||
}
|
||||
format.api { render_validation_errors(@first_page) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def course_page_made
|
||||
if request.get?
|
||||
@course_page = FirstPage.where("page_type = 'course'").first
|
||||
@first_page = FirstPage.where("page_type = 'project'").first
|
||||
elsif request.post?
|
||||
@first_page = FirstPage.where("page_type = 'project'").first
|
||||
@course_page = FirstPage.where("page_type = 'course'").first
|
||||
@first_page.web_title = params[:web_title]
|
||||
@course_page.title = params[:course_title]
|
||||
@course_page.description = params[:course_description]
|
||||
if @first_page.save && @course_page.save
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to admin_course_page_made_path
|
||||
}
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
course_page_made
|
||||
render :action => 'course_page_made'
|
||||
}
|
||||
format.api { render_validation_errors(@first_page) }
|
||||
format.api { render_validation_errors(@course_page) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def contest_page_made
|
||||
if request.get?
|
||||
@contest_page = FirstPage.where("page_type = 'contest'").first
|
||||
@first_page = FirstPage.where("page_type = 'project'").first
|
||||
elsif request.post?
|
||||
@first_page = FirstPage.where("page_type = 'project'").first
|
||||
@contest_page = FirstPage.where("page_type = 'contest'").first
|
||||
@first_page.web_title = params[:web_title]
|
||||
@contest_page.title = params[:contest_title]
|
||||
@contest_page.description = params[:contest_description]
|
||||
if @first_page.save && @contest_page.save
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to admin_contest_page_made_path
|
||||
}
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
contest_page_made
|
||||
render :action => 'contest_page_made'
|
||||
}
|
||||
format.api { render_validation_errors(@first_page) }
|
||||
format.api { render_validation_errors(@contest_page) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -6,7 +6,8 @@ class AppliedProjectController < ApplicationController
|
|||
@project = Project.find(params[:project_id])
|
||||
@applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
|
||||
if @applieds.count == 0
|
||||
AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
|
||||
appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
|
||||
Mailer.applied_project(appliedproject).deliver
|
||||
end
|
||||
|
||||
#redirect_to project_path(params[:project_id])
|
||||
|
|
|
@ -23,6 +23,7 @@ class AttachmentsController < ApplicationController
|
|||
|
||||
before_filter :login_without_softapplication, only: [:download]
|
||||
accept_api_auth :show, :download, :upload
|
||||
require 'iconv'
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
|
@ -49,19 +50,39 @@ class AttachmentsController < ApplicationController
|
|||
end
|
||||
|
||||
def download
|
||||
if true || @attachment.container.is_a?(Version) || @attachment.container.is_a?(Project)
|
||||
@attachment.increment_download
|
||||
# modify by nwb
|
||||
# 下载添加权限设置
|
||||
candown = false
|
||||
if @attachment.container.has_attribute?(:project) && @attachment.container.project
|
||||
project = @attachment.container.project
|
||||
candown= User.current.member_of?(project)
|
||||
elsif @attachment.container.is_a?(Project)
|
||||
project = @attachment.container
|
||||
candown= User.current.member_of?(project)
|
||||
elsif @attachment.container.has_attribute?(:course) && @attachment.container.course
|
||||
course = @attachment.container.course
|
||||
candown= User.current.member_of_course?(course)
|
||||
elsif @attachment.container.is_a?(Course)
|
||||
course = @attachment.container
|
||||
candown= User.current.member_of_course?(course)
|
||||
elsif @attachment.container.class.to_s=="HomeworkAttach" && @attachment.container.bid.reward_type == 3
|
||||
candown = true
|
||||
end
|
||||
if candown || User.current.admin?
|
||||
@attachment.increment_download
|
||||
else
|
||||
render_403 :message => :notice_not_authorized
|
||||
end
|
||||
|
||||
|
||||
if stale?(:etag => @attachment.digest)
|
||||
# images are sent inline
|
||||
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
|
||||
:type => detect_content_type(@attachment),
|
||||
:disposition => (@attachment.image? ? 'inline' : 'attachment')
|
||||
:type => detect_content_type(@attachment),
|
||||
:disposition => (@attachment.image? ? 'inline' : 'attachment')
|
||||
end
|
||||
rescue => e
|
||||
redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
|
||||
return
|
||||
end
|
||||
|
||||
#更新资源文件类型
|
||||
|
@ -76,6 +97,25 @@ class AttachmentsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 更新文件密级
|
||||
def updateFileDense
|
||||
@attachment = Attachment.find(params[:attachmentid])
|
||||
if @attachment != nil
|
||||
filedense = params[:newtype].to_s
|
||||
# d = Iconv.conv("unicodebig","utf-8",filedense)
|
||||
if filedense == "%E5%85%AC%E5%BC%80" #l(:field_is_public)
|
||||
@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
|
||||
if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size])
|
||||
if stale?(:etag => thumbnail)
|
||||
|
@ -90,6 +130,7 @@ class AttachmentsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
def upload
|
||||
# Make sure that API users get used to set this content type
|
||||
# as it won't trigger Rails' automatic parsing of the request body for parameters
|
||||
|
|
|
@ -746,7 +746,7 @@ class ProjectsController < ApplicationController
|
|||
#Added by young
|
||||
# @course_tag = params[:course]
|
||||
# if @course_tag == '1'
|
||||
@course = Course.find_by_extra(@project.identifier)
|
||||
#@course = Course.find_by_extra(@project.identifier)
|
||||
# if @project.project_type == 1
|
||||
# render :layout => 'base_courses'
|
||||
# else
|
||||
|
|
|
@ -16,12 +16,13 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class WelcomeController < ApplicationController
|
||||
include ApplicationHelper
|
||||
caches_action :robots
|
||||
# before_filter :fake, :only => [:index, :course]
|
||||
before_filter :entry_select, :only => [:index]
|
||||
|
||||
def index
|
||||
|
||||
@first_page = FirstPage.where("page_type = 'project'").first
|
||||
end
|
||||
|
||||
def robots
|
||||
|
@ -30,6 +31,7 @@ class WelcomeController < ApplicationController
|
|||
end
|
||||
|
||||
def course
|
||||
@course_page = FirstPage.where("page_type = 'course'").first
|
||||
if params[:school_id]
|
||||
@school_id = params[:school_id]
|
||||
elsif User.current.logged? && User.current.user_extensions.school
|
||||
|
@ -41,13 +43,24 @@ class WelcomeController < ApplicationController
|
|||
|
||||
|
||||
def logolink()
|
||||
@course_page = FirstPage.where("page_type = 'course'").first
|
||||
logo = get_avatar?(@course_page)
|
||||
id = params[:school_id]
|
||||
logo_link = ""
|
||||
if id.nil? and User.current.user_extensions.school.nil?
|
||||
logo_link = '/images/transparent.png'
|
||||
if id.nil? && User.current.user_extensions.school.nil?
|
||||
if logo
|
||||
logo_link = url_to_avatar(@course_page)
|
||||
else
|
||||
logo_link = '/images/transparent.png'
|
||||
end
|
||||
|
||||
else
|
||||
if id == "0"
|
||||
logo_link = '/images/transparent.png'
|
||||
if logo
|
||||
logo_link = url_to_avatar(@course_page)
|
||||
else
|
||||
logo_link = '/images/transparent.png'
|
||||
end
|
||||
else
|
||||
if id.nil?
|
||||
if School.find(User.current.user_extensions.school.id).logo_link.nil?
|
||||
|
@ -66,7 +79,7 @@ class WelcomeController < ApplicationController
|
|||
|
||||
|
||||
def contest
|
||||
|
||||
@contest_page = FirstPage.where("page_type = 'contest'").first
|
||||
end
|
||||
|
||||
def search
|
||||
|
|
|
@ -625,10 +625,15 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def html_title(*args)
|
||||
first_page = FirstPage.where("page_type = 'project'").first
|
||||
if args.empty?
|
||||
title = @html_title || []
|
||||
title << @project.name if @project
|
||||
title << Setting.app_title unless Setting.app_title == title.last
|
||||
if first_page.nil? || first_page.web_title.nil?
|
||||
title << Setting.app_title unless Setting.app_title == title.last
|
||||
else
|
||||
title << first_page.web_title unless first_page.web_title == title.last
|
||||
end
|
||||
title.select {|t| !t.blank? }.join(' - ')
|
||||
else
|
||||
@html_title ||= []
|
||||
|
|
|
@ -109,7 +109,7 @@ module AttachmentsHelper
|
|||
domain = project.nil? ? attachAll : nobelong_attach
|
||||
|
||||
# 搜索到的资源
|
||||
searched_attach = domain.where("filename LIKE :like ", like:"%#{filename_condition}%").limit(limit).order('created_on desc')
|
||||
searched_attach = domain.where("is_public=1 and filename LIKE :like ", like:"%#{filename_condition}%").limit(limit).order('created_on desc')
|
||||
#searched_attach = private_filter searched_attach
|
||||
searched_attach = paginateHelper(searched_attach, 10)
|
||||
|
||||
|
@ -148,7 +148,7 @@ module AttachmentsHelper
|
|||
domain = course.nil? ? attachAll : nobelong_attach
|
||||
|
||||
# 搜索到的资源
|
||||
searched_attach = domain.where("filename LIKE :like ", like:"%#{filename_condition}%").limit(limit).order('created_on desc')
|
||||
searched_attach = domain.where("is_public=1 and filename LIKE :like ", like:"%#{filename_condition}%").limit(limit).order('created_on desc')
|
||||
#searched_attach = private_filter searched_attach
|
||||
searched_attach = paginateHelper(searched_attach, 10)
|
||||
|
||||
|
|
|
@ -196,6 +196,21 @@ class Attachment < ActiveRecord::Base
|
|||
suffix
|
||||
end
|
||||
|
||||
# 文件密级的字符描述
|
||||
def file_dense_str
|
||||
if self.is_public == 1
|
||||
dense = l(:field_is_public)
|
||||
else
|
||||
dense = l(:field_is_private)
|
||||
end
|
||||
dense
|
||||
end
|
||||
|
||||
# 文件可设置的密级列表
|
||||
def file_dense_list
|
||||
denselist = [l(:field_is_public),l(:field_is_private)]
|
||||
end
|
||||
|
||||
def suffixArr
|
||||
@@SuffixArr
|
||||
end
|
||||
|
|
|
@ -90,6 +90,18 @@ class Course < ActiveRecord::Base
|
|||
false
|
||||
end
|
||||
|
||||
# Returns the mail adresses of users that should be always notified on project events
|
||||
def recipients
|
||||
notified_users.collect {|user| user.mail}
|
||||
end
|
||||
|
||||
# Returns the users that should be notified on project events
|
||||
def notified_users
|
||||
# TODO: User part should be extracted to User#notify_about?
|
||||
members.select {|m| m.principal.present? && (m.mail_notification? || m.principal.mail_notification == 'all')}.collect {|m| m.principal}
|
||||
end
|
||||
|
||||
|
||||
# 课程的短描述信息
|
||||
def short_description(length = 255)
|
||||
description.gsub(/<\/?.*?>/,"").html_safe if description
|
||||
|
@ -124,6 +136,7 @@ class Course < ActiveRecord::Base
|
|||
@attachmenttypes = Attachmentstype.find(:all, :conditions => ["#{Attachmentstype.table_name}.typeId= ?",self.attachmenttype ])
|
||||
end
|
||||
|
||||
|
||||
# 获取资源后缀名列表
|
||||
def contenttypes
|
||||
attachmenttypes
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
class FirstPage < ActiveRecord::Base
|
||||
attr_accessible :description, :title, :web_title
|
||||
end
|
|
@ -141,6 +141,19 @@ class Mailer < ActionMailer::Base
|
|||
:subject => s
|
||||
end
|
||||
|
||||
# 用户申请加入项目邮件通知
|
||||
def applied_project(applied)
|
||||
@project =applied.project
|
||||
redmine_headers 'Project' => @project,
|
||||
'User' => applied.user
|
||||
@user = applied.user
|
||||
recipients = @project.manager_recipients
|
||||
s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name)
|
||||
@applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members')
|
||||
mail :to => recipients,
|
||||
:subject => s
|
||||
end
|
||||
|
||||
def reminder(user, issues, days)
|
||||
set_language_if_valid user.language
|
||||
@issues = issues
|
||||
|
@ -177,25 +190,45 @@ class Mailer < ActionMailer::Base
|
|||
added_to_url = ''
|
||||
@author = attachments.first.author
|
||||
case container.class.name
|
||||
when 'Project'
|
||||
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container)
|
||||
added_to = "#{l(:label_project)}: #{container}"
|
||||
recipients = container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect {|u| u.mail}
|
||||
when 'Version'
|
||||
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container.project)
|
||||
added_to = "#{l(:label_version)}: #{container.name}"
|
||||
recipients = container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect {|u| u.mail}
|
||||
when 'Document'
|
||||
added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
|
||||
added_to = "#{l(:label_document)}: #{container.title}"
|
||||
recipients = container.recipients
|
||||
when 'Project'
|
||||
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container)
|
||||
added_to = "#{l(:label_project)}: #{container}"
|
||||
recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
|
||||
when 'Course'
|
||||
added_to_url = url_for(:controller => 'files', :action => 'index', :course_id => container)
|
||||
added_to = "#{l(:label_course)}: #{container}"
|
||||
recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
|
||||
when 'Version'
|
||||
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container.project)
|
||||
added_to = "#{l(:label_version)}: #{container.name}"
|
||||
recipients = container.project.notified_users.select { |user| user.allowed_to?(:view_files, container.project) }.collect { |u| u.mail }
|
||||
when 'Document'
|
||||
added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
|
||||
added_to = "#{l(:label_document)}: #{container.title}"
|
||||
recipients = container.recipients
|
||||
end
|
||||
if container.class.name == 'Course'
|
||||
redmine_headers 'Course' => container.id
|
||||
@attachments = attachments
|
||||
@added_to = added_to
|
||||
@added_to_url = added_to_url
|
||||
mail :to => recipients,
|
||||
:subject => "[#{container.name}] #{l(:label_attachment_new)}"
|
||||
elsif container.class.name == 'Project'
|
||||
redmine_headers 'Project' => container.id
|
||||
@attachments = attachments
|
||||
@added_to = added_to
|
||||
@added_to_url = added_to_url
|
||||
mail :to => recipients,
|
||||
:subject => "[#{container.name}] #{l(:label_attachment_new)}"
|
||||
else
|
||||
redmine_headers 'Project' => container.project.identifier
|
||||
@attachments = attachments
|
||||
@added_to = added_to
|
||||
@added_to_url = added_to_url
|
||||
mail :to => recipients,
|
||||
:subject => "[#{container.project.name}] #{l(:label_attachment_new)}"
|
||||
end
|
||||
redmine_headers 'Project' => container.project.identifier
|
||||
@attachments = attachments
|
||||
@added_to = added_to
|
||||
@added_to_url = added_to_url
|
||||
mail :to => recipients,
|
||||
:subject => "[#{container.project.name}] #{l(:label_attachment_new)}"
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email recipients of a news' project when a news item is added.
|
||||
|
|
|
@ -207,6 +207,12 @@ class Project < ActiveRecord::Base
|
|||
end
|
||||
# end
|
||||
|
||||
# 管理员的邮件列表
|
||||
def manager_recipients
|
||||
notified = project.project_infos.collect(&:user)
|
||||
notified.collect(&:mail)
|
||||
end
|
||||
|
||||
def initialize(attributes=nil, *args)
|
||||
super
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<h3><%=l(:label_first_page_made)%></h3>
|
||||
|
||||
<%= form_tag(:controller => 'admin', :action => 'contest_page_made') do %>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='web_title'><%= l(:label_web_title) %>:</label>
|
||||
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'} %></li>
|
||||
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'} %></li>
|
||||
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} , :class => 'selected'%></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<h4><%=l(:label_contest_first_page)%></h4>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='attachments_fields'> <%= l(:label_site_image) %>:</label>
|
||||
</p>
|
||||
<div style="margin-left: 82px;">
|
||||
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@contest_page} %>
|
||||
</div>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='contest_title'> <%= l(:label_site_title) %>:</label>
|
||||
<%= text_field_tag 'contest_title', params[:label_site_title], :value => @contest_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='contest_description' style="vertical-align: top"> <%= l(:label_site_description)%>:</label>
|
||||
<%= text_area_tag 'contest_description',@contest_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
|
||||
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
|
||||
<% end %>
|
||||
<div>
|
||||
|
||||
|
||||
|
||||
</div>
|
|
@ -0,0 +1,37 @@
|
|||
<h3><%=l(:label_first_page_made)%></h3>
|
||||
|
||||
<%= form_tag(:controller => 'admin', :action => 'course_page_made') do %>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='web_title'><%= l(:label_web_title) %>:</label>
|
||||
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'} %></li>
|
||||
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'}, :class => 'selected' %></li>
|
||||
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} %></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h4><%=l(:label_course_first_page)%></h4>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='attachments_fields'> <%= l(:label_site_image) %>:</label>
|
||||
</p>
|
||||
<div style="margin-left: 82px;">
|
||||
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@course_page} %>
|
||||
</div>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='course_title'> <%= l(:label_site_title) %>:</label>
|
||||
<%= text_field_tag 'course_title', params[:label_site_title], :value => @course_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='course_description' style="vertical-align: top"> <%= l(:label_site_description)%>:</label>
|
||||
<%= text_area_tag 'course_description',@course_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
|
||||
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
|
||||
<% end %>
|
||||
<div>
|
||||
|
||||
|
||||
|
||||
</div>
|
|
@ -0,0 +1,38 @@
|
|||
<h3><%=l(:label_first_page_made)%></h3>
|
||||
|
||||
<%= form_tag(:controller => 'admin', :action => 'first_page_made') do %>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='web_title'><%= l(:label_web_title) %>:</label>
|
||||
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'}, :class => 'selected' %></li>
|
||||
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'} %></li>
|
||||
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} %></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h4><%=l(:label_project_first_page)%></h4>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='attachments_fields'> <%= l(:label_site_image) %>:</label>
|
||||
</p>
|
||||
<div style="margin-left: 82px;">
|
||||
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@first_page} %>
|
||||
</div>
|
||||
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='title'> <%= l(:label_site_title) %>:</label>
|
||||
<%= text_field_tag 'title', params[:label_site_title], :value => @first_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='description' style="vertical-align: top"> <%= l(:label_site_description)%>:</label>
|
||||
<%= text_area_tag 'description',@first_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
|
||||
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
|
||||
<% end %>
|
||||
<div>
|
||||
|
||||
|
||||
|
||||
</div>
|
|
@ -0,0 +1,31 @@
|
|||
<h3><%=l(:label_first_page_made)%></h3>
|
||||
|
||||
<%= form_tag(:controller => 'admin', :action => 'first_page_made') do %>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='web_title'><%= l(:label_web_title) %>:</label>
|
||||
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
<h4><%=l(:label_project_first_page)%></h4>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='attachments_fields'> <%= l(:label_site_image) %>:</label>
|
||||
</p>
|
||||
<div style="margin-left: 82px;">
|
||||
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@first_page} %>
|
||||
</div>
|
||||
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='title'> <%= l(:label_site_title) %>:</label>
|
||||
<%= text_field_tag 'title', params[:label_site_title], :value => @first_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='description' style="vertical-align: top"> <%= l(:label_site_description)%>:</label>
|
||||
<%= text_area_tag 'description',@first_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
|
||||
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
|
||||
<% end %>
|
||||
<div>
|
||||
|
||||
|
||||
|
||||
</div>
|
|
@ -3,10 +3,10 @@
|
|||
<% 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 => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") +
|
||||
link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
|
||||
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
|
||||
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, :class => 'is_public')%>
|
||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||
</span>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
$('#edit-file-dense-form-<%= @attachment.id.to_s%>').hide();
|
||||
$('#field_file_dense_id_label<%= @attachment.id.to_s%>').show();
|
||||
$('#edit_box_dense<%= @attachment.id.to_s%>').show();
|
||||
<%if @attachment.is_public == 1%>
|
||||
$('#field_file_dense_id_label<%= @attachment.id.to_s%>').html('公开');
|
||||
<%else%>
|
||||
$('#field_file_dense_id_label<%= @attachment.id.to_s%>').html('私有');
|
||||
<%end%>
|
||||
// 下面2种写法都没起作用,暂时使用上面的非本地化模式
|
||||
// <%if @attachment.is_public == 1%>
|
||||
// $('#field_file_dense_id_label<%= @attachment.id.to_s%>').html('<%l(:field_is_public)%>');
|
||||
// <%else%>
|
||||
// $('#field_file_dense_id_label<%= @attachment.id.to_s%>').html('<%l(:field_is_private)%>');
|
||||
// <%end%>
|
||||
// $('#field_file_dense_id_label<%= @attachment.id.to_s%>').html(<%=@newfiledense%>);
|
|
@ -45,6 +45,7 @@
|
|||
<a href="javascript:void(0);" class="btn_addPic" style="text-decoration:none;">
|
||||
<span><%= l(:button_upload_photo) %></span>
|
||||
</a>
|
||||
<!-- :accept => 'image/png,image/gif,image/jpeg', -->
|
||||
<span class="add_avatar" style="margin-left: -55px;width: 70px">
|
||||
<%= file_field_tag 'avatar[image]',
|
||||
:id => nil,
|
||||
|
@ -57,6 +58,8 @@
|
|||
: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,
|
||||
:file_type => Redmine::Configuration['pic_types'].to_s,
|
||||
:type_support_message => l(:error_pic_type),
|
||||
:upload_path => upload_avatar_path(:format => 'js'),
|
||||
:description_placeholder => nil ,# l(:label_optional_description)
|
||||
:source_type => source.class.to_s,
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<% edit_allowed = User.current.allowed_to?(:manage_files, @course) %>
|
||||
<% if file_dense_list.any? %>
|
||||
<div id="edit-file-dense-form-<%=attachment.id%>" class="hidden">
|
||||
<%= select_tag "file_dense",
|
||||
options_for_select(file_dense_list,attachment.file_dense_str), :onchange=>"file_dense_edit("+attachment.id.to_s + ",this.value)"%>
|
||||
</div>
|
||||
<%= link_to(image_tag('edit/edit.png'), 'javascript:void(0);',:style=>"white-space:nowrap;", :id=>"edit_box_dense"+attachment.id.to_s ,
|
||||
:onclick =>"$('#edit-file-dense-form-" +attachment.id.to_s+ "').show();
|
||||
$('#field_file_dense_id_label" +attachment.id.to_s+ "').hide();
|
||||
$('#edit_box_dense" +attachment.id.to_s+ "').hide();") if edit_allowed %>
|
||||
|
||||
<% end %>
|
||||
|
|
@ -18,6 +18,7 @@
|
|||
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %>
|
||||
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %>
|
||||
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %>
|
||||
<%= sort_header_tag('field_file_dense', :caption => l(:field_file_dense), :default_order => 'desc', :scope => "col", :id => "vzebra-field_file_dense") %>
|
||||
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
|
||||
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
|
||||
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
|
||||
|
@ -34,6 +35,9 @@
|
|||
</tr>
|
||||
<% end -%>
|
||||
<% container.attachments.each do |file| %>
|
||||
<%if file.is_public == 0 && !User.current.member_of?(@project)%>
|
||||
<%next%>
|
||||
<%end%>
|
||||
<tr class="file <%= cycle("odd", "odd") %>">
|
||||
<td class="filename" style="font-size: 13px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
||||
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
|
||||
|
@ -45,6 +49,14 @@
|
|||
</span>
|
||||
</td>
|
||||
<td class="content_type"><%= file.show_suffix_type %></td>
|
||||
<td class="field_file_dense">
|
||||
<span id="field_file_dense_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.file_dense_str %></span>
|
||||
|
||||
<span id="field_file_dense_id_edit<%= file.id %>" style="white-space:nowrap;">
|
||||
<%= render :partial => 'course_file_dense_edit', :locals => {:file_dense_list => file.file_dense_list,
|
||||
:attachment => file} %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="downloads"><%= file.downloads %></td>
|
||||
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
|
||||
<td align="center">
|
||||
|
|
|
@ -5,66 +5,78 @@
|
|||
<% edit_allowed = User.current.allowed_to?(:manage_files, @course) %>
|
||||
<table class="list files" id="ver-zebra">
|
||||
<colgroup>
|
||||
<col class="vzebra-odd"/>
|
||||
<col class="vzebra-even"/>
|
||||
<col class="vzebra-odd"/>
|
||||
<col class="vzebra-even"/>
|
||||
<!-- <col class="vzebra-odd"/> -->
|
||||
</colgroup>
|
||||
<thead>
|
||||
<col class="vzebra-odd"/>
|
||||
<col class="vzebra-even"/>
|
||||
<col class="vzebra-odd"/>
|
||||
<col class="vzebra-even"/>
|
||||
<!-- <col class="vzebra-odd"/> -->
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %>
|
||||
<%#= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %>
|
||||
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %>
|
||||
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %>
|
||||
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%>
|
||||
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %>
|
||||
<%= sort_header_tag('field_file_dense', :caption => l(:field_file_dense), :default_order => 'desc', :scope => "col", :id => "vzebra-field_file_dense") %>
|
||||
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
|
||||
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
|
||||
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @containers.each do |container| %>
|
||||
<% next if container.attachments.empty? -%>
|
||||
<% container.attachments.each do |file| %>
|
||||
<% if isTypeOk(file,selAttachType,selContentType) %>
|
||||
<tr class="file <%= cycle("odd", "odd") %>">
|
||||
<td class="filename" style="font-size: 13px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
||||
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
|
||||
<td class="filesize"><%= number_to_human_size(file.filesize) %></td>
|
||||
<td class="attach_type">
|
||||
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName %></span>
|
||||
|
||||
<% next if container.attachments.empty? -%>
|
||||
<% container.attachments.each do |file| %>
|
||||
<% if file.is_public == 0 && !User.current.member_of?(@project) %>
|
||||
<% next %>
|
||||
<% end %>
|
||||
<% if isTypeOk(file, selAttachType, selContentType) %>
|
||||
<tr class="file <%= cycle("odd", "odd") %>">
|
||||
<td class="filename" style="font-size: 13px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
||||
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
|
||||
<td class="filesize"><%= number_to_human_size(file.filesize) %></td>
|
||||
<td class="attach_type">
|
||||
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName %></span>
|
||||
|
||||
<span id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;">
|
||||
<%= render :partial => 'attachments/course_type_edit', :locals => {:attachmenttypes => attachmenttypes,
|
||||
:attachment => file,:contentype=>selContentType} %>
|
||||
:attachment => file, :contentype => selContentType} %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="content_type"><%= file.show_suffix_type %></td>
|
||||
<td class="downloads"><%= file.downloads %></td>
|
||||
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
|
||||
<td align="center">
|
||||
<%= link_to(image_tag('delete.png'), attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='description' colspan="6">
|
||||
<div class="tags_area">
|
||||
<%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
|
||||
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
|
||||
<div class="tags_gradint"></div>
|
||||
</div>
|
||||
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% reset_cycle %>
|
||||
<% end -%>
|
||||
<!-- %= h downloadAll(@containers) % -->
|
||||
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
|
||||
</td>
|
||||
<td class="content_type"><%= file.show_suffix_type %></td>
|
||||
<td class="field_file_dense">
|
||||
<span id="field_file_dense_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.file_dense_str %></span>
|
||||
|
||||
<span id="field_file_dense_id_edit<%= file.id %>" style="white-space:nowrap;">
|
||||
<%= render :partial => 'course_file_dense_edit', :locals => {:file_dense_list => file.file_dense_list,
|
||||
:attachment => file} %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="downloads"><%= file.downloads %></td>
|
||||
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
|
||||
<td align="center">
|
||||
<%= link_to(image_tag('delete.png'), attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='description' colspan="6">
|
||||
<div class="tags_area">
|
||||
<%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
|
||||
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
|
||||
<div class="tags_gradint"></div>
|
||||
</div>
|
||||
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% reset_cycle %>
|
||||
<% end -%>
|
||||
<!-- %= h downloadAll(@containers) % -->
|
||||
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<% edit_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
||||
<% if file_dense_list.any? %>
|
||||
<div id="edit-file-dense-form-<%=attachment.id%>" class="hidden">
|
||||
<%= select_tag "file_dense",
|
||||
options_for_select(file_dense_list,attachment.file_dense_str), :onchange=>"file_dense_edit("+attachment.id.to_s + ",this.value)"%>
|
||||
</div>
|
||||
<%= link_to(image_tag('edit/edit.png'), 'javascript:void(0);',:style=>"white-space:nowrap;", :id=>"edit_box_dense"+attachment.id.to_s ,
|
||||
:onclick =>"$('#edit-file-dense-form-" +attachment.id.to_s+ "').show();
|
||||
$('#field_file_dense_id_label" +attachment.id.to_s+ "').hide();
|
||||
$('#edit_box_dense" +attachment.id.to_s+ "').hide();") if edit_allowed %>
|
||||
|
||||
<% end %>
|
||||
|
|
@ -18,6 +18,7 @@
|
|||
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %>
|
||||
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %>
|
||||
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %>
|
||||
<%= sort_header_tag('field_file_dense', :caption => l(:field_file_dense), :default_order => 'desc', :scope => "col", :id => "vzebra-field_file_dense") %>
|
||||
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
|
||||
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
|
||||
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
|
||||
|
@ -34,6 +35,9 @@
|
|||
</tr>
|
||||
<% end -%>
|
||||
<% container.attachments.each do |file| %>
|
||||
<%if file.is_public == 0 && !User.current.member_of?(@project)%>
|
||||
<%next%>
|
||||
<%end%>
|
||||
<tr class="file <%= cycle("odd", "odd") %>">
|
||||
<td class="filename" style="font-size: 13px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
||||
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
|
||||
|
@ -45,6 +49,14 @@
|
|||
</span>
|
||||
</td>
|
||||
<td class="content_type"><%= file.show_suffix_type %></td>
|
||||
<td class="field_file_dense">
|
||||
<span id="field_file_dense_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.file_dense_str %></span>
|
||||
|
||||
<span id="field_file_dense_id_edit<%= file.id %>" style="white-space:nowrap;">
|
||||
<%= render :partial => 'project_file_dense_edit', :locals => {:file_dense_list => file.file_dense_list,
|
||||
:attachment => file} %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="downloads"><%= file.downloads %></td>
|
||||
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
|
||||
<td align="center">
|
||||
|
|
|
@ -5,66 +5,78 @@
|
|||
<% edit_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
||||
<table class="list files" id="ver-zebra">
|
||||
<colgroup>
|
||||
<col class="vzebra-odd"/>
|
||||
<col class="vzebra-even"/>
|
||||
<col class="vzebra-odd"/>
|
||||
<col class="vzebra-even"/>
|
||||
<!-- <col class="vzebra-odd"/> -->
|
||||
</colgroup>
|
||||
<thead>
|
||||
<col class="vzebra-odd"/>
|
||||
<col class="vzebra-even"/>
|
||||
<col class="vzebra-odd"/>
|
||||
<col class="vzebra-even"/>
|
||||
<!-- <col class="vzebra-odd"/> -->
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %>
|
||||
<%#= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %>
|
||||
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %>
|
||||
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %>
|
||||
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%>
|
||||
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %>
|
||||
<%= sort_header_tag('field_file_dense', :caption => l(:field_file_dense), :default_order => 'desc', :scope => "col", :id => "vzebra-field_file_dense") %>
|
||||
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
|
||||
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
|
||||
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @containers.each do |container| %>
|
||||
<% next if container.attachments.empty? -%>
|
||||
<% container.attachments.each do |file| %>
|
||||
<% if isTypeOk(file,selAttachType,selContentType) %>
|
||||
<tr class="file <%= cycle("odd", "odd") %>">
|
||||
<td class="filename" style="font-size: 13px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
||||
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
|
||||
<td class="filesize"><%= number_to_human_size(file.filesize) %></td>
|
||||
<td class="attach_type">
|
||||
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName %></span>
|
||||
|
||||
<% next if container.attachments.empty? -%>
|
||||
<% container.attachments.each do |file| %>
|
||||
<% if file.is_public == 0 && !User.current.member_of?(@project) %>
|
||||
<% next %>
|
||||
<% end %>
|
||||
<% if isTypeOk(file, selAttachType, selContentType) %>
|
||||
<tr class="file <%= cycle("odd", "odd") %>">
|
||||
<td class="filename" style="font-size: 13px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
||||
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
|
||||
<td class="filesize"><%= number_to_human_size(file.filesize) %></td>
|
||||
<td class="attach_type">
|
||||
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName %></span>
|
||||
|
||||
<span id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;">
|
||||
<%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes,
|
||||
:attachment => file,:contentype=>selContentType} %>
|
||||
:attachment => file, :contentype => selContentType} %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="content_type"><%= file.show_suffix_type %></td>
|
||||
<td class="downloads"><%= file.downloads %></td>
|
||||
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
|
||||
<td align="center">
|
||||
<%= link_to(image_tag('delete.png'), attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='description' colspan="6">
|
||||
<div class="tags_area">
|
||||
<%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
|
||||
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
|
||||
<div class="tags_gradint"></div>
|
||||
</div>
|
||||
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% reset_cycle %>
|
||||
<% end -%>
|
||||
<!-- %= h downloadAll(@containers) % -->
|
||||
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
|
||||
</td>
|
||||
<td class="content_type"><%= file.show_suffix_type %></td>
|
||||
<td class="field_file_dense">
|
||||
<span id="field_file_dense_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.file_dense_str %></span>
|
||||
|
||||
<span id="field_file_dense_id_edit<%= file.id %>" style="white-space:nowrap;">
|
||||
<%= render :partial => 'project_file_dense_edit', :locals => {:file_dense_list => file.file_dense_list,
|
||||
:attachment => file} %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="downloads"><%= file.downloads %></td>
|
||||
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
|
||||
<td align="center">
|
||||
<%= link_to(image_tag('delete.png'), attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='description' colspan="6">
|
||||
<div class="tags_area">
|
||||
<%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
|
||||
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
|
||||
<div class="tags_gradint"></div>
|
||||
</div>
|
||||
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% reset_cycle %>
|
||||
<% end -%>
|
||||
<!-- %= h downloadAll(@containers) % -->
|
||||
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -207,6 +207,23 @@
|
|||
<%end%>
|
||||
|
||||
}
|
||||
|
||||
// 编辑文件密级
|
||||
function file_dense_edit(id, type) {
|
||||
$.ajax({
|
||||
url: '<%=updateFileDense_attachments_path%>',
|
||||
type: "POST",
|
||||
remote:"true",
|
||||
data: {
|
||||
attachmentid: encodeURIComponent(id),
|
||||
newtype: encodeURIComponent(type)
|
||||
}
|
||||
|
||||
}).complete(function (xhr, textStatus) {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<%= l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name) %>
|
||||
<hr />
|
||||
|
||||
<h1><%= link_to(h(@project.name), @applied_url) %></h1>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<%= l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name) %>
|
||||
|
||||
<h1><%= link_to(h(@project.name), @applied_url) %></h1>
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
<div> = <%= l(:label_user_score_of_collaboration) %> + <%= l(:label_user_score_of_influence) %> +
|
||||
<%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %></div>
|
||||
<!-- <div> + <%= l(:label_user_score_of_influence) %></div> -->
|
||||
<div> = <%= format("%.2f" ,@user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_f %> + <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence ).to_f %>
|
||||
+ <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_f %> + <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_f %></div>
|
||||
<div> = <%= format("%.2f" ,@user.user_score_attr.total_score.nil? ? 0:@user.user_score_attr.total_score).to_f %></div>
|
||||
<div> = <%= format("%.2f" ,@user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_i %> + <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence ).to_i %>
|
||||
+ <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_i %> + <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_i %></div>
|
||||
<div> = <%= format("%.2f" ,@user.user_score_attr.total_score.nil? ? 0:@user.user_score_attr.total_score).to_i %></div>
|
||||
<!-- end -->
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<td>
|
||||
<table>
|
||||
<tr class="info_font"><td><%= l(:label_user_score) %></td></tr>
|
||||
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , @user.user_score_attr.total_score).to_f %></span></td></tr>
|
||||
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , @user.user_score_attr.total_score).to_i %></span></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -49,23 +49,23 @@
|
|||
<table style="border-bottom: solid 0px #80a6d2;" width="100%">
|
||||
<tr>
|
||||
<%= link_to l(:label_user_score) , {:controller => 'users', :action => 'score_new_index', :remote => true} %> :
|
||||
<%= format("%.2f" , @user.user_score_attr.total_score).to_f %>
|
||||
<%= format("%.2f" , @user.user_score_attr.total_score).to_i %>
|
||||
</tr><br>
|
||||
<tr>
|
||||
<%= link_to l(:label_user_score_of_collaboration), {:controller => 'users',:action => 'topic_new_score_index', :remote => true} %> :
|
||||
<%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_f %>
|
||||
<%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_i %>
|
||||
</tr><br>
|
||||
<tr>
|
||||
<%= link_to l(:label_user_score_of_influence), {:controller => 'users',:action => 'project_new_score_index', :remote => true} %> :
|
||||
<%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_f %>
|
||||
<%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_i %>
|
||||
</tr><br>
|
||||
<tr>
|
||||
<%= link_to l(:label_user_score_of_skill), {:controller => 'users',:action => 'activity_new_score_index', :remote => true} %> :
|
||||
<%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_f %>
|
||||
<%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_i %>
|
||||
</tr><br>
|
||||
<tr>
|
||||
<%= link_to l(:label_user_score_of_active), {:controller => 'users',:action => 'influence_new_score_index', :remote => true} %> :
|
||||
<%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_f %>
|
||||
<%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_i %>
|
||||
</tr><br>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<%= l(:label_user_grade)%>:
|
||||
<%= link_to(format("%.2f" , user.user_score_attr.total_score).to_f, {:controller => 'users',
|
||||
<%= link_to(format("%.2f" , user.user_score_attr.total_score).to_i, {:controller => 'users',
|
||||
:action => 'show_new_score',
|
||||
:remote => true,
|
||||
:id => user.id
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
<td>
|
||||
<table>
|
||||
<tr class="info_font"><td><%= l(:label_user_score) %></td></tr>
|
||||
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , @user.user_score_attr.total_score).to_f %></span></td></tr>
|
||||
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , @user.user_score_attr.total_score).to_i %></span></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -64,23 +64,23 @@
|
|||
<table style="border-bottom: solid 0px #80a6d2;" width="100%">
|
||||
<tr>
|
||||
<%= l(:label_user_score) %> :
|
||||
<%= format("%.2f" , @user.user_score_attr.total_score).to_f %>
|
||||
<%= format("%.2f" , @user.user_score_attr.total_score).to_i %>
|
||||
</tr><br>
|
||||
<tr>
|
||||
<%= l(:label_user_score_of_collaboration) %> :
|
||||
<%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_f %>
|
||||
<%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_i %>
|
||||
</tr><br>
|
||||
<tr>
|
||||
<%= l(:label_user_score_of_influence) %> :
|
||||
<%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_f %>
|
||||
<%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_i %>
|
||||
</tr><br>
|
||||
<tr>
|
||||
<%= l(:label_user_score_of_skill) %> :
|
||||
<%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_f %>
|
||||
<%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_i %>
|
||||
</tr><br>
|
||||
<tr>
|
||||
<%= l(:label_user_score_of_active) %> :
|
||||
<%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_f %>
|
||||
<%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_i %>
|
||||
</tr><br>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -114,12 +114,17 @@
|
|||
<div class="main-content-bar" id="main-content-bar">
|
||||
<!--文字-->
|
||||
<div style="float: left">
|
||||
<%= image_tag '/images/transparent.png', size: "75x75" %>
|
||||
<% if get_avatar?(@contest_page) %>
|
||||
<%= image_tag(url_to_avatar(@contest_page), size: "75x75") %>
|
||||
<% else %>
|
||||
<%= image_tag '/images/transparent.png', size: "75x75" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="welcome_left" id="welcome_left">
|
||||
|
||||
<span class="font_welcome_trustie"><%= l(:label_welcome_trustie) %> <%= l(:label_welcome_trustie_contest) %></span> <span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_contest_description) %></span>
|
||||
</div>
|
||||
<% unless @contest_page.nil? %>
|
||||
<span class="font_welcome_trustie"><%= @contest_page.title %></span> <span class="font_welcome_tdescription">, <%= @contest_page.description %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!--搜索框-->
|
||||
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
|
||||
|
|
|
@ -51,14 +51,17 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
<% end %> </span>
|
||||
<span class="font_welcome_trustie"><%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_course) %> </span>
|
||||
<% unless @course_page.nil? %>
|
||||
<span class="font_welcome_trustie"><%= @course_page.title %> </span>
|
||||
|
||||
<% if @school_id.nil? and User.current.user_extensions.school.nil? %>
|
||||
<span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_course_description) %></span>
|
||||
<span class="font_welcome_tdescription">, <%= @course_page.description %></span>
|
||||
<% else %>
|
||||
<% if @school_id == "0" %>
|
||||
<span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_course_description) %></span>
|
||||
<span class="font_welcome_tdescription">, <%= @course_page.description %></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="search-bar" id="search-bar">
|
||||
<%= render :partial => "search_course", :locals => {:project_type => Project::ProjectType_course} %>
|
||||
|
|
|
@ -33,10 +33,18 @@
|
|||
</div>
|
||||
<div class="main-content-bar" id="main-content-bar">
|
||||
<div style="float: left">
|
||||
<%= image_tag '/images/transparent.png', size: "75x75" %>
|
||||
<!-- <#%= image_tag(get_project_avatar(@first_page), size: "75x75") %> -->
|
||||
<% if get_avatar?(@first_page) %>
|
||||
<%= image_tag(url_to_avatar(@first_page), size: "75x75") %>
|
||||
<% else %>
|
||||
<%= image_tag '/images/transparent.png', size: "75x75" %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<div class="welcome_left" id="welcome_left">
|
||||
<span class="font_welcome_trustie"><%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_project) %></span> <span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_project_description) %></span>
|
||||
<% unless @first_page.nil? %>
|
||||
<span class="font_welcome_trustie"><%= @first_page.title %></span> <span class="font_welcome_tdescription">, <%= @first_page.description %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="search-bar" id="search-bar">
|
||||
<%= render :partial => "search_project", :locals => {:project_type => 0}%>
|
||||
|
|
|
@ -199,6 +199,7 @@ default:
|
|||
|
||||
# Maximum number of simultaneous AJAX uploads
|
||||
#max_concurrent_ajax_uploads: 2
|
||||
#pic_types: "bmp,jpeg,jpg,png,gif"
|
||||
|
||||
# specific configuration options for production environment
|
||||
# that overrides the default ones
|
||||
|
|
|
@ -233,6 +233,7 @@ en:
|
|||
field_mail: Email
|
||||
field_job_category: Job category # added by bai
|
||||
field_filename: File
|
||||
field_file_dense: File Dense
|
||||
field_filesize: Size
|
||||
field_downloads: Downloads
|
||||
field_author: Author
|
||||
|
@ -1079,6 +1080,7 @@ en:
|
|||
text_session_expiration_settings: "Warning: changing these settings may expire the current sessions including yours."
|
||||
text_project_closed: This project is closed and read-only.
|
||||
text_turning_multiple_off: "If you disable multiple values, multiple values will be removed in order to preserve only one value per item."
|
||||
text_applied_project: "User %{id} Apply Join Project %{project}"
|
||||
|
||||
default_role_manager: Manager
|
||||
default_role_developer: Developer
|
||||
|
|
|
@ -251,6 +251,7 @@ zh:
|
|||
field_lastname_eg: '(例:张三丰,请填写[张])'
|
||||
field_mail: 邮件地址
|
||||
field_filename: 文件
|
||||
field_file_dense: 文件密级
|
||||
field_filesize: 大小
|
||||
field_downloads: 下载次数
|
||||
field_author: 作者
|
||||
|
@ -515,6 +516,10 @@ zh:
|
|||
label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。'
|
||||
label_project_plural: 项目列表
|
||||
label_project_score: 项目评分
|
||||
label_first_page_made: 首页定制
|
||||
label_project_first_page: 项目托管平台首页
|
||||
label_course_first_page: 课程实践平台首页
|
||||
label_contest_first_page: 竞赛实战平台首页
|
||||
label_x_projects:
|
||||
zero: 无项目
|
||||
one: 1 个项目
|
||||
|
@ -561,6 +566,10 @@ zh:
|
|||
label_login_with_open_id_option: 或使用OpenID登录
|
||||
label_password_lost: 忘记密码
|
||||
label_home: 主页
|
||||
label_web_title: 浏览器标题
|
||||
label_site_title: 网站标题
|
||||
label_site_description: 网站简介
|
||||
label_site_image: 简介图片
|
||||
#by young
|
||||
label_requirement: 需求
|
||||
label_new_course: 课程列表
|
||||
|
@ -1119,6 +1128,7 @@ zh:
|
|||
text_own_membership_delete_confirmation: 你正在删除你现有的某些或全部权限,如果这样做了你可能将会再也无法编辑该项目了。你确定要继续吗?
|
||||
text_zoom_in: 放大
|
||||
text_zoom_out: 缩小
|
||||
text_applied_project: "用户 %{id} 申请加入项目 %{project}"
|
||||
|
||||
default_role_manager: 管理人员
|
||||
default_role_developer: 开发人员
|
||||
|
@ -1217,6 +1227,7 @@ zh:
|
|||
button_export: 导出
|
||||
label_export_options: "%{export_format} 导出选项"
|
||||
error_attachment_too_big: 该文件无法上传。超过文件大小限制 (%{max_size})
|
||||
error_pic_type: "仅支持如下图片格式:"
|
||||
notice_failed_to_save_time_entries: "无法保存下列所选取的 %{total} 个项目中的 %{count} 工时: %{ids}。"
|
||||
label_x_issues:
|
||||
zero: 0 问题
|
||||
|
|
|
@ -515,6 +515,7 @@ RedmineApp::Application.routes.draw do
|
|||
resources :attachments, :only => [:show, :destroy] do
|
||||
collection do
|
||||
match "updateType" , via: [:get, :post]
|
||||
match "updateFileDense" , via: [:get, :post]
|
||||
match "renderTag" , via: [:get, :post]
|
||||
end
|
||||
end
|
||||
|
@ -558,6 +559,9 @@ RedmineApp::Application.routes.draw do
|
|||
match 'admin', :controller => 'admin', :action => 'index', :via => :get
|
||||
match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get
|
||||
match 'admin/users', :controller => 'admin', :action => 'users', :via => :get
|
||||
match 'admin/first_page_made',:controller => 'admin',:action => 'first_page_made',:via => [:get,:post]
|
||||
match 'admin/course_page_made',:controller => 'admin',:action => 'course_page_made',:via => [:get,:post]
|
||||
match 'admin/contest_page_made',:controller => 'admin',:action => 'contest_page_made',:via => [:get,:post]
|
||||
match 'admin/search', :controller => 'admin', :action => 'search', :via => [:get, :post]
|
||||
match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get
|
||||
match 'admin/info', :controller => 'admin', :action => 'info', :via => :get
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddIsPublicToAttachment < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :attachments, :is_public, :integer,:default => 1
|
||||
end
|
||||
end
|
|
@ -0,0 +1,22 @@
|
|||
class UpdateAttachmentPublicAttr < ActiveRecord::Migration
|
||||
def up
|
||||
# 更新资源文件的is_public属性
|
||||
Attachment.all.each do |res|
|
||||
if res.is_public
|
||||
if(res.container.nil? ||
|
||||
(res.container.class.to_s=="Project" && res.container.is_public == false) ||
|
||||
(res.container.has_attribute?(:project) && res.container.project && res.container.project.is_public == false) ||
|
||||
(res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) ||
|
||||
(res.container.class.to_s=="Course" && res.container.is_public == false) ||
|
||||
(res.container.has_attribute?(:course) && res.container.course && res.container.course.is_public == false)
|
||||
)
|
||||
res.is_public = false
|
||||
res.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,17 @@
|
|||
# -*coding:utf-8 -*-
|
||||
class CreateFirstPages < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :first_pages do |t|
|
||||
t.string :web_title
|
||||
t.string :title
|
||||
t.string :description
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
fp = FirstPage.new
|
||||
fp.web_title = "Trustie - 为大学生技术创新筑巢"
|
||||
fp.title = "Trustie在线项目托管平台"
|
||||
fp.description = "面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。"
|
||||
fp.save
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddCloumnToFirstPage < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :first_pages,:type,:string
|
||||
|
||||
fr = FirstPage.all.first
|
||||
fr.type = "project"
|
||||
fr.save
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AltColumnName < ActiveRecord::Migration
|
||||
def change
|
||||
rename_column :first_pages,:type,:page_type
|
||||
end
|
||||
end
|
|
@ -0,0 +1,17 @@
|
|||
# -*coding:utf-8 -*-
|
||||
class AddContestAndCourseFirstPage < ActiveRecord::Migration
|
||||
def change
|
||||
fp = FirstPage.new
|
||||
fp.web_title = ""
|
||||
fp.title = "Trustie在线课程实践平台"
|
||||
fp.description = "面向中国高校教师与大学生,提供社交化的课程管理、资源共享、合作实验、协同研究。"
|
||||
fp.page_type = "course"
|
||||
fp.save
|
||||
fp1 = FirstPage.new
|
||||
fp1.web_title = ""
|
||||
fp1.title = "Trustie在线竞赛实战平台"
|
||||
fp1.description = "面向中国大学生与编程爱好者,提供社交化的竞赛管理、应用管理、代码托管、合作交流。"
|
||||
fp1.page_type = "contest"
|
||||
fp1.save
|
||||
end
|
||||
end
|
27
db/schema.rb
27
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20140708023356) do
|
||||
ActiveRecord::Schema.define(:version => 20140711012924) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -51,6 +51,7 @@ ActiveRecord::Schema.define(:version => 20140708023356) do
|
|||
t.string "description"
|
||||
t.string "disk_directory"
|
||||
t.integer "attachtype", :default => 1
|
||||
t.integer "is_public", :default => 1
|
||||
end
|
||||
|
||||
add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
|
||||
|
@ -406,6 +407,15 @@ ActiveRecord::Schema.define(:version => 20140708023356) do
|
|||
add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type"
|
||||
add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id"
|
||||
|
||||
create_table "first_pages", :force => true do |t|
|
||||
t.string "web_title"
|
||||
t.string "title"
|
||||
t.string "description"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "page_type"
|
||||
end
|
||||
|
||||
create_table "forums", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.string "description", :default => ""
|
||||
|
@ -794,7 +804,7 @@ ActiveRecord::Schema.define(:version => 20140708023356) do
|
|||
end
|
||||
|
||||
create_table "relative_memos", :force => true do |t|
|
||||
t.integer "osp_id", :null => false
|
||||
t.integer "osp_id"
|
||||
t.integer "parent_id"
|
||||
t.string "subject", :null => false
|
||||
t.text "content", :null => false
|
||||
|
@ -831,19 +841,6 @@ ActiveRecord::Schema.define(:version => 20140708023356) do
|
|||
|
||||
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
|
||||
|
||||
create_table "rich_rich_files", :force => true do |t|
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "rich_file_file_name"
|
||||
t.string "rich_file_content_type"
|
||||
t.integer "rich_file_file_size"
|
||||
t.datetime "rich_file_updated_at"
|
||||
t.string "owner_type"
|
||||
t.integer "owner_id"
|
||||
t.text "uri_cache"
|
||||
t.string "simplified_type", :default => "file"
|
||||
end
|
||||
|
||||
create_table "roles", :force => true do |t|
|
||||
t.string "name", :limit => 30, :default => "", :null => false
|
||||
t.integer "position", :default => 1
|
||||
|
|
|
@ -60,11 +60,28 @@ module Redmine
|
|||
@unsaved_attachments ||= []
|
||||
end
|
||||
|
||||
# 设置资源文件的公开属性
|
||||
# add by nwb
|
||||
def set_attachment_public(res)
|
||||
# 公开的资源判断他的父级的公开属性
|
||||
if res.is_public
|
||||
if( (self.class.to_s=="Project" && self.is_public == false) ||
|
||||
(self.has_attribute?(:project) && self.project && self.project.is_public == false) ||
|
||||
(self.class.to_s=="HomeworkAttach" && self.bid.reward_type == 3) ||
|
||||
(self.class.to_s=="Course" && self.is_public == false) ||
|
||||
(self.has_attribute?(:course) && self.course && self.course.is_public == false)
|
||||
)
|
||||
res.is_public = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def save_attachmentsex(attachments, author=User.current,attachment_type)
|
||||
@curattachment_type = attachment_type
|
||||
result = save_attachments(attachments,author)
|
||||
result
|
||||
end
|
||||
|
||||
def save_attachments(attachments, author=User.current)
|
||||
if attachments.is_a?(Hash)
|
||||
attachments = attachments.stringify_keys
|
||||
|
@ -94,6 +111,10 @@ module Redmine
|
|||
a.filename = attachment['filename'] unless attachment['filename'].blank?
|
||||
a.content_type = attachment['content_type']
|
||||
end
|
||||
if !attachment[:is_public]
|
||||
a.is_public = false
|
||||
end
|
||||
set_attachment_public(a)
|
||||
next unless a
|
||||
a.description = attachment['description'].to_s.strip
|
||||
a.attachtype = @curattachment_type;
|
||||
|
|
|
@ -351,6 +351,7 @@ end
|
|||
Redmine::MenuManager.map :admin_menu do |menu|
|
||||
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
|
||||
menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural
|
||||
menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made
|
||||
menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural
|
||||
menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions
|
||||
menu.push :trackers, {:controller => 'trackers'}, :caption => :label_tracker_plural
|
||||
|
|
|
@ -21,7 +21,8 @@ module Redmine
|
|||
# Configuration default values
|
||||
@defaults = {
|
||||
'email_delivery' => nil,
|
||||
'max_concurrent_ajax_uploads' => 2
|
||||
'max_concurrent_ajax_uploads' => 2,
|
||||
'pic_types' => "bmp,jpeg,jpg,png,gif"
|
||||
}
|
||||
|
||||
@config = nil
|
||||
|
|
|
@ -23,7 +23,9 @@ function addFile(inputEl, file, eagerUpload) {
|
|||
fileSpan.append(
|
||||
$('<input>', { 'type': 'text', 'class': 'filename readonly', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly'} ).val(file.name),
|
||||
$('<input>', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 255, 'placeholder': $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload),
|
||||
$('<a> </a>').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload),
|
||||
$('<span >公开:</span>').attr({ 'class': 'ispublic-label' }) ,
|
||||
$('<input>', { 'type': 'checkbox', 'class': 'is_public_checkbox','value':1, 'name': 'attachments[' + attachmentId + '][is_public]', checked:'checked' } ).toggle(!eagerUpload),
|
||||
$('<a> </a>').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload),
|
||||
$('<div>', { 'class': 'div_attachments', 'name': 'div_'+'attachments_' + attachmentId} )
|
||||
).appendTo('#attachments_fields');
|
||||
|
||||
|
@ -63,6 +65,7 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
|
|||
.done(function(result) {
|
||||
progressSpan.progressbar( 'value', 100 ).remove();
|
||||
fileSpan.find('input.description, a').css('display', 'inline-block');
|
||||
fileSpan.find('input.is_public_checkbox, a').css('display', 'inline-block');
|
||||
})
|
||||
.fail(function(result) {
|
||||
progressSpan.text(result.statusText);
|
||||
|
|
|
@ -140,10 +140,34 @@ function uploadAndAttachFiles(files, inputEl) {
|
|||
if (sizeExceeded) {
|
||||
window.alert(maxFileSizeExceeded);
|
||||
} else {
|
||||
$.each(files, function() {addFile(inputEl, this, true);});
|
||||
uploadAndTypeFiles(files,inputEl);
|
||||
//$.each(files, function() {addFile(inputEl, this, true);});
|
||||
}
|
||||
}
|
||||
|
||||
function uploadAndTypeFiles(files, inputEl) {
|
||||
|
||||
var enableType = $(inputEl).data('file-type');
|
||||
var typeSupportrdMessage = $(inputEl).data('type-support-message');
|
||||
if (enableType == null || enableType.trim() == "")
|
||||
{
|
||||
$.each(files, function() {addFile(inputEl, this, true);});
|
||||
return;
|
||||
}
|
||||
var typeSupported = false;
|
||||
$.each(files, function() {
|
||||
var a = this.name.split('.');
|
||||
var type = a[a.length-1];
|
||||
var rs = enableType.indexOf(type);
|
||||
if(rs >= 0) {typeSupported = true }
|
||||
});
|
||||
if (typeSupported) {
|
||||
$.each(files, function() {addFile(inputEl, this, true);});
|
||||
} else {
|
||||
window.alert(typeSupportrdMessage + enableType);
|
||||
}
|
||||
}
|
||||
|
||||
function handleFileDropEvent(e) {
|
||||
|
||||
$(this).removeClass('fileover');
|
||||
|
|
|
@ -1843,6 +1843,7 @@ span.required {color: #bb0000;}
|
|||
.summary {font-style: italic;}
|
||||
|
||||
#attachments_fields input.description {margin-left:4px; width:100px; }
|
||||
#attachments_fields span {display:block; white-space:nowrap;}
|
||||
#attachments_fields span .boldSpan{display:block; white-space:nowrap; font-family:'微软雅黑';}
|
||||
#attachments_fields input.filename {border:0; height:1.8em; width:150px; color:#555; background-color:inherit; background:url(../images/attachment.png) no-repeat 1px 50%; padding-left:18px;}/*Modified by young*/
|
||||
#attachments_fields .ajax-waiting input.filename {background:url(../images/hourglass.png) no-repeat 0px 50%;}
|
||||
|
@ -1850,6 +1851,8 @@ span.required {color: #bb0000;}
|
|||
#attachments_fields div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; }
|
||||
a.remove-upload {background: url(../images/delete.png) no-repeat 1px 50%; width:1px; display:inline-block; padding-left:16px;}
|
||||
a.remove-upload:hover {text-decoration:none !important;}
|
||||
#attachments_fields input.is_public_checkbox {width:20px;}
|
||||
#attachments_fields span.ispublic-label {display:inline-block;width:50px;margin-left:10px; }
|
||||
|
||||
/*gcm upload file count and deleteall*/
|
||||
#upload_file_count #count {color:red; font-size:1.5em;}
|
||||
|
|
|
@ -1151,6 +1151,11 @@ div.tags_area {
|
|||
border-bottom: 1px solid #c8d4fd;
|
||||
}
|
||||
|
||||
#ver-zebra #vzebra-field_file_dense, #ver-zebra #vzebra-children {
|
||||
background: #ffffff;
|
||||
border-bottom: 1px solid #c8d4fd;
|
||||
}
|
||||
|
||||
#ver-zebra #vzebra-comedy, #ver-zebra #vzebra-action {
|
||||
background: #ffffff;
|
||||
border-bottom: 1px solid #d6dfff;
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
web_title: MyString
|
||||
title: MyString
|
||||
description: MyString
|
||||
|
||||
two:
|
||||
web_title: MyString
|
||||
title: MyString
|
||||
description: MyString
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class FirstPageTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Loading…
Reference in New Issue