Merge branch 'szzh' into develop

Conflicts:
	config/routes.rb
	db/schema.rb
This commit is contained in:
xianbo 2014-05-15 09:46:38 +08:00
commit 66a5db5ad3
52 changed files with 1806 additions and 1031 deletions

View File

@ -62,6 +62,18 @@ class AttachmentsController < ApplicationController
end end
end end
#更新资源文件类型
def updateType
@attachment = Attachment.find(params[:attachmentid])
if @attachment != nil
@attachment.attachtype = params[:newtype]
@attachment.save
render :text =>'success'
else
render :text=>'error'
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)

View File

@ -718,13 +718,14 @@ class BidsController < ApplicationController
def update def update
@bid = Bid.find(params[:id]) @bid = Bid.find(params[:id])
@project = @bid.courses.first#Project.find(params[:course_id])
if @bid.update_attributes(params[:bid]) if @bid.update_attributes(params[:bid])
flash[:notice] = l(:label_update_homework_succeed) flash[:notice] = l(:label_update_homework_succeed)
@project = Project.find(params[:course_id]) #@project = Project.find(params[:course_id])
redirect_to project_homework_path(@project) redirect_to project_homework_path(@project)
else else
@bid.safe_attributes = params[:bid] @bid.safe_attributes = params[:bid]
render :action => 'edit' render :action => 'edit', :layout =>'base_courses'
end end
end end

View File

@ -19,8 +19,8 @@ class FilesController < ApplicationController
layout 'base_projects'#by young layout 'base_projects'#by young
menu_item :files menu_item :files
before_filter :find_project_by_project_id before_filter :find_project_by_project_id#, :except => [:getattachtype]
before_filter :authorize before_filter :authorize, :except => [:getattachtype]
helper :sort helper :sort
include SortHelper include SortHelper
@ -53,7 +53,7 @@ class FilesController < ApplicationController
def create def create
container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id])) container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id]))
attachments = Attachment.attach_files(container, params[:attachments]) attachments = Attachment.attach_filesex(container, params[:attachments],params[:attachment_type])
render_attachment_warning_if_needed(container) render_attachment_warning_if_needed(container)
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
@ -61,4 +61,23 @@ class FilesController < ApplicationController
end end
redirect_to project_files_path(@project) redirect_to project_files_path(@project)
end end
# 返回制定资源类型的资源列表
def getattachtype
sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
'filename' => "#{Attachment.table_name}.filename",
'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads"
@containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] #modify by Long Jun
@containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
@attachtype = params[:type].to_i
@contenttype = params[:contentType].to_s
respond_to do |format|
format.js
end
end
end end

View File

@ -43,7 +43,7 @@ class MessagesController < ApplicationController
@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page @reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
@replies = @topic.children. @replies = @topic.children.
includes(:author, :attachments, {:board => :project}). includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on ASC"). reorder("#{Message.table_name}.created_on DESC").
limit(@reply_pages.per_page). limit(@reply_pages.per_page).
offset(@reply_pages.offset). offset(@reply_pages.offset).
all all

View File

@ -198,7 +198,7 @@ class ProjectsController < ApplicationController
@project_type = params[:project_type] @project_type = params[:project_type]
@school_id = params[:school_id] @school_id = params[:school_id]
per_page_option = 10 per_page_option = 10
if @school_id == "0" or @school.nil? if @school_id == "0" or @school_id.nil?
@projects_all = Project.active.visible. @projects_all = Project.active.visible.
joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id"). joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").
where("#{Project.table_name}.project_type = ? ", Project::ProjectType_course) where("#{Project.table_name}.project_type = ? ", Project::ProjectType_course)
@ -295,8 +295,12 @@ class ProjectsController < ApplicationController
project_type = params[:project_type].to_i project_type = params[:project_type].to_i
projects_all = (project_type.eql? Project::ProjectType_course) ? Project.course_entities : Project.project_entities projects_all = (project_type.eql? Project::ProjectType_course) ? Project.course_entities : Project.project_entities
@projects = projects_all.visible @projects = projects_all.visible
@projects_all = @projects.visible.like(params[:name]) if params[:name].present? #@projects_all = @projects.visible.like(params[:name]) if params[:name].present?
if params[:name].present?
@projects_all = @projects.visible.like(params[:name])
else
@projects_all = @projects;
end
@project_count = @projects_all.count @project_count = @projects_all.count
@project_pages = Paginator.new @project_count, per_page_option, params['page'] @project_pages = Paginator.new @project_count, per_page_option, params['page']

View File

@ -23,10 +23,15 @@ class SchoolController < ApplicationController
end end
end end
def upload_logo def upload_logo
end end
#获取制定学校开设的课程数
def course_count school_id
School.find(school_id).courses.count
end
def index def index
@ -74,7 +79,7 @@ class SchoolController < ApplicationController
render :text => options render :text => options
end end
def get_schoollist def get_schoollist
@school = School.where("province = ?", params[:province]) @school = School.where("province = ?", params[:province])

View File

@ -549,6 +549,14 @@ class UsersController < ApplicationController
format.api { render_validation_errors(@user) } format.api { render_validation_errors(@user) }
end end
end end
unless @user.id.nil?
#后台注册的用户默认权限为男性开发员
ue = UserExtensions.create(:identity => 3,
:gender => 0,
:user_id => @user.id)
ue.save
end
end end
def edit def edit

View File

@ -390,6 +390,16 @@ module ApplicationHelper
s.html_safe s.html_safe
end end
#扩展的checkbox生成
def principals_check_box_tags_ex(name, principals)
s = ''
principals.each do |principal|
s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal.userInfo }</label>\n"
end
s.html_safe
end
# Returns a string for users/groups option tags # Returns a string for users/groups option tags
def principals_options_for_select(collection, selected=nil) def principals_options_for_select(collection, selected=nil)
s = '' s = ''

View File

@ -38,7 +38,7 @@ module AttachmentsHelper
else else
false false
end end
end end
def render_api_attachment(attachment, api) def render_api_attachment(attachment, api)

View File

@ -108,5 +108,7 @@ module CoursesHelper
now > cTime now > cTime
end end
def find_by_extra_from_project extra
Course.find_by_extra(try(extra))
end
end end

View File

@ -44,4 +44,23 @@ module FilesHelper
File.new(zipfile_name,'w+') File.new(zipfile_name,'w+')
end end
# 判断指定的资源时候符合类型
def isTypeOk(attachment, type, contentType)
result = false
if type != 0
if attachment.attachtype == type
result = true
end
else
result = true
end
if result
if contentType != '0' && contentType != attachment.suffix_type
result = false
end
end
result
end
end end

View File

@ -24,7 +24,7 @@ module MembersHelper
principal_pages = Redmine::Pagination::Paginator.new principal_count, 10, params['page'] #by young principal_pages = Redmine::Pagination::Paginator.new principal_count, 10, params['page'] #by young
principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all
s = content_tag('div', principals_check_box_tags('membership[user_ids][]', principals), :id => 'principals') s = content_tag('div', principals_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals')
links = pagination_links_full(principal_pages, principal_count, :per_page_links => false) {|text, parameters, options| links = pagination_links_full(principal_pages, principal_count, :per_page_links => false) {|text, parameters, options|
link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true

View File

@ -32,7 +32,7 @@ module ProjectsHelper
{:name => 'categories', :action => :manage_categories, :partial => 'projects/settings/issue_categories', :label => :label_issue_category_plural}, {:name => 'categories', :action => :manage_categories, :partial => 'projects/settings/issue_categories', :label => :label_issue_category_plural},
# {:name => 'wiki', :action => :manage_wiki, :partial => 'projects/settings/wiki', :label => :label_wiki}, # {:name => 'wiki', :action => :manage_wiki, :partial => 'projects/settings/wiki', :label => :label_wiki},
{:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural}, {:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural},
{:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural}, #{:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural},
{:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities} {:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities}
] ]
tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)} tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
@ -62,33 +62,33 @@ module ProjectsHelper
content_tag('div', content, :class => "tabs_enterprise") content_tag('div', content, :class => "tabs_enterprise")
end end
def sort_course(state, project_type) def sort_course(state, project_type, school_id)
content = ''.html_safe content = ''.html_safe
case state case state
when 0 when 0
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected") content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type), :school_id => school_id, :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type))) # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id)))
when 1 when 1
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id)))
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected") content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id), :class=>"selected"), :class=>"selected")
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type))) # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id)))
when 2 when 2
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id)))
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected") # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id)))
#gcm #gcm
when 3 when 3
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id)))
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type))) # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type), :class=>"selected"), :class=>"selected") content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id), :class=>"selected"), :class=>"selected")
end end
#gcmend #gcmend
@ -145,7 +145,7 @@ module ProjectsHelper
#Added by young #Added by young
def course_settings_tabs def course_settings_tabs
tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'}, tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'},
{:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural, :project_type => 1}, #{:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural, :project_type => 1},
# {:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural}, # {:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural},
{:name => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural} {:name => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural}
] ]

View File

@ -105,7 +105,31 @@ module WelcomeHelper
# c2 = c2 - c1 # c2 = c2 - c1
# (c1.take(max)+c2).take(sum) # (c1.take(max)+c2).take(sum)
end end
#查找所有学校按每个学校开设课程数量降序排序
#page 分页查询开始条数的编号,从0开始
#limit 分页查询的数量
def find_maxmin_course_school page,limit
School.find_by_sql("SELECT *,(SELECT COUNT(*) FROM courses WHERE school_id = schools.id) AS a
FROM schools
ORDER BY a DESC LIMIT #{page},#{limit}")
#School.where(" id IN (SELECT school_id FROM courses GROUP BY school_id)").limit limit;
#School.order("#{School.course_count}").limit(limit).all
#@school = School.all.sort
#@school.each do |s|
# s.courses.count
#end
#result = []
#@school = School.all.to_ary
#i = 1
#for i in i < School.count
# j = i - 1
# for j in j > 0
# if @school[j].courses.count >
# end
#end
end
def find_miracle_project(sum, max_rate) def find_miracle_project(sum, max_rate)
max = sum*(max_rate.to_f/10) max = sum*(max_rate.to_f/10)
c1 = find_new_project(sum).to_a.dup c1 = find_new_project(sum).to_a.dup
@ -130,6 +154,12 @@ module WelcomeHelper
sort_course_by_hot limit sort_course_by_hot limit
end end
def find_all_new_hot_course limit = 9
#sort_project_by_hot_rails 1, 'course_ac_para DESC', limit
time_now = Time.new.strftime("%Y");
Project.visible.joins(:project_status).where("#{Project.table_name}.project_type = ? and #{Project.table_name}.created_on like '%#{time_now}%'", 1).order("course_ac_para DESC").limit(limit).all
end
def find_all_hot_bid def find_all_hot_bid
sort_bid_by_hot sort_bid_by_hot
end end

View File

@ -23,6 +23,7 @@ class Attachment < ActiveRecord::Base
belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'" belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'"
belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'" belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'"
belongs_to :author, :class_name => "User", :foreign_key => "author_id" belongs_to :author, :class_name => "User", :foreign_key => "author_id"
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
validates_presence_of :filename, :author validates_presence_of :filename, :author
validates_length_of :filename, :maximum => 255 validates_length_of :filename, :maximum => 255
@ -65,6 +66,30 @@ class Attachment < ActiveRecord::Base
copy copy
end end
#获取资源的后缀类型
def suffix_type
childArr = self.filename.split('.')
suffix = '*'
if childArr.length > 1
suffix = childArr[childArr.length-1]
end
suffix
end
#获取用来显示的后缀名称
def show_suffix_type
suffix = 'other'
temp = self.suffix_type.downcase
if self.attachmentstype.suffixArr.include?(temp)
suffix = temp
end
suffix
end
def suffixArr
@@SuffixArr
end
def validate_max_file_size def validate_max_file_size
if @temp_file && self.filesize > Setting.attachment_max_size.to_i.kilobytes if @temp_file && self.filesize > Setting.attachment_max_size.to_i.kilobytes
errors.add(:base, l(:error_attachment_too_big, :max_size => Setting.attachment_max_size.to_i.kilobytes)) errors.add(:base, l(:error_attachment_too_big, :max_size => Setting.attachment_max_size.to_i.kilobytes))
@ -260,6 +285,13 @@ class Attachment < ActiveRecord::Base
result result
end end
def self.attach_filesex(obj, attachments,attachment_type)
result = obj.save_attachmentsex(attachments, User.current,attachment_type)
obj.attach_saved_attachments
result
end
def self.latest_attach(attachments, filename) def self.latest_attach(attachments, filename)
attachments.sort_by(&:created_on).reverse.detect { attachments.sort_by(&:created_on).reverse.detect {
|att| att.filename.downcase == filename.downcase |att| att.filename.downcase == filename.downcase

View File

@ -0,0 +1,11 @@
class Attachmentstype < ActiveRecord::Base
attr_accessible :typeId, :typeName
has_many :attachments, :foreign_key => "attachtype",:primary_key => "id"
# 当前使用的文件内容分类列表
@@SuffixArr = ['pdf','zip','doc','docx','rar','txt','jpg','bmp','xls','xlsx']
def suffixArr
@@SuffixArr
end
end

View File

@ -7,6 +7,7 @@ class Course < ActiveRecord::Base
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school该方法通过school_id来调用School表 belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school该方法通过school_id来调用School表
has_many :bid has_many :bid
validates_presence_of :password, :term validates_presence_of :password, :term
validates_format_of :class_period, :message => "class period can only digital!", :with =>/^[1-9]\d*$/
safe_attributes 'extra', safe_attributes 'extra',
'time', 'time',
'name', 'name',
@ -17,7 +18,14 @@ class Course < ActiveRecord::Base
'password', 'password',
'term', 'term',
'password' 'password'
#自定义验证
def validate
if !class_period.match([0-9])
errors.add_to_base("class period can only digital")
end
end
def get_endup_time def get_endup_time
begin begin
end_time = Time.parse(self.endup_time) end_time = Time.parse(self.endup_time)
@ -39,5 +47,4 @@ class Course < ActiveRecord::Base
return time return time
end end
end end
end end

View File

@ -63,7 +63,7 @@ class Mailer < ActionMailer::Base
# Mailer.issue_add(issue).deliver => sends an email to issue recipients # Mailer.issue_add(issue).deliver => sends an email to issue recipients
def issue_add(issue) def issue_add(issue)
redmine_headers 'Project' => issue.project.identifier, redmine_headers 'Project' => issue.project.identifier,
'Issue-Id' => issue.id, 'Issue-Id' => (issue.project.issues.index(issue).to_i + 1).to_s,
'Issue-Author' => issue.author.login 'Issue-Author' => issue.author.login
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
message_id issue message_id issue
@ -85,7 +85,7 @@ class Mailer < ActionMailer::Base
def issue_edit(journal) def issue_edit(journal)
issue = journal.journalized.reload issue = journal.journalized.reload
redmine_headers 'Project' => issue.project.identifier, redmine_headers 'Project' => issue.project.identifier,
'Issue-Id' => issue.id, 'Issue-Id' => (issue.project.issues.index(issue).to_i + 1).to_s,
'Issue-Author' => issue.author.login 'Issue-Author' => issue.author.login
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
message_id journal message_id journal

View File

@ -38,8 +38,7 @@ class Project < ActiveRecord::Base
:conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE})" :conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE})"
has_many :users, :through => :members has_many :users, :through => :members
has_many :principals, :through => :member_principals, :source => :principal has_many :principals, :through => :member_principals, :source => :principal
has_many :enabled_modules, :dependent => :delete_all
has_many :enabled_modules, :dependent => :delete_all
has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position" has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position"
has_many :issues, :dependent => :destroy, :include => [:status, :tracker] has_many :issues, :dependent => :destroy, :include => [:status, :tracker]
has_many :issue_changes, :through => :issues, :source => :journals has_many :issue_changes, :through => :issues, :source => :journals
@ -159,8 +158,27 @@ class Project < ActiveRecord::Base
def new_course def new_course
self.where('project_type = ?', 1) self.where('project_type = ?', 1)
end end
# 获取项目的资源类型列表
def attachmenttypes
@attachmenttypes = Attachmentstype.find(:all, :conditions => ["#{Attachmentstype.table_name}.typeId= ?",self.attachmenttype ])
end
# 获取资源后缀名列表
def contenttypes
attachmenttypes
if @attachmenttypes.length >0
@attachmenttypes.last().suffixArr
end
end
#自定义验证
def validation
if !class_period.match([0-9])
errors.add_to_base("class period can only digital")
end
end
# 项目留言 added by fq # 项目留言 added by fq
def self.add_jour(user, notes) def self.add_jour(user, notes)
project = Project.find('trustie') project = Project.find('trustie')
@ -726,7 +744,8 @@ class Project < ActiveRecord::Base
'custom_fields', 'custom_fields',
'tracker_ids', 'tracker_ids',
'issue_custom_field_ids', 'issue_custom_field_ids',
'project_type' 'project_type',
'attachmenttype'

View File

@ -190,7 +190,11 @@ class User < Principal
where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern) where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern)
end end
} }
#选择项目成员时显示的用户信息文字
def userInfo
info=self.name + ' (' + self.login + ')';
end
###添加留言 fq ###添加留言 fq
def add_jour(user, notes, reference_user_id = 0, options = {}) def add_jour(user, notes, reference_user_id = 0, options = {})

View File

@ -0,0 +1,14 @@
<% edit_allowed = User.current.allowed_to?(:manage_files, @project) %>
<% if attachmenttypes.any? %>
<div id="put-tag-form-<%=attachment.id%>" class="hidden">
<%= select_tag "attachment_type",
options_from_collection_for_select(attachmenttypes, "id",
"typeName",attachment.attachtype), :onchange=>"attachmenttypes_change("+attachment.id.to_s + ",this.value)"%>
</div>
<%= link_to(image_tag('edit/edit.png'), 'javascript:void(0);',:style=>"white-space:nowrap;", :id=>"edit_box"+attachment.id.to_s ,
:onclick =>"$('#put-tag-form-" +attachment.id.to_s+ "').show();
$('#attach_type_id_label" +attachment.id.to_s+ "').hide();
$('#edit_box" +attachment.id.to_s+ "').hide();") if edit_allowed %>
<% end %>

View File

@ -13,9 +13,11 @@
<span class="font_lighter"><%= l(:label_user_create_project_homework) %></span> <span class="font_lighter"><%= l(:label_user_create_project_homework) %></span>
<span><%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %></span> <span><%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %></span>
<span style="float: right"> <span style="float: right">
<% if(User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0)) %>
<%# 提交作业按钮 %> <%# 提交作业按钮 %>
<%= link_to l(:label_commit_homework), '#OpenWindow', rel: 'leanModal', onclick: "showSubH(#{bid.id}, '#{bid.name}');" if User.current.member_of?(@project) %> <%= link_to l(:label_commit_homework), '#OpenWindow', rel: 'leanModal', onclick: "showSubH(#{bid.id}, '#{bid.name}');" if User.current.member_of?(@project) %>
<% if (User.current.admin?||User.current.id==bid.author_id) %> <% end %>
<% if (User.current.admin?||User.current.id==bid.author_id) %>
<%= link_to( <%= link_to(
l(:button_edit), l(:button_edit),
{:action => 'edit', :controller=>'bids', :project_id =>@project.id, :bid_id => bid.id}, {:action => 'edit', :controller=>'bids', :project_id =>@project.id, :bid_id => bid.id},
@ -33,10 +35,19 @@
</tr> </tr>
<tr> <tr>
<td colspan="2"><span class="font_lighter"> <td colspan="2"><span class="font_lighter">
<% if bid.homework_type == 1%> <% @bidding_project = bid.biding_projects.all
<%= l(:label_x_homework_project, :count => bid.homeworks.count) %>(<strong><%= link_to bid.homeworks.count, project_for_bid_path(bid.id) %></strong>) @temp = []
@bidding_project.each do |pro|
if pro.project && pro.project.project_status
@temp << pro
end
@temp
end
%>
<% if bid.homework_type == 1%>
<%= l(:label_x_homework_project, :count => @temp.count) %>(<strong><%= link_to @temp.count, project_for_bid_path(bid.id) %></strong>)
<% else %> <% else %>
<%= l(:label_x_homework_project, :count => bid.biding_projects.count) %>(<strong><%= link_to bid.biding_projects.count, project_for_bid_path(bid.id) %></strong>) <%= l(:label_x_homework_project, :count => @temp.count) %>(<strong><%= link_to @temp.count, project_for_bid_path(bid.id) %></strong>)
<% end %></span> <% end %></span>
<span class="font_lighter"><%= l(:label_x_responses, :count => bid.commit) %>(<strong><%= link_to bid.commit, respond_path(bid) %></strong>)</span> <span class="font_lighter"><%= l(:label_x_responses, :count => bid.commit) %>(<strong><%= link_to bid.commit, respond_path(bid) %></strong>)</span>
<span style="float: right"> <span style="float: right">

View File

@ -148,11 +148,12 @@
</span></td> </span></td>
</tr> </tr>
<tr> <tr>
<td> <td colspan="2">
<% if Time.parse(@bid.deadline.to_s) < Time.parse(b_project.created_at.to_s) %> <% if Time.parse(@bid.deadline.to_s) < Time.parse(b_project.created_at.to_s) %>
<span class="required">迟交</span> <span class="required">迟交</span>
<% end %> <% end %>
</td> </td>
<td align="right"><%= link_to image_tag('delete.png') %></td>
</tr> </tr>
</table> </table>
</td> </td>

View File

@ -20,10 +20,6 @@
<%= render :partial => 'attachments/links', :locals => {:attachments => @bid.attachments, :options => options} %> <%= render :partial => 'attachments/links', :locals => {:attachments => @bid.attachments, :options => options} %>
<% end %> <% end %>
</div> </div>
<span id="praise_tread" style="float: right">
<%= render :partial => "/praise_tread/praise_tread",
:locals => {:obj => @bid,:show_flag => true,:user_id =>User.current.id}%>
</span>
</span> </span>
</div> </div>
<div style="clear: both;"></div> <div style="clear: both;"></div>
@ -35,6 +31,6 @@
<div class="pagination" style="float:left;"> <div class="pagination" style="float:left;">
<ul> <ul>
<%= pagination_links_full @feedback_pages %> <%= pagination_links_full @feedback_pages %>
<ul> </ul>
</div> </div>

View File

@ -12,7 +12,8 @@
<span style="float: right"><%= l(:label_homework) %> (<span class=""><%= link_to (course.homeworks.count), {:controller => 'projects', :action => 'homework', :id => course.identifier} %></span>) <span style="float: right"><%= l(:label_homework) %> (<span class=""><%= link_to (course.homeworks.count), {:controller => 'projects', :action => 'homework', :id => course.identifier} %></span>)
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<%= l(:label_course_news)%> (<span style="color: #ed8924"><%= link_to (course.news.count), {:controller => 'news', :action => 'index', :project_id => course.identifier} %></span>) <%= l(:label_course_news)%> (<span style="color: #ed8924"><%= link_to (course.news.count), {:controller => 'news', :action => 'index', :project_id => course.identifier} %></span>)
</td> </span>
</td>
</tr> </tr>
<tr> <tr>
<td colspan="2" width="580" > <td colspan="2" width="580" >

View File

@ -1,5 +1,6 @@
<h3><%=l(:label_attachment_new)%></h3> <h3><%=l(:label_attachment_new)%></h3>
<% versions = project.versions.sort %> <% versions = project.versions.sort %>
<% attachmenttypes = project.attachmenttypes %>
<%= error_messages_for 'attachment' %> <%= error_messages_for 'attachment' %>
<%= form_tag(project_files_path(project), :multipart => true, :class => "tabular") do %> <%= form_tag(project_files_path(project), :multipart => true, :class => "tabular") do %>
<div class="box"> <div class="box">
@ -10,6 +11,14 @@
options_from_collection_for_select(versions, "id", "name") %></p> options_from_collection_for_select(versions, "id", "name") %></p>
<% end %> <% end %>
<% if attachmenttypes.any? %>
<p> <label for="attachment_type"><%=l(:attachment_type)%></label>
<%= select_tag "attachment_type",
options_from_collection_for_select(attachmenttypes, "id",
"typeName") %>
</p>
<% end %>
<p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p> <p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
</div> </div>
<%= submit_tag l(:button_add) %> <%= submit_tag l(:button_add) %>

View File

@ -0,0 +1,72 @@
<% selAttachType =@attachtype %>
<% selContentType =@contenttype %>
<% attachmenttypes = @project.attachmenttypes %>
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
<% 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>
<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('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>
<% @containers.each do |container| %>
<% next if container.attachments.empty? -%>
<% if container.is_a?(Version) -%>
<tr>
<th colspan="5" align="left" style="line-height: 30px; font-size: 14px; ">
<%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %>
</th>
</tr>
<% end -%>
<% container.attachments.each do |file| %>
<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} %>
</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 -%>
<% reset_cycle %>
<% end -%>
<!-- %= h downloadAll(@containers) % -->
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
</tbody>
</table>

View File

@ -0,0 +1,71 @@
<% selAttachType =@attachtype %>
<% selContentType =@contenttype %>
<% attachmenttypes = @project.attachmenttypes %>
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
<% 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>
<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('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>
<% @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>
&nbsp;
<span id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;">
<%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes,
: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)) % -->
</tbody>
</table>

View File

@ -0,0 +1,5 @@
<% if @attachtype==0 && @contenttype=='0' %>
$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>');
<%else%>
$("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>');
<%end%>

View File

@ -1,278 +1,188 @@
<!-- <h3> --><!-- %=l(:label_attachment_plural)%></h3 --> <!-- <h3> --><!-- %=l(:label_attachment_plural)%></h3 -->
<style> <% attachmenttypes = @project.attachmenttypes %>
#ver-zebra, .file_table_des <% sufixtypes = @project.contenttypes %>
{
font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
font-size: 12px;
margin: 5px 10px;
width: 98%;
text-align: left;
border-collapse: collapse;
line-height: 20px;
font-size: 14px;
}
#ver-zebra th
{
font-size: 14px;
font-weight: normal;
padding: 12px 15px;
border-right: 1px solid #fff;
border-left: 1px solid #fff;
color: #039;
text-align: left;
}
#ver-zebra td
{
padding: 8px 15px;
border-right: 1px solid #fff;
border-left: 1px solid #fff;
color: #669;
}
#ver-zebra td.description {
background-color: white;
padding: 0px;
margin: 0px auto;
}
div.tags_area {
padding: 2px 10px 10px 10px;
margin: 0px;
margin-bottom: 10px;
/*border-bottom: 1px dashed #CCCCCC;*/
overflow: hidden;
position: relative;
}
.tags_gradint {
}
.read-more{
padding: 5px;
border-top: 4px double #ddd;
background: #fff;
color: #333;
}
.read-more a{
padding-right: 22px;
background: url() no-repeat 100% 50%;
font-weight: bold;
text-decoration: none;
}
.read-more a:hover{
color: #000;
}
.vzebra-odd
{
background: #eff2ff;
}
.vzebra-even
{
background: #e8edff;
}
#ver-zebra #vzebra-adventure, #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;
}
.filename{
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
div.pagination{
margin: 10px 0px;
height: 1.5em;
text-align: left;
font-size: 13px;
}
.m5p5{
display: inline-block;
height: auto;
color: white !important;
margin: 8px;
padding: 3px 7px;
}
.m5p5:hover {
text-decoration: none;
/*padding-bottom: 3px;*/
/*border-bottom: 1px solid #666666;*/
border-radius: 4px;
border: 1px solid #15bccf;
box-shadow: 3px 3px 3px #666666;
}
.relation_file_div{
margin: 0px 25px;
}
.relation_file_div fieldset{
margin: 0px 0px;
padding: 10px;
border-radius: 5px;
transition: all 2s linear 1s;
}
.relation_file_div input#attach_search:focus{
border: 1px solid #1B95C6;
box-shadow: 0px 0px 4px #1B95C6;
width: 200px;
}
.relation_file_div input#attach_search{
width: 150px;
outline: none;
border-radius: 5px;
-webkit-transition: 1s width;
-moz-transition : 1s width;
-o-transition : 1s width;
transition : 1s width;
}
</style>
<span class="borad-title"><%= (@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>资源共享区</span>
<span class="borad-title"><%=(@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>资源共享区</span>
<div class="content-title-top"> <div class="content-title-top">
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %> <%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
<div class="clearfix"></div> <div class="clearfix"></div>
<div id="file_buttons" class="nhidden"> <div id="file_buttons" class="nhidden">
<%#= link_to('上传文件', new_project_file_path(@project), :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %> <%#= link_to('上传文件', new_project_file_path(@project), :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %>
<%= 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, @project) %> <%= 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, @project) %>
<%= 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, @project) %> <%= 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, @project) %>
<div id="upload_file_div" class="relation_file_div hidden" >
<%= render :partial => 'new', locals: {project: @project}%> <% if attachmenttypes.any? %>
</div> &nbsp; &nbsp; &nbsp;
<div id="relation_file_div" class="relation_file_div hidden" > <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"),
:onchange => "attachmenttypes_searchex(this.value)" %>
<% end %>
<% if sufixtypes.any? %>
&nbsp;
<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 => "attachment_contenttypes_searchex(this.value)" %>
<% end %>
<div id="upload_file_div" class="relation_file_div hidden">
<%= render :partial => 'new', locals: {project: @project} %>
</div>
<div id="relation_file_div" class="relation_file_div hidden">
<fieldset> <fieldset>
<legend>搜索</legend> <legend>搜索</legend>
<%= form_tag( <%= form_tag(
attachments_autocomplete_path(:format => 'js'), attachments_autocomplete_path(:format => 'js'),
:remote => true, :remote => true,
:method => :post) do %> :method => :post) do %>
<%= label_tag(:attach_search, "按关键字搜索:") %> <%= label_tag(:attach_search, "按关键字搜索:") %>
<%= text_field_tag(:attach_search) %> <%= text_field_tag(:attach_search) %>
<%#= submit_tag("Search") %> <%#= submit_tag("Search") %>
<% end -%> <% end -%>
<%= form_tag attach_relation_path(:format => 'js'), <%= form_tag attach_relation_path(:format => 'js'),
method: :post, method: :post,
remote: true, remote: true,
id:"relation_file_form", id: "relation_file_form",
:class => 'hidden' do %> :class => 'hidden' do %>
<%= hidden_field_tag(:class_name, 'Project') %> <%= hidden_field_tag(:class_name, 'Project') %>
<%= hidden_field_tag(:class_id, params[:project_id]) %> <%= hidden_field_tag(:class_id, params[:project_id]) %>
<div id="relation_file" > <div id="relation_file">
</div> </div>
<div class="kclearfix" style='margin-top: 10px;' > <div class="kclearfix" style='margin-top: 10px;'>
<%= submit_tag(l(:button_add)) -%> <%= submit_tag(l(:button_add)) -%>
</div> </div>
<% end -%> <% end -%>
</fieldset> </fieldset>
<div class="line_under" style="margin:20px 0px;"></div> <div class="line_under" style="margin:20px 0px;"></div>
</div> </div>
</div> </div>
</div> </div>
<%= javascript_tag "observeSearchfield('attach_search', null, '#{ escape_javascript attachments_autocomplete_path(:project_id => @project.id, :format => 'js') }')" %> <%= javascript_tag "observeSearchfield('attach_search', null, '#{ escape_javascript attachments_autocomplete_path(:project_id => @project.id, :format => 'js') }')" %>
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> <% delete_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><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('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>
<% @containers.each do |container| %>
<% next if container.attachments.empty? -%>
<% if container.is_a?(Version) -%>
<tr>
<th colspan="5" align="left" style="line-height: 30px; font-size: 14px; ">
<%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %>
</th>
</tr>
<% end -%>
<% container.attachments.each do |file| %>
<tr class="file <%= cycle("odd", "odd") %>">
<td class="filename" style="font-size: 13px; width: 240px; "><%= 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="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="5">
<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 -%>
<% reset_cycle %>
<% end -%>
<!-- %= h downloadAll(@containers) % -->
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
</tbody> <div id="all_browse_div" class="all_browse_div">
</table> <%= render :partial => 'show_all_attachment' %>
</div>
<% html_title(l(:label_attachment_plural)) -%> <% html_title(l(:label_attachment_plural)) -%>
<script type='text/javascript';> <script type='text/javascript'>
var slideHeight = 29; var slideHeight = 29;
function readmore (aNode) { function readmore(aNode) {
// console.log(aNode) // console.log(aNode)
// var $td_tags_area = $(aNode).parent().parent(); // var $td_tags_area = $(aNode).parent().parent();
var $td_tags_area = $(aNode).parent().parent().parent().parent(); var $td_tags_area = $(aNode).parent().parent().parent().parent();
var $tags_area = $td_tags_area.find('.tags_area') var $tags_area = $td_tags_area.find('.tags_area')
var $tags_gradint = $td_tags_area.find('.tags_gradint') var $tags_gradint = $td_tags_area.find('.tags_gradint')
var $read_more = $td_tags_area.find('.read-more') var $read_more = $td_tags_area.find('.read-more')
var $read_more_a = $td_tags_area.find('.read-more a') var $read_more_a = $td_tags_area.find('.read-more a')
var $tags = $td_tags_area.find('#tags') var $tags = $td_tags_area.find('#tags')
var $icona = $td_tags_area.find('.tags_icona') var $icona = $td_tags_area.find('.tags_icona')
var slideHeight = 20; //px var slideHeight = 5; //px
var defHeight = $tags.height(); var defHeight = $tags.height();
var curHeight = $tags_area.height(); var curHeight = $tags_area.height();
if (curHeight == slideHeight) { if (curHeight == slideHeight) {
$tags_area.animate({ $tags_area.animate({
height: defHeight height: defHeight
}, 'normal'); }, 'normal');
$read_more_a.html('隐藏'); $read_more_a.html('隐藏');
$icona.html('<%=image_tag "/images/sidebar/minus.png"%>') $icona.html('<%=image_tag "/images/sidebar/minus.png"%>')
$tags_gradint.fadeOut(); $tags_gradint.fadeOut();
}else{ } else {
$tags_area.animate({ $tags_area.animate({
height: slideHeight height: slideHeight
}, 'normal'); }, 'normal');
$read_more_a.html('更多'); $read_more_a.html('更多');
$icona.html('<%=image_tag "/images/sidebar/add.png"%>') $icona.html('<%=image_tag "/images/sidebar/add.png"%>')
$tags_gradint.fadeIn(); $tags_gradint.fadeIn();
}; }
;
} }
$(function () { $(function () {
var slideHeight = 20; //px var slideHeight = 20; //px
var defHeight = $('.tags_area').height(); var defHeight = $('.tags_area').height();
if (defHeight >= slideHeight) { if (defHeight >= slideHeight) {
$('.tags_area').css('height', slideHeight +'px'); $('.tags_area').css('height', slideHeight + 'px');
}; }
}); ;
});
function eval_ajax (xhr, textStatus) {
if (textStatus == 'success') {
eval(xhr.responseText);
} else if (textStatus == 'error') {
alert('error');
}
}
function attachmenttypes_searchex(value) {
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
type: "POST",
data: {
type: encodeURIComponent(value),
contentType:$('#attach_sufix_browse').val()
}
}).complete(eval_ajax);
}
function attachment_contenttypes_searchex(value) {
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: encodeURIComponent(value)
}
}).complete(eval_ajax);
}
function attachtype_edit(value) {
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: encodeURIComponent(value)
}
}).complete(eval_ajax);
}
function attachmenttypes_change(id, type) {
$.ajax({
url: '<%=updateType_attachments_path%>',
type: "POST",
data: {
attachmentid: encodeURIComponent(id),
newtype: encodeURIComponent(type)
}
}).complete(function (xhr, textStatus) {
if (textStatus == 'success') {
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: $('#attach_sufix_browse').val()
}
}).error(function () {
alert('error');
});
} else if (textStatus == 'error') {
alert('error');
}
});
}
</script> </script>

View File

@ -19,7 +19,7 @@
<p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor02' %></p> <p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor02' %></p>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor02');</script> <script type="text/javascript">var ckeditor=CKEDITOR.replace('editor02');</script>
<br/> <br/>
<p> <p>
<%= l(:label_attachment_plural) %><br /> <%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %> <%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
</p> </p>

View File

@ -0,0 +1,73 @@
<!--add by huang-->
<div class="clearfix"></div>
<<<<<<< HEAD
<div id="footer" style="margin-left:-5px;padding-top: 50px;clear: both;font-size: 12px;">
<div style="border-top:solid 1px #C6E9F1;width: auto;margin-top: 80px;"></div>
<div class="base_footer">
<div align="center">
<!--gcm-->
<p>
<span>主办单位:</span>
<span class="footer_text_link"><%= link_to "国防科学技术大学并行与分布处理国家重点实验室","http://www.nudt.edu.cn/ArticleShow.asp?ID=47",:target=>"_blank"%></span>
<span class="footer_text_link"><%= link_to "计算机科学与技术系", "http://www.nudt.edu.cn/ArticleShow.asp?ID=41", :target => "_blank" %></span>
<span id="copyright">版权@2007~2014</span>
<span id="contact_us" class="footer_text_link"><%= link_to "联系我们","http://forge.trustie.net/projects/2/member",:target=>"_blank"%></span>
<span id="record"class="footer_text_link"><%= link_to "湘ICP备09019772","http://www.miibeian.gov.cn/"%></span>
</p>
<div id="logo_link">
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/nudt.png',:size=>'100x30',:alt=>"国防科学技术大学计算机学院"),"http://www.nudt.edu.cn/special.asp?classid=12"%></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/peking_eecs.png',:size=>'100x30',:alt=>"北京大学信息科学技术学院软件研究所"), "http://eecs.pku.edu.cn"%></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/buaa_scse.png',:size=>'100x30',:alt=>"北京航空航天大学计算机学院"), "http://scse.buaa.edu.cn/"%></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/iscas.png',:size=>'100x30',:alt=>"中国科学院软件研究所"), "http://www.iscas.ac.cn"%></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/inforbus.png',:size=>'100x30',:alt=>"山东中创软件商用中间件股份有限公司"), "http://www.inforbus.com"%></span>
</div>
<!--gcm-->
</div>
</div>
=======
<div id="footer" style="margin-left:-5px;padding-top: 150px;clear: both;font-size: 12px;">
<div style="border-top:solid 1px #C6E9F1;"></div>
<div class="base_footer">
<div align="center">
<!--gcm-->
<p>
<span>主办单位:</span>
<span class="footer_text_link"><%= link_to "国防科学技术大学并行与分布处理国家重点实验室","http://www.nudt.edu.cn/ArticleShow.asp?ID=47",:target=>"_blank"%></span>
<span class="footer_text_link"><%= link_to "计算机科学与技术系", "http://www.nudt.edu.cn/ArticleShow.asp?ID=41", :target => "_blank" %></span>
<span id="copyright">版权@2007~2014</span>
<span id="contact_us" class="footer_text_link"><%= link_to "联系我们","http://forge.trustie.net/projects/2/member",:target=>"_blank"%></span>
<span id="record"class="footer_text_link"><%= link_to "湘ICP备09019772","http://www.miibeian.gov.cn/"%></span>
</p>
<div id="logo_link">
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/nudt.png',:size=>'100x30',:alt=>"国防科学技术大学计算机学院"),"http://www.nudt.edu.cn/special.asp?classid=12"%></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/peking_eecs.png',:size=>'100x30',:alt=>"北京大学信息科学技术学院软件研究所"), "http://eecs.pku.edu.cn"%></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/buaa_scse.png',:size=>'100x30',:alt=>"北京航空航天大学计算机学院"), "http://scse.buaa.edu.cn/"%></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/iscas.png',:size=>'100x30',:alt=>"中国科学院软件研究所"), "http://www.iscas.ac.cn"%></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/inforbus.png',:size=>'100x30',:alt=>"山东中创软件商用中间件股份有限公司"), "http://www.inforbus.com"%></span>
</div>
<!--gcm-->
</div>
</div>
>>>>>>> develop
</div>
</div>
<div class="debug">
<%= debug(params) if Rails.env.development? %>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-46523987-1', 'trustie.net');
ga('send', 'pageview');
</script>
</div>

View File

@ -124,7 +124,7 @@
<table class="borad-text-list"> <table class="borad-text-list">
<tr> <tr>
<td class="font_lighter"><%= reply_count += 1 %>楼 </td> <td class="font_lighter"><span style="display: none"><%= reply_count += 1 %>楼</span> </td>
<td> <td>
<div class="contextual-borad"> <div class="contextual-borad">
<%= link_to( <%= link_to(

View File

@ -30,7 +30,7 @@
</table> </table>
<% end %> <% end %>
</div> </div>
<%= sort_course(@s_type, @project_type)%> <%= sort_course(@s_type, @project_type, @school_id)%>
<div id="projects-index"> <div id="projects-index">
<%= render_project_hierarchy(@projects)%> <%= render_project_hierarchy(@projects)%>

View File

@ -188,8 +188,8 @@
<% find_new_forum_topics(11).each do |topic|%> <% find_new_forum_topics(11).each do |topic|%>
<li class="message-brief-intro" style="min-height: 60px; line-height:2em; "> <li class="message-brief-intro" style="min-height: 60px; line-height:2em; ">
<div style="display: inline-block; width: 100%;"> <div style="display: inline-block; width: 100%;">
<span style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="memo_activity" style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %> <%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %>
</span> </span>
<br> <br>
<span style="margin-left: 24px; color: rgb(172, 174, 177); white-space: nowrap; font-size 9pt !important;;"><%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前</span> <span style="margin-left: 24px; color: rgb(172, 174, 177); white-space: nowrap; font-size 9pt !important;;"><%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前</span>

View File

@ -1,145 +1,204 @@
<%= stylesheet_link_tag 'welcome' %> <%= stylesheet_link_tag 'welcome' %>
<%= javascript_include_tag 'welcome' %> <%= javascript_include_tag 'welcome' %>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript" xmlns="http://www.w3.org/1999/html"
xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
$(function(){ $(function(){
$("#main").find("a").attr("target", "_blank"); $("#main").find("a").attr("target", "_blank");
});
// 给主页用户弹新页面
$(document).ready(function($) {
$("#loggedas").find("a").attr("target", "_blank");
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
}); });
// 给主页用户弹新页面
$(document).ready(function($) {
$("#loggedas").find("a").attr("target", "_blank");
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
});
</script> </script>
<div class='top_bar'> <div class='top_bar'>
<div id="identifier-pannel" style="display:none"> <div id="identifier-pannel" style="display:none">
<%= image_tag '/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" %> <%= image_tag '/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" %>
<div class="weixin-content">微信扫码</div> <div class="weixin-content">微信扫码</div>
</div> </div>
<div class="main-content-bar"> <div class="main-content-bar">
<div style="float: left"> <div style="float: left">
<%= image_tag(@logoLink, size:'75x75') %> <%= image_tag(@logoLink, size:'75x75') %>
</div> </div>
<div class="welcome_left" > <div class="course welcome_left" >
<br /> <br />
<span class="font_welcome_school"> <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %> <span class="font_welcome_school"> <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %>
<% else%> <% else%>
<% if params[:school_id] == "0" %> <% if params[:school_id] == "0" %>
<% else %> <% else %>
<% if params[:school_id].nil? %> <% if params[:school_id].nil? %>
<%= School.find(User.current.user_extensions.school.id).name %> <%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course',:school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school',:method => 'get'}%>
<br /> <br />
<% else %> <% else %>
<%= School.find(params[:school_id]).name %> <%= link_to School.find(params[:school_id]).name ,options={:action => 'course',:school_id => params[:school_id]}, html_options={:class => 'font_welcome_school',:method => 'get'}%>
<br /> <br />
<% end %> <% end %>
<% end %> <% end %>
<% end %> </span> <% end %> </span>
<span class="font_welcome_trustie"><%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_course) %> </span> <span class="font_welcome_trustie"><%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_course) %> </span>
<% if params[:school_id].nil? and User.current.user_extensions.school.nil? %> <% if params[: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">, <%= l(:label_welcome_trustie_course_description) %></span>
<% else %> <% else %>
<% if params[:school_id] == "0" %> <% if params[:school_id] == "0" %>
<span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_course_description) %></span> <span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_course_description) %></span>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<div class="search-bar"> <div class="search-bar">
<%= render :partial => "search_project", :locals => {:project_type => Project::ProjectType_course}%> <%= render :partial => "search_project", :locals => {:project_type => Project::ProjectType_course}%>
</div> </div>
<div style="clear: both;"></div> <div style="clear: both;"></div>
</div> </div>
</div> </div>
<div style="clear:both"></div> <div style="clear:both"></div>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject"> <div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
<h3><strong>新开课程</strong></h3> <h3><strong>新开课程</strong></h3>
<span><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => params[:school_id]} %></span> <% if(find_miracle_course(10, 7,params[:school_id]).count == 0) %>
<div class="d-p-projectlist-box"> <span><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => nil} %></span>
<ul class="d-p-projectlist"> <div class="d-p-projectlist-box">
<% find_miracle_course(10, 7,params[:school_id]).map do |project| %> <ul class="d-p-projectlist">
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
<div class='avatar'> </ul>
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %> <ul class="d-p-projectlist">
</div> <h1></h1>
<!-- 上左下右 --> <p id="errorExplanation">
<div class='desc_item text_nowrap' > 该学校未开设任何课程,您可以查看其他学校课程
[<%= get_course_term project %>] </p>
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> <h1></h1>
(<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>) <% find_all_new_hot_course(9).map do |project| %>
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %> <li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
(<%=link_to "#{files_count}份", project_files_path(project) %>资料) <div class='avatar'>
</div> <%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
<div class='desc_item' > </div>
<span class=''> <!-- 上左下右 -->
<% course = Course.find_by_extra(project.identifier) %> <div class='desc_item' >
<%= course.school.name.try(:gsub, /(.+)$/, '\1:') %> <span class=''>
</span> <% course = Course.find_by_extra(project.identifier)%>
<span class='font_bolder'> <% if(course.school == nil) %>
<%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%#=course.try(:teacher).try(:name)%> <% else %>
</span> <%= course.school.name.try(:gsub, /(.+)$/, '\1:') %>
</div> <% end %>
<!-- <div class='desc_item' style=""> </span>
<span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span> <span class='font_bolder'>
</div> --> <%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
<div class='join_course_link'> <%#=course.try(:teacher).try(:name)%>
<% if !course_endTime_timeout?(project)%> </span>
<div > </div>
<%= join_in_course(project, User.current)%> <div class='desc_item text_nowrap' style="width: 310px;">
</div> [<%= get_course_term project %>]
<% end %> <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
</div> (<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
</li> <% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
<% end; reset_cycle %> (<%=link_to "#{files_count}份", project_files_path(project) %>资料)
</ul> </div>
</div> <!-- <div class='desc_item' style="">
<span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span>
</div> -->
<div>
<% if !course_endTime_timeout?(project)%>
<div >
<%= new_watcher_link(project, User.current)%>
</div>
<% end %>
</div>
</li>
<% end %>
</ul>
</div>
<% else %>
<span><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => params[:school_id]} %></span>
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
</ul>
<ul class="d-p-projectlist">
<% find_miracle_course(10, 7,params[:school_id]).map do |project| %>
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
<div class='avatar'>
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
</div>
<!-- 上左下右 -->
<div class='desc_item' >
<span class=''>
<% course = Course.find_by_extra(project.identifier) %>
<%= course.school.name.try(:gsub, /(.+)$/, '\1:') %>
</span>
<span class='font_bolder'>
<%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
<%#=course.try(:teacher).try(:name)%>
</span>
</div>
<div class='desc_item text_nowrap' style="width: 310px;">
[<%= get_course_term project %>]
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
(<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
</div>
<!-- <div class='desc_item' style="">
<span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span>
</div> -->
<div class='join_course_link'>
<% if !course_endTime_timeout?(project)%>
<div >
<%= join_in_course(project, User.current)%>
</div>
<% end %>
</div>
</li>
<% end; reset_cycle %>
</ul>
</div>
<% end %>
</div> </div>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;"> <div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<h3 style="padding-bottom:px ;margin-left: 5px; color: #e8770d;"> <h3 style="padding-bottom:0px ;margin-left: 5px; color: #e8770d;">
<strong>问题和反馈动态</strong> <strong>问题和反馈动态</strong>
<%= link_to "我要提问" , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> <%= link_to "我要提问" , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
<%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> <%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
</h3> </h3>
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span> <span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span>
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
<% find_new_forum_topics(10).each do |topic|%> <% find_new_forum_topics(10).each do |topic|%>
<li class="message-brief-intro" style="min-height: 65px; line-height:2em; "> <li class="message-brief-intro" style="min-height: 65px; line-height:2em; ">
<div style="display: inline-block; width: 100%;"> <div style="display: inline-block; width: 100%;">
<span style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="memo_activity" style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %> <%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %>
</span> </span>
<br> <br>
<span style="margin-left: 24px; color: rgb(172, 174, 177); white-space: nowrap; font-size 9pt !important;;"><%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前</span> <span style="margin-left: 24px; color: rgb(172, 174, 177); white-space: nowrap; font-size:9pt !important;;"><%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前</span>
<span style="margin-left: 8px; margin-bottom: 0px; color: rgb(172, 174, 177) !important; white-space: nowrap;"> <span style="margin-left: 8px; margin-bottom: 0px; color: rgb(172, 174, 177) !important; white-space: nowrap;">
由&nbsp;<%= link_to topic.author ? topic.author : 'Anonymous', user_path(topic.author_id), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);" %>&nbsp;发表 由&nbsp;<%= link_to topic.author ? topic.author : 'Anonymous', user_path(topic.author_id), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);" %>&nbsp;发表
</span> </span>
<span style="float: right; color: rgb(172, 174, 177); white-space: nowrap; font-size 9pt !important;;">回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url %>)</span> <span style="float: right; color: rgb(172, 174, 177); white-space: nowrap; font-size:9pt !important;;">回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url %>)</span>
</div> </div>
</li> </li>
<% end %> <% end %>
</ul> </ul>
</div> </div>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="hidden" style="width:100%;"> <div class="hidden" style="width:100%;">
<div style="width:600px;margin:0px auto;margin-top:80px;"> <div style="width:600px;margin:0px auto;margin-top:80px;">
<table style="width:600px;font-size:15px; color: #e8770d;"> <table style="width:600px;font-size:15px; color: #e8770d;">
<tr> <tr>
<td><strong>当前网站状态</strong></td> <td><strong>当前网站状态</strong></td>
<td>活跃课程: <%=@courseCount%></td> <td>活跃课程: <%=@courseCount%></td>
<td>高校: 2个</td> <td>高校: 2个</td>
<td>教师: <%=@teacherCount%> 名</td> <td>教师: <%=@teacherCount%> 名</td>
<td>学生: <%=@studentCount%> 名<td> <td>学生: <%=@studentCount%> 名<td>
</tr> </tr>
</table> </table>
</div> </div>
</div> </div>

View File

@ -100,7 +100,7 @@
<% find_new_forum_topics(7).each do |topic|%> <% find_new_forum_topics(7).each do |topic|%>
<li class="message-brief-intro"> <li class="message-brief-intro">
<div class='memo_title'> <div class='memo_title'>
<%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url,title: topic.subject %> <%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url,title: topic.subject %>
</div> </div>
<div class='memo_attr'> <div class='memo_attr'>
<span class='memo_timestamp'> <span class='memo_timestamp'>

View File

@ -10,5 +10,6 @@ if Dir.glob(File.join(vendor_plugins_dir, "*")).any?
exit 1 exit 1
end end
# Initialize the rails application # Initialize the rails application
RedmineApp::Application.initialize! RedmineApp::Application.initialize!

View File

@ -132,6 +132,10 @@ en:
actionview_instancetag_blank_option: Please select actionview_instancetag_blank_option: Please select
attachment_all: "All"
attachment_browse: "Attachment Content Browse"
attachment_sufix_browse: "Attachment Type Browse"
attachment_type: "Attachment Type"
general_text_No: 'No' general_text_No: 'No'
general_text_Yes: 'Yes' general_text_Yes: 'Yes'
general_text_no: 'no' general_text_no: 'no'
@ -1604,4 +1608,4 @@ en:
# ajax异步验证 # ajax异步验证
modal_valid_passing: can be used. modal_valid_passing: can be used.

View File

@ -140,6 +140,10 @@ zh:
actionview_instancetag_blank_option: 请选择 actionview_instancetag_blank_option: 请选择
attachment_all: "全部"
attachment_sufix_browse: "文件类型"
attachment_browse: "内容类型"
attachment_type: '资源分类'
general_text_No: '否' general_text_No: '否'
general_text_Yes: '是' general_text_Yes: '是'
general_text_no: '否' general_text_no: '否'

View File

@ -19,7 +19,7 @@ RedmineApp::Application.routes.draw do
resources :no_uses resources :no_uses
delete 'no_uses', :to => 'no_uses#delete' delete 'no_uses', :to => 'no_uses#delete'
resources :apply_project_masters resources :apply_project_masters
delete 'apply_project_masters', :to => 'apply_project_masters#delete' delete 'apply_project_masters', :to => 'apply_project_masters#delete'
@ -301,7 +301,12 @@ RedmineApp::Application.routes.draw do
# issue form update # issue form update
match 'issues/update_form', :controller => 'issues', :action => 'update_form', :via => [:put, :post], :as => 'issue_form' match 'issues/update_form', :controller => 'issues', :action => 'update_form', :via => [:put, :post], :as => 'issue_form'
resources :files, :only => [:index, :new, :create] resources :files, :only => [:index, :new, :create] do
collection do
match "getattachtype" , via: [:get, :post]
#match 'getattachtype/:attachtype', :to => 'files#getattachtype', via: [:get, :post]
end
end
resources :versions, :except => [:index, :show, :edit, :update, :destroy] do resources :versions, :except => [:index, :show, :edit, :update, :destroy] do
collection do collection do
@ -453,7 +458,11 @@ RedmineApp::Application.routes.draw do
get 'attachments/autocomplete' get 'attachments/autocomplete'
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'
resources :attachments, :only => [:show, :destroy] resources :attachments, :only => [:show, :destroy] do
collection do
match "updateType" , via: [:get, :post]
end
end
resources :groups do resources :groups do
member do member do

View File

@ -0,0 +1,19 @@
# encoding: utf-8
class CreateAttachmentstypes < ActiveRecord::Migration
def self.up
create_table :attachmentstypes do |t|
t.column :typeId, :integer, :null => false
t.column :typeName, :string, :limit =>50
end
Attachmentstype.create(typeId:1,typeName:'源代码')
Attachmentstype.create(typeId:1,typeName:'课件')
Attachmentstype.create(typeId:1,typeName:'研究报告')
Attachmentstype.create(typeId:2,typeName:'源代码')
Attachmentstype.create(typeId:2,typeName:'课件')
Attachmentstype.create(typeId:2,typeName:'研究报告')
end
def self.down
drop_table :attachmentstypes
end
end

View File

@ -0,0 +1,5 @@
class AddAttachtypeToAttachments < ActiveRecord::Migration
def change
add_column :attachments, :attachtype, :int ,default: 1
end
end

View File

@ -0,0 +1,5 @@
class AddAttachmenttypeToProject < ActiveRecord::Migration
def change
add_column :projects, :attachmenttype, :int ,default: 1
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140505083430) do ActiveRecord::Schema.define(:version => 20140509020307) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -45,12 +45,21 @@ ActiveRecord::Schema.define(:version => 20140505083430) do
t.datetime "created_on" t.datetime "created_on"
t.string "description" t.string "description"
t.string "disk_directory" t.string "disk_directory"
t.integer "attachtype", :default => 1
end end
add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type"
add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on"
create_table "attachmentstypes", :id => false, :force => true do |t|
t.integer "id", :null => false
t.integer "typeId"
t.string "typeName", :limit => 50
end
add_index "attachmentstypes", ["id"], :name => "id"
create_table "auth_sources", :force => true do |t| create_table "auth_sources", :force => true do |t|
t.string "type", :limit => 30, :default => "", :null => false t.string "type", :limit => 30, :default => "", :null => false
t.string "name", :limit => 60, :default => "", :null => false t.string "name", :limit => 60, :default => "", :null => false
@ -614,6 +623,7 @@ ActiveRecord::Schema.define(:version => 20140505083430) do
t.boolean "inherit_members", :default => false, :null => false t.boolean "inherit_members", :default => false, :null => false
t.integer "project_type" t.integer "project_type"
t.boolean "hidden_repo", :default => false, :null => false t.boolean "hidden_repo", :default => false, :null => false
t.integer "attachmenttype", :default => 1
end end
add_index "projects", ["lft"], :name => "index_projects_on_lft" add_index "projects", ["lft"], :name => "index_projects_on_lft"
@ -803,11 +813,6 @@ ActiveRecord::Schema.define(:version => 20140505083430) do
add_index "time_entries", ["project_id"], :name => "time_entries_project_id" add_index "time_entries", ["project_id"], :name => "time_entries_project_id"
add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id"
create_table "tmp", :force => true do |t|
t.string "name"
t.string "part_number"
end
create_table "tokens", :force => true do |t| create_table "tokens", :force => true do |t|
t.integer "user_id", :default => 0, :null => false t.integer "user_id", :default => 0, :null => false
t.string "action", :limit => 30, :default => "", :null => false t.string "action", :limit => 30, :default => "", :null => false
@ -1014,10 +1019,4 @@ ActiveRecord::Schema.define(:version => 20140505083430) do
add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status"
add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id"
create_table "yans", :force => true do |t|
t.string "name"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
end end

View File

@ -60,6 +60,11 @@ module Redmine
@unsaved_attachments ||= [] @unsaved_attachments ||= []
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) def save_attachments(attachments, author=User.current)
if attachments.is_a?(Hash) if attachments.is_a?(Hash)
attachments = attachments.stringify_keys attachments = attachments.stringify_keys
@ -91,6 +96,7 @@ module Redmine
end end
next unless a next unless a
a.description = attachment['description'].to_s.strip a.description = attachment['description'].to_s.strip
a.attachtype = @curattachment_type;
if a.new_record? if a.new_record?
unsaved_attachments << a unsaved_attachments << a
else else

BIN
public/images/Edit/edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

View File

@ -1840,7 +1840,7 @@ a.remove-upload:hover {text-decoration:none !important;}
/*gcm upload file count and deleteall*/ /*gcm upload file count and deleteall*/
#upload_file_count #count {color:red; font-size:1.5em;} #upload_file_count #count {color:red; font-size:1.5em;}
span.add_attachment .remove_all {background:none;background: url(../images/delete.png) no-repeat 1px 50%; width:1px; display:inline-block;position:absolute;right:21px;text-decoration:none;} span.add_attachment .remove_all {background:none;background: url(../images/delete.png) no-repeat 1px 50%; width:1px; display:inline-block;position:absolute;right:61px;text-decoration:none;}
div.fileover { background-color: lavender; } div.fileover { background-color: lavender; }

File diff suppressed because it is too large Load Diff

View File

@ -405,6 +405,16 @@ a.attachments_list_color {
background: url('../images/list-icon.png') no-repeat scroll left center; background: url('../images/list-icon.png') no-repeat scroll left center;
font-size: 10pt; font-size: 10pt;
} }
/*帖子标题前吧名*/
.memo_activity .memo_Bar_title{
display: inline-block;
/*color: #59ceff;*/
color: #e8770d;
font-weight: bold;
margin-bottom: 3px;
padding-left: 0px;
font-size: 10pt;
}
/*帖子的各种属性*/ /*帖子的各种属性*/
.memo_activity .memo_attr{ .memo_activity .memo_attr{
margin-left: 20px; margin-left: 20px;
@ -442,4 +452,15 @@ a.attachments_list_color {
font-size: 10pt; font-size: 10pt;
} }
/************************** 贴吧动态 结束 **************************** /************************** 贴吧动态 结束 ****************************/
/************************** 学校课程 开始 ****************************/
.course{
}
.course .font_welcome_school{
font-family: Tahoma,"Microsoft YaHei";
font-weight: bold;
font-size: 20px;
color:#e8770d;
}
/************************** 学校课程 结束 ****************************/

9
test/fixtures/attachmentstypes.yml vendored Normal file
View File

@ -0,0 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
typeId:
typeName:
two:
typeId:
typeName:

View File

@ -0,0 +1,7 @@
require 'test_helper'
class AttachmentstypeTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end