Merge branch 'develop' into yuanke

This commit is contained in:
yuanke 2016-06-06 10:41:13 +08:00
commit 1173bb9039
157 changed files with 5879 additions and 3624 deletions

2
.gitignore vendored
View File

@ -30,6 +30,4 @@ vendor/cache
/public/files
/tags
/config/initializers/gitlab_config.rb
/config/wechat.yml
/config/menu.yml
1234567

View File

@ -1,4 +1,4 @@
source 'https://rubygems.org/'
source 'https://ruby.taobao.org/'
### <20><><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>bundle config mirror.https://rubygems.org https://gems.ruby-china.org <20>л<EFBFBD><D0BB><EFBFBD>ruby-chinaԴ
unless RUBY_PLATFORM =~ /w32/

View File

@ -13,34 +13,18 @@ module Mobile
end
post do
user = UserWechat.find_by_openid(params[:openid]).user
=begin
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)
page = params[:page] ? params[:page] : 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(",") + ")"
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
project_types = "('Message','Issue','ProjectCreateInfo')"
principal_types = "JournalsForMessage"
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(','))+")"
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}) " +
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc')
=end
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] : 0
user_project_ids = (user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (user.projects.map{|project| project.id}-shield_project_ids).join(",") + ")"
user_course_ids = (user.courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.map{|course| course.id}-shield_course_ids).join(",") + ")"
user_project_ids = (user.projects.where("status = 1").map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (user.projects.where("status = 1").map{|project| project.id}-shield_project_ids).join(",") + ")"
user_course_ids = (user.courses.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
project_types = "('Message','Issue','Project')"
principal_types = "JournalsForMessage"
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(",")
watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").count == 0 ? " " :Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",")
blog_ids = "(" + watched_user_blog_ids + ")"
activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +

View File

@ -98,6 +98,7 @@ module Mobile
end
expose :act_type #缺陷/作业/讨论区/留言等类型
expose :act_id
expose :id
expose :container_type #课程/项目/博客/个人
expose :author, using: Mobile::Entities::User do |a, opt| #用户信息
if a.is_a? ::UserActivity

View File

@ -304,7 +304,7 @@ class CoursesController < ApplicationController
@render_file = 'new_member_list'
@score_sort_by = "desc"
@sort_type = "score"
@sort_type = params[:sort_type] ? params[:sort_type] : "score"
@canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1'
@role = params[:role].nil? ? '2':params[:role]
@is_remote = true
@ -319,7 +319,7 @@ class CoursesController < ApplicationController
if @course.open_student == 1 || User.current.member_of_course?(@course)
@subPage_title = l :label_student_list
page = params[:page].nil? ? 0 : (params['page'].to_i - 1)
@all_members = student_homework_score(0,page, 10,@score_sort_by)
@all_members = student_homework_score(0,page, 10,@score_sort_by,@sort_type)
@members = @all_members
else
render_403

View File

@ -304,7 +304,7 @@ class MessagesController < ApplicationController
@content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
@temp = Message.new
@temp.content = "<blockquote>#{ll(Setting.default_language, :text_user_wrote, @message.author)} <br/>#{@message.content.html_safe}</blockquote>".html_safe
@temp.content = "<blockquote>#{ll(Setting.default_language, :text_user_wrote, @message.author.show_name)} <br/>#{@message.content.html_safe}</blockquote>".html_safe
end
def preview

View File

@ -1,6 +1,6 @@
class OrgDocumentCommentsController < ApplicationController
before_filter :find_organization, :only => [:new, :create, :show, :index]
before_filter :authorize_allowed, :only => [:create, :add_reply]
before_filter :authorize_allowed, :only => [:create]
helper :attachments,:organizations
layout 'base_org'
@ -13,6 +13,7 @@ class OrgDocumentCommentsController < ApplicationController
@org_document_comment = OrgDocumentComment.new(:organization_id => @organization.id, :creator_id => User.current.id)
@org_document_comment.title = params[:org_document_comment][:title]
@org_document_comment.content = params[:org_document_comment][:content]
@org_document_comment.status = params[:org_document_comment][:status] == "on" ? 1 : 0
@org_document_comment.save_attachments(params[:attachments])
if params[:field_id]
@org_document_comment.org_subfield_id = params[:field_id].to_i

View File

@ -6,7 +6,7 @@ class OrgSubfieldsController < ApplicationController
if OrgSubfield.where("organization_id=#{params[:organization_id]} and name=?",params[:name]).count == 0
@res = true
@organization = Organization.find(params[:organization_id])
@subfield = OrgSubfield.create(:name => params[:name], :organization_id => params[:organization_id],:priority => @organization.org_subfields.order("priority").last.priority + 1)
@subfield = OrgSubfield.create(:name => params[:name], :organization_id => params[:organization_id], :priority => @organization.org_subfields.order("priority").last.priority + 1)
if !params[:sub_dir].blank?
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]}'"
@ -15,17 +15,31 @@ class OrgSubfieldsController < ApplicationController
end
end
@subfield.update_attributes(:field_type => params[:field_type])
# 如果栏目是教师,不参入类型的配置,定义为右三模式
# 新增模块命名规则左边1开头右边2开头以前的不变
# eg23 右三
if params[:field_type] == "Comptec"
@subfield.update_attributes(:status => 23)
end
# admin配置的类型
update_status_by_type(@subfield, params[:field_type])
else
@res = false
end
end
# status类型说明详见SubField
def update_status_by_type subfield, type
case type
when "Resource"
subfield.update_attribute(:status, 6)
when "Comptec"
subfield.update_attribute(:status, 6)
when "Compstu"
subfield.update_attribute(:status, 7)
when "Comppro"
subfield.update_attribute(:status, 5)
when "Compcou"
subfield.update_attribute(:status, 2)
when "Compact"
subfield.update_attribute(:status, 4)
end
end
def show
@flag = params[:flag] || false
sort = ""

View File

@ -28,7 +28,8 @@ class OrganizationsController < ApplicationController
helper :project_score
helper :issues
include UsersHelper
before_filter :find_organization, :only => [:show, :members, :apply_subdomain, :select_org_layout, :teachers]
before_filter :find_organization, :only => [:show, :members, :apply_subdomain, :select_org_layout, :teachers, :students, :projects, :courses]
before_filter :allow_as_admin, :only => [:students, :teachers, :projects, :courses, :acts]
layout 'base_org'
def index
@ -76,22 +77,34 @@ class OrganizationsController < ApplicationController
def show
# 组织新类型 show_mode判断标准 1为新类型0为旧
if @organization.show_mode.to_i == 1 && params[:org_subfield_id].nil? && params[:list] .nil?
if @organization.switch_type && 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.find_by_sql("SELECT * from attachments WHERE container_id = #{@organization.id} and container_type = 'Organization' and attachtype = 0 and filename REGEXP '(.jpg|.png|.bmp|.gif|.jpeg)' ORDER BY created_on desc limit 1").first
@org_banner_attchment = Attachment.find_by_sql("SELECT * from attachments WHERE container_id = #{@organization.id} and container_type = 'Organization' and attachtype = 1 and filename REGEXP '(.jpg|.png|.bmp|.gif|.jpeg)' ORDER BY created_on desc limit 1").first
@subfield_content = @organization.org_subfields.order("priority")
@organization = Organization.find(params[:id])
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
render :layout => 'base_org2'
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
# 精品课程, 不符合条件的组织则不查询
if @organization.org_subfields.where(:field_type => "Compcou", :hide => 0).count > 0
@excellent_courses = Course.find_by_sql("select c.*, (select count(*) from course_activities where course_activities.course_id = c.id) as course_count
from courses c where c.is_delete =0 and c.is_public =1 and is_excellent =1 order by course_count desc limit 5;")
end
# 热门项目
if @organization.org_subfields.where(:field_type => "Comppro", :hide => 0).count > 0
# @excellent_projects = Project.where(:is_public => true, :status => true, :hot => true).order("project_score")
@excellent_projects = Project.find_by_sql("select p.*, (select count(*) from forge_activities where forge_activities.project_id = p.id) as project_count
from projects p where p.status =1 and p.is_public =1 and hot =1 order by project_count desc limit 5;")
end
# 最新动态, 来自我关联的项目和课程
if @organization.org_subfields.where(:field_type => "Compact", :hide => 0).count > 0
@acts = UserActivity.find_by_sql("SELECT * FROM `user_activities` where act_type in ('HomeworkCommon', 'News', 'Message', 'Issue') and
((container_type = 'Course' and container_id in (#{course_ids.join(',')})) or (container_type = 'Project' and container_id in (#{project_ids.join(',')})))
order by created_at desc limit 6;")
end
render :layout => 'base_org_custom'
else
render_403
end
@ -159,22 +172,12 @@ class OrganizationsController < ApplicationController
end
def teachers
unless @organization.allow_set_teachers
render_403
return
end
q = params[:search].nil? ? "" : "#{params[:search].strip}"
@field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Comptec").first : OrgSubfield.find(params[:org_subfield_id])
@type = params[:type]
if @type == "courses" || @type.nil?
@org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc")
elsif @type == "students"
@org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc")
elsif @type == "resources"
@org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from attachments where attachments.author_id = u.id) as course_count
from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc")
elsif @type == "famous"
@org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and u.excellent_teacher =1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc")
@ -192,6 +195,73 @@ class OrganizationsController < ApplicationController
end
end
def students
q = params[:search].nil? ? "" : "#{params[:search].strip}"
@field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Compstu").first : OrgSubfield.find(params[:org_subfield_id])
@type = params[:type]
if @type == "courses" || @type.nil?
@org_students = User.find_by_sql("select u.*, ue.student_id, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
from users u, user_extensions ue where u.id = ue.user_id and ue.identity= 1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc")
elsif @type == "famous"
@org_students = User.find_by_sql("select u.*, ue.student_id, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
from users u, user_extensions ue where u.id = ue.user_id and ue.identity= 1 and u.excellent_student =1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc")
end
limit = 10
# @is_remote = true
@students_count = @org_students.count
@atta_pages = Paginator.new @students_count, limit, params['page'] || 1
@offset ||= @atta_pages.offset
#@curse_attachments_all = @all_attachments[@offset, @limit]
@org_students = paginateHelper @org_students, limit
respond_to do |format|
format.html
format.js
end
end
def atta_page_public container
limit = 10
@containers_count = container.count
@atta_pages = Paginator.new @containers_count, limit, params['page'] || 1
@offset ||= @atta_pages.offset
@containers = paginateHelper container, limit
respond_to do |format|
format.html
format.js
end
end
def projects
q = params[:search].nil? ? "" : "#{params[:search].strip}"
@field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Comppro").first : OrgSubfield.find(params[:org_subfield_id])
@type = params[:type]
if @type.nil?
@containers = Project.find_by_sql("select p.*, (select count(*) from forge_activities where forge_activities.project_id = p.id) as project_count
from projects p where p.status =1 and p.is_public =1 and name like '%#{q}%' order by project_count desc;")
elsif @type == "famous"
@containers = Project.find_by_sql("select p.*, (select count(*) from forge_activities where forge_activities.project_id = p.id) as project_count
from projects p where p.status =1 and p.is_public =1 and hot =1 and name like '%#{q}%' order by project_count desc;")
end
atta_page_public @containers
end
def courses
q = params[:search].nil? ? "" : "#{params[:search].strip}"
@field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Compstu").first : OrgSubfield.find(params[:org_subfield_id])
@type = params[:type]
if @type.nil?
@containers = Course.find_by_sql("select c.*, (select count(*) from course_activities where course_activities.course_id = c.id) as course_count
from courses c where c.is_delete =0 and c.is_public =1 and name like '%#{q}%' order by course_count desc;")
elsif @type == "famous"
@containers = Course.find_by_sql("select c.*, (select count(*) from course_activities where course_activities.course_id = c.id) as course_count
from courses c where c.is_delete =0 and c.is_public =1 and is_excellent = 1 and name like '%#{q}%' order by course_count desc;")
end
atta_page_public @containers
end
def acts
end
def searchmember_by_name members, name
#searchPeopleByRoles(project, StudentRoles)
mems = []
@ -322,6 +392,13 @@ class OrganizationsController < ApplicationController
@organization = Organization.find(params[:id])
end
def allow_as_admin
unless User.current.admin?
render_403
return
end
end
def setting
@organization = Organization.find(params[:id])
@ -471,6 +548,18 @@ class OrganizationsController < ApplicationController
end
end
def update_field_by_admin
@type = params[:type]
@status = params[:status]
if @type == "project"
@container = Project.find(params[:container])
@status == "reset" ? @container.update_column(:hot, 0) : @container.update_column(:hot, 1)
else
@container = Course.find(params[:container])
@status == "reset" ? @container.update_column(:is_excellent, 0) : @container.update_column(:is_excellent, 1)
end
end
# 设置为名师
def set_excellent_teacher
@ex_teacher = User.find(params[:user])
@ -483,6 +572,16 @@ class OrganizationsController < ApplicationController
@ex_teacher.update_column(:excellent_teacher, 0)
end
def set_excellent_student
@ex_student = User.find(params[:user])
@ex_student.update_column(:excellent_student, 1)
end
def reset_excellent_student
@ex_student = User.find(params[:user])
@ex_student.update_column(:excellent_student, 0)
end
def hide_org_subfield
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
@org_subfield.update_attribute(:hide, 1)

View File

@ -390,7 +390,7 @@ class StudentWorkController < ApplicationController
student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')'
end
#开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
if @homework.is_open == 1 || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?)
if (@homework.is_open == 1 && @course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?)
if @order == 'lastname'
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
elsif @order == 'student_id'
@ -456,7 +456,7 @@ class StudentWorkController < ApplicationController
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count
else
if @homework.is_open == 1 || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?)
if (@homework.is_open == 1 &&@course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?)
if @order == 'lastname'
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
elsif @order == 'student_id'

View File

@ -1,7 +1,7 @@
class SubDocumentCommentsController < ApplicationController
before_filter :find_subdomain_and_subfield, :only => [:new, :create, :show, :index, :destroy, :edit]
before_filter :find_subfield_content, :only => [:show, :index]
before_filter :authorize_allowed, :only => [:create, :add_reply]
before_filter :authorize_allowed, :only => [:create]
helper :attachments,:organizations
layout 'base_sub_domain'

View File

@ -18,6 +18,9 @@ class SubDomainsController < ApplicationController
else
@res = false
end
respond_to do |format|
format.js
end
end
def update

View File

@ -443,12 +443,7 @@ class UsersController < ApplicationController
# 资源分享请求弹框
def apply_resource
if User.current.logged?
@attachment = Attachment.find params[:attachment_id]
@state = 2
else
@state = 1
end
@attachment = Attachment.find params[:attachment_id]
respond_to do |format|
format.js
end
@ -575,7 +570,7 @@ class UsersController < ApplicationController
end
if !params[:search].nil?
search = "%#{params[:search].to_s.strip.downcase}%"
@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id} and #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)}
@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id} and (#{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p)",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)}
else
@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)}
end
@ -2036,7 +2031,7 @@ class UsersController < ApplicationController
@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} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
if(params[:type].blank? || params[:type] == "1") # 我的资源
if(params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
if params[:status] == "2"
@attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
@ -2050,7 +2045,7 @@ class UsersController < ApplicationController
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
end
elsif params[:type] == "6" # 公共资源
elsif (params[:type].blank? || params[:type] == "6") # 公共资源
if params[:status] == "2"
@attachments = get_course_resources_public( user_course_ids, @order, @score)
elsif params[:status] == "3"
@ -2190,7 +2185,7 @@ class UsersController < ApplicationController
@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} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
if(params[:type].blank? || params[:type] == "1") # 我的资源
if(params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
if params[:status] == "2"
@attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
@ -2204,7 +2199,7 @@ class UsersController < ApplicationController
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
end
elsif params[:type] == "6" # 公共资源
elsif (params[:type].blank? || params[:type] == "6") # 公共资源
if params[:status] == "2"
@attachments = get_course_resources_public( user_course_ids, @order, @score)
elsif params[:status] == "3"
@ -2331,7 +2326,7 @@ class UsersController < ApplicationController
@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} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
if(params[:type].blank? || params[:type] == "1") # 我的资源
if(params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
if params[:status] == "2"
@attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
@ -2345,7 +2340,7 @@ class UsersController < ApplicationController
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
end
elsif params[:type] == "6" # 公共资源
elsif (params[:type].blank? || params[:type] == "6") # 公共资源
if params[:status] == "2"
@attachments = get_course_resources_public( user_course_ids, @order, @score)
elsif params[:status] == "3"

View File

@ -154,12 +154,7 @@ class WechatsController < ActionController::Base
end
end
### controller method
module Controllers
def get_open_id
begin
@ -167,7 +162,6 @@ class WechatsController < ActionController::Base
code = params[:code] || session[:wechat_code]
openid = get_openid_from_code(code)
raise "无法获取到微信openid" unless openid
render :json => {status:0, openid: openid}
rescue Exception=>e
@ -194,6 +188,8 @@ class WechatsController < ActionController::Base
openid: openid,
user: user
)
ws = WechatService.new
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台", user.login, format_time(Time.now))
render :json => {status:0, msg: "绑定成功"}
rescue Exception=>e
render :json => {status: -1, msg: e.message}
@ -202,9 +198,25 @@ class WechatsController < ActionController::Base
def login
session[:wechat_code] = params[:code] if params[:code]
openid = get_openid_from_code(params[:code])
@wechat_user = user_binded?(openid)
render 'wechats/login', layout: 'base_wechat'
end
def user_activities
session[:wechat_code] = params[:code] if params[:code]
code = params[:code] || session[:wechat_code]
openid = get_openid_from_code(code)
@wechat_user = user_binded?(openid)
unless @wechat_user
redirect_to login_wechat_path
return
end
render 'wechats/user_activities', layout: nil
end
private
def get_openid_from_code(code)
openid = session[:wechat_openid]
@ -226,37 +238,8 @@ class WechatsController < ActionController::Base
uw = UserWechat.where(openid: openid).first
end
def user_activity(user)
@user = user
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)
@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(",") + ")"
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
project_types = "('Message','Issue','Project')"
principal_types = "JournalsForMessage"
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(','))+")"
@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}) " +
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10)
end
def process_activity(user_activity)
act= user_activity.act
case user_activity.container_type.to_s
when 'Course'
when 'Project'
case user_activity.act_type.to_s
when 'Issue'
[act.project.name.to_s+" | 项目问题", act.subject.to_s, url_to_avatar(act.author),"http://wechat.trustie.net/app.html#/issue/#{act.id}"]
end
end
end
end

View File

@ -10,14 +10,14 @@ class ZipdownController < ApplicationController
#勿删 before_filter :authorize, :only => [:assort,:download_user_homework]
SAVE_FOLDER = "#{Rails.root}/files"
OUTPUT_FOLDER = "#{Rails.root}/files/archiveZip"
MAX_PATH = 50
#统一下载功能
def download
if User.current.logged?
begin
if params[:base64file]
file = Base64.decode64(params[:base64file])
file = file.sub('*', '+')
file = decode64(params[:base64file])
send_file "#{OUTPUT_FOLDER}/#{file}", :filename => filename_for_content_disposition(file), :type => detect_content_type(file)
else
send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => filename_for_content_disposition(params[:filename]), :type => detect_content_type(params[:file])
@ -125,7 +125,11 @@ class ZipdownController < ApplicationController
end
def encode64(str)
Base64.encode64(str).sub('+', '*')
Base64.urlsafe_encode64(str)
end
def decode64(str)
Base64.urlsafe_decode64(str)
end
def zip_homework_common homework_common
@ -242,6 +246,12 @@ class ZipdownController < ApplicationController
def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[])
rename_zipfile = zip_name_refer ||= "#{Time.now.to_i.to_s}.zip"
# 文件名过长
if rename_zipfile.size > MAX_PATH
rename_zipfile = rename_zipfile[0,rename_zipfile.size-4][0,MAX_PATH-4] + rename_zipfile[-4,4]
end
zipfile_name = "#{output_path}/#{rename_zipfile}"
Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name))

View File

@ -182,7 +182,7 @@ module ApiHelper
timeIntoFormat = 0
updateAtValue = ""
if timePassed < 0
updateAtValue = "时间有问题"
updateAtValue = "刚刚"
elsif timePassed < ONE_MINUTE
updateAtValue = "1分钟前"
elsif timePassed < ONE_HOUR

View File

@ -70,7 +70,6 @@ module ApplicationHelper
attach = Attachment.find(attachment_id)
# 条件取否result结果为true则不能下载
result = attach.is_public == 0 && attach.author != User.current && !attach.get_apply_resource_status(attach.id, User.current.id) && !attach_show_allow(attach)
return result
end
# Time 2015-03-24 15:27:29
@ -3104,9 +3103,10 @@ def named_attachment_url_without_domain(id, filename, option={})
attachment_id = (Attachment === id ? id.id : id)
Setting.protocol + "://" + Setting.host_name + "/attachments/" + attachment_id.to_s + "/" + filename
end
#判断是否为默认的组织栏目
def is_default_field? field
(field.name == 'activity' || field.name == 'course' || field.name == 'project') && field.field_type == 'default'
(field.name == 'activity' || field.name == 'course' || field.name == 'project' ) && field.field_type == 'default'
end
def host_with_protocol

View File

@ -42,11 +42,15 @@ module OrganizationsHelper
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
# 获取两种类型的隐藏状态数量大于0说明是可见
def double_field_show org
OrgSubfield.find_by_sql("SELECT * FROM `org_subfields` where organization_id = #{org.id} and (field_type = 'Compstu' or field_type = 'Comptec') and hide = 0;").count
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;")
attachments = User.current.admin? ? org_attachments.first(5) : visable_attachemnts(org_attachments).first(5)
attachments.sort_by{|x| x.created_on}.reverse
end
# 从内容中获取路径
@ -59,6 +63,58 @@ module OrganizationsHelper
end
end
def org_user_by_type obj
case obj.act_type
when "Message"
user = obj.act.author
when "News"
user = obj.act.author
when "HomeworkCommon"
user = obj.act.user
when "Issue"
user = obj.act.author
end
end
def org_title_by_type obj
case obj.act_type
when "Message"
user = obj.act.parent_id.nil? ? obj.act.subject : obj.act.parent.subject
when "News"
user = obj.act.title
when "HomeworkCommon"
user = obj.act.name
when "Issue"
user = obj.act.subject
end
end
def org_content_by_type obj
case obj.act_type
when "Message"
user = obj.act.parent_id.nil? ? obj.act.content : obj.act.parent.content
when "News"
user = obj.act.description
when "HomeworkCommon"
user = obj.act.description
when "Issue"
user = obj.act.description
end
end
def org_time_by_type obj
case obj.act_type
when "Message"
time = obj.act.updated_on
when "News"
user = obj.act.created_on
when "HomeworkCommon"
user = obj.act.updated_at
when "Issue"
user = obj.act.updated_on
end
end
#排列下拉框
def subfield_status_option
type = []
@ -66,34 +122,14 @@ module OrganizationsHelper
option1 << "左一"
option1 << "1"
type << option1
# option2 = []
# option2 << "中一"
# option2 << "2"
# type << option2
option2 = []
option2 << "左二"
option2 << "2"
type << option2
option3 = []
option3 << ""
option3 << ""
option3 << "3"
type << option3
option4 = []
option4 << "左三"
option4 << "4"
type << option4
option5 = []
option5 << "左四"
option5 << "5"
type << option5
option6 = []
option6 << "右一"
option6 << "6"
type << option6
option7 = []
option7 << "右二"
option7 << "7"
type << option7
option8 = []
option8 << "右三"
option8 << "8"
type << option8
type
end
@ -104,18 +140,22 @@ module OrganizationsHelper
option1 << "左一"
option1 << "1"
type << option1
option2 = []
option2 << "左二"
option2 << "2"
type << option2
option3 = []
option3 << "左二"
option3 << "3"
option3 << ""
option3 << "2"
type << option3
option4 = []
option4 << "左三"
option4 << "4"
option4 << "右一"
option4 << "3"
type << option4
option6 = []
option6 << "右一"
option6 << "6"
type << option6
option5 = []
option5 << "右二"
option5 << "5"
type << option5
type
end
@ -128,30 +168,36 @@ module OrganizationsHelper
when 3
resulet = "左二"
when 4
resulet = "左三"
when 5
resulet = "左四"
when 6
resulet = "右一"
when 7
when 5
resulet = "右二"
when 8
when 6
resulet = "右三"
end
end
# 系统栏目只有管理员才能看到
def subfield_to_addmin?(org)
if User.current.admin?
@organization.org_subfields.order("priority")
else
@organization.org_subfields.select { |os| (os.field_type != "Comptec" && os.field_type != "Compstu" && os.field_type != "Comppro" && os.field_type != "Compcou" && os.field_type != "Compact") }.sort_by {|os| os.priority}
end
end
def get_subfield_acts field
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')
org_acts
end
def allow_to_create?(org, type)
!org_subfield_had_created?(org, type) && User.current.admin?
end
def org_subfield_had_created?(org, type)
sub_field = org.org_subfields.select{|subfield| subfield.field_type == type}
result = sub_field.length > 0 ? true : false
result
end
def org_subfield_type(field)
@ -166,9 +212,20 @@ module OrganizationsHelper
result = "教师"
when "Complex"
result = "综合"
when "Compcou"
result = "课程"
when "Comppro"
result = "项目"
when "Compact"
result = "动态"
end
end
# 获取最新动态
# def get_latest_acts
# acts = UserActivity.find_by_sql("SELECT * FROM `user_activities` where act_type in ('HomeworkCommon', 'news', 'message', 'Issue') and (container_type = 'Course' or container_type = 'Project') order by created_at limit 10;")
# end
def org_teacher_resource_count user
results = Attachment.find_by_sql("SELECT * FROM attachments where author_id = #{user.id};").count
end
@ -187,4 +244,33 @@ module OrganizationsHelper
from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and u.excellent_teacher =1 order by course_count desc").first(5)
end
def excellent_students
User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
from users u, user_extensions ue where u.id = ue.user_id and ue.identity = 1 and u.excellent_student = 1 order by course_count desc").first(5)
end
def excellent_teachers_hide? org
org.org_subfields.where(:field_type => "Comptec").first.hide
end
def excellent_students_hide? org
org.org_subfields.where(:field_type => "Compstu").first.hide
end
#当前学期(2015春季学期)
def current_time_and_term course
str = ""
term = cur_course_term
if (course.time == course.end_time && course.term == course.end_term) || (course.end_term.nil? && course.end_time.nil?) || course.time > Time.now.year
str = course.time.to_s + course.term.to_s
elsif course.time == Time.now.year && set_term_value(cur_course_term) <= set_term_value(course.term)
str = course.time.to_s + course.term.to_s
elsif course.end_time < Time.now.year || (course.end_time == Time.now.year && set_term_value(cur_course_term) >= set_term_value(course.term))
str = course.end_time.to_s + course.end_term.to_s
else
str = Time.now.year.to_s + cur_course_term.to_s
end
str
end
end

View File

@ -143,7 +143,7 @@ class Attachment < ActiveRecord::Base
def get_apply_resource_status attachment_id, author_id
status = ApplyResource.where("attachment_id =? and user_id =?", attachment_id, author_id).first.try(:status)
status == 2 ? true :false
status == 2
end
# add by nwb

View File

@ -21,7 +21,7 @@ class BlogComment < ActiveRecord::Base
after_save :add_user_activity
after_update :update_activity
after_create :update_parent_time, :blog_wechat_message
after_create :update_parent_time
before_destroy :destroy_user_activity
scope :like, lambda {|arg|
@ -77,16 +77,16 @@ class BlogComment < ActiveRecord::Base
end
#博客回复微信模板消息
def blog_wechat_message
ws = WechatService.new
if self.parent_id.nil?
self.author.watcher_users.each do |watcher|
content = strip_html self.author.try(:realname) + " 发表了博客:" + self.title.html_safe, 200
ws.message_update_template watcher.id, "blog_comment", self.id, "#{l(:label_new_blog_template)}", content, format_time(self.created_at)
end
else
content = strip_html self.content.html_safe, 200
ws.comment_template self.parent.author_id, "blog_comment", self.parent_id, "#{l(:label_blog_comment_template)}", self.author.try(:realname), format_time(self.created_at), content
end
end
# def blog_wechat_message
# ws = WechatService.new
# if self.parent_id.nil?
# self.author.watcher_users.each do |watcher|
# content = strip_html self.author.try(:realname) + " 发表了博客:" + self.title.html_safe, 200
# ws.message_update_template watcher.id, "blog_comment", self.id, "#{l(:label_new_blog_template)}", content, format_time(self.created_at)
# end
# else
# content = strip_html self.content.html_safe, 200
# ws.comment_template self.parent.author_id, "blog_comment", self.parent_id, "#{l(:label_blog_comment_template)}", self.author.try(:realname), format_time(self.created_at), content
# end
# end
end

View File

@ -41,15 +41,15 @@ class Comment < ActiveRecord::Base
after_destroy :down_course_score
def act_as_system_message
ws = WechatService.new
#ws = WechatService.new
if self.commented.course
if self.author_id != self.commented.author_id
self.course_messages << CourseMessage.new(:user_id => self.commented.author_id, :course_id => self.commented.course.id, :viewed => false)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.commented.author_id} and shield_type='Course' and shield_id=#{self.commented.course.id}").count
if count == 0
content = strip_html self.comments.html_safe, 200
ws.comment_template self.commented.author_id, "course_notice", self.id, "#{l(:label_notice_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
end
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.commented.author_id} and shield_type='Course' and shield_id=#{self.commented.course.id}").count
# if count == 0
# content = strip_html self.comments.html_safe, 200
# ws.comment_template self.commented.author_id, "course_notice", self.id, "#{l(:label_notice_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
# end
end
else # 项目相关
if self.author_id != self.commented.author_id

View File

@ -30,7 +30,7 @@ class HomeworkCommon < ActiveRecord::Base
:author => :author,
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
after_create :act_as_activity, :send_mail,:act_as_course_message
after_update :update_activity, :wechat_message
after_update :update_activity
after_save :act_as_course_activity
after_destroy :delete_kindeditor_assets
@ -63,7 +63,7 @@ class HomeworkCommon < ActiveRecord::Base
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
if count == 0
ws = WechatService.new
ws.homework_template(m.user_id, "homework", self.id, "#{l(:label_new_homework_template)}", self.course.name, self.name.html_safe, self.end_time.to_s + " 23:59:59")
ws.homework_message_notice(m.user_id, "homework", self.id, "#{m.user.show_name}#{l(:label_new_homework_template)}", self.course.name, "新作业:"+ self.name.html_safe, "作业内容请点击“详情”查看。")
end
# end
end
@ -108,15 +108,15 @@ class HomeworkCommon < ActiveRecord::Base
end
#修改作业后发送微信模板消息
def wechat_message
self.course.members.each do |member|
count = ShieldWechatMessage.where("container_type='User' and container_id=#{member.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
if count == 0
ws = WechatService.new
ws.homework_template(member.user_id, "homework", self.id, "#{l(:label_update_homework_template)}", self.course.name, self.name.html_safe, self.end_time.to_s + " 23:59:59")
end
end
end
# def wechat_message
# self.course.members.each do |member|
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{member.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
# if count == 0
# ws = WechatService.new
# ws.homework_template(member.user_id, "homework", self.id, "#{l(:label_update_homework_template)}", self.course.name, self.name.html_safe, self.end_time.to_s + " 23:59:59")
# end
# end
# end
delegate :language_name, :language, :to => :homework_detail_programing

View File

@ -160,27 +160,27 @@ class Issue < ActiveRecord::Base
unless self.author_id == self.assigned_to_id
self.forge_messages << ForgeMessage.new(:user_id => self.assigned_to_id, :project_id => self.project_id, :viewed => false)
end
self.project.members.each do |m|
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Project' and shield_id=#{self.project_id}").count
if m.user_id != self.author_id && count == 0
ws = WechatService.new
str = " 有新缺陷了: "
case self.tracker_id
when 1
str = " 有新缺陷了: "
when 2
str = " 有新功能了: "
when 3
str = " 有新支持了: "
when 4
str = " 有新任务了: "
when 5
str = " 有新周报了: "
end
content = strip_html self.project.name + str + self.subject.html_safe, 200
ws.message_update_template m.user_id, "issues", self.id, "#{l(:label_new_issue_template)}", content, format_time(self.created_on)
end
end
# self.project.members.each do |m|
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Project' and shield_id=#{self.project_id}").count
# if m.user_id != self.author_id && count == 0
# ws = WechatService.new
# str = " 有新缺陷了: "
# case self.tracker_id
# when 1
# str = " 有新缺陷了: "
# when 2
# str = " 有新功能了: "
# when 3
# str = " 有新支持了: "
# when 4
# str = " 有新任务了: "
# when 5
# str = " 有新周报了: "
# end
# content = strip_html self.project.name + str + self.subject.html_safe, 200
# ws.message_update_template m.user_id, "issues", self.id, "#{l(:label_new_issue_template)}", content, format_time(self.created_on)
# end
# end
if self.tracker_id == 5
self.project.members.each do |m|
if m.roles.first.to_s.include?("Manager") && m.user_id != self.author_id && m.user_id != self.assigned_to_id

View File

@ -55,7 +55,6 @@ class Journal < ActiveRecord::Base
# fq
after_save :act_as_activity,:be_user_score, :act_as_forge_message, act_as_at_message(:notes, :user_id)
after_create :issue_wechat_message
# end
#after_destroy :down_user_score
#before_save :be_user_score
@ -238,11 +237,11 @@ class Journal < ActiveRecord::Base
end
#缺陷回复微信模板消息
def issue_wechat_message
if !self.notes.nil? && self.notes.gsub(' ','') != ''
ws = WechatService.new
content = strip_html self.notes.html_safe, 200
ws.comment_template self.issue.author_id, "issues", self.journalized_id, "#{l(:label_issue_comment_template)}", self.user.try(:realname), format_time(self.created_on), content
end
end
# def issue_wechat_message
# if !self.notes.nil? && self.notes.gsub(' ','') != ''
# ws = WechatService.new
# content = strip_html self.notes.html_safe, 200
# ws.comment_template self.issue.author_id, "issues", self.journalized_id, "#{l(:label_issue_comment_template)}", self.user.try(:realname), format_time(self.created_on), content
# end
# end
end

View File

@ -259,24 +259,24 @@ class JournalsForMessage < ActiveRecord::Base
if self.m_parent_id.nil?
if self.user_id != self.jour.user_id
self.course_messages << CourseMessage.new(:user_id => self.jour.user_id,:course_id => self.jour.course.id, :viewed => false)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count
if count == 0
ws = WechatService.new
#content = truncate(strip_tags(self.notes.to_s), length: 200)
content = strip_html self.notes.html_safe, 200
ws.comment_template self.jour.user_id, "homework", self.jour_id, "#{l(:label_homework_comment_template)}", self.user.try(:realname), format_time(self.created_on), content
end
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count
# if count == 0
# ws = WechatService.new
# #content = truncate(strip_tags(self.notes.to_s), length: 200)
# content = strip_html self.notes.html_safe, 200
# ws.comment_template self.jour.user_id, "homework", self.jour_id, "#{l(:label_homework_comment_template)}", self.user.try(:realname), format_time(self.created_on), content
# end
end
else
if self.user_id != self.parent.user_id
self.course_messages << CourseMessage.new(:user_id => self.parent.user_id,:course_id => self.jour.course.id, :viewed => false)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.parent.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count
if count == 0
ws = WechatService.new
#content = truncate(strip_tags(self.notes.to_s), length: 200)
content = strip_html self.notes.html_safe, 200
ws.comment_template self.parent.user_id, "homework", self.jour_id, "#{l(:label_new_second_comment_template)}", self.user.try(:realname), format_time(self.created_on), content
end
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.parent.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count
# if count == 0
# ws = WechatService.new
# #content = truncate(strip_tags(self.notes.to_s), length: 200)
# content = strip_html self.notes.html_safe, 200
# ws.comment_template self.parent.user_id, "homework", self.jour_id, "#{l(:label_new_second_comment_template)}", self.user.try(:realname), format_time(self.created_on), content
# end
end
end
end
@ -293,7 +293,7 @@ class JournalsForMessage < ActiveRecord::Base
if self.user_id != self.jour_id # 过滤自己给自己的留言消息
receivers << self.jour
content = strip_html self.notes, 200
ws.message_update_template self.jour_id, "journal_for_message", self.id, "#{l(:label_new_journals_template)}", content, format_time(self.created_on)
ws.journal_notice self.jour_id, "journal_for_message", self.id, "#{l(:label_new_journals_template)}", self.user.show_name, format_time(self.created_on),content
end
else # 留言回复
reply_to = User.find(self.reply_id)
@ -303,8 +303,8 @@ class JournalsForMessage < ActiveRecord::Base
if self.user_id != self.parent.jour_id && self.reply_id != self.parent.jour_id # 给东家发信息,如果回复的对象是东家则不发
receivers << self.parent.jour
end
content = strip_html self.notes, 200
ws.comment_template self.reply_id, "journal_for_message", self.parent.id, "#{l(:label_journals_comment_template)}", self.user.try(:realname), format_time(self.created_on), content
#content = strip_html self.notes, 200
#ws.comment_template self.reply_id, "journal_for_message", self.parent.id, "#{l(:label_journals_comment_template)}", self.user.try(:realname), format_time(self.created_on), content
end
receivers.each do |r|
self.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => self.id, :journals_for_message_type => "Principal", :viewed => false)

View File

@ -258,28 +258,28 @@ class Message < ActiveRecord::Base
# 主贴项目成员都能收到
# 回帖:帖子的发布人收到
def act_as_system_message
ws = WechatService.new
#ws = WechatService.new
if self.course
if self.parent_id.nil? # 主贴
self.course.members.includes(:user).each do |m|
if self.author.allowed_to?(:as_teacher, self.course) && m.user_id != self.author_id # 老师 自己的帖子不给自己发送消息
#self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course.id}").count
if count == 0
content = strip_html self.subject, 200
ws.topic_publish_template m.user_id, "course_discussion", self.id, "#{l(:label_course_topic_template)}", content, self.author.try(:realname), format_time(self.created_on)
end
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course.id}").count
# if count == 0
# content = strip_html self.subject, 200
# ws.topic_publish_template m.user_id, "course_discussion", self.id, "#{l(:label_course_topic_template)}", content, self.author.try(:realname), format_time(self.created_on)
# end
end
end
else # 回帖
parent_author_id = Message.find(self.parent_id).author_id
if parent_author_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
self.course_messages << CourseMessage.new(:user_id => parent_author_id, :course_id => self.board.course_id, :viewed => false)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{parent_author_id} and shield_type='Course' and shield_id=#{self.board.course_id}").count
if count == 0
content = strip_html self.content.html_safe, 200
ws.comment_template parent_author_id, "course_discussion", self.parent_id, "#{l(:label_topic_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
end
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{parent_author_id} and shield_type='Course' and shield_id=#{self.board.course_id}").count
# if count == 0
# content = strip_html self.content.html_safe, 200
# ws.comment_template parent_author_id, "course_discussion", self.parent_id, "#{l(:label_topic_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
# end
end
end
elsif self.project # 项目相关
@ -287,22 +287,22 @@ class Message < ActiveRecord::Base
self.project.members.includes(:user).each do |m|
if m.user_id != self.author_id
#self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.board.project_id, :viewed => false)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Project' and shield_id=#{self.project.id}").count
if count == 0
content = strip_html self.subject, 200
ws.topic_publish_template m.user_id, "project_discussion", self.id, "#{l(:label_project_topic_template)}", content, self.author.try(:realname), format_time(self.created_on)
end
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Project' and shield_id=#{self.project.id}").count
# if count == 0
# content = strip_html self.subject, 200
# ws.topic_publish_template m.user_id, "project_discussion", self.id, "#{l(:label_project_topic_template)}", content, self.author.try(:realname), format_time(self.created_on)
# end
end
end
else # 回帖
parent_author_id = Message.find(self.parent_id).author_id
if parent_author_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
self.forge_messages << ForgeMessage.new(:user_id => parent_author_id, :project_id => self.board.project_id, :viewed => false)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{parent_author_id} and shield_type='Project' and shield_id=#{self.board.project_id}").count
if count == 0
content = strip_html self.content.html_safe, 200
ws.comment_template parent_author_id, "project_discussion", self.parent_id, "#{l(:label_topic_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
end
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{parent_author_id} and shield_type='Project' and shield_id=#{self.board.project_id}").count
# if count == 0
# content = strip_html self.content.html_safe, 200
# ws.comment_template parent_author_id, "project_discussion", self.parent_id, "#{l(:label_topic_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
# end
end
end
end

View File

@ -174,7 +174,7 @@ class News < ActiveRecord::Base
if count == 0
ws = WechatService.new
content = strip_html self.author.try(:realname) + " 发布了通知:" + self.title.html_safe, 200
ws.message_update_template m.user_id, "course_notice", self.id, "#{l(:label_new_notice_template)}", content, format_time(self.created_on)
ws.class_notice m.user_id, "course_notice", self.id, "#{l(:label_new_notice_template)}", self.course.name, self.author.show_name, format_time(self.created_on), content, "点击查看通知详情"
end
end
end

View File

@ -1,5 +1,6 @@
class OrgDocumentComment < ActiveRecord::Base
attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title,:sticky,:locked
# status: 1 模式二中置顶 0模式二中正常显示
attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title, :sticky, :locked, :status
include Redmine::SafeAttributes
include ApplicationHelper
belongs_to :organization

View File

@ -11,6 +11,8 @@ class OrgSubfield < ActiveRecord::Base
acts_as_attachable
after_create :create_board_sync
after_destroy :update_priority
# status 为栏目定制决定参数1 左一 2 左二 3 左三 4 右一 5 右二 6 右三 默认的 7 学霸 8 热门项目 9 精品课程 10 最新动态
# 创建资源栏目讨论区
def create_board_sync
@board = self.boards.build

View File

@ -18,17 +18,17 @@ class Organization < ActiveRecord::Base
end
def add_default_subfields
OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default', :priority => 1)
OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default', :priority => 2)
OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default', :priority => 3)
OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default', :priority => 1, :status => 0)
OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default', :priority => 2, :status => 2)
OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default', :priority => 3, :status => 2)
end
def switch_type
self.show_mode.to_i == 1 ? true : false
self.show_mode.to_i == 1
end
def allow_set_teachers
self.allow_teacher.to_i == 1 ? true : false
self.allow_teacher.to_i == 1
end
def secdomain_name

View File

@ -110,4 +110,144 @@ class WechatService
Rails.logger.info "send over. #{req}"
end
end
def two_keys_template(openid, template_id, type, id, first, key1, key2, remark="")
data = {
touser:openid,
template_id:template_id,
url:"#{Setting.protocol}://#{Setting.host_name}/assets/wechat/app.html#/#{type}/#{id}",
topcolor:"#FF0000",
data:{
first: {
value:first,
color:"#707070"
},
keyword1:{
value:key1,
color:"#707070"
},
keyword2:{
value:key2,
color:"#707070"
},
remark:{
value:remark,
color:"#707070"
}
}
}
data
end
def four_keys_template(openid, template_id, type, id, first, key1, key2, key3, key4, remark="")
data = {
touser:openid,
template_id:template_id,
url:"#{Setting.protocol}://#{Setting.host_name}/assets/wechat/app.html#/#{type}/#{id}",
topcolor:"#FF0000",
data:{
first: {
value:first,
color:"#707070"
},
keyword1:{
value:key1,
color:"#707070"
},
keyword2:{
value:key2,
color:"#707070"
},
keyword3:{
value:key3,
color:"#707070"
},
keyword4:{
value:key4,
color:"#707070"
},
remark:{
value:remark,
color:"#707070"
}
}
}
data
end
def binding_succ_notice(user_id, first, key1, key2)
uw = UserWechat.where(user_id: user_id).first
unless uw.nil?
data = {
touser:uw.openid,
template_id:Wechat.config.binding_succ_notice,
url:"#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities",
topcolor:"#FF0000",
data:{
first: {
value:first,
color:"#707070"
},
keyword1:{
value:key1,
color:"#707070"
},
keyword2:{
value:key2,
color:"#707070"
},
remark:{
value:"绑定成功后可使用微信查看Trustie平台最新动态",
color:"#707070"
}
}
}
begin
req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data)
rescue Exception => e
Rails.logger.error "[homework] ===> #{e}"
end
Rails.logger.info "send over. #{req}"
end
end
def journal_notice(user_id, type, id, first, key1, key2, remark="")
uw = UserWechat.where(user_id: user_id).first
unless uw.nil?
data = two_keys_template uw.openid,Wechat.config.journal_notice, type, id, first, key1, key2, remark
begin
req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data)
rescue Exception => e
Rails.logger.error "[homework] ===> #{e}"
end
Rails.logger.info "send over. #{req}"
end
end
def homework_message_notice(user_id, type, id, first, key1, key2, remark="")
uw = UserWechat.where(user_id: user_id).first
unless uw.nil?
data = two_keys_template uw.openid,Wechat.config.homework_message_notice, type, id, first, key1, key2, remark
begin
req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data)
rescue Exception => e
Rails.logger.error "[homework] ===> #{e}"
end
Rails.logger.info "send over. #{req}"
end
end
def class_notice(user_id, type, id, first, key1, key2, key3, key4, remark="")
uw = UserWechat.where(user_id: user_id).first
unless uw.nil?
data = four_keys_template uw.openid,Wechat.config.class_notice, type, id, first, key1, key2, key3, key4, remark
begin
req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data)
rescue Exception => e
Rails.logger.error "[homework] ===> #{e}"
end
Rails.logger.info "send over. #{req}"
end
end
end

View File

@ -1,6 +1,11 @@
<% unless contributor_course_scor(course.id).count == 0 %>
<ul class="rankList">
<h4>课程活跃度
<h4>
<% if (User.current.logged? && course.open_student == 1) || (User.current.member_of_course?(course)) || User.current.admin? %>
<%= link_to "课程活跃度", course_member_path(course, :role => 2, :sort_type => 'act_score'), :class => '' %>
<% else %>
课程活跃度
<% end %>
<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;">

View File

@ -1,7 +1,12 @@
<% 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>
<h4>
<% if (User.current.logged? && course.open_student == 1) || (User.current.member_of_course?(course)) || User.current.admin? %>
<%= link_to "课程英雄榜", course_member_path(course, :role => 2), :class => '' %>
<% else %>
<span>课程英雄榜</span>
<% end %>
<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/>

View File

@ -9,7 +9,7 @@
<div class="ping_distop f14">
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
<span>
<%= link_to "#{journal.user.show_name}(#{journal.user.login})", user_path(journal.user),:class => 'c_blue fb fl mb10 f14', :target => "_blank"%>
<%= link_to journal.user.show_name, user_path(journal.user),:class => 'c_blue fb fl mb10 f14', :target => "_blank"%>
</span>
<span class="c_grey fr f14">
<%= format_time(journal.created_on) %>

View File

@ -26,7 +26,7 @@
<li class="ml10" style="padding-right: 15px;"><span class="fontGrey6 fb">学号</span></li>
<li style="padding-right: 55px; margin-left: 160px;"><span class="fontGrey6 fb">分班</span></li>
<li class="st_list_score ml10">
<%= link_to '作业积分', member_score_sort_course_path(:sort_type => 'score', :sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true, :class => 'ml25'%>
<%= link_to '英雄榜', member_score_sort_course_path(:sort_type => 'score', :sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true, :class => 'ml35'%>
<% if @sort_type == "score" && @score_sort_by == 'desc' %>
<a id="pic" href="javascript:" class= "st_down"></a>
<% elsif @sort_type == "score" && @score_sort_by == 'asc' %>
@ -51,17 +51,9 @@
<%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 32, :height => 32)) %>
</a>
<ul>
<% if @canShowCode %>
<li>
<% if member.user.show_name == ''%>
<%= link_to("#{l(:label_bidding_user_studentname)}<span >#{member.user.name}</span>".html_safe,user_path(member.user)) %>
<% else%>
<%= link_to("#{l(:label_bidding_user_studentname)}<span >#{member.user.show_name}</span>".html_safe,user_path(member.user)) %>
<%end%>
</li>
<% else %>
<li><%= link_to("#{l(:label_bidding_user_studentname)}<span >#{member.user.name}</span>".html_safe, user_path(member.user)) %></li>
<% end %>
<li>
<%= link_to("#{l(:label_bidding_user_studentname)}<span >#{member.user.show_name}</span>".html_safe,user_path(member.user)) %>
</li>
<br/>
<% unless member.user.user_extensions.student_id == ''%>
<li><%= link_to("#{l(:label_bidding_user_studentcode)}<span >#{member.user.user_extensions.student_id}</span>".html_safe,user_path(member.user)) %></li>

View File

@ -1,10 +1,20 @@
<div id="popbox02">
<div class="ni_con">
<% if @homework.is_open == 0 %>
<% if @homework.is_open == 0 && @homework.course.is_public == 1 %>
<h2>公开作品</h2>
<p>
本次作业的所有作品将对Trustie平台所有注册用户开放请问是否确定公开作品
</p>
<% elsif @homework.is_open == 0 && @homework.course.is_public == 0 %>
<h2>公开作品</h2>
<p>
该作业是私有课程的作业,公开作品后本次作业的所有作品将对课程内的所有学生开放,请问是否确定公开作品?
</p>
<% elsif @homework.is_open == 1 && @homework.course.is_public == 0 %>
<h2>取消公开作品</h2>
<p>
您将取消“公开作品”的功能,该私有作业的作品将只在作业截止后对已提交作品的学生开放,请问是否确定?
</p>
<% else %>
<h2>取消公开作品</h2>
<p>

View File

@ -0,0 +1,10 @@
<div class="por_footer_con">
<ul>
<li ><a href="<%= about_us_path %>" target="_blank" class="" >关于我们<span>|</span></a></li>
<li ><a href="<%= agreement_path %>" target="_blank" class="" >服务协议<span>|</span></a></li>
<li ><a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="" >帮助中心<span>|</span></a></li>
<li ><a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="" > 贴吧交流</a></li>
<div class="cl"></div>
</ul>
<p>Copyright 2007~2016, All Rights Reserved 湘ICP备09019772</p>
</div>

View File

@ -157,9 +157,9 @@
</div>
</div>
<div class="lg-foot" id="lg-foot" onclick="show_more_msg();">
<%= l(:label_expend_information)%>
<label id="expend_more_information" value="show_more"><%= l(:label_expend_information)%></label>
<span class="g-arr-down">
<img src="/images/jiantou.jpg" width="12" height="6" />
<img id="arrow" src="/images/jiantou.jpg" width="12" height="6" />
</span>
</div>
</div><!--项目简介 end-->

View File

@ -86,39 +86,39 @@
<li class="nav-element-default" style="display:<%= field.hide == 0?'block':'none' %>;">
<%= link_to "首页", organization_path(@organization), :class => "sn-link-white" %>
</li>
<% when 'course' %>
<li class="nav-element-default" style="display:<%= field.hide == 0?'block':'none' %>;">
<a href="#course_<%= field.id %>" class="sn-link-white"> 课程动态</a>
</li>
<% when 'project' %>
<li class="nav-element-default" style="display:<%= field.hide == 0?'block':'none' %>;">
<a href="#project_<%= field.id %>" class="sn-link-white">项目动态</a>
</li>
<% end %>
<% else %>
<% if field.field_type == "Post" && field.hide == 0 %>
<li class="nav-element">
<a href="#message_<%= field.id %>" class="sn-link-white"><%= field.name %></a>
<% 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 => "sn-link-white", :target => "_blank" %>
<% else %>
<%= link_to field.name, show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "sn-link-white", :target => "_blank" %>
<% end %>
<% else %>
<%= link_to field.name, organization_path(@organization, :org_subfield_id => field.id), :class => "sn-link-white", :target => "_blank" %>
<% end %>
</li>
<!--二级目录-->
<div class="sn-row sn-subnav-position sn-grey-opacity" style="display:none;">
<ul class="sn-sub-nav" style="display:<%= if_hidden_subdomain( field) ? 'block':'none' %>;">
<% field.sub_domains.each do |subdomain| %>
<li><%=link_to subdomain.name, org_subfield_sub_domain_sub_document_comments_path(subdomain, :org_subfield_id => field.id), :class => "sn-link-grey" %></li>
<li><%=link_to subdomain.name, org_subfield_sub_domain_sub_document_comments_path(subdomain, :org_subfield_id => field.id), :class => "sn-link-grey", :target => "_blank" %></li>
<li class="sn-subnav-slice">|</li>
<% end %>
</ul>
</div>
<% elsif field.field_type == "Resource" && field.hide == 0 %>
<li class="nav-element">
<a href="#resource_<%= field.id %>" class="sn-link-white"><%= field.name %></a>
<%= link_to field.name, org_subfield_files_path(field), :class => "sn-link-white", :target => "_blank" %>
</li>
<% end %>
<% end %>
<% end %>
<% if User.current.admin_of_org?(@organization) %>
<li class="nav-element">
<a href="<%= setting_organization_path(@organization) %>" class="sn-link-white">配置</a>
<a href="<%= setting_organization_path(@organization) %>" class="sn-link-white" target ="_blank">配置</a>
</li>
<% end %>
</ul>
@ -173,7 +173,7 @@
<li class="sn-mr50"><a href="<%= about_us_path %>" class="sn-link-white sn-f18">关于我们</a></li>
<li class="sn-mr50"><a href="<%= agreement_path %>" class="sn-link-white sn-f18">服务协议</a></li>
<li class="sn-mr50"><a href="http://forge.trustie.net/forums/1/memos/1168" class="sn-link-white sn-f18">帮助中心</a></li>
<li><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="sn-link-white sn-f18">在线报名</a></li>
</ul>
<div class="sn-contact">联系人:魏小姐 | 电 话0731-84761282 | 传 真0731-84761268 | 邮 箱office@gnssopenlab.org</div>
<div class="sn-address">地 址湖南省长沙市开福区东风路89号观园大厦23层<br />

View File

@ -0,0 +1,43 @@
<!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 'new_user', 'public', 'org_custom','jquery/jquery-ui-1.9.2' %>
<%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
<%=render :partial => "math_js" %>
</head>
<body style="background: #fff">
<% update_visiti_count @organization %>
<header id="por_header">
<%= render :partial => 'org_custom_header', :locals => {:subfield_content => @subfield_content} %>
</header>
<%# 内容开始 %>
<div id="por_container">
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
</div>
<%# 内容结束 %>
<%# 页面底部 %>
<footer class="por_footer"><%= render :partial => "layouts/org_custom_footer" %></footer>
<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 %>
<%# JS提前加载 %>
<%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%>
<%= javascript_include_tag 'attachments' %>
</body>
</html>

View File

@ -104,10 +104,11 @@
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<% if @topic.author.id == User.current.id %>
<li>
<%= link_to(l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'postOptionLink') if @message.editable_by?(User.current) %>
</li>
<% if @topic.author.id == User.current.id %>
<li>
<%= link_to(l(:button_delete), {:action => 'destroy', :id => @topic},:method => :post,
:data => {:confirm => l(:text_are_you_sure)},

View File

@ -0,0 +1,30 @@
<div>
<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="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" %>
</div>
<div class="cl"></div>
<p id="homework_course_id_span" class="c_red mt5"></p>
<p id="e_tip" class="c_grey"></p>
<p id="e_tips" class="c_grey"></p>
<div class="cl"></div>
<div class="mt10">
<div class="fl" id="topic_attachments">
<%= render :partial => 'org_document_comments/attachment', :locals => {:container => nil} %>
</div>
</div>
<div class="cl"></div>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_topic_submit_btn">确定</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" onclick="cancel_create_org_document();" id="new_topic_cancel_btn" class="fr mr10 mt3">取消</a>
<div class="cl"></div>
</div>
</div>

View File

@ -36,7 +36,7 @@
$('#doc_title_hint').hide();
}
</script>
<div class="resources" nhname="new_topic_form">
<div class="resources" style="margin-top:<%= User.current.logged? ? '0px':'10px' %>;" nhname="new_topic_form">
<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id), :id => 'new_org_document_form' do |f| %>
<div>
<input class="postDetailInput fl" maxlength="250" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" placeholder="请输入文章标题" />

View File

@ -27,37 +27,37 @@
<div class="cl"></div>
<div>
<div class="resources" nhname="new_topic_form">
<%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id, :flag => @flag, :org_subfield_id => params[:org_subfield_id]),:method => 'put', :id => 'new_org_document_form' do |f| %>
<div>
<input class="postDetailInput fl mr15" style="margin-bottom:15px;" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" onblur="check_org_title();" value="<%= @org_document.title %>" />
</div>
<div id="doc_title_hint"></div>
<div class="cl"></div>
<div>
<div class="mt10">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='description_textarea' name="org_document_comment[content]"><%=@org_document.content.html_safe %></textarea>
<%#= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %>
<%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id, :flag => @flag, :org_subfield_id => params[:org_subfield_id]),:method => 'put', :id => 'new_org_document_form' do |f| %>
<div>
<input class="postDetailInput fl mr15" style="margin-bottom:15px;" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" onblur="check_org_title();" value="<%= @org_document.title %>" />
</div>
<div id="doc_title_hint"></div>
<div class="cl"></div>
<div>
<div class="mt10">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='description_textarea' name="org_document_comment[content]"><%=@org_document.content.html_safe %></textarea>
<%#= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %>
</div>
<div class="cl"></div>
<p id="homework_course_id_span" class="c_red mt5"></p>
<p id="e_tip" class="c_grey"></p>
<p id="e_tips" class="c_grey"></p>
<div class="cl"></div>
<p id="homework_course_id_span" class="c_red mt5"></p>
<p id="e_tip" class="c_grey"></p>
<p id="e_tips" class="c_grey"></p>
<div class="cl"></div>
<div class="mt10">
<div class="fl" id="topic_attachments">
<%= render :partial => 'org_document_comments/attachment', :locals => {:container => @org_document} %>
<div class="mt10">
<div class="fl" id="topic_attachments">
<%= render :partial => 'org_document_comments/attachment', :locals => {:container => @org_document} %>
</div>
</div>
<div class="cl"></div>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_topic_submit_btn">确定</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" id="new_topic_cancel_btn" onclick="location=document.referrer;" class="fr mr10 mt3">取消</a>
<div class="cl"></div>
</div>
</div>
<div class="cl"></div>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_topic_submit_btn">确定</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" id="new_topic_cancel_btn" onclick="location=document.referrer;" class="fr mr10 mt3">取消</a>
<div class="cl"></div>
</div>
</div>
<% end %>
</div>
</div>
</div>

View File

@ -37,35 +37,6 @@
</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>
<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="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" %>
</div>
<div class="cl"></div>
<p id="homework_course_id_span" class="c_red mt5"></p>
<p id="e_tip" class="c_grey"></p>
<p id="e_tips" class="c_grey"></p>
<div class="cl"></div>
<div class="mt10">
<div class="fl" id="topic_attachments">
<%= render :partial => 'org_document_comments/attachment', :locals => {:container => nil} %>
</div>
</div>
<div class="cl"></div>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_topic_submit_btn">确定</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" onclick="cancel_create_org_document();" id="new_topic_cancel_btn" class="fr mr10 mt3">取消</a>
<div class="cl"></div>
</div>
</div>
<%= render :partial => "form" %>
<% end %>
</div>

View File

@ -5,7 +5,7 @@
showNormalImage('message_description_<%= @document.id %>');
});
</script>
<div class="resources" id="organization_document_<%= @document.id %>">
<div class="resources" style="margin-top:<%= User.current.logged? ? '0px':'10px' %>;" id="organization_document_<%= @document.id %>">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(@document.creator_id) %>
@ -124,7 +124,7 @@
</div>
<div class="cl"></div>
<%# end %>
<% if User.current.logged?%>
<%# if User.current.logged?%>
<div class="talkWrapMsg" nhname="about_talk_reply">
<em class="talkWrapArrow"></em>
<div class="cl"></div>
@ -137,7 +137,7 @@
<div class="cl"></div>
</div>
</div>
<% end %>
<%# end %>
</div>
</div>

View File

@ -1,10 +1,9 @@
<% if @res %>
$("#org_subfield_list").html("");
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',
:locals => {:subfields => @organization.org_subfields.order("priority") }) %>");
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>");
$("#sub_field_left_lists").html("");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
$("#org_excellent_teachers").html("<%= escape_javascript(render :partial => 'organizations/setting_excellent_teachers') %>");
$("#org_custom_admin").html("<%= escape_javascript(render :partial => 'organizations/org_custom_admin') %>");
<% end %>
$("#subfield_name").val("");
$("#sub_dir").val("");

View File

@ -1,6 +1,5 @@
$("#org_subfield_list").html("");
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',
:locals => {:subfields => @organization.org_subfields.order("priority") }) %>");
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>");
$("#sub_field_left_lists").html("");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
$("#org_excellent_teachers").html("<%= escape_javascript(render :partial => 'organizations/setting_excellent_teachers') %>");
$("#org_custom_admin").html("<%= escape_javascript(render :partial => 'organizations/org_custom_admin') %>");

View File

@ -1,3 +1,4 @@
$("#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}) %>");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>");

View File

@ -1,2 +1,2 @@
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields.order("priority")}) %>");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");

View File

@ -1,9 +1,9 @@
<% 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 "更多", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more" , :target => "_blank" %>
<%= link_to "更多", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "f12 fontGrey2 fr" , :target => "_blank" %>
<% else %>
<%= link_to "更多", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more" , :target => "_blank" %>
<%= link_to "更多", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "f12 fontGrey2 fr" , :target => "_blank" %>
<% end %>
<% else %>
<%= link_to "更多", organization_path(@organization, :org_subfield_id => field.id), :class => "more" , :target => "_blank" %>
<%= link_to "更多", organization_path(@organization, :org_subfield_id => field.id), :class => "f12 fontGrey2 fr" , :target => "_blank" %>
<% end %>

View File

@ -0,0 +1,11 @@
<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>

View File

@ -0,0 +1,12 @@
<div class="sn-row sn-bg-grey2">
<div class="sn-footer">
<ul class="sn-footer-link">
<li class="sn-mr50"><a href="<%= about_us_path %>" class="sn-link-white sn-f18">关于我们</a></li>
<li class="sn-mr50"><a href="<%= agreement_path %>" class="sn-link-white sn-f18">服务协议</a></li>
<li class="sn-mr50"><a href="http://forge.trustie.net/forums/1/memos/1168" class="sn-link-white sn-f18">帮助中心</a></li>
<li><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="sn-link-white sn-f18">在线报名</a></li>
</ul>
<div class="sn-contact">联系人:魏小姐 | 电 话0731-84761282 | 传 真0731-84761268 | 邮 箱office@gnssopenlab.org</div>
<div class="sn-address">地 址湖南省长沙市开福区东风路89号观园大厦23层<br />卫星导航仿真与测试开放实验室</div>
</div>
</div>

View File

@ -0,0 +1,8 @@
<% if @org_logo_attchment.blank? || !User.current.logged? %>
<img src="/images/org_new_style/logo.jpg" width="367" height="63" class="sn-mt13 sn-fl" alt=""/>
<% else %>
<img src="/attachments/<%= @org_logo_attchment.id %>/<%= @org_logo_attchment.filename %>" width="367" height="63" class="sn-mt13 sn-fl" alt="">
<% end %>
<% if User.current.admin_of_org?(@organization) %>
<a href="#" class="sn-logo-add" title="点击替换LOGO" onclick="org_new_files_upload();"></a>
<% end %>

View File

@ -0,0 +1,24 @@
<% containers.each do |container| %>
<div class="teacher-list-row">
<div>
<div class="teacher-avatar">
<%= link_to image_tag(url_to_avatar(container), :width => "90", :height => "90"), container.class == Course ? course_path(container) : project_path(container) %>
</div>
<div class="fl">
<div class="ml25 mb20"><span class="teacher-name"><%=link_to container.name, container.class == Course ? course_path(container) : project_path(container) %></span></div>
<div class="teacher-social-block">
<div class="block-num"><%= container.members.count %></div>
<div class="block-title">成员</div>
</div>
<div class="block-slice"></div>
<div class="teacher-social-block">
<div class="block-num"><%= container.attachments.count %></div>
<div class="block-title">资源</div>
</div>
</div>
<a href="javascript:void(0);" class="fr teacher-select" onclick="admin_hide_org($(this),'<%= container.id %>');" id="hide_<%= container.id %>"><%= container.class == Course ? (container.is_excellent == 0 ? "设为精品" : "取消精品") : (container.hot ==0 ? "设为热门" : "取消热门") %></a>
</div>
<div class="cl"></div>
</div>
<% end %>

View File

@ -0,0 +1,30 @@
<% if allow_to_create?(@organization, "Comptec") %>
<li class="fl mr15">
<input type="radio" id="orgTec" value="Comptec" name="field_type" />
<label for="Comptec">教师</label>
</li>
<% end %>
<% if allow_to_create?(@organization, "Compstu") %>
<li class="fl mr15">
<input type="radio" id="orgStu" value="Compstu" name="field_type" />
<label for="Comptec">学生</label>
</li>
<% end %>
<% if allow_to_create?(@organization, "Comppro") %>
<li class="fl mr15">
<input type="radio" id="orgPro" value="Comppro" name="field_type" />
<label for="Comppro">热门项目</label>
</li>
<% end %>
<% if allow_to_create?(@organization, "Compcou") %>
<li class="fl mr15">
<input type="radio" id="orgCou" value="Compcou" name="field_type" />
<label for="Compcou">精品课程</label>
</li>
<% end %>
<% if allow_to_create?(@organization, "Compact") %>
<li class="fl mr15">
<input type="radio" id="orgAct" value="Compact" name="field_type" />
<label for="Compact">最新动态</label>
</li>
<% end %>

View File

@ -0,0 +1,96 @@
<div class="por_header_top">
<div class="por_header_con" >
<%= image_tag(url_to_avatar(@organization), width:"67", height: "61", :id => 'nh_user_tx', :class => "por_logo fl ", :target => "_blank") %>
<% if User.current.logged? %>
<div class="navHomepageProfile" id="navHomepageProfile">
<ul>
<li class="homepageProfileMenuIcon fr mt15" id="homepageProfileMenuIcon">
<%= link_to "<div class='user-img' id='user_avatar'>#{image_tag(url_to_avatar(User.current), :width =>"40", :height => "40", :class => "portraitRadius",:alt=>"头像", :id => "nh_user_logo")}</div>".html_safe, user_activities_path(User.current.id) %>
<ul class="topnav_login_list none sn-f12" id="topnav_login_list" style="text-align:left;">
<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><%= link_to "退出", logout_url_without_domain, :class => "menuGrey", :method => "post"%></li>
</ul>
</li>
</ul>
</div>
<% else %>
<ul class="por_login fr">
<li><a href="<%= signin_url_without_domain %>" target="_blank" class=" ">登录</a></li>
<li><a href="<%= register_url_without_domain %>" target="_blank" class=" ">注册</a></li>
</ul>
<% end %>
<!--<div class="por_search fr">-->
<!--<input type="text" class="pro_input_search fl" value="00000" />-->
<!--<a href="javascript:void(0);" class="por_search_btn fl"></a>-->
<!--</div>-->
</div>
</div>
<div class="cl"></div>
<div class="por_nav" >
<ul >
<% subfield_content.each do |field| %>
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'activity' %>
<li style="display:<%= field.hide == 0 ? 'block':'none' %>;">
<%= link_to "首页", organization_path(@organization), :class => "por_index_act" %>
</li>
<% when 'course' %>
<% when 'project' %>
<% end %>
<% else %>
<% if field.field_type == "Post" && field.hide == 0 %>
<li>
<% 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 => "sn-link-white", :target => "_blank" %>
<% else %>
<%= link_to field.name, show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "sn-link-white", :target => "_blank" %>
<% end %>
<% else %>
<%= link_to field.name, organization_path(@organization, :org_subfield_id => field.id), :class => "sn-link-white", :target => "_blank" %>
<% end %>
</li>
<!--二级目录-->
<div class="sn-row sn-subnav-position sn-grey-opacity" style="display:none;">
<ul class="sn-sub-nav" style="display:<%= if_hidden_subdomain( field) ? 'block':'none' %>;">
<% field.sub_domains.each do |subdomain| %>
<li><%=link_to subdomain.name, org_subfield_sub_domain_sub_document_comments_path(subdomain, :org_subfield_id => field.id), :class => "sn-link-grey" %></li>
<li class="sn-subnav-slice">|</li>
<% end %>
</ul>
</div>
<% elsif field.field_type == "Resource" && field.hide == 0 %>
<li class="nav-element">
<%= link_to field.name, org_subfield_files_path(field), :class => "sn-link-white", :target => "_blank" %>
</li>
<% end %>
<% end %>
<% end %>
</ul>
<% if User.current.admin_of_org?(@organization) %>
<a href="<%= setting_organization_path(@organization) %>" class="link-black fr por_edit_index" target="_blank">配置</a>
<% end %>
<div class="cl"></div>
</div><!--por_nav 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,170 @@
<div class="por_hotbar clear" style="display:<%= field.hide == 0 ? 'block':'none' %>;">
<% if acts.blank? %>
<h2 class="por_h2_index clear"><%= field.name %></h2>
<p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p>
<% else %>
<h2 class="por_h2_index clear"><%= field.name %>
<%= render :partial => 'organizations/link_subfield_more', :locals => {:field => field} %>
</h2>
<ul class="por_hotbar_left fl">
<% if acts.count > 1 %>
<% acts[1..2].each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %>
<li>
<%= link_to "<span class='por_icons_hot fl'>热门推荐</span>#{document.title}".html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hot_title link-black', :target => "_blank", :title => document.title %>
<p class="mt5 mb5"><span class="por_time mr10"><%= time_from_now(document.created_at) %></span>
<%= link_to document.creator.show_name, user_path(document.creator), :class => "por_hot_name link-blue", :target => "_blank" %>
</p>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => document.id, :content=> document.content, :maxheight => 60, :maxwordsnum => 80, :maxwidth => 0, :cl => "por_hot_txt"} %>
</li>
<% else 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 = activity.org_act %>
<% content = message.parent_id.nil? ? message.content : message.parent.content %>
<% title = message.parent_id.nil? ? message.subject : message.parent.subject %>
<% if message.board.org_subfield_id %>
<li>
<%= link_to "<span class='por_icons_hot fl'>热门推荐</span>#{title}".html_safe, board_message_url_in_org(message.board.id,message.id), class: 'por_hot_title link-black', :target => "_blank", :title => title %>
<p class="mt5 mb5"><span class="por_time mr10"><%= time_from_now(message.created_on) %></span>
<%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %>
</p>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 60, :maxwordsnum => 80, :maxwidth => 0, :cl => "por_hot_txt"} %>
</li>
<% else %>
<li>
<%= link_to "<span class='por_icons_hot fl'>热门推荐</span>#{title}".html_safe, board_message_path(message.board.id,message.id), class: 'por_hot_title link-black', :target => "_blank", :title => title %>
<p class="mt5 mb5"><span class="por_time mr10"><%= time_from_now(message.created_on) %></span>
<%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %>
</p>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 60, :maxwordsnum => 80, :maxwidth => 0, :cl => "por_hot_txt"} %>
</li>
<% end %>
<% end %>
<% if activity.org_act_type == 'News' and News.where("id=?", activity.org_act_id).count > 0 %>
<% news = activity.org_act %>
<li>
<%= link_to "<span class='por_icons_hot fl'>热门推荐</span>#{news.title}".html_safe, news_path(news), class: 'por_hot_title link-black', :target => "_blank", :title => news.title %>
<p class="mt5 mb5"><span class="por_time mr10"><%= time_from_now(news.created_on) %></span>
<%= link_to news.author.show_name, user_path(news.author), :class => "por_hot_name link-blue", :target => "_blank" %>
</p>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => news.id, :content=> news.description, :maxheight => 60, :maxwordsnum => 80, :maxwidth => 0, :cl => "por_hot_txt"} %>
</li>
<% end %>
<% end %>
<% end %>
<% end %>
<% if acts.count > 3 %>
<% activity = acts[3] %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %>
<li>
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hot_title link-black', :target => "_blank", :title => document.title %>
<p class="mt5 mb5"><span class="por_time mr10"><%= time_from_now(document.created_at) %></span>
<%= link_to document.creator.show_name, user_path(document.creator), :class => "por_hot_name link-blue", :target => "_blank" %>
</p>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => document.id, :content=> document.content, :maxheight => 60, :maxwordsnum => 80, :maxwidth => 0, :cl => "por_hot_txt"} %>
</li>
<% else 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 = activity.org_act %>
<% content = message.parent_id.nil? ? message.content : message.parent.content %>
<% title = message.parent_id.nil? ? message.subject : message.parent.subject %>
<% if message.board.org_subfield_id %>
<li>
<%= link_to title, board_message_url_in_org(message.board.id,message.id), class: 'por_hot_title link-black', :target => "_blank", :title => title %>
<p class="mt5 mb5"><span class="por_time mr10"><%= time_from_now(message.created_on) %></span>
<%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %>
</p>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 60, :maxwordsnum => 80, :maxwidth => 0, :cl => "por_hot_txt"} %>
</li>
<% else %>
<li>
<%= link_to title, board_message_path(message.board.id,message.id), class: 'por_hot_title link-black', :target => "_blank", :title => title %>
<p class="mt5 mb5"><span class="por_time mr10"><%= time_from_now(message.created_on) %></span>
<%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %>
</p>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 60, :maxwordsnum => 80, :maxwidth => 0, :cl => "por_hot_txt"} %>
</li>
<% end %>
<% end %>
<% if activity.org_act_type == 'News' and News.where("id=?", activity.org_act_id).count > 0 %>
<% news = activity.org_act %>
<li>
<%= link_to news.title, news_path(news), class: 'por_hot_title link-black', :target => "_blank", :title => news.title %>
<p class="mt5 mb5"><span class="por_time mr10"><%= time_from_now(news.created_on) %></span>
<%= link_to news.author.show_name, user_path(news.author), :class => "por_hot_name link-blue", :target => "_blank" %>
</p>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => news.id, :content=> news.description, :maxheight => 60, :maxwordsnum => 80, :maxwidth => 0, :cl => "por_hot_txt"} %>
</li>
<% end %>
<% end %>
<% end %>
</ul>
<%# if acts.count > 3 %>
<% activity = acts.first %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %>
<div class="por_hotbar_right fl">
<% if get_image_path_from_content(document.content).nil? %>
<%= link_to image_tag("/images/default_blank/mo-1.jpg", :width => "299", :height => "246"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{get_image_path_from_content(document.content)}", :width => "299", :height => "246"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %>
<% end %>
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :class => 'por_hot_title_r link-black', :target => "_blank", :title => document.title %>
<p class="mt5 mb5"><span class="por_time mr10"><%= time_from_now(document.created_at) %></span><%= link_to document.creator.show_name, user_path(document.creator), :class => "por_hot_name link-blue", :target => "_blank" %></p>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => document.id, :content=> document.content, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %>
</div>
<% else 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 = activity.org_act %>
<% content = message.parent_id.nil? ? message.content : message.parent.content %>
<% title = message.parent_id.nil? ? message.subject : message.parent.subject %>
<% if message.board.org_subfield_id %>
<div class="por_hotbar_right fl">
<% if get_image_path_from_content(content).nil? %>
<%= link_to image_tag("/images/default_blank/mo-1.jpg", :width => "299", :height => "246"), board_message_url_in_org(message.board.id, message.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{get_image_path_from_content(content)}", :width => "299", :height => "246"), board_message_url_in_org(message.board.id, message.id), :target => "_blank" %>
<% end %>
<%= link_to title, board_message_url_in_org(message.board.id, message.id), :class => 'por_hot_title_r link-black', :target => "_blank", :title => title %>
<p class="mt5 mb5"><span class="por_time mr10"><%= time_from_now(message.created_on) %></span><%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %></p>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %>
</div>
<% else %>
<div class="por_hotbar_right fl">
<% if get_image_path_from_content(document.content).nil? %>
<%= link_to image_tag("/images/default_blank/mo-1.jpg", :width => "299", :height => "246"), board_message_path(message.board.id, message.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{get_image_path_from_content(content)}", :width => "299", :height => "246"), board_message_path(message.board.id, message.id), :target => "_blank" %>
<% end %>
<%= link_to title, board_message_path(message.board.id, message.id), :class => 'por_hot_title_r link-black', :target => "_blank", :title => title %>
<p class="mt5 mb5"><span class="por_time mr10"><%= time_from_now(message.created_on) %></span><%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %></p>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %>
</div>
<% end %>
<% end %>
<% if activity.org_act_type == 'News' and News.where("id=?", activity.org_act_id).count > 0 %>
<% news = activity.org_act %>
<% path = get_image_path_from_content(news.description) %>
<div class="por_hotbar_right fl">
<% if path.nil? %>
<%= link_to image_tag("/images/default_blank/mo-1.jpg", :width => "299", :height => "246"), news_path(news), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{path}", :width => "299", :height => "246"), news_path(news), :target => "_blank" %>
<% end %>
<%= link_to news.title, news_path(news), :class => 'por_hot_title_r link-black', :target => "_blank", :title => news.title %>
<p class="mt5 mb5"><span class="por_time mr10"><%= time_from_now(news.created_on) %></span><%= link_to news.author.show_name, user_path(news.author), :class => "por_hot_name link-blue", :target => "_blank" %></p>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => news.id, :content=> news.description, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %>
</div>
<% end %>
<% end %>
<% end %>
<%# end %>
<div class="cl"></div>
</div><!--por_hotbar end-->

View File

@ -0,0 +1,212 @@
<div class="por_course mt10 clear" style="display:<%= field.hide == 0 ? 'block':'none' %>;">
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'course' %>
<h2 class="por_h2_index clear">课程动态</h2>
<% if @course_acts.blank? %>
<p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p>
<% else %>
<% @course_acts.first(4).each do |act| %>
<% if act.org_act_type == "HomeworkCommon" %>
<% activity = act.org_act %>
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="por_course_bar fl clear">
<%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "por_course_title link-black", :title => activity.name.to_s %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"fl" %>
<% end %>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
<span class=" por_course_time"><%= time_from_now(activity.updated_at) %></span>
</div>
<% elsif act.org_act_type == "Message" %>
<% activity = act.org_act %>
<% iamge_path = get_image_path_from_content(activity.content) %>
<div class="por_course_bar fl clear">
<%= link_to activity.parent_id.nil? ? activity.subject : activity.parent.subject, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "por_course_title link-black", :title => activity.parent_id.nil? ? activity.subject : activity.parent.subject %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"fl" %>
<% end %>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
<span class=" por_course_time"><%= time_from_now activity.updated_on %></span>
</div>
<% elsif act.org_act_type == "News" %>
<% activity = News.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="por_course_bar fl clear">
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "por_course_title link-black", :title => activity.title %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), news_url_in_org(activity.id), :target => "_blank", :class =>"fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), news_url_in_org(activity.id), :target => "_blank", :class =>"fl" %>
<% end %>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
<span class=" por_course_time"><%= time_from_now activity.created_on %></span>
</div>
<% elsif act.org_act_type == "Poll" %>
<% activity = act.org_act %>
<% has_commit = has_commit_poll?(activity.id ,User.current)%>
<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
<% iamge_path = get_image_path_from_content(activity.polls_description) %>
<% if ( activity.polls_status==2) %>
<div class="por_course_bar fl clear">
<% if has_commit %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "por_course_title link-black", :title => poll_name %>
<% else %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "por_course_title link-black", :title => poll_name %>
<% end %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"fl" %>
<% end %>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.polls_description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
<span class=" por_course_time"><%= time_from_now activity.published_at %></span>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
<% when 'project' %>
<h2 class="por_h2_index clear">项目动态</h2>
<% if @project_acts.blank? %>
<p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p>
<% else %>
<% @project_acts.first(4).each do |act| %>
<% if act.org_act_type == "Issue" %>
<% activity = act.org_act %>
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="por_course_bar fl clear">
<%= link_to activity.subject, issue_url_in_org(activity.id), :target => '_blank', :class => "por_course_title link-black", :title => activity.subject %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), issue_url_in_org(activity.id), :target => "_blank", :class =>"fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), issue_url_in_org(activity.id), :target => "_blank", :class =>"fl" %>
<% end %>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
<span class=" por_course_time"><%= time_from_now activity.updated_on %></span>
</div>
<% elsif act.org_act_type == "Message" %>
<% activity = act.org_act %>
<% iamge_path = get_image_path_from_content(activity.content) %>
<% subject = activity.parent_id.nil? ? activity.subject : activity.parent.subject %>
<div class="por_course_bar fl clear">
<%= link_to subject, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "por_course_title link-black", :title => subject %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"fl" %>
<% end %>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
<span class=" por_course_time"><%= time_from_now activity.updated_on %></span>
</div>
<% elsif act.org_act_type == "News" %>
<% activity = act.org_act %>
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="por_course_bar fl clear">
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "por_course_title link-black", :title => activity.title %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), news_url_in_org(activity.id), :target => "_blank", :class =>"fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), news_url_in_org(activity.id), :target => "_blank", :class =>"fl" %>
<% end %>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
<span class=" por_course_time"><%= time_from_now activity.created_on %></span>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
<% else %>
<% if field.field_type == "Post" %>
<% org_acts = get_subfield_acts field %>
<% if org_acts.blank? %>
<h2 class="por_h2_index clear"><%= field.name %></h2>
<p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p>
<% else %>
<h2 class="por_h2_index clear"><%= field.name %>
<%= render :partial => 'organizations/link_subfield_more', :locals => {:field => field} %>
</h2>
<% org_acts.first(4).each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %>
<% org_subfield_id = params[:org_subfield_id] %>
<% iamge_path = get_image_path_from_content(document.content) %>
<div class="por_course_bar fl clear">
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "por_course_title link-black", :title => document.title %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"fl" %>
<% end %>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => document.id, :content=> document.content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
<span class=" por_course_time"><%= time_from_now document.created_at %></span>
</div>
<% else 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 = activity.org_act %>
<% title = message.parent_id.nil? ? message.subject : message.parent.subject %>
<% content = message.parent_id.nil? ? message.content : message.parent.content%>
<% iamge_path = get_image_path_from_content(content) %>
<% if message.board.org_subfield_id %>
<div class="por_course_bar fl clear">
<%= link_to title, board_message_url_in_org(message.board.id, message.id), :target => '_blank', :class => "por_course_title link-black", :title => title %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), board_message_url_in_org(message.board.id, message.id), :target => "_blank", :class =>"fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), board_message_url_in_org(message.board.id, message.id), :target => "_blank", :class =>"fl" %>
<% end %>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
<span class=" por_course_time"><%= time_from_now message.created_on %></span>
</div>
<% else %>
<div class="por_course_bar fl clear">
<%= link_to title, board_message_path(message.board, message.id), :target => '_blank', :class => "por_course_title link-black", :title => title %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), board_message_path(message.board.id, message.id), :target => "_blank", :class =>"fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), board_message_path(message.board.id, message.id), :target => "_blank", :class =>"fl" %>
<% end %>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
<span class=" por_course_time"><%= time_from_now message.created_on %></span>
</div>
<% end %>
<% end %>
<% if activity.org_act_type == 'News' and News.where(:id => activity.org_act_id).count > 0 %>
<% news = activity.org_act %>
<% iamge_path = get_image_path_from_content(news.description) %>
<div class="por_course_bar fl clear">
<%= link_to news.title, news_path(news), :target => '_blank', :class => "por_course_title link-black", :title => news.title %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/mo-2.jpg", :width => "140", :height => "100"), news_path(news), :target => "_blank", :class =>"fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), news_path(news), :target => "_blank", :class =>"fl" %>
<% end %>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => news.id, :content=> news.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
<span class=" por_course_time"><%= time_from_now news.created_on %></span>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
<% elsif 'Compcou' %>
<h2 class="por_h2_index clear"><%= field.name %></h2>
<% if @excellent_courses.blank? %>
<p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p>
<% else %>
<% @excellent_courses.first(4).each do |course| %>
<div class="por_course_bar fl clear">
<%= link_to course.name, course_path(course.id), :target => '_blank', :class => "por_course_title link-black", :title => course.name %>
<%= link_to image_tag(url_to_avatar(course),:width => "140", :height => "100"), course_path(course), :target => "_blank", :class => "fl" %>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => course.id, :content=> course.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
<span class=" por_course_time"><%= current_time_and_term course %></span>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
<div class="cl"></div>
</div><!--por_course end-->

View File

@ -0,0 +1,149 @@
<div class="por_post mt10" style="display:<%= field.hide == 0 ? 'block':'none' %>;">
<% if acts.blank? %>
<h2 class="por_h2_index clear"><%= field.name %></h2>
<p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p>
<% else %>
<h2 class="por_h2_index clear"><%= field.name %>
<%= render :partial => 'organizations/link_subfield_more', :locals => {:field => field} %>
</h2>
<div class="por_post_left fl">
<div class="por_post_leftbar ">
<% activity = acts.first %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %>
<% if get_image_path_from_content(document.content).nil? %>
<%= link_to image_tag("/images/default_blank/mo-3.jpg", :width => "299", :height => "246"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{get_image_path_from_content(document.content)}", :width => "299", :height => "246"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %>
<% end %>
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "por_post_title link-black", :title => document.title %>
<p class="mt5 mb5">
<span class="por_time mr10"><%= time_from_now(document.created_at) %> </span>
<%= link_to document.creator.show_name, user_path(document.creator), :class => "por_hot_name link-blue", :target => "_blank" %>
</p>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => acts.first.org_act.id, :content=> acts.first.org_act.content, :maxheight => 40, :maxwordsnum => 60, :maxwidth => 0, :cl => "por_post_txt"} %>
<% else 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 = activity.org_act %>
<% content = message.parent_id.nil? ? message.content : message.parent.content %>
<% title = message.parent_id.nil? ? message.subject : message.parent.subject %>
<% iamge_path = get_image_path_from_content(content) %>
<% if message.board.org_subfield_id %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/mo-3.jpg", :width => "299", :height => "246"), board_message_url_in_org(message.board.id,message.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "299", :height => "246"), board_message_url_in_org(message.board.id,message.id), :target => "_blank" %>
<% end %>
<%= link_to title, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "por_post_title link-black", :title => title %>
<p class="mt5 mb5">
<span class="por_time mr10"><%= time_from_now(message.created_on) %> </span>
<%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %>
</p>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> message.content, :maxheight => 40, :maxwordsnum => 60, :maxwidth => 0, :cl => "por_post_txt"} %>
<% else %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/mo-3.jpg", :width => "299", :height => "246"), board_message_path(message.board, message), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "299", :height => "246"), board_message_path(message.board, message), :target => "_blank" %>
<% end %>
<%= link_to title, board_message_path(message.board, message), :target => '_blank', :class => "por_post_title link-black", :title => title %>
<p class="mt5 mb5">
<span class="por_time mr10"><%= time_from_now(message.created_on) %> </span>
<%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %>
</p>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> message.content, :maxheight => 40, :maxwordsnum => 60, :maxwidth => 0, :cl => "por_post_txt"} %>
<% 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) %>
<% iamge_path = get_image_path_from_content(news.description) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/mo-3.jpg", :width => "299", :height => "246"), news_path(news), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "299", :height => "246"), news_path(news), :target => "_blank" %>
<% end %>
<%= link_to news.title, news_path(news), :target => '_blank', :class => "por_post_title link-black", :title => news.title %>
<p class="mt5 mb5">
<span class="por_time mr10"><%= time_from_now(news.created_on) %> </span>
<%= link_to news.author.show_name, user_path(news.author), :class => "por_hot_name link-blue", :target => "_blank" %>
</p>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => news.id, :content=> news.description, :maxheight => 40, :maxwordsnum => 60, :maxwidth => 0, :cl => "por_post_txt"} %>
<% end %>
<% end %>
</div>
<% unless acts[1..5].nil? %>
<% acts[1..5].each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %>
<ul class="por_post_list">
<li><%= link_to "<span class='post_icons_grey fl'></span>#{document.title}".html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
</ul>
<% else 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 %>
<ul class="por_post_list">
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<li><%= link_to "<span class='post_icons_grey fl'></span>#{message.subject}".html_safe, board_message_url_in_org(message.board.id, message.id), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
<% else %>
<li><%= link_to "<span class='post_icons_grey fl'></span>#{message.parent.subject}".html_safe, board_message_url_in_org(message.board.id, message.id), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
<% end %>
</ul>
<% else %>
<ul class="por_post_list">
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<li><%= link_to "<span class='post_icons_grey fl'></span>#{message.subject}".html_safe, board_message_path(message.board,message), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
<% else %>
<li><%= link_to "<span class='post_icons_grey fl'></span>#{message.parent.subject}".html_safe, board_message_path(message.board, message), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
<% end %>
</ul>
<% 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) %>
<% iamge_path = get_image_path_from_content(news.description) %>
<ul class="por_post_list">
<li><%= link_to "<span class='post_icons_grey fl'></span>#{news.title}".html_safe, news_path(news), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
</ul>
<% end %>
<% end %>
<% end %>
<% end %>
</div>
<% unless acts[6..19].nil? %>
<div class="fl">
<ul class="por_post_right por_post_list">
<% acts[6..19].each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %>
<li><%= link_to "<span class='post_icons_grey fl'></span>#{document.title}".html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hidden_w270 link-black', :target => "_blank" %></li>
<% else 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 %>
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<li><%= link_to "<span class='post_icons_grey fl'></span>#{message.subject}".html_safe, board_message_url_in_org(message.board.id, message.id), class: 'por_hidden_w270 link-black', :target => "_blank" %></li>
<% else %>
<li><%= link_to "<span class='post_icons_grey fl'></span>#{message.parent.subject}".html_safe, board_message_url_in_org(message.board.id, message.id), class: 'por_hidden_w270 link-black', :target => "_blank" %></li>
<% end %>
<% else %>
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<li><%= link_to "<span class='post_icons_grey fl'></span>#{message.subject}".html_safe, board_message_path(message.board,message), class: 'por_hidden_w270 link-black', :target => "_blank" %></li>
<% else %>
<li><%= link_to "<span class='post_icons_grey fl'></span>#{message.parent.subject}".html_safe, board_message_path(message.board, message), class: 'por_hidden_w270 link-black', :target => "_blank" %></li>
<% 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) %>
<% iamge_path = get_image_path_from_content(news.description) %>
<li><%= link_to "<span class='post_icons_grey fl'></span>#{news.title}".html_safe, news_path(news), class: 'por_hidden_w270 link-black', :target => "_blank" %></li>
<% end %>
<% end %>
<% end %>
</ul>
</div>
<% end %>
<div class="cl"></div>
<% end %>
</div><!--por_post end-->

View File

@ -0,0 +1,37 @@
<div class="por_news" style="display:<%= field.hide == 0 ? 'block':'none' %>;">
<h2 class="por_h2_index clear"><%= field.name %></h2>
<% if @acts.blank? %>
<p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p>
<% else %>
<ul class="por_news_list clear">
<% @acts.each do |obj| %>
<% user = org_user_by_type(obj) %>
<% title = org_title_by_type(obj) %>
<% content = org_content_by_type(obj) %>
<% time = org_time_by_type(obj) %>
<li>
<%= link_to image_tag(url_to_avatar(user),:width => "43", :height => "43", :class => "por_users_img"), user_path(user), :target => "_blank", :class => "fl" %>
<div class="por_news_txt fl">
<p class="por_news_p fl">
<%= link_to user.show_name, user_path(user), :class => "por_hot_name link-blue fl", :target => "_blank" %>
<span class="fl">&nbsp;:&nbsp;</span>
<% if obj.act_type == "Message" %>
<%= link_to title, board_message_path(obj.act.board.id, obj.act.id) %>
<% elsif obj.act_type == "News" %>
<%= link_to title, news_path(obj.act.id) %>
<% elsif obj.act_type == "HomeworkCommon" %>
<%= link_to title, student_work_index_url_in_org(obj.act.id) %>
<% elsif obj.act_type == "Issue" %>
<%= link_to title, issue_path(obj.act.id) %>
<% end %>
</p>
<p><span class="por_time fl"><%= time_from_now(time) %> </span>
<!--<a href="javascript:void(0);" target="_blank" class="por_zan fr">50</a>-->
</p>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>
<% end %>
</div><!--por_news end-->

View File

@ -0,0 +1,24 @@
<div class="por_projects" style="display:<%= field.hide == 0 ? 'block':'none' %>;">
<h2 class="por_h2_index clear">热点项目</h2>
<% if containers.blank? %>
<p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p>
<% else %>
<ul>
<% container = containers.first %>
<li class="por_project_li">
<%= link_to "<span class='post_icons_grey fl'></span>#{container.name}".html_safe, project_path(container), :class => "por_hidden_w205 link-black fl", :title => container.name, :target => "_blank" %>
<p class="fr por_time">活跃度<a class="ml5" ><%= static_project_score(container.project_score) %></a></p>
<div class="cl"></div>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => container.id, :content=> container.description, :maxheight => 40, :maxwordsnum => 55, :maxwidth => 0, :cl => "por_project_p"} %>
</li>
<% containers[1..4].each do |container| %>
<li>
<%= link_to "<span class='post_icons_grey fl'></span>#{container.name}".html_safe, project_path(container), :class => "por_hidden_w205 link-black fl", :title => container.name, :target => "_blank" %>
<p class="fr por_time">活跃度<a class="ml5" ><%= static_project_score(container.project_score) %></a></p>
<div class="cl"></div>
</li>
<% end %>
</ul>
<% end %>
</div><!--por_projects end-->

View File

@ -0,0 +1,105 @@
<% if field.field_type == "Resource" %>
<div class="por_teachers" style="display:<%= field.hide == 0 ? 'block' : 'none' %>;">
<h2 class="por_h2_index clear"><%= field.name %><%= link_to "更多>", org_subfield_files_path(field), :target => "_blank", :class => "f12 fontGrey2 fr" %></h2>
<div>
<ul class="por_teachers_li">
<% get_attach_org2(field).each do |attach| %>
<li >
<%= link_to image_tag(url_to_avatar(attach.author),:width => "43", :height => "43", :class => "por_teachers_img fl mr15"), user_path(attach.author), :target => "_blank", :class => "fl" %>
<!--<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_teachers_img fl mr15"/></a>-->
<div class="por_teachers_txt fl mt5">
<%= link_to attach.author, user_path(attach.author), :class => " por_teachers_name link-black fl", :target => "_blank" %>
<p class="por_teachers_p fr">
<%= link_to truncate(attach.filename,length: 20, 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;" %>
</p>
<div class="cl"></div>
<p class="por_teachers_span ">
<span class="mr10">类型:<span><%= attach.tag_list[0] %></span></span>
<span class="mr10">下载:<span><%= attach.downloads %></span></span>
<span class="mr10">引用:<span><%= attach.quotes.nil? ? 0 : attach.quotes %></span></span>
</p>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>
</div>
</div>
<% elsif field.field_type == "Comptec" || field.field_type == "Compstu" %>
<div class="por_teachers" style="display:<%= field.hide == 0 ? 'block' : 'none' %>;">
<ul id="por_teachers_nav">
<li id="por_teachers_nav_1" class="por_teachers_hover" onclick="HoverLi(1);">
<a href="javascript:void(0);" class="por_teachers_type">名师风采</a>
</li>
<li id="por_teachers_nav_2" onclick="HoverLi(2);">
<a href="javascript:void(0);" class="por_teachers_type">学生英雄榜</a>
</li>
<!--<a href="javascript:void(0);" target="_blank" class="f12 fontGrey2 fr mt5">更多></a>-->
<div class="cl"></div>
</ul>
<div id="por_teachers_content_1">
<ul class="por_teachers_li">
<% excellent_teachers.each do |teacher| %>
<li >
<%= link_to image_tag(url_to_avatar(teacher), :width => "43", :height => "43", :class => "por_teachers_img fl mr15"), user_path(teacher), :alt => "用户头像", :target => '_blank', :class => "fl" %>
<div class="por_teachers_txt fl mt5">
<%=link_to teacher.try(:realname) ? teacher.try(:realname) :teacher.try(:login), user_path(teacher), :class => "por_teachers_name link-black fl", :target => '_blank' %>
<p class="por_teachers_p fr" title="<%= teacher.my_workplace %>"><%= teacher.my_workplace %></p>
<div class="cl"></div>
<p class="por_teachers_span ">
<% unless teacher.my_blogs_count == 0 %>
<span class=" mr10">博客 <%= teacher.my_blogs_count %></span>
<% end %>
<% unless teacher.courses.count == 0 %>
<span class="mr10">课程 <%= teacher.courses.count %></span>
<% end %>
<% unless teacher.my_students == 0 %>
<span class="mr10">学生 <%= teacher.my_students %></span>
<% end %>
</p>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>
</div>
<div id="por_teachers_content_2" class="undis">
<ul class="por_teachers_li">
<% excellent_students.each do |student| %>
<li >
<%= link_to image_tag(url_to_avatar(student), :width => "43", :height => "43", :class => "por_teachers_img fl mr15"), user_path(student), :alt => "用户头像", :target => '_blank', :class => "fl" %>
<div class="por_teachers_txt fl mt5">
<%=link_to student.try(:realname) ? student.try(:realname) :student.try(:login), user_path(student), :class => "por_teachers_name link-black fl", :target => '_blank' %>
<p class="por_teachers_p fr" title="<%= student.my_workplace %>"><%= student.my_workplace %></p>
<div class="cl"></div>
<p class="por_teachers_span ">
<% unless student.my_blogs_count == 0 %>
<span class=" mr10">博客 <%= student.my_blogs_count %></span>
<% end %>
<% unless student.courses.count == 0 %>
<span class="mr10">课程 <%= student.courses.count %></span>
<% end %>
</p>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>
</div>
</div>
<script>
//名师列表
function g(o){return document.getElementById(o);}
function HoverLi(n){
for(var i=1;i<=2;i++){
g('por_teachers_nav_'+i).className='por_teachers_nomal';
g('por_teachers_content_'+i).className='undis';
}
g('por_teachers_content_'+n).className='dis';
g('por_teachers_nav_'+n).className='por_teachers_hover';
}
</script>
<% end %>

View File

@ -0,0 +1,44 @@
<ul class="sn-nav">
<% subfield_content.each do |field| %>
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'activity' %>
<li class="nav-element-default" style="display:<%= field.hide == 0?'block':'none' %>;">
<%= link_to "首页", organization_path(@organization), :class => "sn-link-white" %>
</li>
<% when 'course' %>
<li class="nav-element-default" style="display:<%= field.hide == 0?'block':'none' %>;">
<a href="#course_<%= field.id %>" class="sn-link-white"> 课程动态</a>
</li>
<% when 'project' %>
<li class="nav-element-default" style="display:<%= field.hide == 0?'block':'none' %>;">
<a href="#project_<%= field.id %>" class="sn-link-white">项目动态</a>
</li>
<% end %>
<% else %>
<% if field.field_type == "Post" && field.hide == 0 %>
<li class="nav-element">
<a href="#message_<%= field.id %>" class="sn-link-white"><%= field.name %></a>
</li>
<!--二级目录-->
<div class="sn-row sn-subnav-position sn-grey-opacity" style="display:none;">
<ul class="sn-sub-nav" style="display:<%= if_hidden_subdomain( field) ? 'block':'none' %>;">
<% field.sub_domains.each do |subdomain| %>
<li><%=link_to subdomain.name, org_subfield_sub_domain_sub_document_comments_path(subdomain, :org_subfield_id => field.id), :class => "sn-link-grey" %></li>
<li class="sn-subnav-slice">|</li>
<% end %>
</ul>
</div>
<% elsif field.field_type == "Resource" && field.hide == 0 %>
<li class="nav-element">
<a href="#resource_<%= field.id %>" class="sn-link-white"><%= field.name %></a>
</li>
<% end %>
<% end %>
<% end %>
<% if User.current.admin_of_org?(@organization) %>
<li class="nav-element">
<a href="<%= setting_organization_path(@organization) %>" class="sn-link-white">配置</a>
</li>
<% end %>
</ul>

View File

@ -91,7 +91,7 @@
<% end %>
<% else %>
<div style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
<% if field.field_type == "Post" || field.field_type == "Complex" || field.field_type == "Compstu" || field.field_type == "Comptec" %> <!--讨论帖子-->
<% if field.field_type == "Post" || field.field_type == "Complex" %> <!--讨论帖子-->
<div class="homepageLeftMenuBlock">
<!--<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuProjects').slideToggle();">项目</a>-->
<% if !field.subfield_subdomain_dir.nil? %> <!--讨论帖子-->
@ -101,28 +101,47 @@
<%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
<% end %>
<% else %>
<% if field.field_type == "Comptec" %>
<%= link_to "#{field.name}", teachers_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
<% else %>
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
<% end %>
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
<% end %>
<% if User.current.logged? and User.current.admin_of_org?(organization) && field.field_type != "Comptec" %>
<% if User.current.logged? and User.current.admin_of_org?(organization) %>
<%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子" %>
<% end %>
</div>
<div class="<%= (field.sub_domains.count == 0) ? 'homepageLeftMenuCourses':'homepageLeftMenuCourses borderBottomNone' %>" id="PostDomain_<%= field.id %>" style="display:none;">
<ul>
<%= render :partial => 'organizations/org_subdomain',:locals=>{:subdomains => field.sub_domains.reorder('priority').uniq.limit(5), :org_subfield_id => field.id} %>
<%= render :partial => 'organizations/org_subdomain',:locals=>{:subdomains => field.sub_domains.reorder('priority').uniq, :org_subfield_id => field.id} %>
</ul>
</div>
<% unless (field.sub_domains.count == 0 || !if_hidden_subdomain(field)) %>
<li class="homepageLeftMenuMore" id="sub_domain_jiantou_<%= field %>">
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="$('#PostDomain_<%= field.id %>').slideToggle();" style="border-bottom: 1px solid #ddd;"></a>
</li>
<% end %>
<% else %>
<% elsif field.field_type == "Comptec" && User.current.admin? %>
<div class="homepageLeftMenuBlock">
<%= link_to "#{field.name}", teachers_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
</div>
<% elsif field.field_type == "Compstu" && User.current.admin? %>
<div class="homepageLeftMenuBlock">
<%= link_to "#{field.name}", students_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
</div>
<% elsif field.field_type == "Compstu" && User.current.admin? %>
<div class="homepageLeftMenuBlock">
<%= link_to "#{field.name}", students_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
</div>
<% elsif field.field_type == "Comppro" && User.current.admin? %>
<div class="homepageLeftMenuBlock">
<%= link_to "#{field.name}", projects_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
</div>
<% elsif field.field_type == "Compcou" && User.current.admin? %>
<div class="homepageLeftMenuBlock">
<%= link_to "#{field.name}", courses_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
</div>
<% elsif field.field_type == "Compact" && User.current.admin? %>
<div class="homepageLeftMenuBlock">
<%= link_to "#{field.name}", acts_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
</div>
<% elsif field.field_type == "Resource" %>
<div class="homepageLeftMenuBlock">
<% 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) %>

View File

@ -31,8 +31,9 @@
<% end %>
</li>
<% if ( (User.current.id == member.organization.creator_id || User.current.admin_of_org?(member.organization) ) && member.user_id != member.organization.creator_id )%>
<a href="javascript:void(0);" style="color: #0781B4;margin-left: 30px;float: left" onclick="$(this).parent().height(70);$('#org-member-<%= member.id%>-roles-form').show();">编辑</a>
<a href="javascript:void(0);" style="color: #0781B4;margin-left: 30px;float: left" onclick="$(this).parent().height();$('#org-member-<%= member.id%>-roles-form').show();">编辑</a>
<%= link_to '删除', Setting.protocol + "://" + Setting.host_name + "/org_member/" + member.id.to_s,:method=>'delete',:style=>'color: #0781B4;margin-left: 30px;float: left',:confirm=>'您确定要删除么?', :remote => true %><% end %>
<div class="cl"></div>
</ul>
<div class="cl"></div>
<% end %>

View File

@ -0,0 +1,45 @@
<% org_students.each do |org_student| %>
<% school = School.where("id =?", org_student.school_id).first %>
<div class="teacher-list-row">
<div>
<div class="teacher-avatar">
<%= link_to image_tag(url_to_avatar(org_student), :width => "90", :height => "90"), user_url_in_org(org_student), :alt => "用户头像" %>
</div>
<div class="fl">
<div class="ml25 mb20"><span class="teacher-name"><%=link_to org_student.try(:realname).nil? ? org_student.try(:login) : org_student.try(:realname), user_url_in_org(org_student) %></span>
<% unless school.nil? %>
<span class="f12 fontGrey2 mr15"><%= school.name %></span>
<% end %>
</div>
<div class="teacher-social-block">
<div class="block-num"><%= org_student.courses.count %></div>
<div class="block-title">课程数</div>
</div>
<div class="block-slice"></div>
<div class="teacher-social-block">
<div class="block-num"><%= org_teacher_resource_count(org_student) %></div>
<div class="block-title">资源数</div>
</div>
</div>
<% if User.current.admin_of_org?(@organization) %>
<a href="javascript:void(0);" class="fr teacher-select" onclick="hide($(this),'<%= org_student.id %>');" id="hide_<%= org_student.id %>"><%= org_student.excellent_student ==0 ? "设为学霸" : "取消设置" %></a>
<% end %>
</div>
<div class="cl"></div>
</div>
<% end %>
<script>
function hide(content, id){
if (content.text() == '设为学霸')
$.ajax({
url: "/organizations/set_excellent_student?user=" + id ,
type: "post"
});
else
$.ajax({
url: "/organizations/reset_excellent_student?user=" + id ,
type: "post"
});
}
</script>

View File

@ -0,0 +1,24 @@
<div class="<%= cl %>" id="activity_description_<%= user_activity_id %>">
<span id="intro_content_<%= user_activity_id%>">
<%= content.to_s.html_safe%>
</span>
</div>
<script type="text/javascript">
$("#intro_content_<%= user_activity_id %>").hide();
$(function() {
var heightType = <%= maxheight %>;
if (heightType > 0) {
$("#activity_description_<%= user_activity_id %>").css("max-height", heightType + "px");
}
var maxWidth = <%= maxwidth %>
if (maxWidth > 0) {
$("#intro_content_<%= user_activity_id%>").css("max-width", maxWidth + "px");
}
description_showwords_ellipsis(<%= user_activity_id %>,<%= maxwordsnum %>);
});
</script>

View File

@ -0,0 +1,12 @@
<% if @organization.allow_set_teachers && !org_subfield_had_created?(@organization, "Comptec") %>
<li class="fl mr15">
<input type="radio" id="orgTec" value="Comptec" name="field_type" />
<label for="Comptec">教师</label>
</li>
<% end %>
<% if User.current.admin? && !org_subfield_had_created?(@organization, "Compstu") %>
<li class="fl mr15">
<input type="radio" id="orgStu" value="Compstu" name="field_type" />
<label for="Comptec">学生</label>
</li>
<% end %>

View File

@ -0,0 +1,24 @@
<div class="por_left">
<% @subfield_content.each do |field| %>
<% if field.status.to_i == 1 %>
<%= render :partial => 'organizations/org_custom_left1', :locals => {:field => field, :acts => get_subfield_acts(field) } %>
<% elsif field.status.to_i == 2 %>
<%= render :partial => 'organizations/org_custom_left2', :locals => {:field => field} %>
<% elsif field.status.to_i == 3 %>
<%= render :partial => 'organizations/org_custom_left3', :locals => {:field => field, :acts => get_subfield_acts(field) }%>
<% end %>
<% end %>
</div>
<!--右侧-->
<div class="por_right">
<% @subfield_content.each do |field| %>
<% if field.status.to_i == 4 %>
<%= render :partial => 'organizations/org_custom_right1', :locals => {:field => field} %>
<% elsif field.status.to_i == 5 %>
<%= render :partial => 'organizations/org_custom_right2', :locals => {:field => field, :containers => @excellent_projects} %>
<% elsif field.status.to_i == 6 %>
<%= render :partial => 'organizations/org_custom_right3', :locals => {:field => field} %>
<% end %>
<% end %>
</div>
<div class="cl"></div>

View File

@ -0,0 +1,33 @@
<div class="sn-content-left fl sn-mt15">
<% @subfield_content.each do |field| %>
<% if field.status.to_i == 1 %>
<%= render :partial => 'organizations/org_subfield_leftT', :locals => {:field => field} %>
<% elsif field.status.to_i == 3 %>
<%#= render :partial => 'organizations/org_subfield_leftM', :locals => {:field => field} %>
<div class="sn-index-leftbox" style="display:<%= field.hide == 0?'block':'none' %>;">
<%= render :partial => 'organizations/org_subfield_leftM1', :locals => {:field => field} %>
<%= render :partial => 'organizations/org_subfield_leftM2', :locals => {:field => field} %>
<div class="cl"></div>
</div>
<% elsif field.status.to_i == 4 %>
<%= render :partial => 'organizations/org_subfield_leftMD', :locals => {:field => field} %>
<% elsif field.status.to_i == 5 %>
<%= render :partial => 'organizations/org_subfield_leftD', :locals => {:field => field} %>
<% end %>
<% end %>
</div>
<!--右侧-->
<div class="sn-content-right fr sn-mt15">
<% @subfield_content.each do |field| %>
<% if field.status.to_i == 6 %>
<%= render :partial => 'organizations/org_subfield_rightT', :locals => {:field => field} %>
<% elsif field.status.to_i == 7 %>
<%= render :partial => 'organizations/org_subfield_rightM', :locals => {:field => field} %>
<% elsif field.status.to_i == 8 %>
<%= render :partial => 'organizations/org_subfield_rightD', :locals => {:field => field} %>
<% elsif field.status.to_i == 23 %>
<%= render :partial => 'organizations/org_subfield_rightM2', :locals => {:field => field} %>
<% end %>
<% end %>
</div>
<div class="cl"></div>

View File

@ -23,7 +23,7 @@
<li class="orgListUser" title="<%= name %>"><%= name %></li>
<li class="orgListStatus">默认</li>
<li class="orgListStatusList">
<% if field.name == "activity" %>
<% if field.name == "activity" || field.name == "course" || field.name == "project" %>
默认
<% 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 %>
@ -57,7 +57,7 @@
</li>
<li class="orgListStatus">新增</li>
<li class="orgListStatusList">
<% if field.field_type == "Resource" || field.field_type == "Comptec" %>
<% if field.field_type == "Resource" || field.field_type == "Comptec" || field.field_type == "Comppro" || field.field_type == "Compcou" || field.field_type == "Compact" || field.field_type == "Compstu" %>
默认
<% 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 %>
@ -92,7 +92,7 @@
<%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkGrey fr ml5 mr5" %>
<span class="fr">|</span>
<a href="javascript:void(0);" class="linkGrey fr ml5 mr5" onclick="edit('#subfield_show_<%= field.id %>','#subfield_edit_<%= field.id %>');">编辑</a>
<% unless field.field_type == "Resource" || field.field_type == "Comptec" %>
<% unless field.field_type == "Resource" || field.field_type == "Comptec" || field.field_type == "Compstu" || field.field_type == "Comppro" || field.field_type == "Compcou" || field.field_type == "Compact" %>
<span class="fr">|</span>
<!--escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (Setting.cross_project_issue_relations? ? 'all' : nil)-->
<!--<a href="javascript:void(0);" class="linkGrey fr mr5" onclick="org_submain_new('<%#= escape_javascript new_org_subfield_sub_domain_path(:org_subfield_id => field.id, :field => field) %>');">添加二级目录</a>-->

View File

@ -0,0 +1,30 @@
<div class="homepageRightBanner">
<div class="f16 fontGrey3">
<% if @type == "famous" %>
精品课程
<% else %>
<%= @field.name %>
<% end %>
</div>
</div>
<div class="resources mt10">
<div class="function-row" id="org_student_search">
<%= form_tag(url_for(:controller => 'organizations', :action => 'courses', :type => @type), :remote => true , :method => 'get', :id => 'resource_search_form') do %>
<input type="text" name="search" placeholder="输入项目名进行搜索" class="teacher-list-search fl" />
<%= submit_tag '', :class => 'homepageSearchIcon', :onfocus => 'this.blur();', :class => "teacher-search-icon fl" %>
<!--<a href="javascript:void(0);" onclick='this.parent.submit();return false;' class="searchIcon"></a>-->
<% end %>
<div class="sn-font-grey fr">
<%= link_to "精品课程", courses_organization_path(@organization, :type => "famous", :org_subfield_id => @field.id), :class => "fontGrey2" %>
</div>
<div class="cl"></div>
</div>
<div id="org_container_list">
<%=render 'organizations/org_container', :containers => @containers %>
</div>
<div>
<ul class="wlist" id="pages" style="margin-top: 15px;">
<%= pagination_links_full @atta_pages, @containers_count, :per_page_links => false, :flag => true %>
</ul>
</div>
</div>

View File

@ -0,0 +1,3 @@
$("#org_container_list").html('<%= escape_javascript( render :partial => 'organizations/org_container', :locals => {:containers => @containers})%>');
$("#pages").html('<%= pagination_links_full @atta_pages, @container_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#org_student_search").attr('href','<%= courses_organization_path(@organization, :type => @type) %>');

View File

@ -0,0 +1,30 @@
<div class="homepageRightBanner">
<div class="f16 fontGrey3">
<% if @type == "famous" %>
热门项目
<% else %>
<%= @field.name %>
<% end %>
</div>
</div>
<div class="resources mt10">
<div class="function-row" id="org_student_search">
<%= form_tag(url_for(:controller => 'organizations', :action => 'projects', :type => @type), :remote => true , :method => 'get', :id => 'resource_search_form') do %>
<input type="text" name="search" placeholder="输入项目名进行搜索" class="teacher-list-search fl" />
<%= submit_tag '', :class => 'homepageSearchIcon', :onfocus => 'this.blur();', :class => "teacher-search-icon fl" %>
<!--<a href="javascript:void(0);" onclick='this.parent.submit();return false;' class="searchIcon"></a>-->
<% end %>
<div class="sn-font-grey fr">
<%= link_to "热门项目", projects_organization_path(@organization, :type => "famous", :org_subfield_id => @field.id), :class => "fontGrey2" %>
</div>
<div class="cl"></div>
</div>
<div id="org_container_list">
<%=render 'organizations/org_container', :containers => @containers %>
</div>
<div>
<ul class="wlist" id="pages" style="margin-top: 15px;">
<%= pagination_links_full @atta_pages, @containers_count, :per_page_links => false, :flag => true %>
</ul>
</div>
</div>

View File

@ -0,0 +1,3 @@
$("#org_container_list").html('<%= escape_javascript( render :partial => 'organizations/org_container', :locals => {:containers => @containers})%>');
$("#pages").html('<%= pagination_links_full @atta_pages, @container_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#org_student_search").attr('href','<%= projects_organization_path(@organization, :type => @type) %>');

View File

@ -0,0 +1 @@
$("#hide_<%= @ex_student.id %>").text("设为学霸");

View File

@ -0,0 +1 @@
$("#hide_<%= @ex_student.id %>").text("取消设置");

View File

@ -87,11 +87,11 @@
&nbsp;<span>允许游客下载</span>
<span class="c_green f12" id="allow_down_hint"><%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %></span>
</div>
<% if User.current.admin? %>
<div class="orgRow mb10 mt5"><span style="margin-left:10px;">允许设置名师榜&nbsp;: </span>
<input id="allow_set_excellent_teachers" type="checkbox" style="margin-top:5px;" name="organization[allow_teacher]" <%= @organization.allow_teacher==1 ? 'checked': ''%> class="ml3" />
</div>
<% end %>
<!--<%# if User.current.admin? %>-->
<!--<div class="orgRow mb10 mt5"><span style="margin-left:10px;">允许设置名师榜&nbsp;: </span>-->
<!--<input id="allow_set_excellent_teachers" type="checkbox" style="margin-top:5px;" name="organization[allow_teacher]" <%#= @organization.allow_teacher==1 ? 'checked': ''%> class="ml3" />-->
<!--</div>-->
<!--<%# end %>-->
<a href="javascript:void(0);" class="saveBtn ml80 db fl" onclick="update_org('<%=@organization.id %>','<%= @organization.name %>', $('#organization_name'));">保存</a>
<% end %>
</div>
@ -162,8 +162,8 @@
<input type="radio" id="orgMeb" value="Resource" name="field_type" />
<label for="orgMeb">资源</label>
</li>
<div id="org_excellent_teachers">
<%= render :partial => 'organizations/setting_excellent_teachers' %>
<div id="org_custom_admin">
<%= render :partial => 'organizations/org_custom_admin' %>
</div>
<li class="fr"><a href="javascript:void(0);" class="saveBtn db" onclick="add_org_subfield();">新增</a></li>
<li class="cl"></li>
@ -172,7 +172,7 @@
</div>
<!--over-->
<div class="orgColumnList" id="org_subfield_list">
<%= render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields.order("priority")} %>
<%= render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)} %>
</div>
</div>
</div>
@ -184,7 +184,7 @@
function add_org_subfield_subdomain(){
if ($("#subfield_name_subdomain").val().trim() != "")
$("#add_subfield_form_subdomain").submit();
$("#org_subfield_list").html('<%= escape_javascript(render(:partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields.order("priority")} )) %>');
$("#org_subfield_list").html('<%= escape_javascript(render(:partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)})) %>');
}
var $is_exist = false;
function apply_subdomain(id, domain){

View File

@ -1,66 +1,71 @@
<%= javascript_include_tag "jquery.infinitescroll.js" %>
<%# 区分两种模式 params[:org_subfield_id] 不为空的时候则跳到栏目%>
<% if @organization.switch_type && params[:org_subfield_id].nil? %>
<%= render :partial => 'show_custom' %>
<% else %>
<%= javascript_include_tag "jquery.infinitescroll.js" %>
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<% end %>
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<% end %>
<% if params[:show_homepage].nil? and User.current.logged? %>
<div class="homepageRightBanner">
<div class="NewsBannerName"><%= @org_subfield.nil? ? "最新动态":"#{@org_subfield.name}" %></div>
<% if params[:org_subfield_id].nil? %>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="homepagePostType">
<li>
<ul class="homepagePostTypeHomework fl">
<li class="f14">课程动态</li>
<li><%= link_to "作业动态", {:controller => "organizations", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
<!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li>
<li><%= link_to "通知动态", {:controller => "organizations", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeNotice postTypeGrey">通知动态</a></li>-->
<li><%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
<li><%= link_to "问卷动态", {:controller => "organizations", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">项目动态</li>
<li><%= link_to "问题动态", {:controller => "organizations", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%>
<li><%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuestion postTypeGrey">问题动态</a></li>
<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">更多</li>
<li class="mt-4"><%= link_to "组织动态", {:controller => "organizations", :action => "show", :type => "org"}, :class =>"homepagePostTypeMessage postTypeGrey"%>
<li class="mt-4"><%= link_to "全部动态", {:controller => "organizations", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
<% if params[:show_homepage].nil? and User.current.logged? %>
<div class="homepageRightBanner">
<div class="NewsBannerName"><%= @org_subfield.nil? ? "最新动态":"#{@org_subfield.name}" %></div>
<% if params[:org_subfield_id].nil? %>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="homepagePostType">
<li>
<ul class="homepagePostTypeHomework fl">
<li class="f14">课程动态</li>
<li><%= link_to "作业动态", {:controller => "organizations", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
<!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li>
<li><%= link_to "通知动态", {:controller => "organizations", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeNotice postTypeGrey">通知动态</a></li>-->
<li><%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
<li><%= link_to "问卷动态", {:controller => "organizations", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">项目动态</li>
<li><%= link_to "问题动态", {:controller => "organizations", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%>
<li><%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuestion postTypeGrey">问题动态</a></li>
<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">更多</li>
<li class="mt-4"><%= link_to "组织动态", {:controller => "organizations", :action => "show", :type => "org"}, :class =>"homepagePostTypeMessage postTypeGrey"%>
<li class="mt-4"><%= link_to "全部动态", {:controller => "organizations", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<% end %>
</div>
<% end %>
<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %>
<script>
$(function() {
sd_create_editor_from_data(<%= OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?",@organization.home_id).first.id %>, null, "100%", 'OrgActivity');
});
</script>
<% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %>
<%= render :partial => 'show_home_page', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %>
<% end %>
<% if @org_activities %>
<%= render :partial => 'organizations/org_activities',
:locals => {:org_activities => @org_activities,
:page=> @page,
:org => @organization,
:org_act_count=> @org_activities.count} %>
<% end %>
</div>
<% end %>
<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %>
<script>
$(function() {
sd_create_editor_from_data(<%= OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?",@organization.home_id).first.id %>, null, "100%", 'OrgActivity');
});
</script>
<% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %>
<%= render :partial => 'show_home_page', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %>
<% end %>
<% if @org_activities %>
<%= render :partial => 'organizations/org_activities',
:locals => {:org_activities => @org_activities,
:page=> @page,
:org => @organization,
:org_act_count=> @org_activities.count} %>
<% end %>
<% end %>
@ -70,3 +75,4 @@

View File

@ -0,0 +1,30 @@
<div class="homepageRightBanner">
<div class="f16 fontGrey3">
<% if @type == "famous" %>
学霸列表
<% else %>
<%= @field.name %>
<% end %>
</div>
</div>
<div class="resources mt10">
<div class="function-row" id="org_student_search">
<%= form_tag(url_for(:controller => 'organizations', :action => 'students', :type => @type), :remote => true , :method => 'get', :id => 'resource_search_form') do %>
<input type="text" name="search" placeholder="输入学生名进行搜索" class="teacher-list-search fl" />
<%= submit_tag '', :class => 'homepageSearchIcon', :onfocus => 'this.blur();', :class => "teacher-search-icon fl" %>
<!--<a href="javascript:void(0);" onclick='this.parent.submit();return false;' class="searchIcon"></a>-->
<% end %>
<div class="sn-font-grey fr">
<%= link_to "学霸列表", students_organization_path(@organization, :type => "famous", :org_subfield_id => @field.id), :class => "fontGrey2" %>
</div>
<div class="cl"></div>
</div>
<div id="org_students_list">
<%=render 'organizations/org_students_list', :org_students => @org_students %>
</div>
<div>
<ul class="wlist" id="pages" style="margin-top: 15px;">
<%= pagination_links_full @atta_pages, @students_count, :per_page_links => false, :flag => true %>
</ul>
</div>
</div>

View File

@ -0,0 +1,3 @@
$("#org_students_list").html('<%= escape_javascript( render :partial => 'organizations/org_students_list', :locals => {:org_students => @org_students})%>');
$("#pages").html('<%= pagination_links_full @atta_pages, @students_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#org_student_search").attr('href','<%= students_organization_path(@organization, :type => @type) %>');

View File

@ -0,0 +1,5 @@
<% if @type == "course" %>
$("#hide_<%= @container.id %>").text("<%= (@status == 'reset' ? '设为精品' : '取消精品') %>");
<% elsif @type == "project" %>
$("#hide_<%= @container.id %>").text("<%= (@status == 'reset' ? '设为热门' : '取消热门') %>");
<% end %>

View File

@ -6,7 +6,7 @@
<div class="ping_discon" style="width: 610px;">
<div class="ping_distop f14">
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
<span><%= link_to journal.user, user_path(journal.user), :class => 'c_blue fb fl mb10 f14', :target => "_blank" %>
<span><%= link_to journal.user.show_name, user_path(journal.user), :class => 'c_blue fb fl mb10 f14', :target => "_blank" %>
</span><span class="c_grey fr f14"><%= format_time(journal.created_on) %></span>
<div class="cl"></div>
<!--<p><%#= textilizable journal.notes%></p>-->

View File

@ -30,6 +30,11 @@
<input id="project_is_public" name="project[is_public]" type="checkbox" <%= @project.is_public ? "checked" : ""%>>
<div class="cl"></div>
</li>
<li >
<label class="label02">隐藏代码库&nbsp;&nbsp;</label>
<input id="project_hidden_repo" name="project[hidden_repo]" type="checkbox" <%= @project.hidden_repo ? "checked" : ""%>>
<div class="cl"></div>
</li>
</ul>
<a href="javascript:void(0)" class="blue_btn ml110" onclick="submit_edit_project(<%= @project.id %>);" >保存</a>
<% end %>

View File

@ -29,13 +29,16 @@
<!--CONTENT LIST-->
</div>
<% unless @project.gpid.nil? || @project.project_score.changeset_num == 0 || @project.rep_statics.blank? %>
<div class="resources mt10">
<div class="homepagePostBrief">
<%= render :partial => "rep_static" %>
<div class="cl"></div>
</div>
</div>
<%# 时间紧,权限待优化 %>
<% unless @project.hidden_repo && !User.current.member_of?(@project) && !User.current.admin? %>
<% unless @project.gpid.nil? || @project.project_score.changeset_num == 0 || @project.rep_statics.blank? %>
<div class="resources mt10">
<div class="homepagePostBrief">
<%= render :partial => "rep_static" %>
<div class="cl"></div>
</div>
</div>
<% end %>
<% end %>
<%= render :partial => "project_activities", :locals => {:forge_acts => @events_pages, :page => 0, :type => @type} %>

View File

@ -39,6 +39,10 @@
<script type="text/javascript">
$(function(){
if($("#homework_info_hidden").is(":hidden"))
{
$("#homework_info_show").show();
}
<% if !@is_evaluation && (!@is_teacher || params[:show_work_id].present?) || @message_student_work_id %>
<% if @message_student_work_id %>
<% work = @homework.student_works.where("id =?", @message_student_work_id).first %>

View File

@ -36,7 +36,7 @@
$('#doc_title_hint').hide();
}
</script>
<div class="resources" nhname="new_topic_form">
<div class="resources" style="margin-top:<%= User.current.logged? ? '0px':'10px' %>;" nhname="new_topic_form">
<%= form_tag org_subfield_sub_domain_sub_document_comments_path(:org_subfield_id => @org_subfield.id, :sub_domain_id => @subdomain.id), :id => 'new_sub_document_form' do |f| %>
<div>
<input class="postDetailInput fl" maxlength="250" name="sub_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#sub_document_editor').show();" placeholder="请输入文章标题" />

View File

@ -8,7 +8,7 @@
showNormalImage('message_description_<%= @document.id %>');
});
</script>
<div class="resources" id="organization_document_<%= @document.id %>">
<div class="resources" style="margin-top:<%= User.current.logged? ? '0px':'10px' %>;" id="organization_document_<%= @document.id %>">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(@document.creator_id) %>
@ -138,7 +138,7 @@
</div>
<div class="cl"></div>
<%# end %>
<% if User.current.logged?%>
<%# if User.current.logged?%>
<div class="talkWrapMsg" nhname="about_talk_reply">
<em class="talkWrapArrow"></em>
<div class="cl"></div>
@ -151,7 +151,7 @@
<div class="cl"></div>
</div>
</div>
<% end %>
<%# end %>
</div>
</div>

View File

@ -9,10 +9,6 @@
<input type="radio" id="orgMng" value="Post" name="field_type" checked="checked"/>
<label for="orgMng">帖子</label>
</li>
<!--<li class="fl mr15">-->
<!--<input type="radio" id="orgMeb" value="Resource" name="field_type" />-->
<!--<label for="orgMeb">资源</label>-->
<!--</li>-->
<li class="cl"></li>
</ul>
<div class="courseSendSubmit mr15"><a href="javascript:void(0);" class="sendSourceText" onclick="add_org_subfield_subdomain();hideModal()">确定</a></div>
@ -20,8 +16,3 @@
<% end %>
<div class="cl"></div>
</div>
<script type="javascript">
</script>

View File

@ -1,8 +1,5 @@
<% if @res %>
$("#org_subfield_list").html("");
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields.order("priority") }) %>");
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>");
$("#sub_field_left_lists").html("");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
<% end %>
$("#subfield_name").val("");
$("#sub_dir").val("");

View File

@ -1,4 +1,4 @@
$("#org_subfield_list").html("");
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields.order("priority") }) %>");
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>");
$("#sub_field_left_lists").html("");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");

View File

@ -1,2 +1,2 @@
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields.order("priority")}) %>");
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");

View File

@ -1,3 +1,4 @@
$("#subsubdomain_show_<%= @subdomain.id %>").html("<%= @subdomain.name %>");
$("#sub_field_left_lists").html("");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>");

View File

@ -66,11 +66,7 @@
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.author == User.current %>
<span class="ml15 likeButton"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
<% end %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
@ -108,11 +104,7 @@
<% end %>
<%= format_time(comment.created_on) %>
<span id="reply_praise_count_<%=comment.id %>">
<% if comment.author == User.current %>
<span class="fr likeButton"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "#{get_praise_num(comment)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<% end %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">

View File

@ -49,8 +49,6 @@
alert("您只能删除没有历史记录的资源,请重新选择后再删除。");
return;
}
if(data != "" && confirm('确认要删除这些资源吗?')) {
$.post(
'<%= user_resource_delete_user_path(User.current.id,:type=>@type,:status=>@status)%>',
@ -62,8 +60,6 @@
}
}
function show_send(){
$("#contextMenu").hide();
document.oncontextmenu = function() {return true;}

View File

@ -1,3 +1 @@
<% if @type != "2" %>
<div class="resourcesUploadBox mt10" ><a href="javascript:void(0);" onclick="show_upload();" class="uploadBoxIcon">上传资源</a></div>
<% end %>
<div class="resourcesUploadBox mt10" ><a href="javascript:void(0);" onclick="show_upload();" class="uploadBoxIcon">上传资源</a></div>

View File

@ -10,7 +10,7 @@
</div>
<div class="mb10 mt10">
<label>
<input type="checkbox" class="mr5" name="base_on_project" checked value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.base_on_project : 1 %>" id="base_on_project"/>
<input type="checkbox" class="mr5" name="base_on_project" value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.base_on_project : 1 %>" id="base_on_project"/>
<span class="f14 fontGrey3 mr10">基于项目实施</span>
</label>
<p class="c_red">提醒勾选后各小组必须在Trustie平台创建项目教师可随时观察平台对各小组最新进展的实时统计。</p>

View File

@ -1,6 +1,6 @@
<% if @state == 1 %>
<% if !User.current.logged? %>
alert("您还未登录");
<% elsif @state == 2 %>
<% else %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/apply_resource', :locals => {:attachment => @attachment}) %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();

View File

@ -1,4 +1,22 @@
<% if @wechat_user %>
<div class="page">
<div class="weui_msg">
<div class="weui_icon_area"><i class="weui_icon_success weui_icon_msg"></i></div>
<div class="weui_text_area">
<h2 class="weui_msg_title">操作成功</h2>
<p class="weui_msg_desc">您已经绑定过微信了,用户名: (<%= @wechat_user.user.login %>)</p>
</div>
<div class="weui_opr_area">
<p class="weui_btn_area">
<a onclick="WeixinJSBridge.call('closeWindow');" class="weui_btn weui_btn_primary">确定</a>
</p>
</div>
</div>
</div>
<% else %>
<div class="loginIn">
<div>
<p class="weui_cells_title wechat-error">
@ -62,4 +80,7 @@
})
});
</script>
</script>
<% end %>

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