Merge branch 'hjq_beidou' into cxt_course

Conflicts:
	app/views/layouts/new_base_user.html.erb
This commit is contained in:
cxt 2016-04-14 11:29:26 +08:00
commit 5e1284605f
198 changed files with 6083 additions and 3079 deletions

View File

@ -548,7 +548,8 @@ class AdminController < ApplicationController
#作业
def homework
@homework = HomeworkCommon.order('end_time desc')
#@homework = HomeworkCommon.order('end_time desc')
@homework = HomeworkCommon.order( 'created_at desc ')
@homework = paginateHelper @homework,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|

View File

@ -70,8 +70,8 @@ class AttachmentsController < ApplicationController
def direct_download
@attachment.increment_download
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
:type => detect_content_type(@attachment),
:disposition => 'attachment' #inline can open in browser
:type => detect_content_type(@attachment),
:disposition => 'attachment' #inline can open in browser
end
def direct_download_history
@ -175,7 +175,7 @@ class AttachmentsController < ApplicationController
@attachment = Attachment.find(params[:attachmentid])
if @attachment != nil
filedense = params[:newtype].to_s
# d = Iconv.conv("unicodebig","utf-8",filedense)
# d = Iconv.conv("unicodebig","utf-8",filedense)
if filedense == "%E5%85%AC%E5%BC%80" #l(:field_is_public)
@attachment.is_public = 1
else
@ -210,9 +210,9 @@ class AttachmentsController < ApplicationController
if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size])
if stale?(:etag => thumbnail)
send_file thumbnail,
:filename => filename_for_content_disposition(@attachment.filename),
:type => detect_content_type(@attachment),
:disposition => 'inline'
:filename => filename_for_content_disposition(@attachment.filename),
:type => detect_content_type(@attachment),
:disposition => 'inline'
end
else
# No thumbnail for the attachment or thumbnail could not be created
@ -292,10 +292,10 @@ class AttachmentsController < ApplicationController
respond_to do |format|
if !@attachment.container.nil? &&
(@attachment.container.is_a?(Course) || ((@attachment.container.has_attribute?(:course) || @attachment.container.has_attribute?(:course_id) ) &&
@attachment.container.course ) || ((@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) &&
@attachment.container.board && @attachment.container.board.course ) || @attachment.container.is_a?(StudentWorksScore) || @attachment.container.is_a?(HomeworkCommon) ||
@attachment.container.is_a?(StudentWork))
(@attachment.container.is_a?(Course) || ((@attachment.container.has_attribute?(:course) || @attachment.container.has_attribute?(:course_id) ) &&
@attachment.container.course ) || ((@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) &&
@attachment.container.board && @attachment.container.board.course ) || @attachment.container.is_a?(StudentWorksScore) || @attachment.container.is_a?(HomeworkCommon) ||
@attachment.container.is_a?(StudentWork))
if @attachment.container.is_a?(News)
format.html { redirect_to_referer_or news_path(@attachment.container) }
elsif @attachment.container.is_a?(StudentWorksScore)
@ -327,25 +327,25 @@ class AttachmentsController < ApplicationController
elsif !@attachment.container.nil? && @attachment.container.is_a?(OrgDocumentComment)
format.html {redirect_to_referer_or org_document_comment_path(@attachment.container)}
else
if @project.nil?
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
else
if @project.nil?
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
else
format.html { redirect_to_referer_or project_path(@project) }
end
end
end
format.js
end
end
end
def delete_homework
@bid = @attachment.container.bid
# Make sure association callbacks are called
container = @attachment.container
@attachment.container.attachments.delete(@attachment)
#if container.attachments.empty?
#container.delete
#end
@bid = @attachment.container.bid
# Make sure association callbacks are called
container = @attachment.container
@attachment.container.attachments.delete(@attachment)
#if container.attachments.empty?
#container.delete
#end
respond_to do |format|
format.html { redirect_to_referer_or respond_path(@bid) }
@ -594,7 +594,7 @@ class AttachmentsController < ApplicationController
end
end
private
private
def find_project
@attachment = Attachment.find(params[:id])
# Show 404 if the filename in the url is wrong
@ -608,7 +608,7 @@ private
@attachment.container.board.course)
@course = @attachment.container.board.course
else
unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWork'
unless @attachment.container_type == 'Bid' || @attachment.container_type == 'Organization' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWork'
@project = @attachment.project
end
end
@ -628,7 +628,7 @@ private
def read_authorize
if @attachment.container_type == "HomeworkAttach" || @attachment.container_type == 'Bid'
true
true
#User.current.allowed_to?(:view_homework_attaches, @attachment.project) ? true : deny_access
else
@attachment.visible? ? true : deny_access
@ -654,14 +654,16 @@ private
def renderTag
@attachmentNew = Attachment.find(params[:attchmentId])
respond_to do |format|
respond_to do |format|
format.js
end
end
def has_login
unless @attachment && @attachment.container_type == "PhoneAppVersion"
render_403 if !User.current.logged? && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download)
unless @attachment && @attachment.container_type == "Organization"
unless @attachment && @attachment.container_type == "PhoneAppVersion"
render_403 if !User.current.logged? && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download)
end
end
end
end

View File

@ -71,18 +71,18 @@ class BlogCommentsController < ApplicationController
@course.save
redirect_to course_path(:id=>params[:course_id])
else
@article.children.delete
@article.delete
@article.children.destroy
@article.destroy
redirect_to user_blogs_path(:user_id=>User.current)
end
else#如果是回复被删,
if params[:course_id] #如果带了course_id过来了那么这是要跳到课程大纲去的
@article.delete
@article.destroy
redirect_to syllabus_course_path(:id=>params[:course_id])
else
root = @article.root
@article.delete
@article.destroy
redirect_to user_blog_blog_comment_path(:user_id=>root.author_id,:blog_id=>root.blog_id,:id=>root.id)
end

View File

@ -70,31 +70,16 @@ class BoardsController < ApplicationController
def show
# 讨论区消息状态更新(已读和未读)
if @project
query_forge_messages = @board.messages
query_forge_messages.each do |query_forge_message|
query = query_forge_message.forge_messages
query.each do |forge_message|
if User.current.id == forge_message.user_id
forge_message.update_attributes(:viewed => true)
end
end
end
ForgeMessage.where("user_id =? and project_id =? and viewed =?", User.current.id, @project.id, 0).update_all(:viewed => true)
# 更新@消息为已读
@project.boards.each do |board|
board.messages.each do |m|
User.current.at_messages.unviewed('Message', m.id).each {|x| x.viewed!}
end
end
# 注释掉这句是因为和上面的方法代码重复,一个类型的消息,已经更新就不需要再更新
# @project.boards.each do |board|
# board.messages.each do |m|
# User.current.at_messages.unviewed('Message', m.id).each {|x| x.viewed!}
# end
# end
elsif @course
query_course_messages = @board.messages
query_course_messages.each do |query_course_message|
query = query_course_message.course_messages
query.each do |course_message|
if User.current.id == course_message.user_id
course_message.update_attributes(:viewed => true)
end
end
end
CourseMessage.where("user_id =? and course_id =? and viewed =?", User.current.id, @course.id, 0).update_all(:viewed => true)
end
sort_init 'updated_on', 'desc'

View File

@ -851,8 +851,6 @@ class CoursesController < ApplicationController
# render_403
# return
# end
# 统计访问量
@course.update_attribute(:visits, @course.visits.to_i + 1)
#更新创建课程消息状态
create_course_messages = @course.course_messages.where("user_id =? and course_message_type =? and course_id =? and viewed =?", User.current.id, 'Course', @course.id, 0)
create_course_messages.update_all(:viewed => true)

View File

@ -458,10 +458,16 @@ class FilesController < ApplicationController
if params[:in_project_toolbar]
@in_project_toolbar = params[:in_project_toolbar]
end
# 发送邮件
attachments = Attachment.attach_filesex(@project, params[:attachments], params[:attachment_type])
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
# 发送邮件
Mailer.run.attachments_added(attachments[:files])
# 生成动态
attachments[:files].each do |file|
ForgeActivity.create(:user_id => User.current.id, :project_id => @project.id, :forge_act_id => file.id, :forge_act_type => "Attachment")
end
# 更新资源总数, 根据上传的附件数累加
@project.project_score.update_attribute(:attach_num, @project.project_score.attach_num + attachments[:files].count) unless @project.project_score.nil?
end
# end
if params[:project_attachment_type] && params[:project_attachment_type].is_a?(Array)
@ -485,11 +491,6 @@ class FilesController < ApplicationController
end
end
end
# 更新资源总数, 根据上传的附件数累加
unless @project.project_score.nil?
@project.project_score.update_attribute(:attach_num, @project.project_score.attach_num + attachments[:files].count)
end
# end
# TODO: 临时用 nyan
sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
@ -622,6 +623,36 @@ class FilesController < ApplicationController
@attachtype = 0
@contenttype = 0
respond_to do |format|
format.js
# format.html {
# redirect_to org_subfield_files_url(@org_subfield)
# }
end
# 组织添加附件,为了修改图片
elsif params[:organization_id]
@organization = Organization.find(params[:organization_id])
@addTag=false
# atttchment_type = 0为logo 1为banner
if params[:logo]
attachments = Attachment.attach_filesex(@organization, params[:attachments], false)
else
attachments = Attachment.attach_filesex(@organization, params[:attachments], true)
end
# TODO: 临时用 nyan
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 = [Organization.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@organization.id)]
show_attachments @containers
@tag_list = attachment_tag_list @all_attachments
@attachtype = 0
@contenttype = 0
respond_to do |format|
format.js
# format.html {

View File

@ -37,16 +37,6 @@ class MessagesController < ApplicationController
# Show a topic and its replies
def show
=begin
if @course
topic_id = params[:r]?params[:r]:params[:id]
parent_id = params[:id]
url = course_boards_path(@course,:topic_id => topic_id,:parent_id=>parent_id);
redirect_to url
return;
end
=end
@isReply = true
page = params[:page]
# Find the page of the requested reply
@ -54,16 +44,7 @@ class MessagesController < ApplicationController
offset = @topic.children.count(:conditions => ["#{Message.table_name}.id < ?", params[:r].to_i])
page = 1 + offset / REPLIES_PER_PAGE
end
@reply_count = @topic.children.count
# @reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
# @replies = @topic.children.
# includes(:author, :attachments, {:board => :project}).
# reorder("#{Message.table_name}.created_on DESC").
# limit(@reply_pages.per_page).
# offset(@reply_pages.offset).
# all
@reply = Message.new(:subject => "RE: #{@message.subject}")
if @course
messages_replies = @topic.children.

View File

@ -11,7 +11,7 @@ class OrgSubfieldsController < ApplicationController
sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+
"and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'"
if SubfieldSubdomainDir.find_by_sql(sql).count == 0
SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir])
SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir].downcase)
end
end
@subfield.update_attributes(:field_type => params[:field_type])
@ -130,6 +130,12 @@ class OrgSubfieldsController < ApplicationController
@organization = @org_subfield.organization
end
def update_status
@subfield = OrgSubfield.find(params[:id])
@organization = Organization.find(@subfield.organization_id)
@subfield.update_attributes(:status => params[:status])
end
def show_attachments obj
@attachments = []
obj.each do |container|

View File

@ -28,18 +28,25 @@ class OrganizationsController < ApplicationController
helper :project_score
helper :issues
include UsersHelper
before_filter :find_organization, :only => [:show, :members, :apply_subdomain]
before_filter :find_organization, :only => [:show, :members, :apply_subdomain, :select_org_layout]
layout 'base_org'
def index
end
def new
@organization = Organization.new
render :layout => 'new_base'
end
def edit
@organization = Organization.find(params[:id])
# @organization = Organization.find(params[:id])
begin
@organization = Organization.where("id =?", params[:id])
ensure
render_404
end
end
def destroy
@ -56,6 +63,7 @@ class OrganizationsController < ApplicationController
@organization.description = params[:organization][:description]
@organization.is_public = params[:organization][:is_public]
@organization.allow_guest_download = params[:organization][:allow_guest_download] == '1' ? 1 : 0
@organization.show_mode = 0
@organization.creator_id = User.current.id
member = OrgMember.new(:user_id => User.current.id)
@ -67,50 +75,170 @@ class OrganizationsController < ApplicationController
end
def show
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
@organization = Organization.find(params[:id])
# 统计访问量
@organization.update_attribute(:visits, @organization.visits.to_i + 1)
if params[:org_subfield_id]
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
@org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10)
# 组织新类型 show_mode判断标准 1为新类型0为旧
if @organization.show_mode == 1 && params[:org_subfield_id].nil? && params[:list] .nil?
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
# REDO:时间紧,暂时先这样
@org_logo_attchment = Attachment.where("container_id =? and container_type =? and attachtype =?", @organization, "Organization", 0).order("created_on desc").first
@org_banner_attchment = Attachment.where("container_id =? and container_type =? and attachtype =?", @organization, "Organization", 1).order("created_on desc").first
@subfield_content = @organization.org_subfields.order("priority")
@organization = Organization.find(params[:id])
# 统计访问量
@organization.update_column(:visits, @organization.visits.to_i + 1)
# @org_subfield = OrgSubfield.find(params[:org_subfield_id])
# @org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
# @org_acts = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10)
shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id)
shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id)
project_ids = (@organization.projects.map(&:id)-shield_project_ids) << 0
course_ids = (@organization.courses.map(&:id)-shield_course_ids) << 0
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
@project_acts = get_project_activities_org @organization, project_ids
@course_acts = get_course_activities_org @organization, course_ids
#@org_acts = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc')
#@project_acts = OrgActivity.where("(container_id =? and container_type =?) " +
# "or (container_type ='Project' and org_act_type in ('Issue','Message') and container_id in (#{project_ids.join(',')})) ",
# @organization.id, 'Organization').order('updated_at desc').limit(8)
#@course_acts = OrgActivity.where("(container_id =? and container_type =?) " +
# "or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))",
# @organization.id, 'Organization').order('updated_at desc').limit(8)
# 项目两种动态
#@project_acts = get_project_activities_org @organization
# 课程动态
#@project_acts_issues = get_project_activities_org @organization
#@course_acts = get_course_activities_org @organization
render :layout => 'base_org_newstyle'
else
shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id)
shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id)
project_ids = (@organization.projects.map(&:id)-shield_project_ids) << 0
course_ids = (@organization.courses.map(&:id)-shield_course_ids) << 0
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
case params[:type]
when nil
@org_activities = OrgActivity.where("(container_id =? and container_type =?) " +
"or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')})) "+
"or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))",
@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
when 'project_issue'
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
when 'project_message'
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Message' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
when 'org'
@org_activities = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
when 'course_homework'
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'HomeworkCommon' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
when 'course_news'
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'News' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
when 'course_message'
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Message' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
when 'course_poll'
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Poll' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
end
end
@page = params[:page] ? params[:page].to_i : 1
respond_to do |format|
format.html
format.js
render_403
end
else
render_403
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
@organization = Organization.find(params[:id])
# 统计访问量
@organization.update_column(:visits, @organization.visits.to_i + 1)
if params[:org_subfield_id]
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
@org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10)
else
shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id)
shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id)
project_ids = (@organization.projects.map(&:id)-shield_project_ids) << 0
course_ids = (@organization.courses.map(&:id)-shield_course_ids) << 0
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
case params[:type]
when nil
@org_activities = OrgActivity.where("(container_id =? and container_type =?) " +
"or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')})) "+
"or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))",
@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
when 'project_issue'
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
when 'project_message'
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Message' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
when 'org'
@org_activities = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
when 'course_homework'
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'HomeworkCommon' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
when 'course_news'
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'News' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
when 'course_message'
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Message' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
when 'course_poll'
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Poll' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
end
end
@page = params[:page] ? params[:page].to_i : 1
respond_to do |format|
format.html
format.js
end
else
render_403
end
end
end
def get_project_message_activities_org org
project_ids = org.projects.map{|project| project.id}.join(",")
unless project_ids.blank?
project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' and org_act_type = 'Message' order by updated_at desc limit 2;")
else
project_acts = nil
end
end
def get_project_issue_activities_org org
project_ids = org.projects.map{|project| project.id}.join(",")
unless project_ids.blank?
project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' and org_act_type = 'issue' order by updated_at desc limit 4;")
else
project_acts = nil
end
#project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' and org_act_type = 'issue' order by updated_at desc limit 4;")
end
# 获取整过项目的动态
def get_project_activities_org org, project_ids
unless project_ids.blank?
project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids.join(',')}) and container_type = 'project'
and org_act_type in ('Message', 'Issue') order by updated_at desc limit 8;")
else
project_acts = nil
end
#project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids}) and container_type = 'project' and org_act_type = 'issue' order by updated_at desc limit 4;")
end
# 获取整过课程的动态
def get_course_activities_org org, course_ids
unless course_ids.blank?
project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids.join(',')}) and container_type = 'course'
and org_act_type in ('HomeworkCommon', 'Poll', 'Message', 'News', 'Course') order by updated_at desc limit 8;")
else
project_acts = nil
end
#project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' order by updated_at desc limit 5;")
#project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'HomeworkCommon' order by updated_at desc limit 1;")
end
def get_course_homework_activities_org org
course_ids = org.courses.map{|course| course.id}.join(",")
unless course_ids.blank?
project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'HomeworkCommon' order by updated_at desc limit 1;")
else
project_acts = nil
end
#project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' order by updated_at desc limit 5;")
#project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'HomeworkCommon' order by updated_at desc limit 1;")
end
def get_course_message_activities_org org
course_ids = org.courses.map{|course| course.id}.join(",")
unless course_ids.blank?
project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'Message' order by updated_at desc limit 1;")
else
project_acts = nil
end
end
def get_course_news_activities_org org
course_ids = org.courses.map{|course| course.id}.join(",")
unless course_ids.blank?
project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'News' order by updated_at desc limit 1;")
else
project_acts = nil
end
#project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' and org_act_type = 'News' order by updated_at desc limit 1;")
end
def update
@ -120,12 +248,17 @@ class OrganizationsController < ApplicationController
# @organization.domain = params[:organization][:domain]
@organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0
@organization.allow_guest_download = params[:organization][:allow_guest_download] == 'on' ? 1 : 0
@organization.show_mode = params[:show_mode]
#@organization.name = params[:organization][:name]
@organization.save
respond_to do |format|
if @organization.show_mode == 1
format.html { redirect_to organization_path(@organization)}
else
format.html { redirect_to setting_organization_path(@organization)}
end
end
end
def check_uniq
@check = false;
@ -157,11 +290,6 @@ class OrganizationsController < ApplicationController
end
end
def clear_org_avatar_temp
end
def set_homepage
@org = Organization.find(params[:id])
@org.home_id = params[:home_id]
@ -224,8 +352,8 @@ class OrganizationsController < ApplicationController
if !params[:name].nil?
condition = "%#{params[:name].strip}%".gsub(" ","")
end
sql = "select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.name like '#{condition}'"+
"and courses.id not in (select distinct org_courses.course_id from org_courses where org_courses.organization_id = #{@organization.id})"
sql = "select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.is_public = 1 and courses.name like '#{condition}'"+
"and courses.id not in (select distinct org_courses.course_id from org_courses where org_courses.organization_id = #{@organization.id}) and courses.is_delete=0"
#user_courses = Course.find_by_sql(sql)
@courses = Course.find_by_sql(sql)
# @added_course_ids = @organization.courses.map(&:id)
@ -268,8 +396,8 @@ class OrganizationsController < ApplicationController
if !params[:name].nil?
condition = "%#{params[:name].strip}%".gsub(" ","")
end
sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.name like '#{condition}'" +
" and projects.id not in (select org_projects.project_id from org_projects where organization_id = #{@organization.id})"
sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.is_public = 1 and projects.name like '#{condition}'" +
" and projects.id not in (select org_projects.project_id from org_projects where organization_id = #{@organization.id}) and status=1"
#user_projects = Course.find_by_sql(sql)
@projects = Course.find_by_sql(sql)
# @added_course_ids = @organization.projects.map(&:id)

View File

@ -295,34 +295,34 @@ class ProjectsController < ApplicationController
def show
# 更新消息为已读
update_message_status(User.current, @project)
# over
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
return
end
# 统计访问量
@project.update_attribute(:visits, @project.visits.to_i + 1)
# over
@author = params[:user_id].blank? ? nil : User.active.find(params[:user_id])
@page = params[:page] ? params[:page].to_i + 1 : 0
# 根据私密性,取出符合条件的所有数据
if User.current.member_of?(@project) || User.current.admin?
case params[:type]
when nil
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'ProjectCreateInfo', 'Attachment')",@project).order("updated_at desc").limit(10).offset(@page * 10)
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'Project', 'Attachment')", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
when 'issue'
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Issue'",@project).order("updated_at desc").limit(10).offset(@page * 10)
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Issue'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
when 'news'
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'News'",@project).order("updated_at desc").limit(10).offset(@page * 10)
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'News'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
when 'message'
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Message'",@project).order("updated_at desc").limit(10).offset(@page * 10)
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Message'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
when 'attachment'
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Attachment'",@project).order("updated_at desc").limit(10).offset(@page * 10)
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Attachment'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
end
else
@events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public
= ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc")
.page(params['page'|| 1]).per(10);
@events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public = ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc").page(params['page'|| 1]).per(10);
end
g = Gitlab.client
unless @project.gpid.nil?
@static_total_per_user = g.rep_stats(@project.gpid)
end
boards = @project.boards.includes(:last_message => :author).all
@topic_count = @project.boards.count
# 根据对应的请求,返回对应的数据
respond_to do |format|
format.html
@ -560,18 +560,9 @@ class ProjectsController < ApplicationController
end
def update_message_status(user, project)
project_invite_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type =?", user, project, "ProjectInvite")
project_invite_messages.each do |project_invite_message|
project_invite_message.update_attribute(:viewed, true)
end
#更新被加入项目消息的viewed字段
join_project_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type=?", user, project, "JoinProject")
join_project_messages.each do |join_project|
join_project.update_attribute(:viewed, true)
end
#更新被移出项目消息的viewed字段
remove_project_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type=?", user, project, "RemoveFromProject")
remove_project_messages.update_all(:viewed => true)
# 更新加入项目消息
project__messages = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'JoinProject', 'RemoveFromProject') and user_id =? and project_id =? ", user, project)
project__messages.update_all(:viewed => true) unless project__messages.blank?
end
def message_invite(message_id, key)

View File

@ -30,7 +30,7 @@ class RepositoriesController < ApplicationController
menu_item :settings, :only => [:new, :create, :edit, :update, :destroy, :committers]
default_search_scope :changesets
before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo]
before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo, :stats]
before_filter :find_repository, :only => [:edit, :update, :destroy, :committers]
before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo, :to_gitlab, :forked]
before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
@ -332,7 +332,7 @@ update
# end
#if( !User.current.member_of?(@project) || @project.hidden_repo)
@repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty?
# @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty?
# :name, :path, :kind, :size, :lastrev, :changeset
@entries = @repository.entries(@path, @rev)
@ -348,24 +348,25 @@ update
# (show_error_not_found; return) unless @entries
g = Gitlab.client
@changesets = g.commits(@project.gpid, :ref_name => @rev)
# @changesets = @repository.latest_changesets(@path, @rev)
# @changesets_count = @repository.latest_changesets(@path, @rev).count
# 总的提交数
@changesets_all_count = @project.gpid.nil? ? 0 : g.project(@project.gpid).commit_count
# 访问该页面的是会后则刷新
if @project.project_score.nil?
ProjectScore.create(:project_id => @project.id, :score => false)
end
# 刷新改页面的时候,更新统计数
if @changesets_all_count != @project.project_score.changeset_num && @changesets_all_count != 0
update_commits_count(@project, @changesets_all_count)
end
# end
# 最近一次提交
@changesets_latest_coimmit = @changesets[0]
unless @changesets[0].blank?
update_commits_date(@project, @changesets_latest_coimmit)
end
@creator = User.where("id =?", @project.user_id).first.try(:login)
@properties = @repository.properties(@path, @rev)
@repositories = @project.repositories
@course_tag = params[:course]
project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
ip = RepositoriesHelper::REPO_IP_ADDRESS
gitlab_address = Redmine::Configuration['gitlab_address']
@ -374,11 +375,7 @@ update
else
@repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s + @repository.url.slice(project_path_cut, @repository.url.length).to_s
end
if @course_tag == 1
render :action => 'show', :layout => 'base_courses'
else
render :action => 'show', :layout => 'base_projects'
end
render :action => 'show', :layout => 'base_projects'
end
end
@ -390,7 +387,7 @@ update
g = Gitlab.client
limit = 20
#每次页面的换回值从1开始,但是gitlab的页面查询是从0开始,所以先改变page的类型减一在改回来
@commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s)
@commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s, ref_name:@rev)
#add by hx
#rep_count = commit_count(@project)
@ -565,10 +562,24 @@ update
end
def stats
@project_id = params[:id]
@repository_id = @repository.identifier
# 提交次数统计
@status_commit_count = Changeset.count(:conditions => ["#{Changeset.table_name}.repository_id = ?", @repository.id])
if @project.gpid.nil?
render 404
return
end
project_id = @project.gpid
# @repository_id = @repository.identifier
# creator = params[:creator]
rev = params[:rev]
g = Gitlab.client
begin
@static_total_per_user = g.rep_stats(project_id, :rev => rev)
@static_total_per_user
# @static_month__per_user = g.rep_stats(project_id, :rev => rev, :creator => creator, :period => 2)
# @static_week_per_user = g.rep_stats(project_id, :rev => rev, :creator => creator, :period => 3)
rescue
render_404
return
end
render :layout => 'base_projects'
end

View File

@ -5,14 +5,14 @@ class StudentWorkController < ApplicationController
include ApplicationHelper
require 'bigdecimal'
require "base64"
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students]
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students]
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work,:revise_attachment]
before_filter :member_of_course, :only => [:new, :create, :show, :add_score, :praise_student_work]
before_filter :author_of_work, :only => [:edit, :update, :destroy]
before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule, :forbidden_anonymous_comment]
before_filter :is_logged, :only => [:index]
###
###
def program_test
is_test = params[:is_test] == 'true'
resultObj = {status: 0, results: [], error_msg: '', time: Time.now.strftime('%Y-%m-%d %T')}
@ -49,13 +49,127 @@ class StudentWorkController < ApplicationController
resultObj[:time] = student_work_test.created_at.to_s(:db)
resultObj[:index] = student_work.student_work_tests.count
end
end
end
render :json => resultObj
end
#行尾空格替换成□
def space_replace_1(str)
for i in 0 .. str.size
tChar = str[i]
if tChar != ' ' && tChar != "\n"
sFlag = false
eFlag = false
elsif tChar == ' ' && sFlag == false
tStart = i
sFlag = true
elsif tChar == "\n"
tEnd = i - 1
if sFlag == true
for j in tStart .. tEnd
str[j] = ""
end
sFlag = false
end
end
end
end
#由于负载问题 不要使用全局变量
#根据传入的tIndex确定是第几次测试
#之后如果觉得很卡 可以改成将结果传回JS再以参数形式传回来
def program_test_ex
is_test = params[:is_test] == 'true'
resultObj = {status: 0, results: [], error_msg: '', time: Time.now.strftime('%Y-%m-%d %T'),tseq:1,tcount:1,testid:1} #保存每测试一次返回的结果
student_work = find_or_save_student_work(is_test)
resultObj[:tcount] = @homework.homework_tests.size
unless student_work
resultObj[:status] = 100
else
if @homework.homework_type == 2 && @homework.homework_detail_programing
#找到第index个测试的输入输出
index = params[:tIndex].to_i
resultObj[:tseq] = index
test = @homework.homework_tests[index - 1]
#请求测试
result = test_realtime_ex(test, params[:src])
if result["status"].to_i != -2
#result["results"].first['output'] = result["results"].first['output'].gsub(" ","□")
#result["results"].first['result'] = result["results"].first['result'].gsub(" ","□")
space_replace_1(result["results"].first['output'])
space_replace_1(result["results"].first['result'])
end
logger.debug result
#-1 默认值 0全部正确并结束 2 超时 -2 编译错误
resultObj[:status] = -1
resultObj[:results] = result["results"].first #本次测试结果
resultObj[:error_msg] = result["error_msg"] #编译错误时的信息
if result["status"].to_i == -2 #编译错误
resultObj[:results] = result["error_msg"]
resultObj[:status] = -2
elsif result["results"][0]["status"].to_i == 2
resultObj[:status] = 2
end
unless student_work.save
resultObj[:status] = 200
else
student_work.name = params[:title]
student_work.description = params[:src]
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
student_work.late_penalty = @homework.late_penalty
else
student_work.late_penalty = 0
end
#每次从数据库取出上次的结果加上本次的结果再存入数据库
status = result["status"]
if index == 1
student_work_test = student_work.student_work_tests.build(status: status,
results: [resultObj[:results]],src: params[:src])
student_work_test.save!
resultObj[:testid] = student_work_test.id
else
#先从数据库取出result
student_work_test = StudentWorkTest.find(params[:testid])
results = student_work_test.results
results << resultObj[:results]
student_work_test.results = results
student_work_test.status = (result["status"] != 0 ? result["status"] : student_work_test.status)
student_work_test.save!
status = student_work_test.status
resultObj[:testid] = student_work_test.id
end
#超时或编译错误则直接返回了并存入数据库
if resultObj[:status] == 2 || resultObj[:status] == -2 || index == @homework.homework_tests.size
if status == 0
resultObj[:status] = 0
end
student_work.save!
resultObj[:time] = student_work_test.created_at.to_s(:db)
resultObj[:index] = student_work.student_work_tests.count
end
#渲染返回结果
render :json => resultObj
end
end
end
end
def index
# 作业消息状态更新
@homework.course_messages.each do |homework_message|
@ -63,6 +177,13 @@ class StudentWorkController < ApplicationController
homework_message.update_attributes(:viewed => true) if homework_message.viewed == 0
end
end
#修改作品提示消息更新
student_work_messages = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, StudentWork.name, 0)
student_work_messages.each do |message|
message.update_attribute(:viewed, true)
end
# 作品打分消息状态更新
studentworks_scores = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, "StudentWorksScore", 0)
studentworks_scores.each do |studentworks_score|
@ -230,12 +351,12 @@ class StudentWorkController < ApplicationController
render_403
return
end
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("#{@order} #{@b_sort}"),@name).count
end
@score = @b_sort == "desc" ? "asc" : "desc"
# 消息传过来的ID
@message_student_work_id = params[:student_work_id]
respond_to do |format|
format.js
format.html
@ -369,6 +490,8 @@ class StudentWorkController < ApplicationController
@work.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@work)
if @work.save
#如果学生作品被打分后修改,应该给老师提示
send_message_to_teacher(@work)
if @homework.homework_type == 3
@student_work_project = @homework.student_work_projects.where("user_id=?",User.current.id).first
student_work_projects = @homework.student_work_projects.where("student_work_id=? and is_leader =?",@work.id,0)
@ -457,7 +580,7 @@ class StudentWorkController < ApplicationController
end
end
end
redirect_to user_homeworks_user_path(User.current.id)
redirect_to student_homeworks_user_path(User.current.id)
end
def retry_work
@ -987,7 +1110,6 @@ class StudentWorkController < ApplicationController
student_work
end
def test_realtime(student_work, src)
url = "#{Redmine::Configuration['judge_server']}api/realtime_test.json"
@ -1011,6 +1133,28 @@ class StudentWorkController < ApplicationController
JSON.parse(res.body)
end
def test_realtime_ex(test, src)
url = "#{Redmine::Configuration['judge_server']}api/realtime_test.json"
factor = []
factor << {input: test.input, output: test.output}
solutions = {
src:src,
language:@homework.homework_detail_programing.language,
factor: factor
}
uri = URI(url)
body = solutions.to_json
res = Net::HTTP.new(uri.host, uri.port).start do |client|
request = Net::HTTP::Post.new(uri.path)
request.body = body
request["Content-Type"] = "application/json"
client.request(request)
end
JSON.parse(res.body)
end
#成绩计算
def set_final_score homework,student_work
if homework && homework.homework_detail_manual

View File

@ -119,49 +119,46 @@ class UsersController < ApplicationController
# @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count
case params[:type]
when nil
# 系统消息为管理员发送,我的消息中包含有系统消息
@message_alls = []
messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user, "SystemMessage", "SystemMessage").order("created_at desc")
messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc")
messages.each do |message_all|
@message_alls << message_all.message
end
when 'unviewed'
@message_alls = []
messages = MessageAll.where("user_id =?", @user).order("created_at desc")
messages = MessageAll.where("user_id =?", @user.id).includes(:message).order("created_at desc")
messages.each do |message_all|
# 在点击或者刷新消息列表后未读的消息存放在数组
if message_all.message_type != "SystemMessage"&& !message_all.message.nil? && message_all.message.viewed == 0
@message_alls << message_all.message
end
end
#课程相关消息
when 'homework'
@message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork','Exercise') and user_id =?", @user).order("created_at desc")
@message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork','Exercise') and user_id =?", @user.id).order("created_at desc")
when 'course_message'
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc")
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user.id).order("created_at desc")
when 'course_news'
# 课程通知包含发布的通知和回复的通知
@message_alls = CourseMessage.where("course_message_type in (?, ? ,?)", "News", "Comment", "Course").where("user_id =?", @user).order("created_at desc")
@message_alls = CourseMessage.where("course_message_type in ('News', 'Comment') and user_id =?", @user.id).order("created_at desc")
when 'poll'
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc")
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user.id).order("created_at desc")
#项目相关消息
when 'issue'
@message_alls = ForgeMessage.where("forge_message_type =? or forge_message_type =?" , "Issue", "Journal").where("user_id=?", @user).order("created_at desc")
@message_alls = ForgeMessage.where("forge_message_type in ('Issue', 'Journal') and user_id =?" , @user.id).order("created_at desc")
when 'forge_message'
@message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc")
@message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user.id).order("created_at desc")
when 'forge_news'
@message_alls = ForgeMessage.where("forge_message_type in (?,?) and user_id =?", "News", "Comment", @user).order("created_at desc")
@message_alls = ForgeMessage.where("forge_message_type in (?,?) and user_id =?", "News", "Comment", @user.id).order("created_at desc")
when 'apply'
@message_alls = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'AppliedProject', 'JoinProject', 'RemoveFromProject') and user_id =?", @user).order("created_at desc")
@message_alls = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'AppliedProject', 'JoinProject', 'RemoveFromProject') and user_id =?", @user.id).order("created_at desc")
#贴吧消息
when 'forum'
@message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc")
@message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user.id).order("created_at desc")
#用户留言
when 'user_feedback'
@message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc")
@message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user.id).order("created_at desc")
else
render_404
return
@ -717,6 +714,7 @@ class UsersController < ApplicationController
end
student_work.save
send_message_to_teacher(student_work)
homework.update_attributes(:updated_at => Time.now)
update_course_activity(homework.class,homework.id)
update_user_activity(homework.class,homework.id)
@ -838,8 +836,8 @@ class UsersController < ApplicationController
render_403
return
end
user_course_ids = User.current.courses.map { |c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id}
user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id }
# user_org_ids = User.current.organizations.map {|o| o.id}
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
@ -888,11 +886,11 @@ class UsersController < ApplicationController
def user_ref_resource_search
search = params[:search].to_s.strip.downcase
if(params[:type].blank? || params[:type] == "1") #全部
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 取交集并查询
user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 取交集并查询
@attachments = Attachment.where("((author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
" or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))) and (filename like '%#{search}%') ").order("created_on desc")
elsif params[:type] == "2" #课程资源
user_course_ids = User.current.courses.map { |c| c.id}
user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id}
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) and (filename like '%#{search}%') ").order("created_on desc")
elsif params[:type] == "3" #项目资源
@attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project' and (filename like '%#{search}%')").order("created_on desc")
@ -1208,18 +1206,14 @@ class UsersController < ApplicationController
end
def show
# 统计访问量
unless User.current == @user
@user.update_attribute(:visits, @user.visits.to_i + 1)
end
#更新用户申请成为课程老师或教辅消息的状态
if params[:course_id] != nil
join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",
params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
join_course_messages.update_all(:viewed => true)
end
shield_project_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
shield_course_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
@page = params[:page] ? params[:page].to_i + 1 : 0
user_project_ids = (@user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
user_course_ids = (@user.courses.visible.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.map{|course| course.id}-shield_course_ids).join(",") + ")"
@ -1255,7 +1249,13 @@ class UsersController < ApplicationController
end
else
# @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10)
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
# blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
# 减少数据库交互
watched_user_ids = User.watched_by(@user.id).count == 0 ? " " : ("," + User.watched_by(@user.id).map{|u| u.id.to_s }.join(','))
user_ids = "(" + @user.id.to_s + watched_user_ids + ")"
watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",")
blog_ids = "(" + watched_user_blog_ids + ")"
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
@ -1577,16 +1577,14 @@ class UsersController < ApplicationController
# 上传用户资源
def user_resource_create
user_course_ids = User.current.courses.map { |c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id}
user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id }
# user_org_ids = User.current.organizations.map {|o| o.id}
@user = User.find(params[:id])
# 保存文件
attach = Attachment.attach_filesex_public(@user, params[:attachments], params[:attachment_type], is_public = true)
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
@score = @b_sort == "desc" ? "asc" : "desc"
user_course_ids = User.current.courses.map { |c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
# user_org_ids = User.current.organizations.map {|o| o.id}
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
@ -1616,8 +1614,10 @@ class UsersController < ApplicationController
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
end
@status = params[:status]
@type = params[:type]
@path = user_resource_user_path(User.current, :type => @type)
@limit = 25
@is_remote = true
@atta_count = @attachments.count
@ -1675,6 +1675,7 @@ class UsersController < ApplicationController
end
@status = params[:status]
@type = params[:type]
@path = user_resource_user_path(User.current, :type => @type)
@limit = 25
@is_remote = true
@atta_count = @attachments.count
@ -1699,6 +1700,7 @@ class UsersController < ApplicationController
.select { |course| @user.allowed_to?(:as_teacher,course) and course.is_delete == 0 }
end
@search = params[:search]
@type = params[:type]
#这里仅仅是传递需要发送的资源id
@send_id = params[:send_id]
@send_ids = params[:checkbox1] || params[:send_ids]
@ -1717,6 +1719,7 @@ class UsersController < ApplicationController
@projects = @user.projects.visible
end
@search = params[:search]
@type = params[:type]
#这里仅仅是传递需要发送的资源id
@send_id = params[:send_id]
@send_ids = params[:checkbox1] || params[:send_ids] #搜索的时候 和 直接 用表格提交的时候的send_ids
@ -1813,11 +1816,41 @@ class UsersController < ApplicationController
else
@flag = false
end
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
@score = @b_sort == "desc" ? "asc" : "desc"
user_project_ids = User.current.projects.map {|p| p.id}
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
if params[:status] == "2"
@attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
elsif params[:status] == "3"
@attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
elsif params[:status] == "4"
@attachments = get_attch_resources(params[:id], @order, @score)
elsif params[:status] == "5"
@attachments = get_principal_resources(params[:id], @order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
end
elsif params[:type] == "6" # 公共资源
if params[:status] == "2"
@attachments = get_course_resources_public( user_course_ids, @order, @score)
elsif params[:status] == "3"
@attachments = get_project_resources_public(user_project_ids, @order, @score)
elsif params[:status] == "4"
@attachments = get_attch_resources_public(@order, @score)
elsif params[:status] == "5"
@attachments = get_principal_resources_public(@order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
end
@type = params[:type]
@limit = 25
@path = user_resource_user_path(User.current, :type => @type)
@user = User.current
@is_remote = true
@atta_count = @attachments.count
@ -1924,11 +1957,42 @@ class UsersController < ApplicationController
else
@flag=true
end
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
@score = @b_sort == "desc" ? "asc" : "desc"
user_project_ids = User.current.projects.map {|p| p.id}
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
if params[:status] == "2"
@attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
elsif params[:status] == "3"
@attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
elsif params[:status] == "4"
@attachments = get_attch_resources(params[:id], @order, @score)
elsif params[:status] == "5"
@attachments = get_principal_resources(params[:id], @order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
end
elsif params[:type] == "6" # 公共资源
if params[:status] == "2"
@attachments = get_course_resources_public( user_course_ids, @order, @score)
elsif params[:status] == "3"
@attachments = get_project_resources_public(user_project_ids, @order, @score)
elsif params[:status] == "4"
@attachments = get_attch_resources_public(@order, @score)
elsif params[:status] == "5"
@attachments = get_principal_resources_public(@order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
end
@status = params[:status]
@type = params[:type]
@limit = 25
@path = user_resource_user_path(User.current, :type => @type)
@user = User.current
@is_remote = true
@atta_count = @attachments.count
@ -2022,11 +2086,41 @@ class UsersController < ApplicationController
else
@flag=true
end
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
@score = @b_sort == "desc" ? "asc" : "desc"
user_project_ids = User.current.projects.map {|p| p.id}
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
if params[:status] == "2"
@attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
elsif params[:status] == "3"
@attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
elsif params[:status] == "4"
@attachments = get_attch_resources(params[:id], @order, @score)
elsif params[:status] == "5"
@attachments = get_principal_resources(params[:id], @order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
end
elsif params[:type] == "6" # 公共资源
if params[:status] == "2"
@attachments = get_course_resources_public( user_course_ids, @order, @score)
elsif params[:status] == "3"
@attachments = get_project_resources_public(user_project_ids, @order, @score)
elsif params[:status] == "4"
@attachments = get_attch_resources_public(@order, @score)
elsif params[:status] == "5"
@attachments = get_principal_resources_public(@order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
end
@type = params[:type]
@limit = 25
@path = user_resource_user_path(User.current, :type => @type)
@user = User.current
@is_remote = true
@atta_count = @attachments.count
@ -2369,7 +2463,7 @@ class UsersController < ApplicationController
# 获取我的资源
def get_my_resources author_id, user_course_ids, user_project_ids, order, score
attachments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
attachments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('OrgSubfield','Principal','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)" ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
@ -2475,15 +2569,15 @@ class UsersController < ApplicationController
# 资源库 分为全部 课程资源 项目资源 附件
def user_resource
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
@score = @b_sort == "desc" ? "asc" : "desc"
# 别人的资源库是没有权限去看的
if User.current.id.to_i != params[:id].to_i
render_403
return
end
user_course_ids = User.current.courses.map { |c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
@score = @b_sort == "desc" ? "asc" : "desc"
user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id}
user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id }
# user_org_ids = User.current.organizations.map {|o| o.id}
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
@ -2540,8 +2634,8 @@ class UsersController < ApplicationController
@user = User.find(params[:id])
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
@score = @b_sort == "desc" ? "asc" : "desc"
user_course_ids = User.current.courses.map { |c| c.id}
user_project_ids = User.current.projects.map {|p| p.id} # user_org_ids = User.current.organizations.map {|o| o.id}
user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id}
user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id } # user_org_ids = User.current.organizations.map {|o| o.id}
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
@ -2565,6 +2659,10 @@ class UsersController < ApplicationController
end
def import_resources_search
if User.current.id.to_i != params[:id].to_i
render_403
return
end
@resource_id = params[:mul_id]
@resource_type = params[:mul_type]
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
@ -2573,15 +2671,10 @@ class UsersController < ApplicationController
@switch_search = params[:name].nil? ? " " : params[:name]
search = "%#{@switch_search.strip.downcase}%"
# 别人的资源库是没有权限去看的
if User.current.id.to_i != params[:id].to_i
render_403
return
end
@resource_id = params[:mul_id]
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
user_course_ids = User.current.courses.map { |c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id}
user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id }
# user_org_ids = User.current.organizations.map {|o| o.id}
@attachments = get_my_resources_search(params[:id], user_course_ids, user_project_ids, @order, @score, search)
elsif params[:type] == "6" # 公共资源
@ -2661,8 +2754,8 @@ class UsersController < ApplicationController
@user = User.current
@switch_search = params[:search].nil? ? " " : params[:search]
search = "%#{@switch_search.strip.downcase}%"
user_course_ids = User.current.courses.map {|c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id}
user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id }
if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') # 全部
if params[:status] == "2"
@attachments = get_course_resources_search(params[:id], user_course_ids, @order, @score, search)
@ -2720,6 +2813,7 @@ class UsersController < ApplicationController
name = "%"+name+"%"
@orgs = User.current.organizations.where("name like ?", name)
@user = User.current
@type = params[:type]
respond_to do |format|
format.html {render :layout => 'static_base'}
format.js

View File

@ -33,6 +33,10 @@ module ApplicationHelper
extend Forwardable
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
def update_visiti_count container
container.update_column(:visits, container.visits + 1)
end
# Time 2015-03-24 15:27:29
# Author lizanle
# Description 从硬盘上删除对应的资源文件
@ -764,7 +768,7 @@ module ApplicationHelper
# 判断版本库是否初始为gitlab
def rep_is_gitlab?(project)
rep = Repository.where("project_id =? and type =?", project, "Repository::Gitlab")
rep = project.repositories.where("type =?", "Repository::Gitlab")
return rep.blank? ? true :false
end
@ -2104,6 +2108,8 @@ module ApplicationHelper
attachment.container.board.course
course = attachment.container.board.course
candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
elsif attachment.container.class.to_s=="Organization"
candown = true
elsif attachment.container.class.to_s=="HomeworkAttach"
candown = true
elsif attachment.container.class.to_s=="StudentWorksScore"
@ -2137,6 +2143,20 @@ module ApplicationHelper
end
#如果学生作品被打分后修改,应该给老师提示
def send_message_to_teacher student_work
if StudentWork === student_work
if student_work.student_works_scores.any?
course = student_work.homework_common.course
course.members.map(&:user_id).uniq.each do|user_id|
if User.find(user_id).allowed_to?(:as_teacher, course)
student_work.course_messages << CourseMessage.new(:user_id => user_id, :course_id => course.id, :viewed => false, :status => 1)
end
end
end
end
end
private
def wiki_helper
@ -3044,3 +3064,7 @@ def is_default_field? field
(field.name == 'activity' || field.name == 'course' || field.name == 'project') && field.field_type == 'default'
end
def host_with_protocol
return Setting.protocol + "://" + Setting.host_name
end

View File

@ -24,40 +24,20 @@ module CoursesHelper
def find_excelletn_course keywords, current_course
# 获取tag匹配结果ID
a_tags = []
# kc = keywords.to_a
Course.visible.where("is_excellent =? and is_public =?", 1, 1).each do |ec|
Course.where("is_excellent =? and is_public =?", 1, 1).each do |ec|
if ec.tags.any?{|value| current_course.name.include?(value.to_s)}
a_tags << ec.id
end
end
# sql = "SELECT distinct c.* FROM `courses` c, tags t, taggings ts where t.id = ts.tag_id and ts.taggable_id = c.id and c.is_excellent = 1 and is_delete = 0 and
# ts.taggable_type = 'Course' and t.name like '%#{keywords}%'"
# a_tags = Course.find_by_sql(sql).select{|course| course.is_public ==1 unless User.current.member_of_course?(course)}
# 通过elastic结果获取精品课程
a_courses = []
#courses = Course.search(keywords)
#courses.each do |c|
# a_courses << c.id
#end
a_courses << a_tags unless a_tags.length == 0
# 课程本身不能搜索显示自己
excellent_ids = a_courses.flatten.uniq.delete_if{|i| i == current_course.id}
limit = 5 - excellent_ids.length.to_i
excellent_ids = a_tags.uniq.delete_if{|i| i == current_course.id}
sql = "SELECT distinct c.id FROM course_activities cs, courses c where cs.course_id = c.id
and c.is_excellent =1 and c.is_public = 1 and c.id != #{current_course.id} order by cs.updated_at desc;"
default_ecourse_ids = Course.find_by_sql(sql).flatten
# REDO:时间紧,待优化
default_ids =[]
default_ecourse_ids.each do |de|
default_ids << de.id
end
default_ids = default_ids - excellent_ids
#default_ecourse = Course.where("id is not in (?)", ids).find_by_sql(sql).flatten.delete_if{|i| i == current_course.id}.flatten
arr_result = excellent_ids << default_ids
arr_result = arr_result.flatten.first(5)
return arr_result
# 过滤条件:精品课程、本身不在搜索范围
#e_courses = Course.where("is_excellent =? and id in (?)",1, arr_result).where("id !=?", current_course.id)
and (c.is_excellent =1 or c.excellent_option =1) and c.is_public = 1 and c.id != #{current_course.id} order by cs.updated_at desc;"
default_ids = Course.find_by_sql(sql).flatten.map { |c| c.id }
excellent_ids << default_ids.flatten
arr_result = excellent_ids.flatten.uniq.first(5)
excellent_courses = Course.find(arr_result)
return excellent_courses
end
# 判断精品课程是否可见,非课程成员无法查看私有课程
@ -258,7 +238,7 @@ module CoursesHelper
# 学生人数计算
# add by nwb
def studentCount course
course ? course.student.count.to_s : 0#course.student.count
course ? course.student.count.to_i : 0#course.student.count
end
#课程成员数计算
@ -293,12 +273,17 @@ module CoursesHelper
def searchTeacherAndAssistant project
#searchPeopleByRoles(project, TeacherRoles)
members = []
project.members.each do |m|
project.members.includes(:user).each do |m|
members << m if m && m.user && m.user.allowed_to?(:as_teacher,project)
end
members
end
def TeacherAndAssistantCount course
students_count = course.student.count
number = course.members.count - students_count
end
def search_student_in_group(project, course_group_id)
#searchPeopleByRoles(project, StudentRoles)
members = []
@ -766,7 +751,7 @@ module CoursesHelper
#加入课程、退出课程按钮
def join_in_course_header(course, user, options=[])
if user.logged?
joined = course.members.map{|member| member.user_id}.include? user.id
joined = course.members.includes(:user).map{|member| member.user_id}.include? user.id
text = joined ? l(:label_course_exit_student) : l(:label_course_join_student)
url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id)
method = joined ? 'delete' : 'post'

View File

@ -111,9 +111,9 @@ module IssuesHelper
def principals_options_for_isuue_list(project)
if User.current.member_of?(project)
project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0])
project.members.includes(:user).order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0])
else
project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给", 0])
project.members.includes(:user).order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给", 0])
end
end

View File

@ -9,7 +9,7 @@ module OrgMemberHelper
principals = paginateHelper scope,10
s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals')
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options|
link_to text, org_member_autocomplete_org_member_index_path(parameters.merge(:q => params[:q],:flag => true,:org=> org, :format => 'js')), :remote => true
link_to text, host_with_protocol + "/org_member/org_member_autocomplete?" + parameters.merge(:q => params[:q],:flag => true,:org=> org, :format => 'js').to_query, :remote => true
}
s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" )
end

View File

@ -1,6 +1,7 @@
# encoding: utf-8
module OrganizationsHelper
include ApplicationHelper
include FilesHelper
def find_user_not_in_current_org_by_name org
@ -28,4 +29,48 @@ module OrganizationsHelper
end
end
def get_message_org(org_id, field_id)
OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and org_subfield_id = #{field_id} and parent_id is null order by updated_at desc limit 8;")
end
def get_message_reply_org(org_id, ids)
# OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and parent_id is not null order by updated_at desc limit 1;")
OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and parent_id in (#{ids}) order by updated_at desc limit 1;")
end
def get_attach_org(field_id)
Attachment.find_by_sql("SELECT * FROM `attachments` where container_id =#{field_id} and container_type = 'OrgSubfield' and is_public =1 order by created_on limit 6;")
end
def get_attach_org2(field)
org_attachments = field.attachments
attachments = User.current.admin? ? org_attachments : visable_attachemnts(org_attachments)
return attachments.sort_by{|x| x.created_on}.reverse.first(6)
# Attachment.find_by_sql("SELECT * FROM `attachments` where container_id =#{field_id} and container_type = 'OrgSubfield' and is_public =1 order by created_on limit 6;")
end
# 从内容中获取路径
def get_image_path_from_content content
r = Regexp.new(/src="\/files\/uploads\/image(.+?)"/)
if r.match(content).nil?
image_path = nil
else
image_path = r.match(content)[1]
end
end
#排列下拉框
def subfield_status_option
type = []
option1 = []
option1 << "列表"
option1 << "1"
type << option1
option2 = []
option2 << "图片"
option2 << "0"
type << option2
type
end
end

View File

@ -130,7 +130,7 @@ module StudentWorkHelper
def revise_attachment_status homework, attach
date = Time.parse(format_time(attach.created_on.to_s)).strftime("%Y-%m-%d")
status = ""
if homework.homework_detail_manual && ((homework.anonymous_comment == 0 &&homework.homework_detail_manual.evaluation_start.to_s <= date) || (homework.anonymous_comment == 1 && homework.end_time < date))
if homework.homework_detail_manual && ((homework.anonymous_comment == 0 &&homework.homework_detail_manual.evaluation_start.to_s <= date) || (homework.anonymous_comment == 1 && homework.end_time.to_s < date))
status = "此时其他同学作品已公开"
else
status = "此时其他同学作品尚未公开"

View File

@ -23,6 +23,7 @@ class Attachment < ActiveRecord::Base
belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'"
belongs_to :course, foreign_key: 'container_id', conditions: "attachments.container_type = 'Course'"
belongs_to :org_subfield, foreign_key: 'container_id', conditions: "attachements.container_type = 'OrgSubfield'"
belongs_to :organization, foreign_key: 'container_id', conditions: "attachements.container_type = 'Organization'"
belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'"
belongs_to :author, :class_name => "User", :foreign_key => "author_id"
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
@ -90,7 +91,7 @@ class Attachment < ActiveRecord::Base
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
before_save :files_to_final_location
after_save :act_as_course_activity,:act_as_forge_activity
after_save :act_as_course_activity
after_create :office_conver, :be_user_score,:create_attachment_ealasticsearch_index
after_update :office_conver, :be_user_score,:update_attachment_ealasticsearch_index
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index, :decrease_attchments_count, :down_course_score

View File

@ -8,6 +8,8 @@ class Organization < ActiveRecord::Base
has_many :org_courses, :dependent => :destroy
has_many :org_subfields, :dependent => :destroy
has_many :users, :through => :org_members
has_many :files
acts_as_attachable
validates_uniqueness_of :name
after_create :save_as_org_activity, :add_default_subfields

View File

@ -42,9 +42,9 @@ class Principal < ActiveRecord::Base
if q.blank?
where({})
else
pattern = "%#{q}%"
pattern = "%#{q}%".gsub("/","//").gsub("_","/_")
# sql = %w(login firstname lastname mail).map {|column| "LOWER(#{table_name}.#{column}) LIKE LOWER(:p)"}.join(" OR ")
sql= "LOWER(concat(lastname,firstname)) LIKE LOWER(:p) or LOWER(login) LIKE LOWER(:p) or LOWER(mail) LIKE LOWER(:p)"
sql= "LOWER(concat(lastname,firstname)) LIKE LOWER(:p) escape '/' or LOWER(login) LIKE LOWER(:p) escape '/' or LOWER(mail) LIKE LOWER(:p) escape '/'"
params = {:p => pattern}
if q =~ /^(.+)\s+(.+)$/
a, b = "#{$1}%", "#{$2}%"

View File

@ -108,7 +108,8 @@ class Project < ActiveRecord::Base
has_many :tags, :through => :project_tags, :class_name => 'Tag'
has_many :project_tags, :class_name => 'ProjectTags'
# 动态级联删除
has_many :forge_activities, :class_name => 'ForgeActivity', :dependent => :destroy
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
#has_many :forge_activities, :class_name => 'ForgeActivity', :as =>:forge_act, :dependent => :destroy
# 关联虚拟表
has_many :forge_messages, :class_name =>'ForgeMessage', :as => :forge_message, :dependent => :destroy
@ -1212,9 +1213,7 @@ class Project < ActiveRecord::Base
# Author lizanle
# Description 新建项目要在ForgeActivities中加一条数据。
def acts_as_forge_activities
fa = ForgeActivity.new(:user_id => User.current.id,:project_id => self.id,
:forge_act_id => self.id,:forge_act_type => "ProjectCreateInfo")
fa.save!
self.forge_acts << ForgeActivity.new(:user_id => User.current.id, :project_id => self.id)
end

View File

@ -339,13 +339,15 @@ class User < Principal
message_new_time.onclick_time = User.current.last_login_on.nil? ? Time.now : User.current.last_login_on
message_new_time.save
end
course_count = CourseMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
forge_count = ForgeMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
system_messages_count = SystemMessage.where("created_at >?", User.current.onclick_time.onclick_time).count
at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", User.current.id,0, User.current.onclick_time.onclick_time).count
user = User.current
onclick_time = user.onclick_time.onclick_time
course_count = CourseMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
forge_count = ForgeMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
system_messages_count = SystemMessage.where("created_at >?", onclick_time).count
at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", user.id,0, onclick_time).count
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count
end

View File

@ -22,24 +22,27 @@
提交作品数
</th>
<th style="width: 70px;">
提交截止日期
作业发布日期
</th>
</tr>
</thead>
<tbody>
<%@count=@page*30 %>
<% for homework in @homework do %>
<% unless homework.nil? %>
<% @count+=1 %>
<tr>
<td align="center">
<%=@count %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=homework.name%>'>
<%=link_to(homework.name, student_work_index_path(:homework => homework.id))%>
<%=link_to(homework.try(:name), student_work_index_path(:homework => homework.id))%>
</td>
<% if homework.course %>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=homework.course.name%>'>
<%= link_to(homework.course.name, course_path(homework.course.id)) %>
</td>
<% end %>
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if homework.try(:user).try(:realname) == ' '%><%= homework.try(:user)%><% else %><%=homework.try(:user).try(:realname) %><% end %>'>
<% if homework.try(:user).try(:realname) == ' '%>
<%= link_to(homework.try(:user), user_path(homework.user_id)) %>
@ -51,9 +54,10 @@
<%=link_to(StudentWork.where('homework_common_id=?',homework.id).count, student_work_index_path(:homework => homework.id))%>
</td>
<td align="center">
<%=format_date(homework.end_time) %>
<%=format_date( homework.created_at ) %>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>

View File

@ -24,7 +24,8 @@
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align:center;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=org.name%>'>
<span>
<%= link_to org.name,home_path(:organization => org.id) %>
<%#= link_to org.name,home_path(:organization => org.id) %>
<%= link_to org.name, organization_path(org) %>
</span>
</td>
<td align="center">

View File

@ -2,20 +2,7 @@
<%= import_ke(enable_at: false, prettify: false) %>
<%= javascript_include_tag "create_kindeditor" %>
<% end %>
<style type="text/css">
/*回复框*/
/*.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}*/
/*.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-outline {border: none;}*/
/*.homepagePostReplyInputContainer .ke-inline-block {display: none;}*/
/*.homepagePostReplyInputContainer .ke-container {float: left;}*/
</style>
<% if topics%>
<% if topics %>
<% topics.each do |topic| %>
<script>
function expand_reply(container, btnid) {
@ -44,19 +31,12 @@
});
</script>
<% if topic %>
<%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id,:is_course=>1,:is_board=>1} %>
<%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id, :is_course => 1, :is_board=>1} %>
<% end %>
<% end %>
<% if topics.count == 10 %>
<!--<div id="show_more_course_topic" class="loadMore mt10 f_grey">展开更多<%#= link_to "", boards_topic_path(@board, :course_id => @board.course.id ,:page => page), :id => "more_topic_link", :remote => "true", :class => "none" %></div>-->
<%= link_to "点击展开更多",boards_topic_path(@board, :course_id => @board.course.id ,:page => page),:id => "show_more_course_topic",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end %>
<% end%>
<!--
<script type="text/javascript">
$("#show_more_course_topic").mouseover(function () {
$("#more_topic_link").click();
});
</script>-->

View File

@ -192,6 +192,4 @@ function nh_init_board(params){
});
}
}
</script>

View File

@ -50,7 +50,7 @@
</script>
<style type="text/css">
</style>
<% course_activities.each do |activity| if course_activities %>
<% course_activities.includes(:course_act).each do |activity| if course_activities %>
<script>
function expand_reply(container, btnid) {
var target = $(container);
@ -73,7 +73,7 @@
sd_create_editor_from_data(<%= activity.id%>, null, "100%", "<%= activity.class.to_s %>");
});
</script>
<% if activity && activity.course_act%>
<% if activity && activity.course_act %>
<% act = activity.course_act %>
<% case activity.course_act_type.to_s %>
<% when 'HomeworkCommon' %>

View File

@ -0,0 +1,59 @@
<% unless contributor_course_scor(course.id).count == 0 %>
<ul class="rankList">
<h4>课程活跃度
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor: pointer; position:relative;">积分规则</a>
</h4>
<div class="numIntro undis" style="cursor:pointer;">
<div class="active-degree-rule">
积分规则<br/>
资源发布:资源数 x 5 <br/>
问答发布:发帖数 x 2 <br/>
通知发布:通知数 x 1 <br/>
问答回复:回复数 x 1 <br/>
作业留言:留言数 x 1 <br/>
通知留言:留言数 x 1 <br/>
课程留言:留言数 x 1 <br/>
总得分为以上得分之和</div>
</div>
<% contributor_course_scor(course.id).each do |contributor_score| %>
<% total_score = contributor_score.resource_num.to_i * 5 + contributor_score.message_num.to_i * 2 +
contributor_score.message_reply_num.to_i * 1 + contributor_score.journal_num.to_i * 1 +
+ contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_num.to_i * 1 +
contributor_score.news_num.to_i * 1 %>
<% unless total_score ==0 %>
<li><%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %>
<p><%=link_to contributor_score.user.show_name, user_path(contributor_score.user.id), :title => contributor_score.user.show_name %></p>
<p><span class="c_green" style="cursor:pointer">
<a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))" class="c_green">
<%=total_score %></a></span></p>
<div style="display: none" class="numIntro">
<div class="contributor-course-calculate">积分计算</div>
<%# unless contributor_score.resource_num.to_i == 0 %>
<div style="padding-left: 2px;padding-bottom: 2px;padding-right: 2px">
资源发布数 x 5 = <%= contributor_score.resource_num.to_i %> x 5 = <%= contributor_score.resource_num.to_i * 5 %></br>
<%# end %>
<%# unless contributor_score.message_num.to_i == 0 %>
问答发布数 x 2 = <%= contributor_score.message_num.to_i %> x 2 = <%= contributor_score.message_num.to_i * 2 %></br>
通知发布数 x 1 = <%= contributor_score.news_num.to_i %> x 1 = <%= contributor_score.news_num.to_i %></br>
<%# end %>
<%# unless contributor_score.message_reply_num.to_i == 0 %>
问答回帖数 x 1 = <%= contributor_score.message_reply_num.to_i %> x 1 = <%= contributor_score.message_reply_num.to_i %></br>
作业留言数 x 1 = <%= contributor_score.homework_journal_num.to_i %> x 1 = <%= contributor_score.homework_journal_num.to_i %></br>
通知留言数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %></br>
<%# end %>
<%# unless contributor_score.journal_num.to_i == 0 %>
课程留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %></br>
<%# end %>
<%# unless contributor_score.homework_journal_num.to_i == 0 %>
<%# end %>
<%# unless contributor_score.news_reply_num.to_i == 0 %>
<%# end %>
总得分:<%=total_score %>
</div>
</div>
</li>
<% end %>
<% end %>
<div class="cl"></div>
</ul>
<% end %>

View File

@ -0,0 +1,21 @@
<% hero_homework_scores = hero_homework_score(course, "desc") %>
<% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %>
<ul class="rankList">
<h4><span>课程英雄榜</span>
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor:pointer;">积分规则</a></h4>
<div style="cursor:pointer;" class="numIntro undis">
<div class="hero-degree-rule">积分规则<br/>
英雄榜的得分是每个同学作业的得分总和
</div>
</div>
<% hero_homework_scores.each do |student_score| %>
<% if student_score.score.to_i != 0 %>
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %></a>
<p><a href="javascript:void:(0);"><%=link_to student_score.user.show_name, user_path(student_score.user), :title => student_score.user.show_name %></a></p>
<p><span class="c_red" style="cursor:pointer" ><%= student_score.score<0 ? 0 : student_score.score.to_i %></span></p>
</li>
<% end %>
<% end %>
<div class="cl"></div>
</ul>
<% end %>

View File

@ -1,9 +1,8 @@
<% unless excellent_course_recommend(course).length == 0 %>
<% exc_course = excellent_course_recommend(course) %>
<% unless exc_course.length == 0 %>
<ul class="courseR mb10">
<h4 class="mb5" ><%= l(:label_homework_recommendation) %></h4>
<% excellent_course_recommend(course).each do |e_course| %>
<% e_course = Course.find(e_course) %>
<% exc_course.each do |e_course| %>
<li class="mt15"> <%= image_tag(url_to_avatar(e_course), :width => "40", :height => "40", :class => "fl mr10 rankPortrait", :alt => "logo") %>
<div class="fl">
<p class="f12 mb5"><%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %><div class="cl"></div> </p>
@ -15,8 +14,8 @@
<span class="fl fontGrey4"><%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.where("publish_time <= '#{Date.today}'").count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>)</span>
<% end %>
<div class="cl"></div>
</p>
</div>
</p>
</div>
<div class="cl"></div>
</li>
<% end %>

View File

@ -0,0 +1,9 @@
<% if @order == "asc" %>
按&nbsp;<%= link_to "时间",params.merge(:sort => "created_on:desc", :order => order,:tag_name => tag_name,:name => search_name),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort => "downloads:desc", :order => order,:tag_name => tag_name,:name => search_name),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %>&nbsp;/&nbsp;
<%= link_to "引用次数",params.merge(:sort => "quotes:desc", :order => order,:tag_name => tag_name,:name => search_name),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %>&nbsp;排序
<% else %>
按&nbsp;<%= link_to "时间",params.merge(:sort => "created_on:asc", :order => order, :tag_name => tag_name,:name => search_name),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort => "downloads:asc", :order => order, :tag_name => tag_name,:name => search_name),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %>&nbsp; /&nbsp;
<%= link_to "引用次数",params.merge(:sort =>"quotes:asc", :order => order, :tag_name => tag_name,:name => search_name),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %>&nbsp;排序
<% end %>

View File

@ -0,0 +1,32 @@
<span class="add_attachment" data-containerid="<%= container.id %>">
<button name="button" class="sub_btn" onclick="_file<%=container.id %>.click()" onmouseover="this.focus()" style="<%= ie8? ? 'display:none' : ''%>" type="button" ><%= l(:label_browse_org) %></button>
<%= file_field_tag 'attachments[dummy][file]',
:id => "_file#{container.id}",
:class => ie8? ? '':'file_selector',
:multiple => true,
:onchange => "addInputFiles_board(this, '#{container.id}','"+"submit_resource"+"');",
:style => ie8? ? '': 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:upload_path => uploads_path(:format => 'js'),
:description_placeholder => l(:label_optional_description),
:field_is_public => l(:field_is_public),
:are_you_sure => l(:text_are_you_sure),
:file_count => l(:label_file_count),
:delete_all_files => l(:text_are_you_sure_all),
:lebel_file_uploding => l(:lebel_file_uploding),
:containerid => "#{container.id}"
} %>
</span>
<!--<input type="submit" name="" value="上传文件" class="f_l ml10" style="width:80px; height:26px;">-->
<span id="upload_file_count<%=container.id %>">
建议上传高度不超过52px的图片
</span>
<div class="cl"></div>
<div>
<span id="attachments_fields<%= container.id %>" data-containerid="<%= container.id %>" xmlns="http://www.w3.org/1999/html">
</span>
</div>

View File

@ -0,0 +1,32 @@
<span class="add_attachment" data-containerid="<%= container.id %>">
<button name="button" class="sub_btn" onclick="_file<%=container.id %>.click()" onmouseover="this.focus()" style="<%= ie8? ? 'display:none' : ''%>" type="button" ><%= l(:label_browse_org) %></button>
<%= file_field_tag 'attachments[dummy][file]',
:id => "_file#{container.id}",
:class => ie8? ? '':'file_selector',
:multiple => true,
:onchange => "addInputFiles_board(this, '#{container.id}','"+"submit_resource"+"');",
:style => ie8? ? '': 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:upload_path => uploads_path(:format => 'js'),
:description_placeholder => l(:label_optional_description),
:field_is_public => l(:field_is_public),
:are_you_sure => l(:text_are_you_sure),
:file_count => l(:label_file_count),
:delete_all_files => l(:text_are_you_sure_all),
:lebel_file_uploding => l(:lebel_file_uploding),
:containerid => "#{container.id}"
} %>
</span>
<!--<input type="submit" name="" value="上传文件" class="f_l ml10" style="width:80px; height:26px;">-->
<span id="upload_file_count<%=container.id %>">
建议上传 长度为1452px/高度为304px 的图片
</span>
<div class="cl"></div>
<div>
<span id="attachments_fields<%= container.id %>" data-containerid="<%= container.id %>" xmlns="http://www.w3.org/1999/html">
</span>
</div>

View File

@ -56,16 +56,8 @@
</div>
<div class="cl"></div>
<p class="f_l fontBlue f_b f_14">共有&nbsp;<span id="attachment_count"><%= User.current.member_of_org?(@org_subfield.organization) ? @all_attachments.count : @all_attachments.select{|attach| attach.is_public == 1 }.count %></span>&nbsp;个资源</p>
<p class="f_r" style="color: #808080">
<% if @order == "asc" %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %>&nbsp;/&nbsp;
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %>&nbsp;排序
<% else %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %>&nbsp; /&nbsp;
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %>&nbsp;排序
<% end %>
<p class="f_r" style="color: #808080" id="org_sort">
<%= render :partial => 'files/org_order_filter', :locals => {:order => @order, :sort => @sort, :tag_name => @tag_name, :search_name => nil} %>
</p>
</div>
<div class="cl"></div>

View File

@ -0,0 +1,25 @@
<div id="popbox_upload" class="mb10" style="margin-top: -30px;color:#15bccf; font-size:16px;">
<div class="upload_con">
<h2 style="text-align: center">更换Logo</h2>
<div class="upload_box">
<%= error_messages_for 'attachment' %>
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
<%= form_tag(organization_files_path(org, :in_org => params[:in_org], :logo => true), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<!--<input type="hidden" name="org_subfield_attachment_type" value="<%#= org_subfield_attachment_type%>">-->
<%= render :partial => 'files/org_upload_attachment_list', :locals => {:container => org}%>
<div class="cl"></div>
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
<a id="submit_org_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
<% end %>
</div>
</div>
</div>
<script>
function submit_resource()
{
$('#submit_org_resource').parent().submit();
}
</script>

View File

@ -0,0 +1,25 @@
<div id="popbox_upload" class="mb10" style="margin-top: -30px;color:#15bccf; font-size:16px;">
<div class="upload_con">
<h2 style="text-align: center">更换背景图片</h2>
<div class="upload_box">
<%= error_messages_for 'attachment' %>
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
<%= form_tag(organization_files_path(org, :in_org => params[:in_org]), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<!--<input type="hidden" name="org_subfield_attachment_type" value="<%#= org_subfield_attachment_type%>">-->
<%= render :partial => 'files/org_upload_attachment_list_banner', :locals => {:container => org}%>
<div class="cl"></div>
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
<a id="submit_org_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
<% end %>
</div>
</div>
</div>
<script>
function submit_resource()
{
$('#submit_org_resource').parent().submit();
}
</script>

View File

@ -1,71 +1,75 @@
<% if @addTag%>
<% if @obj_flag == '3'%>
$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name',
<% if @obj_flag == '3'%>
$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
//$('#put-tag-form-issue').hide();
$('#name-issue').val("");
<% elsif @obj_flag == '6'%>
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name',
//$('#put-tag-form-issue').hide();
$('#name-issue').val("");
<% elsif @obj_flag == '6'%>
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
$("#put-tag-form- <%=@obj.class%>- <%=@obj.id%>").hide();
$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%> #name").val("");
<% else %>
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name',
$("#put-tag-form- <%=@obj.class%>- <%=@obj.id%>").hide();
$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%> #name").val("");
<% else %>
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
$('#tags_show').html('<%=render_attachments_tag_save(@project, nil)%>');
$('#put-tag-form #name').val("");
//$('#put-tag-form').hide();
<% end %>
$('#tags_show').html('<%=render_attachments_tag_save(@project, nil)%>');
$('#put-tag-form #name').val("");
//$('#put-tag-form').hide();
<% end %>
<% else %>
$("#attachments_fields").children().remove();
$("#upload_file_count").text("未上传文件");
$('#upload_file_div').slideToggle('slow');
<% if @project %>
hideModal();
<% if @in_project_toolbar %>
window.location.href = '<%= project_files_path(@project) %>'
<% else %>
<% if @project %>
hideModal();
<% if @in_project_toolbar %>
window.location.href = '<%= project_files_path(@project) %>'
<% else %>
$("#resource_list").html('<%= j(render partial:"project_file", locals: {project: @project}) %>');
$("#project_files_count_info").html("<%= @all_attachments.count %>");
$("#project_files_count_nav").html("(<%= @all_attachments.count %>)")
// 添加文件上传成功提示
<% unless params[:attachments].nil? %>
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
$("#course_list").prepend(div);
setTimeout( function(){div.remove();},3000)
<% end %>
<% end %>
<%elsif @course%>
hideModal();
<%if @in_course_toolbar %>
window.location.href='<%= course_files_path(@course)%>'
<%else%>
$("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>');
$("#courses_files_count_info").html("<%= @all_attachments.count%>");
$("#courses_files_count_nav").html("(<%= @all_attachments.count%>)")
// 添加文件上传成功提示,
<% unless params[:attachments].nil? %>
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
$("#course_list").prepend(div);
setTimeout( function(){div.remove();},3000)
<% end %>
<%end%>
<% elsif @org_subfield %>
<% if params[:in_org] %>
window.location.href = '<%= org_subfield_files_path @org_subfield %>';
<%else %>
hideModal();
$("#resource_list").html('<%= j(render partial: "subfield_files" ,locals: {org_subfield: @org_subfield}) %>');
// 添加文件上传成功提示,
<% unless params[:attachments].nil? %>
$("#resource_list").html('<%= j(render partial:"project_file", locals: {project: @project}) %>');
$("#project_files_count_info").html("<%= @all_attachments.count %>");
$("#project_files_count_nav").html("(<%= @all_attachments.count %>)")
// 添加文件上传成功提示
<% unless params[:attachments].nil? %>
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
$("#course_list").prepend(div);
setTimeout( function(){div.remove();},3000)
<% end %>
<% end %>
<%elsif @course%>
hideModal();
<%if @in_course_toolbar %>
window.location.href='<%= course_files_path(@course)%>'
<%else%>
$("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>');
$("#courses_files_count_info").html("<%= @all_attachments.count%>");
$("#courses_files_count_nav").html("(<%= @all_attachments.count%>)")
// 添加文件上传成功提示,
<% unless params[:attachments].nil? %>
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
$("#course_list").prepend(div);
setTimeout( function(){div.remove();},3000)
<% end %>
<%end%>
<% elsif @org_subfield %>
<% if params[:in_org] %>
window.location.href = '<%= org_subfield_files_path @org_subfield %>';
<%else %>
hideModal();
$("#resource_list").html('<%= j(render partial: "subfield_files" ,locals: {org_subfield: @org_subfield}) %>');
// 添加文件上传成功提示,
<% unless params[:attachments].nil? %>
// var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
// $("#org_subfield_list").prepend(div);
// setTimeout( function(){div.remove();},3000);
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<% elsif @organization %> //组织单独处理
hideModal();
window.location.href = '<%= organization_path @organization %>';
<% end %>
<% end %>
$(document).ready(img_thumbnails);

View File

@ -5,4 +5,6 @@
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'org_subfield_list',
:locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>");
$("#attachment_count").html("<%= @result.count %>");
$("#org_sort").html("<%= escape_javascript(render :partial => 'org_order_filter',
:locals => {:sort => @sort, :order => @order, :tag_name => @tag_name, :search_name => @q}) %>");
<% end %>

View File

@ -1,3 +1,5 @@
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'org_subfield_list',
:locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>");
$("#attachment_count").html("<%= @result.count %>");
$("#attachment_count").html("<%= @result.count %>");
$("#org_sort").html("<%= escape_javascript(render :partial => 'org_order_filter',
:locals => {:sort => @sort, :order => @order, :tag_name => @tag_name,:search_name => @q}) %>");

View File

@ -24,19 +24,6 @@
</ul>
</div>
<script>
<%# type = type%>
// $(function (){
// if('<%#= type %>' != null && '<%#= type %>' == 'courses' ){
// $('input:radio[value="courses"]').attr('checked','checked');
// }
// if('<%#= type %>' != null && '<%#= type %>' == 'projects' ){
// $('input:radio[value="projects"]').attr('checked','checked');
// }
// if('<%#= type %>' != null && '<%#= type %>' == 'users' ){
// $('input:radio[value="users"]').attr('checked','checked');
// }
// });
$(function(){
$("#navHomepageSearchInput").keypress(function(e){
var name = $.trim($('#navHomepageSearchInput').val());
@ -65,23 +52,6 @@
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>
<% end %>
<!--<div class="navSearchTypeBox" id="navHomepageSearchType">-->
<!--<div class="fl mr15 mt8">-->
<!--<input type="radio" value="courses" name="search_type" checked/>-->
<!--课程-->
<!--</div>-->
<!--<div class="fl mr15 mt8">-->
<!--<input type="radio" value="projects" name="search_type" />-->
<!--项目-->
<!--</div>-->
<!--<div class="fl mr15 mt8">-->
<!--<input type="radio" value="users" name="search_type" />-->
<!--用户-->
<!--</div>-->
<!--<div id="navSearchAlert" class="fr mr10">-->
<!--<span class="c_red">请选择搜索类型</span>-->
<!--</div>-->
<!--</div>-->
</div>
<div class="navHomepageProfile" id="navHomepageProfile">

View File

@ -1,80 +1,40 @@
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<% teacher_num = searchTeacherAndAssistant(@course).count %>
<% teacher_num = TeacherAndAssistantCount(@course) %>
<% student_num = studentCount(@course) %>
<% course_file_num = visable_attachemnts_incourse(@course).count%>
<% course_file_num = visable_attachemnts_incourse(@course).count %>
<div class="pr_info_logo fl mr10 mb5">
<% if is_excellent_course(@course) %>
<img src="/images/course/boutique.png" width="50" height="auto" alt="精品" class="boutiqueP" />
<% end %>
<!--<a href="#"><img src="images/courses/pic_courses.jpg" width="60" height="60" alt="logo" /></a>-->
<%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %>
</div>
<div class="pr_info_id fl mb5 f14">ID:<%= @course.id%><%= @course.is_public == 0 ? "(私有)" : "(公开)" %>
<div class="pr_info_id fl mb5 f14">ID:<%= @course.id %><%= @course.is_public == 0 ? "(私有)" : "(公开)" %>
<% if is_excellent_course(@course) %>
<img src="/images/course/medal.png" alt="精品课程" style="vertical-align:bottom;" class="ml5" />
<% end %>
</div>
<div class="pr_info_id fl f14">
<% unless is_teacher %>
<!--<a href="" class="pr_join_a f12">加入课程</a>-->
<div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div>
<div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div>
<% end %>
</div>
<!--<div class="pr_info_id fl mb5 f14">
ID:<%#= @course.id%>
</div>
<div class="pr_info_join fl">
<%# if is_teacher%>
<%#= link_to "<span class='pr_setting'></span>#{l(:button_configure)}".html_safe, {:controller => 'courses', :action => 'settings', :id => @course}, :class => "pr_join_a" %>
<%#= set_course_time @course%>
<%#= link_to "<span class='pr_copy'></span>#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %>
<%# else%>
<div id="join_in_course_header"><%#= join_in_course_header(@course, User.current) %></div>
<%# end%>
</div>-->
<div class="cl"></div>
<!--<div >-->
<!--<a class="pr_info_name fl c_dark fb break_word" href="http://<%#= Setting.host_course%>/courses/<%#= @course.id%>" target="_blank">-->
<!--<%#= @course.name %>-->
<!--</a>-->
<!--<%# if @course.is_public == 0%>-->
<!--<span class="img_private ">-->
<!--<%#= l(:field_is_private)%>-->
<!--</span>-->
<!--<%# end %>-->
<!--<%#if @course.tea_id == User.current.id && @course.outline == 0 %>-->
<!--<span>-->
<!--<a href="javascript:void(0)" onclick="course_outline('<%#= @course.id%>');">设置大纲</a>-->
<!--</span>-->
<!--<%# else%>-->
<!--<span>-->
<!--<a href="javascript:void(0)" onclick="course_outline('<%#= @course.id%>');">设置大纲</a>-->
<!--</span>-->
<!--<%# end %>-->
<!--</div>-->
<div >
<a class="pr_info_name fl c_dark fb break_word" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank"></a>
<div>
<a class="pr_info_name c_dark fb break_word fl" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank">
<%= @course.name %>
</a>
<%# if @course.is_public == 0%>
<!--<span class="img_private "></span>-->
<!--<span class="img_private mr5 fl">
<%#= l(:field_is_private)%>
</span>-->
<%# end %>
<span id="course_outline_bar">
<%if User.current && @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %>
<% if User.current && @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %>
<a href="javascript:void(0);" title="设置课程大纲" onclick="course_outline('<%= @course.id%>')" class="mr5 syllabusSetting fl"> </a>
<% elsif User.current && @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0%>
<% elsif User.current && @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0 %>
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<% elsif User.current && @course.tea_id != User.current.id && !@course.is_public? && User.current.member_of_course?(@course) && @course.outline != 0%>
<% elsif User.current && @course.tea_id != User.current.id && !@course.is_public? && User.current.member_of_course?(@course) && @course.outline != 0 %>
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<% elsif User.current && @course.tea_id != User.current.id && @course.is_public? && @course.outline != 0%>
<% elsif User.current && @course.tea_id != User.current.id && @course.is_public? && @course.outline != 0 %>
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<%else%>
<%else %>
<%end %>
</span>
</div>

View File

@ -68,6 +68,10 @@
</ul>
</div>
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @course %>
<%# over %>
<div class="subNavBox">
<% unless show_nav?(@course.course_activities.count) %>
<div class="subNav">
@ -138,94 +142,11 @@
</ul>
<% end %>
</div><!--项目侧导航 end-->
<%# 课程贡献榜 %>
<%# 课程活跃度 %>
<div class="cl"></div>
<% unless contributor_course_scor(@course.id).count == 0 %>
<ul class="rankList">
<h4>课程活跃度
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor: pointer; position:relative;">积分规则</a>
</h4>
<div class="numIntro undis" style="cursor:pointer;">
<div class="active-degree-rule">
积分规则<br/>
资源发布:资源数 x 5 <br/>
问答发布:发帖数 x 2 <br/>
通知发布:通知数 x 1 <br/>
问答回复:回复数 x 1 <br/>
作业留言:留言数 x 1 <br/>
通知留言:留言数 x 1 <br/>
课程留言:留言数 x 1 <br/>
总得分为以上得分之和</div>
</div>
<% contributor_course_scor(@course.id).each do |contributor_score| %>
<% total_score = contributor_score.resource_num.to_i * 5 + contributor_score.message_num.to_i * 2 +
contributor_score.message_reply_num.to_i * 1 + contributor_score.journal_num.to_i * 1 +
+ contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_num.to_i * 1 +
contributor_score.news_num.to_i * 1 %>
<% unless total_score ==0 %>
<li><%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %>
<p><%=link_to contributor_score.user.show_name, user_path(contributor_score.user.id), :title => contributor_score.user.show_name %></p>
<p><span class="c_green" style="cursor:pointer">
<a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))" class="c_green">
<%=total_score %></a></span></p>
<div style="display: none" class="numIntro">
<div class="contributor-course-calculate">积分计算</div>
<%# unless contributor_score.resource_num.to_i == 0 %>
<div style="padding-left: 2px;padding-bottom: 2px;padding-right: 2px">
资源发布数 x 5 = <%= contributor_score.resource_num.to_i %> x 5 = <%= contributor_score.resource_num.to_i * 5 %></br>
<%# end %>
<%# unless contributor_score.message_num.to_i == 0 %>
问答发布数 x 2 = <%= contributor_score.message_num.to_i %> x 2 = <%= contributor_score.message_num.to_i * 2 %></br>
通知发布数 x 1 = <%= contributor_score.news_num.to_i %> x 1 = <%= contributor_score.news_num.to_i %></br>
<%# end %>
<%# unless contributor_score.message_reply_num.to_i == 0 %>
问答回帖数 x 1 = <%= contributor_score.message_reply_num.to_i %> x 1 = <%= contributor_score.message_reply_num.to_i %></br>
作业留言数 x 1 = <%= contributor_score.homework_journal_num.to_i %> x 1 = <%= contributor_score.homework_journal_num.to_i %></br>
通知留言数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %></br>
<%# end %>
<%# unless contributor_score.journal_num.to_i == 0 %>
课程留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %></br>
<%# end %>
<%# unless contributor_score.homework_journal_num.to_i == 0 %>
<%# end %>
<%# unless contributor_score.news_reply_num.to_i == 0 %>
<%# end %>
总得分:<%=total_score %>
</div>
</div>
</li>
<% end %>
<% end %>
<div class="cl"></div>
</ul>
<% end %>
<% hero_homework_scores = hero_homework_score(@course, "desc") %>
<% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %>
<ul class="rankList">
<h4><span>课程英雄榜</span>
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor:pointer;">积分规则</a></h4>
<div style="cursor:pointer;" class="numIntro undis">
<div class="hero-degree-rule">积分规则<br/>
英雄榜的得分是每个同学作业的得分总和
</div>
</div>
<% hero_homework_scores.each do |student_score| %>
<% if student_score.score.to_i != 0 %>
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %></a>
<p><a href="javascript:void:(0);"><%=link_to student_score.user.show_name, user_path(student_score.user), :title => student_score.user.show_name %></a></p>
<p><span class="c_red" style="cursor:pointer" ><%= student_score.score<0 ? 0 : student_score.score.to_i %></span></p>
</li>
<% end %>
<% end %>
<div class="cl"></div>
</ul>
<% end %>
<%= render :partial => 'courses/course_activity_users', :locals => {:course => @course} %>
<%# 课程英雄榜 %>
<%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %>
<% if @course.description && !@course.description.blank? %>
<div class="project_intro">

View File

@ -90,8 +90,8 @@
<% end%>
</div>
<!--<div class="orgName fl mb5 f14">组织id<%#= @organization.id %></div>-->
<div class="orgName fl mb5 f14">
<%= link_to @organization.name, organization_path(@organization.id), :class=>"pr_info_name fl c_dark fb break_word" %>
<div class="orgName fl mb5 f14" title="<%= @organization.name %>">
<%= link_to truncate(@organization.name,:length => 26), organization_path(@organization.id), :class=>"pr_info_name c_dark fb break_word" %>
<% if User.current.logged? %>
<% if @organization.is_public? %>
<span class="img_private"><%= l(:label_public)%></span>

View File

@ -0,0 +1,422 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><%= h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'org_new_style','jquery/jquery-ui-1.9.2' %>
<%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%>
<%= javascript_include_tag 'attachments' %>
<%#= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%#= yield :header_tags -%>
<!-- MathJax的配置 -->
<script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
<script>
jQuery(document).ready(function($){
// browser window scroll (in pixels) after which the "back to top" link is shown
var offset = 300,
//browser window scroll (in pixels) after which the "back to top" link opacity is reduced
offset_opacity = 1200,
//duration of the top scrolling animation (in ms)
scroll_top_duration = 700,
//grab the "back to top" link
$back_to_top = $('.cd-top');
//hide or show the "back to top" link
$(window).scroll(function(){
( $(this).scrollTop() > offset ) ? $back_to_top.addClass('cd-is-visible') : $back_to_top.removeClass('cd-is-visible cd-fade-out');
if( $(this).scrollTop() > offset_opacity ) {
$back_to_top.addClass('cd-fade-out');
}
});
//smooth scroll to top
$back_to_top.on('click', function(event){
event.preventDefault();
$('body,html').animate({
scrollTop: 0 ,
}, scroll_top_duration
);
});
});
</script>
</head>
<!--add by huang-->
<script type="text/javascript">
function orge_new_files_upload()
{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_org_new_files',:locals => {:org => @organization, :org_attachment_type => 1}) %>');
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
}
function orge_new_files_banner_upload()
{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_org_new_files_banner',:locals => {:org => @organization, :org_attachment_type => 1}) %>');
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
}
</script>
<body onload="prettyPrint();">
<div class="cl"></div>
<div class="container">
<div class="header">
<div class="header-con">
<% if User.current.admin_of_org?(@organization) %>
<div class="logo fl">
<a class="logo-img"><img src="/images/org_new_style/logo.jpg" alt=""/></a>
<a href="" class="logo-add" title="点击替换LOGO" onclick="orge_new_files_upload();"></a>
</div>
<% else %>
<div class="logo fl">
<a class="logo-img"><img src="/images/org_new_style/logo.jpg" alt=""/></a>
</div>
<% end %>
<%= render :partial => 'organizations/org_logined_header' %>
</div>
<div class="cl"></div>
</div><!--header end-->
<div class="nav-box">
<div class="nav-con">
<div class="nav fl">
<% @subfield_content.each do |field| %>
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'activity' %>
<%= link_to "首页", organization_path(@organization), :class => "fl navact" %>
<% when 'course' %>
<a href="#course_<%= field.id %>" class="fl"> 课程动态</a>
<% when 'project' %>
<a href="#project_<%= field.id %>" class="fl">项目动态</a>
<% end %>
<% else %>
<% if field.field_type == "Post" && field.hide == 0 %>
<a href="#message_<%= field.id %>" class="fl"><%= field.name %></a>
<% elsif field.field_type == "Resource" && field.hide == 0 %>
<a href="#resource_<%= field.id %>" class="fl"><%= field.name %></a>
<% end %>
<% end %>
<% end %>
<% if User.current.admin_of_org?(@organization) %>
<a href="<%= setting_organization_path(@organization) %>" class="fl">配置</a>
<% end %>
</div>
<div class="cl"></div>
</div>
</div>
<!--nav end-->
<div class="banner">
<div class="banner-inner">
<% if User.current.admin_of_org?(@organization) %>
<% if @org_banner_attchment.blank? %>
<img class="banner-img" src="/images/org_new_style/banner.jpg" alt=""/>
<% else %>
<img src="/attachments/<%= @org_banner_attchment.id %>/<%= @org_banner_attchment.filename %>" class="banner-img">
<% end %>
<a href="#" class="banner-add" title="点击替换图片" onclick="orge_new_files_banner_upload();"></a>
<div class="banner-txt">
<p ><%= @organization.name %></p>
</div>
<% else %>
<% if @org_banner_attchment.blank? %>
<img class="banner-img" src="/images/org_new_style/banner.jpg" alt=""/>
<% else %>
<img src="/attachments/<%= @org_banner_attchment.id %>/<%= @org_banner_attchment.filename %>" class="banner-img">
<% end %>
<div class="banner-txt">
<p ><%= @organization.name %></p>
</div>
<% end %>
</div>
</div>
<!--模块-->
<% @subfield_content.each do |field| %>
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'course' %>
<div class="box1 bg-grey" style="display:<%= field.hide == 0?'block':'none' %>;">
<% if field.status == 0 %>
<div class="content ">
<div class="box-top" id="course_<%= field.id %>"><h2 class="box-title">课程动态</h2></div>
<% if @course_acts.blank? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% else %>
<div class="course-list">
<ul class="clearfix">
<% unless @course_acts.nil? %>
<%= render :partial => 'organizations/org_new_course_pic', :locals => {:activities => @course_acts.first(3)} %>
<% end %>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
</ul>
</div>
<% end %>
</div><!--content end-->
<% else %>
<div class="content">
<div class="box-top" id="course_<%= field.id %>"><h2 class="box-title">课程动态</h2></div>
<% if @course_acts.blank? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% else %>
<div class="row">
<%= render :partial => 'organizations/org_new_course_act_list', :locals =>{:activities => @course_acts, :field => field, :organization => @organization} %>
<!--row-ziyuan end-->
</div>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% end %>
</div><!--row end-->
<% end %>
</div><!--box1 end-->
<% when 'project' %>
<div class="box1" style="display:<%= field.hide == 0?'block':'none' %>;">
<% if field.status == 0 %>
<div class="content ">
<div class="box-top" id="project_<%= field.id %>"><h2 class="box-title">项目动态</h2><p class="box-title-p"></p></div>
<% if @project_acts.blank? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% else %>
<div class="course-list">
<ul class="clearfix">
<% unless @project_acts.nil? %>
<%= render :partial => 'organizations/org_new_project_pic', :locals => {:activities => @project_acts.first(3)} %>
<% end %>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
</ul>
</div>
<% end %>
</div><!--content end-->
<% else %>
<div class="content">
<div class="box-top" style="display:<%= field.hide == 0?'block':'none' %>;" id="project_<%= field.id %>"><h2 class="box-title">项目动态</h2><p class="box-title-p"></p></div>
<% if @project_acts.blank? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% else %>
<div class="row">
<%= render :partial => 'organizations/org_new_project_act_list', :locals =>{:activities => @project_acts, :field => field, :organization => @organization} %>
<!--row-ziyuan end-->
</div>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% end %>
</div><!--row end-->
<% end %>
</div>
<% end %>
<% else %>
<% if field.field_type == "Post" %> <%# 讨论类型 %>
<% org_subfield = OrgSubfield.find(field.id) %>
<% org_subfield_ids = org_subfield.org_document_comments.map(&:id) << 0 %>
<% org_acts = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{org_subfield.id})").order('updated_at desc') %>
<%# message_ats = get_message_org(@organization.id, field.id) %>
<%# ids = field.org_document_comments.map{|o| o.id}.join(",") %>
<div class="box1 bg-grey" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
<% if field.status == 0 %>
<div class="content">
<div class="box-top" id="message_<%= field.id %>"><h2 class="box-title"><%= field.name %></h2></div>
<% if org_acts.blank? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<div class="cl"></div>
<% if !field.subfield_subdomain_dir.nil? %> <!--讨论帖子-->
<% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
<%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %>
<% else %>
<%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %>
<% end %>
<% else %>
<%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<% end %>
<%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% else %>
<div class="course-list">
<ul class="clearfix">
<% org_acts.first(3).each do |act| %>
<%= render :partial => 'organizations/org_new_forum_pic', :locals => {:activity => act, :field => field, :organization => @organization} %>
<% end %>
<div class="cl"></div>
</ul>
<% if !field.subfield_subdomain_dir.nil? %> <!--讨论帖子-->
<% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
<%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %>
<% else %>
<%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %>
<% end %>
<% else %>
<%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<% end %>
<%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
</div>
<% end %>
</div><!--content end-->
<% else %>
<div class="content">
<div class="box-top" id="message_<%= field.id %>"><h2 class="box-title"><%= field.name %></h2></div>
<% if org_acts.blank? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<div class="cl"></div>
<% if !field.subfield_subdomain_dir.nil? %> <!--讨论帖子-->
<% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
<%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %>
<% else %>
<%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %>
<% end %>
<% else %>
<%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<% end %>
<div class="cl"></div>
<% else %>
<div class="row">
<% org_acts.each do |act| %>
<%= render :partial => 'organizations/org_new_forum_list', :locals => {:activity => act, :field => field, :organization => @organization} %>
<% end %>
<!--row-ziyuan end-->
</div>
<div class="cl"></div>
<% if !field.subfield_subdomain_dir.nil? %> <!--讨论帖子-->
<% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
<%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %>
<% else %>
<%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %>
<% end %>
<% else %>
<%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<% end %>
<div class="cl"></div>
<% end %>
</div><!--row end-->
<div class="cl"></div>
<% end %>
</div><!--box1 end-->
<% elsif field.field_type == "Resource" %>
<% org_attachs = get_attach_org2(field) %>
<div class="box1" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
<div class="content">
<div class="box-top" id="resource_<%= field.id %>"><h2 class="box-title"><%= field.name %></h2></div>
<% if org_attachs.blank? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<div class="cl"></div>
<% if !field.subfield_subdomain_dir.nil? %>
<% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
<%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30", :target => "_blank" %>
<% else %>
<%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30", :target => "_blank" %>
<% end %>
<% else %>
<%= link_to "More", org_subfield_files_path(field), :class => "more-btn-center mt30", :target => "_blank" %>
<% end %>
<%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% else %>
<div class="row">
<%= render :partial => 'organizations/org_new_resource', :locals => {:org_attachs => org_attachs} %>
<!--row-ziyuan end-->
</div>
<div class="cl"></div>
<% if !field.subfield_subdomain_dir.nil? %>
<% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
<%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30", :target => "_blank" %>
<% else %>
<%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30", :target => "_blank" %>
<% end %>
<% else %>
<%= link_to "More", org_subfield_files_path(field), :class => "more-btn-center mt30", :target => "_blank" %>
<% end %>
<%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% end %>
</div><!--row end-->
<div class="cl"></div>
</div><!--box1 end-->
</div>
<% end %>
<% end %>
<% end %>
<div class="footer">
<div class="footer-con">
<ul>
<li><a href="<%= about_us_path %>" target="_blank" class="fl">关于我们</a></li>
<li><a href="<%= agreement_path %>" target="_blank" class="fl"> 服务协议 </a></li>
<li><a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="fl">帮助中心</a></li>
<li><a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="fl"> 贴吧交流</a></li>
</ul>
<div class="cl"></div>
<p>Copyright 2007~2016 All Rights Reserved<br>湘ICP备09019772</p>
</div>
</div>
<!--backtop end-->
<main class="cd-container">
</main>
<a href="#0" class="cd-top">Top</a>
</div><!--container end-->
<!--页面底部-->
<div class="cl"></div>
<div id="ajax-modal" style="display:none;"></div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<%#= call_hook :view_layouts_base_body_bottom %>
</body>
</html>

View File

@ -29,7 +29,7 @@
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
</script>
</head>
<!--add by huang-->
@ -44,8 +44,6 @@
<div class="cl"></div>
<div id="Container">
<%#= render :partial => 'layouts/new_header'%>
<div class="cl"></div>
<div id="content">
@ -74,6 +72,9 @@
<% end %>
</div>
<div class="cl"></div>
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @project %>
<%# over %>
<div>
<% if @project.project_type == 0 %>
<% unless static_project_score(@project.project_score) == 0 %>
@ -104,20 +105,6 @@
<!--邀请加入-->
<div class="subNavBox">
<%# if User.current.member_of?(@project) %>
<!--<div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" nhtype="toggle4cookie" data-id="expand_invit" data-target="#navContent_invit" data-val="expand">-->
<!--<%#= l(:label_invite)%>-->
<!--</div>-->
<!--<ul class="navContent " style="display:block" id="navContent_invit">-->
<!--<li><%#= link_to l(:label_invite_new_user), :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li>-->
<!--&lt;!&ndash;<%# if User.current.allowed_to?(:manage_members, @project) %>&ndash;&gt;-->
<!--<li><%#= link_to l(:label_invite_trustie_user), :controller=>"projects", :action=>"invite_members", :id => @project %></li>-->
<!--<%# end %>-->
<!--</ul>-->
<%# end %><!--end-->
<!--menu 左侧工具栏 -->
<%#--project_new_type: 1为开发组2为科研组3为朋友圈子--%>
<div id="project_memu_list">
<% if @project.project_new_type == 1 || @project.project_new_type.nil? %>
<%= render :partial => 'projects/development_group', :locals => {:project => @project} %>

View File

@ -132,6 +132,11 @@
</div>
</div>
<div class="cl"></div>
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @user %>
<%# over %>
<div>
<div class="homepageSignature break_word">
<p id="user_brief_introduction_show">
@ -204,7 +209,19 @@
<% end%>
<% end%>
</div>
<% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
<% if @user.courses.visible.count > 0
course_order_ids = "(" +
CourseActivity.find_by_sql("SELECT c.course_id, updated_at FROM
(SELECT ca.course_id, MAX(ca.updated_at) AS updated_at FROM course_activities ca WHERE ca.course_id IN (" + @user.courses.visible.select('courses.id').map{|c| c.id}.join(',') + ")
GROUP BY ca.course_id) AS c
ORDER BY c.updated_at DESC limit 5").map {|c| c.course_id}.join(",") + ")"
courses = Course.where("id in #{course_order_ids}")
else
courses = []
end
%>
<%# courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>" id="homepageLeftMenuCourses">
<ul>
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %>
@ -217,7 +234,19 @@
<%=link_to "", new_project_path(:host=> Setting.host_name), :class => "homepageMenuSetting fr", :style => "margin-right:10px;", :title => "新建项目"%>
<% end%>
</div>
<% projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%>
<% if @user.projects.visible.count > 0
project_order_ids = "(" +
ForgeActivity.find_by_sql("SELECT p.project_id, p.created_at FROM
(SELECT fa.project_id, MAX(fa.created_at) AS created_at FROM forge_activities fa WHERE fa.project_id IN (" + @user.projects.visible.select('projects.id').map{|p| p.id}.join(',') + ")
GROUP BY fa.project_id) AS p
ORDER BY p.created_at DESC limit 5").map {|p| p.project_id}.join(",") + ")"
projects = Project.where("projects.id in #{project_order_ids}")
else
projects = []
end
%>
<%# projects = @user.projects.visible.select("projects.*, (SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%>
<div class="homepageLeftMenuCourses <%= projects.empty? ? 'none' : ''%>" id="homepageLeftMenuForge">
<ul>
<%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :page => 0} %>

View File

@ -12,10 +12,12 @@
if($("#document_title").val().trim() == "")
{
$("#doc_title_hint").html("<span class='c_red'>标题不能为空</span>").show();
return false;
}
else
{
$("#doc_title_hint").hide();
return true;
}
}
</script>

View File

@ -32,14 +32,18 @@
location.href = document.referrer;
}
</script>
<div class="resources" nhname="new_topic_form">
<div class="homepageRightBanner" style="margin-top:<%= User.current.logged? ? '0px':'10px' %>; margin-bottom:10px;">
<div class="NewsBannerName"><%= OrgSubfield.try(:find, params[:field_id]).try(:name) %></div>
</div>
<div class="resources" nhname="new_topic_form" >
<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id, :field_id => params[:field_id]), :id => 'new_org_document_form' do |f| %>
<div>
<textarea class="postDetailInput fl mr15" style="margin-bottom:15px;" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" placeholder="请输入文章标题"></textarea>
<input class="postDetailInput fl mr15" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" placeholder="请输入文章标题"></input>
</div>
<div id="doc_title_hint">
</div>
<div class="mt15" >
<div class="cl"></div>
<div class="" >
<div class="mt10">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='description_textarea' name="org_document_comment[content]"></textarea>
<%#= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %>

View File

@ -4,7 +4,6 @@
:locals => {:subfields => @organization.org_subfields.order("priority") }) %>");
$("#sub_field_left_lists").html("");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
$("#subfield_name").val("");
<% else %>
$("#subfield_name").val("");
<% end %>
<% end %>
$("#subfield_name").val("");
$("#sub_dir").val("");

View File

@ -0,0 +1,3 @@
$("#subfield_show_<%= @subfield.id %>").html("<%= @subfield.name %>");
$("#sub_field_left_lists").html("");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");

View File

@ -63,7 +63,7 @@
</div>
<div class="homepageLeftMenuCourses" id="homepageLeftMenuCourses" style="display:<%= organization.courses.count == 0 ?'none':'' %>">
<ul >
<%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
<%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.where("is_delete=0").reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
</ul>
</div>
</div>
@ -77,15 +77,15 @@
</div>
<div class="homepageLeftMenuCourses" id="homepageLeftMenuProjects" style="display:<%= organization.projects.count == 0?'none':'' %>">
<ul>
<%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
<%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.where("status=1").reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
</ul>
</div>
</div>
<% end %>
<% else %>
<div class="homepageLeftMenuBlock" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
<% if field.field_type == "Post" %>
<% if !field.subfield_subdomain_dir.nil? %>
<% if field.field_type == "Post" %> <!--讨论帖子-->
<% if !field.subfield_subdomain_dir.nil? %> <!--讨论帖子-->
<% if !request.local? and Secdomain.where("sub_type=2 and pid=?", organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", organization.id).map(&:subname).include?(request.subdomain) %>
<%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %>
<% else %>

View File

@ -0,0 +1,48 @@
<% if User.current.logged? %>
<div class="navHomepageProfile" id="navHomepageProfile">
<ul>
<li class="homepageProfileMenuIcon fr" id="homepageProfileMenuIcon">
<%= link_to "<div class='mt5 mb8 user-img' id='user_avatar'>#{image_tag(url_to_avatar(User.current), :class => "portraitRadius",:alt=>"头像", :id => "nh_user_logo")}</div>".html_safe, user_activities_path(User.current.id) %>
<%#= link_to image_tag(url_to_avatar(User.current)), user_url_in_org(User.current.id), :alt => '用户头像', :target => '_blank', :class => "fr user-img" %>
<ul class="topnav_login_list none" id="topnav_login_list">
<li>
<%= link_to "修改资料", my_account_path, :class => "menuGrey"%>
</li>
<li>
<%= link_to "我的组织", user_organizations_user_path(:id => User.current.id), :class => "menuGrey"%>
</li>
<li>
<%= link_to "新建组织", new_organization_path, :class => "menuGrey"%>
</li>
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
<li>
<%= link_to "退出", logout_url_without_domain, :class => "menuGrey", :method => "post"%>
</li>
</ul>
</li>
</ul>
</div>
<% else %>
<div class="login fr" >
<a href="<%= signin_url_without_domain %>" class=" " >登录&nbsp;&nbsp;|&nbsp;</a>
<a href="<%= register_url_without_domain %>" class=" " >退出</a>
</div>
<% end %>
<script type="text/javascript">
$("#navHomepageProfile").mouseenter(function(){
$("#homepageProfileMenuIcon").addClass("homepageProfileMenuIconhover");
$("#topnav_login_list").show();
});
$("#navHomepageProfile").mouseleave(function(){
$("#homepageProfileMenuIcon").removeClass("homepageProfileMenuIconhover");
$("#topnav_login_list").hide();
});
function signout(){
$.post(
'<%= signout_path%>',
{}
);
}
</script>

View File

@ -0,0 +1,80 @@
<% activities.each do |act| %>
<% if act.org_act_type == "HomeworkCommon" %>
<% activity = HomeworkCommon.find(act.org_act_id) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.user),:width => "40", :height => "40"), user_path(activity.user), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="note-box fl">
<%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "fl note-title" %>
<%#= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<p class="fl"><span >发布时间:<%= format_date activity.updated_at %></span>
<span> 作者:<%= activity.try(:user).try(:realname).nil? ? activity.try(:user).try(:login) : activity.try(:user).try(:realname) %></span>
<span class="fr right-info2"> <%= activity.journals_for_messages.count %></span> </p>
</div>
</div><!--row-ziyuan end-->
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.author),:width => "40", :height => "40"), user_path(activity.author), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="note-box fl">
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "fl note-title" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "fl note-title" %>
<% end %>
<%#= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<p class="fl"><span >发布时间:<%= format_date activity.updated_on %></span>
<span> 作者:<%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %></span>
<span class="fr right-info2"> <%= activity.children.count %></span> </p>
</div>
</div><!--row-ziyuan end-->
<% elsif act.org_act_type == "News" %>
<% activity = News.find(act.org_act_id) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.author),:width => "40", :height => "40"), user_path(activity.author), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="note-box fl">
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl note-title" %>
<p class="fl"><span >发布时间:<%= format_date activity.created_on %></span>
<span> 作者:<%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %></span>
<span class="fr right-info2"> <%= activity.comments.count %></span> </p>
</div>
</div><!--row-ziyuan end-->
<% elsif act.org_act_type == "Poll" %>
<% activity = Poll.find(act.org_act_id) %>
<% has_commit = has_commit_poll?(activity.id ,User.current)%>
<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
<% if ( activity.polls_status==2) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.user),:width => "40", :height => "40"), user_path(activity.user), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="note-box fl">
<% if has_commit %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "fl note-title" %>
<% else %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s, :target => '_blank', :class => "fl note-title" %>
<% end %>
<p class="fl"><span >发布时间:<%= format_date activity.published_at %></span>
<span> 作者:<%= activity.try(:user).try(:realname).nil? ? activity.try(:user) : activity.try(:user).try(:realname) %></span>
<span class="fr right-info2"> 0 </span> </p>
</div>
</div><!--row-ziyuan end-->
<% end %>
<% elsif act.org_act_type == "Course" %>
<% activity = Course.find(act.org_act_id) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.teacher),:width => "40", :height => "40"), user_path(activity.teacher), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="note-box fl">
<%= link_to activity.name.to_s, course_url_in_org(activity.id), :target => '_blank', :class => "fl note-title" %>
<p class="fl"><span >发布时间:<%= format_date activity.created_at %></span>
<span> 作者:<%= activity.try(:teacher).try(:realname).nil? ? activity.try(:teacher) : activity.try(:teacher).try(:realname) %></span>
<span class="fr right-info2"> 0</span> </p>
</div>
</div><!--row-ziyuan end-->
<% end %>
<% end %>

View File

@ -0,0 +1,5 @@
<a href="#" target="_blank" class="row-con">
<span class="row-time"><%= format_date(activity.updated_at) %></span>
<h3 class="row-title "><%= activity.title %></h3>
<div class="row-txt row-txt-line"><%= activity.description %></div>
</a>

View File

@ -0,0 +1,20 @@
<a href="/#" title="">
<div class="course-list-img">
<% iamge_path = get_image_path_from_content(activity.description) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), student_work_index_url_in_org(activity.id), :target => "_blank" %>
<!--<img width="370" height="220" alt="#" src="/images/org_new_style/default-img.jpg">-->
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), student_work_index_url_in_org(activity.id), :target => "_blank" %>
<!--<img width="370" height="220" src="/files/uploads/image<%#= iamge_path %>" alt="" />-->
<% end %>
</div>
<h5>
<span><%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank' %></span>
</h5>
<div class="item-btm clearfix">
<%=link_to activity.try(:user).try(:realname).nil? ? activity.try(:user).try(:login) : activity.try(:user).try(:realname), user_path(activity.user), :class=>"publisher-name fl", :target => "_blank" %></a>
<p class="pass-time fl"><span><%= format_date activity.updated_at %></span></p>
<div class="fr right-info"> <span> <%= activity.journals_for_messages.count %></span></div>
</div>
</a>

View File

@ -0,0 +1,22 @@
<a href="/#" title="">
<div class="course-list-img">
<% iamge_path = get_image_path_from_content(activity.content) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank" %>
<% end %>
</div>
<h5>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %>
<% end %>
</h5>
<div class="item-btm clearfix">
<%=link_to activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname), user_path(activity.author), :class=>"publisher-name fl", :target => "_blank" %></a>
<p class="pass-time fl"><span><%= format_date activity.updated_on %></span></p>
<div class="fr right-info"> <span> <%= activity.children.count %></span></div>
</div>
</a>

View File

@ -0,0 +1,19 @@
<a href="/#" title="">
<div class="course-list-img">
<% iamge_path = get_image_path_from_content(activity.description) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %>
<!--<img width="370" height="220" alt="#" src="/images/org_new_style/default-img.jpg">-->
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %>
<% end %>
</div>
<h5>
<span><%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank' %></span>
</h5>
<div class="item-btm clearfix">
<%=link_to activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname), user_path(activity.author), :class=>"publisher-name fl", :target => "_blank" %></a>
<p class="pass-time fl"><span><%= format_date activity.created_on %></span></p>
<div class="fr right-info"> <span> <%= activity.comments.count %></span></div>
</div>
</a>

View File

@ -0,0 +1,107 @@
<% activities.each do |act| %>
<% if act.org_act_type == "HomeworkCommon" %>
<% activity = HomeworkCommon.find(act.org_act_id) %>
<li>
<a href="/#" title="">
<div class="course-list-img">
<% iamge_path = get_image_path_from_content(activity.description) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), student_work_index_url_in_org(activity.id), :target => "_blank" %>
<!--<img width="370" height="220" alt="#" src="/images/org_new_style/default-img.jpg">-->
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), student_work_index_url_in_org(activity.id), :target => "_blank" %>
<!--<img width="370" height="220" src="/files/uploads/image<%#= iamge_path %>" alt="" />-->
<% end %>
</div>
<h5>
<%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank' %>
</h5>
<div class="item-btm clearfix">
<%=link_to activity.try(:user).try(:realname).nil? ? activity.try(:user).try(:login) : activity.try(:user).try(:realname), user_path(activity.user), :class=>"publisher-name fl", :target => "_blank" %></a>
<p class="pass-time fl"><span><%= format_date activity.updated_at %></span></p>
<div class="fr right-info"> <span> <%= activity.journals_for_messages.count %></span></div>
</div>
</a>
</li>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<li>
<a href="/#" title="">
<div class="course-list-img">
<% iamge_path = get_image_path_from_content(activity.content) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank" %>
<% end %>
</div>
<h5>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %>
<% end %>
</h5>
<div class="item-btm clearfix">
<%=link_to activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname), user_path(activity.author), :class=>"publisher-name fl", :target => "_blank" %></a>
<p class="pass-time fl"><span><%= format_date activity.updated_on %></span></p>
<div class="fr right-info"> <span> <%= activity.children.count %></span></div>
</div>
</a>
</li>
<% elsif act.org_act_type == "News" %>
<% activity = News.find(act.org_act_id) %>
<li>
<a href="/#" title="">
<div class="course-list-img">
<% iamge_path = get_image_path_from_content(activity.description) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %>
<% end %>
</div>
<h5>
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank' %>
</h5>
<div class="item-btm clearfix">
<%=link_to activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname), user_path(activity.author), :class=>"publisher-name fl", :target => "_blank" %></a>
<p class="pass-time fl"><span><%= format_date activity.created_on %></span></p>
<div class="fr right-info"> <span> <%= activity.comments.count %></span></div>
</div>
</a>
</li>
<% elsif act.org_act_type == "Poll" %>
<% activity = Poll.find(act.org_act_id) %>
<% has_commit = has_commit_poll?(activity.id ,User.current)%>
<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
<% if ( activity.polls_status==2) %>
<li>
<a href="/#" title="">
<div class="course-list-img">
<% iamge_path = get_image_path_from_content(activity.polls_description) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %>
<% end %>
</div>
<h5>
<% if has_commit %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank' %>
<% else %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s, :target => '_blank' %>
<% end %>
</h5>
<div class="item-btm clearfix">
<%=link_to activity.try(:user).try(:realname).nil? ? activity.try(:user).try(:login) : activity.try(:user).try(:realname), user_path(activity.user), :class=>"publisher-name fl", :target => "_blank" %></a>
<p class="pass-time fl"><span><%= format_date activity.published_at %></span></p>
<div class="fr right-info"> <span> 0 </span></div>
</div>
</a>
</li>
<% end %>
<% end %>
<% end %>

View File

@ -0,0 +1,5 @@
<a href="#" target="_blank" class="row-con">
<span class="row-time"><%= format_date activity.updated_at %></span>
<h3 class="row-title ">首届卫星导航仿真与测试专题研讨会在...首届卫星导航仿真与测试专题研讨会在...</h3>
<div class="row-txt row-txt-line">10月15日由卫星导航仿真与测试开放实验室联盟主办的首次专题研讨会在西安国家民用航天产业基地隆重召开...</div>
</a>

View File

@ -0,0 +1,12 @@
<div class="cl"></div>
<div style="margin-top: 10px">
<% iamge_path = get_image_path_from_content(activity.content) %>
<% if iamge_path.nil? %>
<img src="/images/org_new_style/default-img.jpg" alt="" class="fl con-left-img"/>
<% else %>
<img src="/files/uploads/image<%= iamge_path %>" alt="" class="fl con-left-img"/>
<% end %>
<%=link_to activity.content.html_safe, organization_path(organization, :org_subfield_id => field.id), :class => "con-left-txt fl", :target => "_blank" %>
</div>
<div class="cl"></div>

View File

@ -0,0 +1,74 @@
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %>
<% document = activity.org_act %>
<% org_subfield_id = params[:org_subfield_id] %>
<% flag = 2 %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(document.creator),:width => "40", :height => "40"), user_path(document.creator), :class => "fl user-img" %>
<div class="note-box fl">
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "fl note-title" %>
<p class="fl"><span >发布时间:<%= format_date document.created_at %></span>
<span> 作者:<%= document.try(:creator).try(:realname).nil? ? document.try(:creator).try(:login) : document.try(:creator).try(:realname) %></span>
<span class="fr right-info2"> <%= document.children.count %></span> </p>
</div>
</div>
<% elsif activity.container_type == 'OrgSubfield' %>
<% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where("id=#{activity.org_act_id}").count > 0 %>
<% message = Message.find(activity.org_act_id) %>
<% if message.board.org_subfield_id %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(message.author),:width => "40", :height => "40"), user_path(message.author), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="note-box fl">
<% if message.parent_id.nil? %>
<%= link_to message.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "fl note-title" %>
<% else %>
<%= link_to message.parent.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "fl note-title" %>
<% end %>
<%#= link_to activity.title.to_s, organization_path(@organization, :org_subfield_id => field.id), :target => '_blank', :class => "fl note-title" %>
<%#= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<p class="fl"><span >发布时间:<%= format_date message.created_on %></span>
<span> 作者:<%= message.try(:author).try(:realname).nil? ? message.try(:author).try(:login) : message.try(:author).try(:realname) %></span>
<span class="fr right-info2"> <%= message.children.count %></span> </p>
</div>
</div><!--row-ziyuan end-->
<% else %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(message.author),:width => "40", :height => "40"), user_path(message.author), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="note-box fl">
<% if message.parent_id.nil? %>
<%= link_to message.subject.to_s.html_safe, board_message_path(message.board,message), :target => '_blank', :class => "fl note-title" %>
<% else %>
<%= link_to message.parent.subject.to_s.html_safe, board_message_path(message.board,activity), :target => '_blank', :class => "fl note-title" %>
<% end %>
<%#= link_to activity.title.to_s, organization_path(@organization, :org_subfield_id => field.id), :target => '_blank', :class => "fl note-title" %>
<%#= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<p class="fl"><span >发布时间:<%= format_date message.updated_at %></span>
<span> 作者:<%= message.try(:author).try(:realname).nil? ? message.try(:author).try(:login) : message.try(:author).try(:realname) %></span>
<span class="fr right-info2"> <%= message.children.count %></span> </p>
</div>
</div><!--row-ziyuan end-->
<% end %>
<% end %>
<% if activity.org_act_type == 'News' and News.where("id=?", activity.org_act_id).count > 0 %>
<% news = News.find(activity.org_act_id) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(news.author),:width => "40", :height => "40"), user_path(news.author), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="note-box fl">
<%= link_to news.title.to_s, news_path(news), :target => '_blank', :class => "fl note-title" %>
<%#= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<p class="fl"><span >发布时间:<%= format_date news.created_on %></span>
<span> 作者:<%= news.try(:author).try(:realname).nil? ? news.try(:author).try(:login) : news.try(:author).try(:realname) %></span>
<span class="fr right-info2"> <%= news.comments.count %></span> </p>
</div>
</div><!--row-ziyuan end-->
<% end %>
<% end %>

View File

@ -0,0 +1,124 @@
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %>
<% document = activity.org_act %>
<% org_subfield_id = params[:org_subfield_id] %>
<% flag = 2 %>
<li>
<a href="/#" title="" >
<div class="course-list-img">
<% iamge_path = get_image_path_from_content(document.content) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %>
<% end %>
</div>
<h5><%#= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
<span><%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank' %></span>
</h5>
<div class="item-btm clearfix">
<%=link_to document.try(:creator).try(:realname).nil? ? document.try(:creator).try(:login) : document.try(:creator).try(:realname), user_path(document.creator), :class=>"publisher-name fl", :target => "_blank" %></a>
<p class="pass-time fl"><span><%= format_date document.created_at %></span></p>
<div class="fr right-info"> <span> <%= document.children.count %></span></div>
</div>
</a>
</li>
<% elsif activity.container_type == 'OrgSubfield' %>
<% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where("id=#{activity.org_act_id}").count > 0 %>
<% message = Message.find(activity.org_act_id) %>
<% if message.board.org_subfield_id %>
<li>
<a href="/#" title="" >
<div class="course-list-img">
<% if message.parent_id.nil? %>
<% content = message.content%>
<% else %>
<% content = message.parent.content%>
<% end %>
<% iamge_path = get_image_path_from_content(content) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), board_message_url_in_org(message.board.id,message.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_url_in_org(message.board.id,message.id), :target => "_blank" %>
<% end %>
</div>
<h5>
<% if message.parent_id.nil? %>
<span><%= link_to message.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank' %></span>
<% else %>
<span><%= link_to message.parent.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank'%></span>
<% end %>
<%#= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
<%#= link_to document.subject, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %>
</h5>
<div class="item-btm clearfix">
<%=link_to message.try(:author).try(:realname).nil? ? message.try(:author).try(:login) : message.try(:author).try(:realname), user_path(message.author), :class=>"publisher-name fl", :target => "_blank" %></a>
<p class="pass-time fl"><span><%= format_date message.created_on %></span></p>
<div class="fr right-info"> <span> <%= message.children.count %></span></div>
</div>
</a>
</li>
<% else %>
<li>
<a href="/#" title="" >
<div class="course-list-img">
<% if message.parent_id.nil? %>
<% content = message.content%>
<% else %>
<% content = message.parent.content%>
<% end %>
<% iamge_path = get_image_path_from_content(content) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), board_message_path(message.board,activity), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_path(message.board,activity), :target => "_blank" %>
<% end %>
</div>
<h5>
<% if message.parent_id.nil? %>
<%= link_to message.subject.to_s.html_safe, board_message_path(message.board,message), :class=> "postGrey"
%>
<% else %>
<%= link_to message.parent.subject.to_s.html_safe, board_message_path(message.board,activity), :class=> "postGrey"
%>
<% end %>
<%#= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
<%#= link_to document.subject, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %>
</h5>
<div class="item-btm clearfix">
<%=link_to message.try(:author).try(:realname).nil? ? message.try(:author).try(:login) : message.try(:author).try(:realname), user_path(message.author), :class=>"publisher-name fl", :target => "_blank" %></a>
<p class="pass-time fl"><span><%= format_date message.created_on %></span></p>
<div class="fr right-info"> <span> <%= message.children.count %></span></div>
</div>
</a>
</li>
<% end %>
<% end %>
<% if activity.org_act_type == 'News' and News.where("id=?", activity.org_act_id).count > 0 %>
<% news = News.find(activity.org_act_id) %>
<li>
<a href="/#" title="" >
<div class="course-list-img">
<% iamge_path = get_image_path_from_content(news.description) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), news_path(news), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), news_path(news), :target => "_blank" %>
<% end %>
</div>
<h5><%#= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
<span><%= link_to news.title.to_s, news_path(news), :target => '_blank' %></span>
</h5>
<div class="item-btm clearfix">
<%=link_to news.try(:author).try(:realname).nil? ? news.try(:author).try(:login) : news.try(:author).try(:realname), user_path(news.author), :class=>"publisher-name fl", :target => "_blank" %></a>
<p class="pass-time fl"><span><%= format_date news.created_on %></span></p>
<div class="fr right-info"> <span> <%= news.comments.count %></span></div>
</div>
</a>
</li>
<% end %>
<% end %>

View File

@ -0,0 +1,6 @@
<a href="#" target="_blank">
<div class="con-r-img fl">
<%= link_to image_tag(url_to_avatar(activity.creator),:width => "40", :height => "40"), user_path(activity.creator) %>
<span class="con-name"><%= activity.try(:creator).try(:realname).nil? ? activity.try(:creator).try(:login) : activity.try(:creator).try(:realname) %></span></div>
<p class="fr"><%= activity.content.html_safe %></p>
</a>

View File

@ -0,0 +1,49 @@
<% activities.each do |act| %>
<% if act.org_act_type == "Issue" %>
<% activity = Issue.find(act.org_act_id) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.author),:width => "40", :height => "40"), user_path(activity.author), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="note-box fl">
<%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :target => '_blank', :class => "fl note-title" %>
<%#= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<%#= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<p class="fl"><span >发布时间:<%= format_date activity.updated_on %></span>
<span> 作者:<%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %></span>
<span class="fr right-info2"> <%= activity.journals.count %></span> </p>
</div>
</div><!--row-ziyuan end-->
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.author),:width => "40", :height => "40"), user_path(activity.author), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="note-box fl">
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "fl note-title" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "fl note-title" %>
<% end %>
<%#= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl ziyuan-title" %>
<p class="fl"><span >发布时间:<%= format_date activity.updated_on %></span>
<span> 作者:<%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %></span>
<span class="fr right-info2"> <%= activity.children.count %></span> </p>
</div>
</div><!--row-ziyuan end-->
<% elsif act.org_act_type == "News" %>
<% activity = News.find(act.org_act_id) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.author),:width => "40", :height => "40"), user_path(activity.author), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="note-box fl">
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "fl note-title" %>
<p class="fl"><span >发布时间:<%= format_date activity.created_on %></span>
<span> 作者:<%= activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname) %></span>
<span class="fr right-info2"> <%= activity.comments.count %></span> </p>
</div>
</div><!--row-ziyuan end-->
<% end %>
<% end %>

View File

@ -0,0 +1,17 @@
<div class="article-rwrap">
<h3 class="item-title-r">
<%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :class => "title-detail-r" %>
</h3>
<div class="item-btm clearfix">
<ul class="fl left-info">
<li class="hd-pic">
<%= link_to activity.author.realname.nil? ? activity.author.login : activity.author.realname, user_path(activity.author), :class => "publisher-name fl", :target => "_blank" %>
</li>
<li class="pass-time"><span><%= format_date(activity.updated_on) %></span></li>
</ul>
<div class="fr right-info">
<span> <%= activity.journals.count %></span>
</div>
</div>
<div class="cl"></div>
</div>

View File

@ -0,0 +1,49 @@
<div class="item-img fr">
<% iamge_path = get_image_path_from_content(activity.content) %>
<% if iamge_path.nil? %>
<img src="/images/org_new_style/default-img.jpg" width="180" height="115">
<% else %>
<img src="/files/uploads/image<%= iamge_path %>" width="180" height="115">
<% end %>
</div>
<div class="article-lwrap clearfix">
<div class="item-txt fl">
<h3 class="item-title">
<% if activity.parent_id.nil? %>
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board.id,activity.id), :class => "title-detail" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board.id,activity.id), :class => "title-detail" %>
<% end %>
</h3>
<% if activity.parent_id.nil? %>
<% content = activity.content %>
<% else %>
<% content = activity.parent.content %>
<% end %>
<div class="item-bd">
<span class="fl"><%= content.to_s.html_safe %></span>
<% if activity.parent_id.nil? %>
<%= link_to "[查看全文]", board_message_url_in_org(activity.board.id,activity.id), :class => "read-more fl" %>
<% else %>
<%= link_to "[查看全文]", board_message_url_in_org(activity.board.id,activity.id), :class => "read-more fl" %>
<% end %>
</div>
<div class="item-btm clearfix">
<ul class="fl left-info">
<li class="hd-pic">
<%= link_to image_tag(url_to_avatar(activity.author),:width => "20", :height => "20"), user_path(activity.author), :class => "publisher-hd fl", :target => "_blank" %>
<a class="publisher-name fl" href="#" target="_blank">
<%= link_to activity.author.realname.nil? ? activity.author.login : activity.author.realname, user_path(activity.author), :class => "publisher-name fl", :target => "_blank" %>
</a>
</li>
<li class="pass-time"><span><%= format_date(activity.updated_on) %></span></li>
</ul>
<div class="fr right-info">
<span> <%= activity.children.count %></span>
</div>
</div>
</div>
<div class="cl"></div>
</div>

View File

@ -0,0 +1,77 @@
<% activities.each do |act| %>
<% if act.org_act_type == "Issue" %>
<% activity = Issue.find(act.org_act_id) %>
<li>
<a href="/#" title="">
<div class="course-list-img">
<% iamge_path = get_image_path_from_content(activity.description) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), issue_url_in_org(activity.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), issue_url_in_org(activity.id), :target => "_blank" %>
<% end %>
</div>
<h5>
<%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :target => '_blank' %>
</h5>
<div class="item-btm clearfix">
<%=link_to activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname), user_path(activity.author), :class=>"publisher-name fl", :target => "_blank" %></a>
<p class="pass-time fl"><span><%= format_date activity.updated_on %></span></p>
<div class="fr right-info"> <span> <%= activity.journals.count %></span></div>
</div>
</a>
</li>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<li>
<a href="/#" title="">
<div class="course-list-img">
<% iamge_path = get_image_path_from_content(activity.content) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank" %>
<% end %>
</div>
<h5>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %>
<% end %>
</h5>
<div class="item-btm clearfix">
<%=link_to activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname), user_path(activity.author), :class=>"publisher-name fl", :target => "_blank" %></a>
<p class="pass-time fl"><span><%= format_date activity.updated_on %></span></p>
<div class="fr right-info"> <span> <%= activity.children.count %></span></div>
</div>
</a>
</li>
<% elsif act.org_act_type == "News" %>
<% activity = News.find(act.org_act_id) %>
<li>
<a href="/#" title="">
<div class="course-list-img">
<% iamge_path = get_image_path_from_content(activity.description) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/org_new_style/default-img.jpg", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), news_url_in_org(activity.id), :target => "_blank" %>
<% end %>
</div>
<h5>
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank' %>
</h5>
<div class="item-btm clearfix">
<%=link_to activity.try(:author).try(:realname).nil? ? activity.try(:author).try(:login) : activity.try(:author).try(:realname), user_path(activity.author), :class=>"publisher-name fl", :target => "_blank" %></a>
<p class="pass-time fl"><span><%= format_date activity.created_on %></span></p>
<div class="fr right-info"> <span> <%= activity.comments.count %></span></div>
</div>
</a>
</li>
<% end %>
<% end %>

View File

@ -0,0 +1,14 @@
<% org_attachs.each do |attach| %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(attach.author),:width => "40", :height => "40"), user_path(attach.author), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="ziyuan-box fl">
<%= link_to truncate(attach.filename,length: 35, omission: '...'),
download_named_attachment_path(attach.id, attach.filename),
:title => attach.filename+"\n"+attach.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;", :class => "fl ziyuan-title" %>
<p class="fl"><span >上传时间:<%= format_date attach.created_on %></span><span>类型:<%= attach.tag_list[0] %></span><span> 下载次数:<%= attach.downloads%></span> <span>引用:<%= attach.quotes.nil? ? 0:attach.quotes %></span></p>
</div>
<%= link_to "下载", download_named_attachment_path(attach.id, attach.filename), :class => "download-btn fl" %>
<div class="cl"></div>
</div><!--row-ziyuan end-->
<% end %>

View File

@ -10,6 +10,9 @@
TO&nbsp;&nbsp;<%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %>
|
<span style="color:#269ac9;"><%= document.org_subfield_id.nil? ? "组织文章" :"#{OrgSubfield.find(document.org_subfield_id).name}" %></span>
<% if document.organization.home_id == document.id %>
<span class="red_homework_btn_cir ml5">已设为首页</span>
<% end %>
</div>
<div class="homepagePostTitle postGrey"><%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %></div>
<div class="homepagePostDate fl">

View File

@ -2,6 +2,7 @@
<li class="orgOrder fb">顺序</li>
<li class="orgListUser fb">已有栏目</li>
<li class="orgListStatus fb">状态</li>
<li class="orgListStatusList fb fb">排列</li>
<li class="orgListStatus fb">类型</li>
<li class="orgListUser fb">域名目录</li>
<div class="cl"></div>
@ -21,8 +22,23 @@
</li>
<li class="orgListUser"><%= name %></li>
<li class="orgListStatus">默认</li>
<li class="orgListStatusList">
<% if field.name == "activity" %>
默认
<% else %>
<%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %>
<div class="update_status_class"><span class="hidden"><%=field.status== 1 ? "列表" : "图片" %></span>
<a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2"></a>
</div>
<%= select( :name,:group_id, subfield_status_option,
{ :include_blank => false,:selected => field.status},
{:onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:56px;"}) %>
<% end %>
<% end %>
</li>
<li class="orgListStatus">默认</li>
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"设为隐藏":"设为可见" %></a>
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"隐藏":"可见" %></a>
<div class="cl"></div>
</ul>
<% else %>
@ -42,6 +58,21 @@
</div>
</li>
<li class="orgListStatus">新增</li>
<li class="orgListStatusList">
<% if field.field_type == "Resource" %>
列表
<% else %>
<%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %>
<div class="update_status_class"><span class="hidden"><%=field.status== 1 ? "列表" : "图片" %></span>
<a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2"></a>
</div>
<%= select( :name,:group_id, subfield_status_option,
{ :include_blank => false,:selected => field.status},
{:onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:56px;"}) %>
<% end %>
<% end %>
</li>
<li class="orgListStatus"><%= field.field_type == "Post" ? "帖子" : "资源" %></li>
<li class="orgListUser hidden">
<% if Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 %>
@ -54,11 +85,11 @@
</div>
<% end %>
<div id="sub_dir_edit_<%= field.id %>" style="display:none;">
<input type="text" name="name" onblur="update_sub_dir('#sub_dir_show_<%= field.id %>','#sub_dir_edit_<%= field.id %>','<%= field.id %>',$(this).val());" value="<%= field.subfield_subdomain_dir.nil? ? '': field.subfield_subdomain_dir.name %>" style="width:70px;"/>
<input type="text" name="name" onfocus="observe_input_to_lowercase($(this));" onblur="update_sub_dir('#sub_dir_show_<%= field.id %>','#sub_dir_edit_<%= field.id %>','<%= field.id %>',$(this).val().toLowerCase());" value="<%= field.subfield_subdomain_dir.nil? ? '': field.subfield_subdomain_dir.name %>" style="width:70px;"/>
</div>
</li>
<%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %>
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"设为隐藏":"设为可见" %></a>
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"隐藏":"可见" %></a>
<%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr10" %>
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="edit('#subfield_show_<%= field.id %>','#subfield_edit_<%= field.id %>');">编辑</a>
@ -68,6 +99,34 @@
<% end %>
<script>
$(document).ready(function(){
$(".pic_edit2").click(function(){
$(this).parent().hide();
$(this).parent().next().show();
});
$(".class-edit").blur(function(){
$(this).hide();
$(this).prev().show();
var editValue = $(this).children("option:selected").text();
$(this).prev().children(":first").text(editValue);
});
function stopPropagation(e) {
if (e.stopPropagation)
e.stopPropagation();
else
e.cancelBubble = true;
};
$(document).bind('click',function(){
$('.class-edit').css('display','none');
$('.update_status_class').show();
});
$('.class-edit,.pic_edit2').bind('click',function(e){
stopPropagation(e);
});
});
function update_status(id){
$(id).submit();
}
function edit(show_id, edit_id) {
$(show_id).toggle();
$(edit_id).toggle();
@ -85,6 +144,9 @@
url: "/org_subfields/" + field_id + "?name=" + input_value,
type: 'put'
});
else{
$(edit_id).children("input").val($(show_id).html().trim());
}
}
$(show_id).show();
$(edit_id).hide();
@ -109,6 +171,9 @@
url: "/org_subfields/" + field_id + "/update_sub_dir?sub_dir_name=" + input_value,
type: 'put'
});
else{
$(edit_id).children("input").val($(show_id).html().trim());
}
}
$(show_id).show();
$(edit_id).hide();
@ -128,22 +193,19 @@
function update_priority(show_id, edit_id, field_id, input_value){
var re = /^[0-9]*[1-9]*[0-9]$/
if(re.test(input_value) && $(show_id).html().trim() != input_value.trim() && input_value.trim() != ''){
if(confirm("确定修改为" + input_value + "?")){
$.ajax({
url: "/org_subfields/" + field_id + "/update_priority?priority=" + input_value,
type: 'put'
});
}
$.ajax({
url: "/org_subfields/" + field_id + "/update_priority?priority=" + input_value,
type: 'put'
});
}
else
{
$(edit_id).find("input").val($(show_id).html().trim());
else{
$(edit_id).children("input").val($(show_id).html().trim());
}
$(show_id).show();
$(edit_id).hide();
}
function hide(content, id){
if (content.text() == '设为隐藏')
if (content.text() == '隐藏')
$.ajax({
url: "/organizations/hide_org_subfield?org_subfield_id=" + id,
type: "post"

View File

@ -1,2 +1,2 @@
$("#hide_<%= @org_subfield.id %>").text("设为可见");
$("#hide_<%= @org_subfield.id %>").text("可见");
$("#org_subfield_<%= @org_subfield.id %>").css("display", "none");

View File

@ -28,9 +28,16 @@
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>
</p>
</li>
<!--<li class=" mb5 ml45">-->
<!--<span style="margin-left:10px;" >显示模式&nbsp;&nbsp;&nbsp;&nbsp;: </span>-->
<!--<input type="radio" id="show_mode_ordinary" value="0" name="show_mode" style="margin-left:2px;" checked />-->
<!--<label for="show_mode_ordinary">社区模式一</label>-->
<!--<input type="radio" id="show_mode_special" value="1" name="show_mode" style="margin-left:10px;" />-->
<!--<label for="show_mode_special">社区模式二</label>-->
<!--</li>-->
<li class=" mb5 ml80">
<label >公开&nbsp;&nbsp;</label>
<input id="organization_is_public" name="organization[is_public]" onblur="disable_down($(this), $('#organization_alow_download'), $('#allow_down_hint'));" type="checkbox" value="1" checked="checked">
<input id="organization_is_public" name="organization[is_public]" onclick="disable_down($(this), $('#organization_alow_download'), $('#allow_down_hint'));" type="checkbox" value="1" checked="checked">
<span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)</span>
<div class="cl"></div>
</li>

View File

@ -19,8 +19,11 @@
'<%= check_uniq_organizations_path%>'+'?org_name='+$("#organization_name").val().trim()+"&config_page=Y" + "&org_id="+id
)
}
function update_org(id){
check_uniq(id);
function update_org(id, old_value, input_value){
if (old_value == input_value)
{
check_uniq(id);
}
if( $checkName){
$("#edit_organization_"+id).submit();
}
@ -57,7 +60,7 @@
<div style="margin-left: 80px " id="check_desc_hint"></div>
<div class="orgRow mb10"><span class="ml10">组织URL</span>
<div class="w607 fr">http//
<input type="text" name="organization[domain]" id="domain" value="<%= domain.nil? ? '' : domain.subname %>" class="orgUrlInput" />
<input type="text" name="organization[domain]" id="domain" value="<%= domain.nil? ? '' : domain.subname %>" class="orgUrlInput" onfocus="observe_input_to_lowercase($(this));" />
.trustie.net<a href="javascript:void(0);" class="linkBlue ml15" style="text-decoration:underline;" onclick="apply_subdomain(<%= @organization.id %>,$('#domain').val());">申请</a>
<% record = OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first %>
<% if domain.present? and record.present? and record.content == domain.subname %>
@ -69,6 +72,13 @@
<!--class="c_green f12" 您的申请已提交,系统会以消息的形式通知您结果 -->
</div>
<div class="cl"></div>
<div class="orgRow mb10 mt5">
<span style="margin-left:10px;" >显示模式&nbsp;: </span>
<input type="radio" id="show_mode_ordinary" value="0" name="show_mode" style="margin-left:5px;" <%= @organization.show_mode == 0 ? "checked" : "" %> />
<label for="show_mode_ordinary">社区模式一</label>
<input type="radio" id="show_mode_special" value="1" name="show_mode" style="margin-left:10px;" <%= @organization.show_mode == 1 ? "checked" : "" %> />
<label for="show_mode_special">社区模式二</label>
</div>
<div class="orgRow mb10 mt5"><span style="margin-left:38px;" >公开&nbsp;: </span>
<input type="checkbox" id="is_public" onclick="disable_down($(this), $('#allow_download'),$('#allow_down_hint'));" name="organization[is_public]" <%= @organization.is_public ? 'checked': ''%> class="ml3" />
</div>
@ -77,7 +87,7 @@
&nbsp;<span>允许游客下载</span>
<span class="c_green f12" id="allow_down_hint"><%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %></span>
</div>
<a href="javascript:void(0);" class="saveBtn ml80 db fl" onclick="update_org(<%=@organization.id %>);">保存</a>
<a href="javascript:void(0);" class="saveBtn ml80 db fl" onclick="update_org('<%=@organization.id %>','<%= @organization.name %>', $('#organization_name'));">保存</a>
<% end %>
</div>
<div class="undis ml15 mr15" id="orgContent_2">
@ -96,7 +106,7 @@
<p class="fontBlue fb mb5">添加成员</p>
<%= form_tag url_for(:controller => 'org_member',:action => 'create',:org=>@organization),:id=>'org_member_add_form',:remote=>true do |f|%>
<input type="text" id="not_org_member_search" name="orgAddSearch" placeholder="支持姓名、邮箱、登录名搜索" class="orgAddSearch mb20" />
<%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript org_member_autocomplete_org_member_index_path(:org=>@organization, :format => 'js') }')" %>
<%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript host_with_protocol + "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %>
<div id="principals_for_new_member">
<%= find_user_not_in_current_org_by_name(@project) %>
</div>
@ -129,9 +139,9 @@
<div class="mb5">
<p class="fontGrey3"><span class="fb">域名目录</span>用户自定义url可选</p>
<% if domain %>
<span class="fl"><%= domain.subname %>.trustie.net/</span><input class="fl personalUrl ml3" type="text" name="sub_dir">
<span class="fl"><%= domain.subname %>.trustie.net/</span><input id="sub_dir" class="fl personalUrl ml3" type="text" name="sub_dir" onfocus="observe_input_to_lowercase($(this));">
<% else %>
<span class="fl">您还没有子域名,请先在左侧信息栏申请子域名</span>
<span class="fl" style="width:195px;">您还没有子域名,请先在左侧信息栏申请子域名</span>
<% end %>
<div class="cl"></div>
</div>
@ -195,12 +205,25 @@
}
}
// $(document).ready(function(){
// if ( $("#is_public").attr("checked") != true){
// alert($(this).attr("checked"));
// $("#allow_download").attr("checked", false);
// $("#allow_download").attr("disabled", true);
// $("#allow_down_hint").html("");
// }
// });
//输入子域名或者二级目录,自动将输入换成小写
function observe_input_to_lowercase(id){
$(id).each(function(){
var $this = $(this);
var old_input = $this.val();
var check=function(){
var val = $this.val();
if ( old_input != val){
$this.val(val.toLowerCase());
old_input = val.toLowerCase();
}
};
var reset = function() {
if (timer) {
clearInterval(timer);
}
};
var timer = setInterval(check, 300);
$this.bind('blur', reset);
});
}
</script>

View File

@ -1,2 +1,2 @@
$("#hide_<%= @org_subfield.id %>").text("设为隐藏");
$("#hide_<%= @org_subfield.id %>").text("隐藏");
$("#org_subfield_<%= @org_subfield.id %>").css("display", "block");

View File

@ -73,15 +73,14 @@
</script>
<!--创建-->
<% case activity.forge_act_type %>
<% when "ProjectCreateInfo" %>
<% when "Project" %>
<%= render :partial => 'projects/project_create', :locals => {:activity => activity, :user_activity_id => activity.id} %>
<!--缺陷动态-->
<% when "Issue" %>
<%= render :partial => 'users/project_issue', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %>
<!--message -->
<% when "Message" %>
<%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act,:user_activity_id =>activity.id,:is_course=>1,:is_board=>0} %>
<%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :is_course => 1, :is_board => 0} %>
<!--new 新闻-->
<% when "News" %>
<% if !activity.forge_act.nil? and activity.forge_act.project %>

View File

@ -0,0 +1,111 @@
<%= javascript_include_tag 'highcharts','highcharts-more' %>
<div id = "container" style="max-width:360px;min-height:400px;width:370px;float: left">
</div>
<div id = "container_code" style="max-width:360px;min-height:400px;width:370px;float: left">
</div>
<script>
$(function () {
$('#container_code').highcharts({
chart: {
type: 'line'
},
title: {
text: '版本库代码提交量'
},
subtitle: {
// text: 'Source: WorldClimate.com'
},
xAxis: {
// categories: ["Jan", "Jan", "Jan", 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
categories: <%= raw(@static_total_per_user.map{|c| c.uname}) %>
},
yAxis: {
title: {
text: '代码行数'
}
},
credits:{
enabled: false
},
tooltip: {
enabled: false,
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+this.x +': '+ this.y +'°C';
}
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
enableMouseTracking: false
}
},
series: [{
name: '改动或增加',
color: '#fd9e04',
// data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
data: <%= @static_total_per_user.map{|c| c.add.to_i} %>
},
{
name: '删除',
color: '#46baed ',
data: <%= @static_total_per_user.map{|c| c.del.to_i} %>
},{
name: '总变更',
color: '#d397d5',
data: <%= @static_total_per_user.map{|c| c.changes.to_i} %>
}]
});
// 代码提交次数统计
$('#container').highcharts({
chart: {
type: 'line'
},
credits:{
enabled: false
},
title: {
text: '版本库代码提交次数'
},
subtitle: {
// text: 'Source: WorldClimate.com'
},
xAxis: {
// categories: ["Jan", "Jan", "Jan", 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
categories: <%= raw(@static_total_per_user.map{|c| c.uname}) %>
},
yAxis: {
title: {
text: '次'
}
},
tooltip: {
enabled: false,
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+this.x +': '+ this.y +'°C';
}
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
enableMouseTracking: false
}
},
series: [{
name: '提交次数',
// data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
data: <%= @static_total_per_user.map{|c| c.commits_num.to_i} %>
}
// {
// name: 'London',
// data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
// }
]
});
});
</script>

View File

@ -138,7 +138,7 @@
</li>
<% roles.each do |role| %>
<li>
<%= radio_button_tag 'membership[role_ids][]', role.id %>
<%= radio_button_tag 'membership[role_ids][]', role.id, role.name == "报告人员" || role.name == "Reporter" %>
<% if User.current.language == "zh" %>
<% if role.id == 3 %>
<label >管理人员</label>

View File

@ -29,5 +29,12 @@
<!--CONTENT LIST-->
</div>
<div class="resources mt10">
<div class="homepagePostBrief">
<%= render :partial => "rep_static" %>
<div class="cl"></div>
</div>
</div>
<%= render :partial => "project_activities", :locals => {:forge_acts => @events_pages, :page => 0, :type => @type} %>
</div>

View File

@ -24,7 +24,9 @@
<div class="fl c_grey02 mt5 mr5">克隆网址:</div>
<textarea id="copy_rep_content" class="cloneUrl mt5 fl" type="input" ><%= @repository.type.to_s=="Repository::Gitlab" ? @repos_url.to_s.lstrip : @repository.url %></textarea>
<a href="javascript:void(0);" class="clone_btn mt5" onclick="jsCopy()"><span class="vl_copy" title="点击复制版本库地址"></span></a>
<div class="fl mt5 ml15"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_zip"></span>ZIP</a> </div>
<div class="fl mt5 ml15">
<%=link_to "统计", stats_repository_project_path(:id => @project, :repository_id => @repository.identifier_param, :rev => @rev, :creator => @creator ), :class => "fl vl_zip" %>
</div>
<%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %>
<% if User.current.id != @project.user_id %>
<div class="fr mt5"><%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn", :target => "_blank", :confirm=>"平台将为您创建一个新的同名项目和版本库,请问是否继续?" %>

View File

@ -1,30 +1,123 @@
<div class="project_r_h">
<%= javascript_include_tag 'highcharts','highcharts-more' %>
<div class="project_r_h" xmlns="http://www.w3.org/1999/html">
<h2 class="project_h2"><%= l(:label_statistics) %></h2>
</div>
<% if @status_commit_count ==0 %>
<div class="flash notice">该项目目前还没有提交过代码!</div>
<% if false %>
<div class="flash notice">请在版本库中提交代码,统计信息将更准确</div>
<% else %>
<div class="riviseRed fl"></div><div class="fl">修订 是版本库的提交次数, 显示为橘红色。</div><br>
<div class="changeBlue fl"></div><div class="fl">变更 是对版本库中文件的修改次数, 显示为蓝色。</div>
<div class="repository_con " style="line-height:1.9;">
<%= render :partial => 'navigation' %>
<div class="cl"></div>
</div>
<div id = "container">
</div>
<div id = "container_code" class="mt30">
</div>
<script>
$(function () {
$('#container_code').highcharts({
chart: {
type: 'line'
},
title: {
text: '代码提交量'
},
subtitle: {
// text: 'Source: WorldClimate.com'
},
xAxis: {
// categories: ["Jan", "Jan", "Jan", 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
categories: <%= raw(@static_total_per_user.map{|c| c.uname}) %>
},
yAxis: {
title: {
text: '代码行数'
}
},
credits:{
enabled: false
},
tooltip: {
enabled: false,
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+this.x +': '+ this.y +'°C';
}
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
enableMouseTracking: false
}
},
series: [{
name: '改动或增加',
// data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
data: <%= @static_total_per_user.map{|c| c.add.to_i} %>
},
{
name: '删除',
data: <%= @static_total_per_user.map{|c| c.del.to_i} %>
},{
name: '总变更',
data: <%= @static_total_per_user.map{|c| c.changes.to_i} %>
}]
});
// 代码提交次数统计
$('#container').highcharts({
chart: {
type: 'line'
},
credits:{
enabled: false
},
title: {
text: '代码提交次数'
},
subtitle: {
// text: 'Source: WorldClimate.com'
},
xAxis: {
// categories: ["Jan", "Jan", "Jan", 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
categories: <%= raw(@static_total_per_user.map{|c| c.uname}) %>
},
yAxis: {
title: {
text: '次'
}
},
tooltip: {
enabled: false,
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+this.x +': '+ this.y +'°C';
}
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
enableMouseTracking: false
}
},
series: [{
name: '提交次数',
// data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
data: <%= @static_total_per_user.map{|c| c.commits_num.to_i} %>
}
// {
// name: 'London',
// data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
// }
]
});
});
</script>
<p style="padding-top:35px;">
<%= tag("embed", :width => 670, :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_month")) %>
</p>
<p style="padding-top: 50px;">
<%# 用户每月提交代码次数 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_author")) %>
</p>
<p style="padding-top: 50px;">
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_per_month")) %>
</p>
<p style="padding-top: 50px;">
<%# 用户最近六个月的提交次数 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_six_month")) %>
</p>
<p style="padding-top: 50px;">
<%# 用户最近六个月的代码量 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_six_months")) %>
</p>
<p><%= link_to l(:button_back), :action => 'show', :id => @project %></p>
<% html_title(l(:label_repository), l(:label_statistics)) -%>
<% end %>

View File

@ -18,7 +18,7 @@
<% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%>
<!-- 匿评结束阶段,显示点赞按钮 -->
<li class="fr" id="student_work_praise_<%= work.id%>">
<%= render :partial => 'student_work_praise' %>
<%= render :partial => 'student_work_praise',:locals => {:work => work} %>
</li>
<% end%>
<div class="cl"></div>
@ -53,21 +53,36 @@
<% else %>
<div class="ProResultTable " >
<ul class="ProResultUl " >
<% test.results.each_with_index do |x, i| %>
<% test.results.reverse.each_with_index do |x, i| %>
<% unless x.nil? %>
<li >
<span class="w60 T_C">测试<%=i+1%></span>
<span class="w60 T_C">测试<%=test.results.size-i%></span>
<% if x["status"].to_i != 0 %>
<span class="w150 c_red">测试错误!</span>
<% if x["status"].to_i == 2 %>
<span class="w60 c_red">超时!</span>
<% else %>
<span class="w60 c_red">测试错误!</span>
<% end %>
<span class="w60">您的输出:</span>
<span class="width150"><pre><%=x["result"].force_encoding("UTF-8")%></pre></span>
<span class="width120"><pre style="white-space: pre-wrap; margin-right: 15px;"><%=x["result"].force_encoding("UTF-8")%> </pre></span>
<span class="w60">正确输出:</span>
<span class="width150"><pre><%=x["output"]%></pre></span>
<span class="width120"><pre style="white-space: pre-wrap; margin-right: 15px;"><%=x["output"]%></pre></span>
<% if x["status"].to_i == 2 %>
<span class="w50">耗时:</span>
<span class="w80"><pre><%=x["time_used"]%>毫秒</pre></span>
<% end %>
<div class="cl"></div>
<% else %>
<span class="w150 c_green">测试正确!</span>
<span class="w60 c_green">测试正确!</span>
<!-- <span class="w50"> 耗时:</span> -->
<!-- <span class="w80"><pre><%=x["time_used"]%>微秒</pre></span> -->
<div class="cl"></div>
<% end %>
</li>
<% end %>
<% end %>
</ul>
</div>

View File

@ -25,7 +25,7 @@
<% if @homework.homework_detail_manual.comment_status == 3 && !is_my_work %>
<!-- 匿评结束阶段,显示点赞按钮 -->
<li class="fr" id="student_work_praise_<%= work.id%>">
<%= render :partial => 'student_work_praise' %>
<%= render :partial => 'student_work_praise',:locals => {:work => work} %>
</li>
<% end%>
<div class="cl"></div>

View File

@ -46,8 +46,8 @@
<% end%>
<script type="text/javascript">
$(function(){
<% if !@is_evaluation && !@is_teacher %>
<% work=@homework.student_works.where("user_id = ?",User.current.id).first %>
<% if !@is_evaluation && (!@is_teacher || params[:show_work_id].present?) %>
<% work= params[:show_work_id].nil? ? @homework.student_works.where("user_id = ?",User.current.id).first : StudentWork.find(params[:show_work_id]) %>
<% unless work.nil? %>
<% if @homework.homework_type == 2 %>
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");

View File

@ -1,5 +1,5 @@
<% if is_praise_homework User.current.id,@work.id %>
<%= link_to "赞(#{praise_homework_count @work.id})",praise_student_work_student_work_path(@work), :remote => true,:class => 'orange_btn', :style => 'font-size:12px;'%>
<% if is_praise_homework User.current.id,work.id %>
<%= link_to "赞(#{praise_homework_count work.id})",praise_student_work_student_work_path(work), :remote => true,:class => 'orange_btn', :style => 'font-size:12px;'%>
<% else %>
<%= link_to "赞(#{praise_homework_count @work.id})","javascript:void(0)",:class => 'grey_btn', :style => 'font-size:12px;'%>
<%= link_to "赞(#{praise_homework_count work.id})","javascript:void(0)",:class => 'grey_btn', :style => 'font-size:12px;'%>
<% end %>

View File

@ -7,8 +7,7 @@
</span>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) if attachment.id && User.current == attachment.author && status != 2 %>
<span class="postAttSize">(<%= number_to_human_size attachment.filesize %>)</span>
<span class="author" title="<%= attachment.author%>">
<%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "c_orange" %>,
<span class="author">
<%= format_time(attachment.created_on) %>
</span>
<div class="cl"></div>

View File

@ -4,9 +4,9 @@
<p class="f14 mt5">
<span class="fb">作品名称:</span><%=@student_work.name%>
</p>
<div class="f14 mt5" style="max-width: 425px; color:#808181">
<div class="f14 mt5" style="max-width: 425px; color:#808181; max-height:300px; overflow: auto;">
<div class="fb fl dis">作品描述:</div>
<div class="upload_img fl" style="max-width: 350px;"><%=@student_work.description.html_safe %></div>
<div class="upload_img fl" style="max-width: 330px;"><%=@student_work.description.html_safe %></div>
<div class="cl"></div>
</div>
<p class="mt5">

View File

@ -4,9 +4,9 @@
<p class="f14 mt5">
<span class="fb">作品名称:</span><%=@student_work.name%>
</p>
<div class="f14 mt5" style="max-width: 425px; color:#808181">
<div class="f14 mt5" style="max-width: 425px; color:#808181; max-height:300px; overflow: auto;">
<div class="fb fl dis">作品描述:</div>
<div class="upload_img fl" style="max-width: 350px;"><%=@student_work.description.html_safe %></div>
<div class="upload_img fl" style="max-width: 330px;"><%=@student_work.description.html_safe %></div>
<div class="cl"></div>
</div>
<p class="mt5">

View File

@ -1 +1 @@
$('#student_work_praise_<%= @work.id%>').html('<%= escape_javascript(render :partial => 'student_work/student_work_praise')%>');
$('#student_work_praise_<%= @work.id%>').html('<%= escape_javascript(render :partial => 'student_work/student_work_praise', :locals => {:work => @work})%>');

View File

@ -0,0 +1,28 @@
<%= form_tag add_exist_file_to_course_user_path(user, :type => defined?(type) ? type : "6" ),:remote=>true,:id=>'course_list_form' do %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !courses.empty? %>
<% courses.each do |course| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="course_ids[]" type="checkbox" value="<%= course.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%></li>
</ul>
<% end %>
<% end %>
</div>
</div>
<div class="cl"></div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText mt10" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>
<% end %>

View File

@ -151,7 +151,7 @@
<% else %>
<% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("score desc") %>
<% end %>
<% student_works.each_with_index do |sw, i| %>
<% student_works.includes(:user).each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue">
<% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %>

View File

@ -2,14 +2,14 @@
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
<%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4">
<% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
<%= link_to activity.try(:author), user_path(activity.author_id, :host=>Setting.host_user), :class => "newsBlue mr15" %>
<% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id, :host=>Setting.host_user), :class => "newsBlue mr15" %>
<% end %>
TO
<%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
@ -18,15 +18,15 @@
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey"%>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %>
<% end %>
</div>
<% if activity.sticky == 1%>
<% if activity.sticky == 1 %>
<span class="sticky_btn_cir ml10">置顶</span>
<% end%>
<% if activity.locked%>
<% if activity.locked %>
<span class="locked_btn_cir ml10 fl" title="已锁定">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<% end%>
<% end %>
<div class="cl"></div>
<div class="homepagePostDate fl">
发帖时间:<%= format_time(activity.created_on) %>
@ -36,9 +36,9 @@
</div>
<div class="cl"></div>
<% if activity.parent_id.nil? %>
<% content = activity.content%>
<% content = activity.content %>
<% else %>
<% content = activity.parent.content%>
<% content = activity.parent.content %>
<% end %>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
<div class="cl"></div>
@ -113,7 +113,7 @@
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<ul>
<% activity.children.reorder("created_on desc").each do |reply|%>
<% activity.children.includes(:author).reorder("created_on desc").each do |reply|%>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= reply.id %>');

View File

@ -0,0 +1,27 @@
<%= form_tag share_message_to_course_user_path(user), :remote => true, :id => 'course_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !courses.empty? %>
<% courses.each do |course| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="course_ids[]" type="checkbox" value="<%= course.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= truncate(course.name, :lendght => 25) + '['+course.time.to_s+course.term + ']' %></li>
</ul>
<% end %>
<% end %>
</div>
</div>
<div class="cl"></div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();' %>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" class="sendSourceText mt10" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>

View File

@ -0,0 +1,27 @@
<%= form_tag share_news_to_course_user_path(user), :remote => true, :id => 'course_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !courses.empty? %>
<% courses.each do |course| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="course_ids[]" type="checkbox" value="<%= course.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= truncate(course.name, :lendght => 25) + '['+course.time.to_s+course.term + ']' %></li>
</ul>
<% end %>
<% end %>
</div>
</div>
<div class="cl"></div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();' %>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText mt10" onclick="hideModal();">取消</a>
</div>
</div>
<div class="cl"></div>

View File

@ -0,0 +1,32 @@
<%= form_tag add_exist_file_to_org_user_path(user, :type => defined?(type) ? type : "6" ),:remote=>true,:id=>'orgs_list_form' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="sectionWrap fl mr15">
<ul class="fontGrey3 sectionContent">
<% unless orgs.empty? %>
<% orgs.each do |org|%>
<li>
<label>
<input type="radio" name="org_id" value="<%= org.id%>" onchange="change_org_subfield('<%= org_resources_subfield_organization_path(:id=>org.id)%>')" class="mt3 fl mr5" />
<span><%= org.name%></span></label>
</li>
<%end%>
<%end%>
</ul>
</div>
<div class="columnWrap">
<ul class="columnContent">
<%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%>
</ul>
</div>
<div class="cl"></div>
<div class="orgDirection mb10 break_word" style="white-space: nowrap;-o-text-overflow:ellipsis;text-overflow: ellipsis;overflow: hidden">目标地址:</div>
<div class="courseSendSubmit mr15">
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" onclick="hideModal();" class="sendSourceText">取消</a>
</div>
<div class="cl"></div>
<%end %>

View File

@ -0,0 +1,31 @@
<%= form_tag share_message_to_org_user_path(user), :remote => true, :id => 'orgs_list_form' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="sectionWrap fl mr15">
<ul class="fontGrey3 sectionContent">
<% unless orgs.empty? %>
<% orgs.each do |org| %>
<li>
<label>
<input type="radio" name="org_id" value="<%= org.id %>" onchange="change_org_subfield('<%= org_resources_subfield_organization_path(:id=>org.id,:send_type => params[:send_type])%>')" class="mt3 fl mr5"/>
<span><%= org.name %></span></label>
</li>
<% end %>
<% end %>
</ul>
</div>
<div class="columnWrap">
<ul class="columnContent">
<%= render :partial => 'users/org_resources_subfield', :locals => {:subfield => nil} %>
</ul>
</div>
<div class="cl"></div>
<div class="orgDirection mb10 break_word" style="white-space: nowrap;-o-text-overflow:ellipsis;text-overflow: ellipsis;overflow: hidden">目标地址:</div>
<div class="courseSendSubmit mr15">
<%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();', :onclick => "check_des(event);" %>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" onclick="hideModal();" class="sendSourceText">取消</a>
</div>
<div class="cl"></div>
<% end %>

View File

@ -0,0 +1,32 @@
<%= form_tag share_news_to_org_user_path(user), :remote => true, :id => 'orgs_list_form' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="sectionWrap fl mr15">
<ul class="fontGrey3 sectionContent">
<% unless orgs.empty? %>
<% orgs.each do |org| %>
<li>
<label>
<input type="radio" name="org_id" value="<%= org.id %>" onchange="change_org_subfield('<%= org_resources_subfield_organization_path(:id=>org.id,:send_type => params[:send_type])%>')" class="mt3 fl mr5"/>
<span><%= org.name %></span></label>
</li>
<% end %>
<% end %>
</ul>
</div>
<div class="columnWrap">
<ul class="columnContent">
<%= render :partial => 'users/org_resources_subfield', :locals => {:subfield => nil} %>
</ul>
</div>
<div class="cl"></div>
<div class="orgDirection mb10 break_word" style="white-space: nowrap;-o-text-overflow:ellipsis;text-overflow: ellipsis;overflow: hidden">目标地址:</div>
<div class="courseSendSubmit mr15">
<%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();', :onclick => "check_des(event);" %>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" onclick="hideModal();" class="sendSourceText">取消</a>
</div>
<div class="cl"></div>
<% end %>

View File

@ -1,5 +1,3 @@
<div class="resources mt10">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">

Some files were not shown because too many files have changed in this diff Show More