Merge branch 'yuanke_1' into yuanke

This commit is contained in:
yuanke 2016-04-28 10:32:57 +08:00
commit bcca1366e9
124 changed files with 3789 additions and 726 deletions

View File

@ -1,9 +1,45 @@
class BlogsController < ApplicationController
before_filter :find_blog,:except => [:index,:create,:new,:set_homepage, :cancel_homepage]
before_filter :find_user
include PraiseTreadHelper
def index
@article = BlogComment.new
@order, @b_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
#确定 sort_type 1升序 2 降序
if @order.to_i == @type.to_i
@b_sort = @b_sort.to_i == 1 ? 2 : 1
else
@b_sort = 2
end
sort_name = "updated_at"
sort_type = @b_sort == 1 ? "asc" : "desc"
@topics = @user.blog.articles.reorder("#{BlogComment.table_name}.sticky desc,#{BlogComment.table_name}.#{sort_name} #{sort_type}")
#根据 赞+回复数排序
if @order.to_i == 2
@type = 2
@b_sort == 1 ? @topics = @topics.sort{|x,y| get_praise_num(x) + (x.parent ? x.parent.children.count : x.children.count) <=> get_praise_num(y) + (y.parent ? y.parent.children.count : y.children.count) } : @topics = @topics.sort{|x,y| get_praise_num(y) + (y.parent ? y.parent.children.count : y.children.count) <=> get_praise_num(x) + (x.parent ? x.parent.children.count : x.children.count) }
@topics = @topics.sort{|x,y| y.sticky <=> x.sticky}
else
@type = 1
end
#分页
@limit = 10
@is_remote = true
@atta_count = @topics.count
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset
@topics = paginateHelper @topics,@limit
respond_to do |format|
format.js
format.html {render :layout=>'new_base_user'}
end
end

View File

@ -28,6 +28,7 @@ class BoardsController < ApplicationController
helper :watchers
helper :project_score
helper :attachments
include PraiseTreadHelper
def index
#modify by nwb
@flag = params[:flag] || false
@ -62,13 +63,24 @@ class BoardsController < ApplicationController
else
render_403
end
end
end
def show
# 讨论区消息状态更新(已读和未读)
@order, @b_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
#确定 sort_type 1升序 2 降序
if @order.to_i == @type.to_i
@b_sort = @b_sort.to_i == 1 ? 2 : 1
else
@b_sort = 2
end
sort_name = "updated_at"
sort_type = @b_sort == 1 ? "asc" : "desc"
if @project
ForgeMessage.where("user_id =? and project_id =? and viewed =?", User.current.id, @project.id, 0).update_all(:viewed => true)
# 更新@消息为已读
@ -82,10 +94,10 @@ class BoardsController < ApplicationController
CourseMessage.where("user_id =? and course_id =? and viewed =?", User.current.id, @course.id, 0).update_all(:viewed => true)
end
sort_init 'updated_on', 'desc'
sort_update 'created_on' => "#{Message.table_name}.created_on",
'replies' => "#{Message.table_name}.replies_count",
'updated_on' => "COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on)"
# sort_init 'updated_on', 'desc'
# sort_update 'created_on' => "#{Message.table_name}.created_on",
# 'replies' => "#{Message.table_name}.replies_count",
# 'updated_on' => "COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on)"
@is_new = params[:is_new]
@topic_count = @board ? @board.topics.count : 0
@ -93,52 +105,71 @@ class BoardsController < ApplicationController
if @board
limit = 10;
@topic_count = @board.topics.count();
@topic_pages = (params[:page] ? params[:page].to_i + 1 : 0) *10
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) desc").
limit(limit).offset(@topic_pages).includes(:last_reply).
@topic_pages = 0#(params[:page] ? params[:page].to_i + 1 : 0) *10
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) #{sort_type}").
offset(@topic_pages).includes(:last_reply).
preload(:author, {:last_reply => :author}).all();
else
@topics = [];
end
elsif @course
if (@board)
limit = 10;
@topic_count = @board.topics.count();
@topic_pages = (params[:page] ? params[:page].to_i + 1 : 0) *10
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) desc").
limit(limit).offset(@topic_pages).includes(:last_reply).
preload(:author, {:last_reply => :author}).all();
@topic_pages = 0 #(params[:page] ? params[:page].to_i + 1 : 0) *10
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) #{sort_type}").offset(@topic_pages).includes(:last_reply).preload(:author, {:last_reply => :author}).all();
else
@topics = [];
end
end
#根据 赞+回复数排序
if @order.to_i == 2
@type = 2
@b_sort == 1 ? @topics = @topics.sort{|x,y| get_praise_num(x) + (x.parent ? x.parent.children.count : x.children.count) <=> get_praise_num(y) + (y.parent ? y.parent.children.count : y.children.count) } : @topics = @topics.sort{|x,y| get_praise_num(y) + (y.parent ? y.parent.children.count : y.children.count) <=> get_praise_num(x) + (x.parent ? x.parent.children.count : x.children.count) }
@topics = @topics.sort{|x,y| y.sticky <=> x.sticky}
else
@type = 1
end
#分页
@limit = 10
@is_remote = true
@atta_count = @topics.count
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset
@topics = paginateHelper @topics,@limit
@page = params[:page] ? params[:page].to_i + 1 : 0
@message = Message.new(:board => @board)
#modify by nwb
respond_to do |format|
format.js
format.html {
if @project
render :action => 'show', :layout => 'base_projects'
elsif @course
@params=params
render :action => 'show', :layout => 'base_courses'
end
}
format.atom {
@messages = @board.messages.
reorder('created_on DESC').
includes(:author, :board).
limit(Setting.feeds_limit.to_i).
all
if @project
render_feed(@messages, :title => "#{@project}: #{@board}")
elsif @course
render_feed(@messages, :title => "#{@course}: #{@board}")
end
}
if (params[:page] || params[:order])
respond_to do |format|
format.js{render "show.js.erb"}
end
else
respond_to do |format|
format.js
format.html {
if @project
render :action => 'show', :layout => 'base_projects'
elsif @course
@params=params
render :action => 'show', :layout => 'base_courses'
end
}
format.atom {
@messages = @board.messages.
reorder('created_on DESC').
includes(:author, :board).
limit(Setting.feeds_limit.to_i).
all
if @project
render_feed(@messages, :title => "#{@project}: #{@board}")
elsif @course
render_feed(@messages, :title => "#{@course}: #{@board}")
end
}
end
end
end

View File

@ -84,9 +84,6 @@ class OrganizationsController < ApplicationController
@subfield_content = @organization.org_subfields.order("priority")
@organization = Organization.find(params[:id])
# 统计访问量
@organization.update_column(:visits, @organization.visits.to_i + 1)
# @org_subfield = OrgSubfield.find(params[:org_subfield_id])
# @org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
# @org_acts = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10)
@ -116,15 +113,13 @@ class OrganizationsController < ApplicationController
#@project_acts_issues = get_project_activities_org @organization
#@course_acts = get_course_activities_org @organization
render :layout => 'base_org_newstyle'
render :layout => 'base_org2'
else
render_403
end
else
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
@organization = Organization.find(params[:id])
# 统计访问量
@organization.update_column(:visits, @organization.visits.to_i + 1)
if params[:org_subfield_id]
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0

View File

@ -319,9 +319,25 @@ class ProjectsController < ApplicationController
else
@events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public = ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc").page(params['page'|| 1]).per(10);
end
g = Gitlab.client
unless @project.gpid.nil?
@static_total_per_user = g.rep_stats(@project.gpid)
# g = Gitlab.client
unless @project.gpid.nil? || @project.project_score.changeset_num == 0
# rep_statics_commit = @project.rep_statics.order("commits_num desc")
rep_statics_commit = RepStatics.find_by_sql("SELECT * FROM `rep_statics` where project_id = #{@project.id} order by commits_num desc limit 10")
rep_statics_code = RepStatics.find_by_sql("SELECT * FROM `rep_statics` where project_id = #{@project.id} order by changeset desc limit 10")
# rep_statics_code = @project.rep_statics.sort_by {|u| u.changeset}.reverse
@a_uname = rep_statics_commit.map {|s| s.uname }
@a_uname_code = rep_statics_code.map {|s| s.uname }
@a_commits_num = rep_statics_commit.map {|s| s.commits_num.to_i }
@a_commits_add = rep_statics_code.map {|s| s.add.to_i }
@a_commits_del = rep_statics_code.map {|s| s.del.to_i }
@a_commits_changeset = rep_statics_code.map {|s| s.changeset.to_i }
g = Gitlab.client
begin
g_branch = g.project(@project.gpid).default_branch.to_s
rescue
logger.error("get gitlab project failed!")
end
@rev = g_branch.nil? ? "master" : g_branch
end
# 根据对应的请求,返回对应的数据
respond_to do |format|

View File

@ -325,31 +325,17 @@ update
end
end
# unless @repository.gitlab?
# # redirect_to to_gitlab_project_repository_path(@project, @repository)
# render :to_gitlab
# return
# end
#if( !User.current.member_of?(@project) || @project.hidden_repo)
# @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty?
# :name, :path, :kind, :size, :lastrev, :changeset
@entries = @repository.entries(@path, @rev)
# @trees = g.trees(project, @path)
@changeset = @repository.find_changeset_by_name(@rev)
#@project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
#@ip = RepositoriesHelper::REPO_IP_ADDRESS
if request.xhr?
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
else
#Modified by young
# (show_error_not_found; return) unless @entries
g = Gitlab.client
@changesets = g.commits(@project.gpid, :ref_name => @rev)
g_project = g.project(@project.gpid)
# 总的提交数
@changesets_all_count = @project.gpid.nil? ? 0 : g.project(@project.gpid).commit_count
@changesets_all_count = @project.gpid.nil? ? 0 : g_project.commit_count
@g_default_branch = g_project.default_branch.nil? ? "master" : g_project.default_branch
# 访问该页面的是会后则刷新
if @project.project_score.nil?
ProjectScore.create(:project_id => @project.id, :score => false)
@ -358,17 +344,16 @@ update
if @changesets_all_count != @project.project_score.changeset_num && @changesets_all_count != 0
update_commits_count(@project, @changesets_all_count)
end
# end
# 最近一次提交
@changesets_latest_coimmit = @changesets[0]
unless @changesets[0].blank?
update_commits_date(@project, @changesets_latest_coimmit)
end
@creator = User.where("id =?", @project.user_id).first.try(:login)
@properties = @repository.properties(@path, @rev)
@repositories = @project.repositories
project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
ip = RepositoriesHelper::REPO_IP_ADDRESS
# @properties = @repository.properties(@path, @rev)
# @repositories = @project.repositories
# project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
# ip = RepositoriesHelper::REPO_IP_ADDRESS
gitlab_address = Redmine::Configuration['gitlab_address']
if @repository.type.to_s == "Repository::Gitlab"
@repos_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+@repository.identifier+"."+"git"
@ -573,9 +558,17 @@ update
g = Gitlab.client
begin
@static_total_per_user = g.rep_stats(project_id, :rev => rev)
@static_total_per_user
# @static_month__per_user = g.rep_stats(project_id, :rev => rev, :creator => creator, :period => 2)
# @static_week_per_user = g.rep_stats(project_id, :rev => rev, :creator => creator, :period => 3)
# 更新rep_statics统计数
@static_total_per_user.each do |static|
rep_static = RepStatics.where("project_id =? and email =?", @project.id, static.email.to_s).first
if rep_static.nil?
RepStatics.create(:project_id => @project.id, :uname => static.uname, :commits_num => static.commits_num, :email => static.email, :add => static.add, :del => static.del, :changeset => static.changes)
else
if @rev == params[:default_branch]
rep_static.update_attributes(:uname => static.uname, :commits_num => static.commits_num, :email => static.email, :add => static.add, :del => static.del, :changeset => static.changes)
end
end
end
rescue
render_404
return

View File

@ -504,6 +504,7 @@ class StudentWorkController < ApplicationController
end
@score = @b_sort == "desc" ? "asc" : "desc"
@is_focus = params[:is_focus] ? params[:is_focus].to_i : 0
# 消息传过来的ID
@message_student_work_id = params[:student_work_id]
respond_to do |format|
@ -920,8 +921,6 @@ class StudentWorkController < ApplicationController
student_work.late_penalty = @homework.late_penalty
student_work.save
end
@homework.save
end
if params[:absence_penalty] && homework_detail_manual.absence_penalty.to_s != params[:absence_penalty].to_s
@ -944,7 +943,6 @@ class StudentWorkController < ApplicationController
homework_detail_programing.ta_proportion = params[:sy_proportion] if homework_detail_programing
@homework.teacher_priority = teacher_priority
@homework.save
homework_detail_manual.save if homework_detail_manual
homework_detail_programing.save if homework_detail_programing
@ -953,6 +951,8 @@ class StudentWorkController < ApplicationController
student_work.save
end
end
@homework.save
if params[:student_path]
redirect_to student_work_index_url(:homework => @homework.id)
else

View File

@ -41,7 +41,7 @@ class UsersController < ApplicationController
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course]
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist]
before_filter :auth_user_extension, only: :show
#before_filter :rest_user_score, only: :show
#before_filter :select_entry, only: :user_projects
@ -2845,6 +2845,93 @@ class UsersController < ApplicationController
end
end
def user_courselist
@order, @c_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
#确定 sort_type
if @order.to_i == @type.to_i
@c_sort = @c_sort.to_i == 1 ? 2 : 1 #1升序 2降序
else
@c_sort = 2
end
sort_name = "updated_at"
sort_type = @c_sort == 1 ? "asc" : "desc"
if @user.courses.visible.count > 0
course_order_ids = "(" + CourseActivity.find_by_sql("SELECT c.course_id, updated_at FROM(SELECT ca.course_id, MAX(ca.updated_at) AS updated_at FROM course_activities ca WHERE ca.course_id IN (" + @user.courses.visible.select('courses.id').map{|c| c.id}.join(',') + ") GROUP BY ca.course_id) AS c ").map {|c| c.course_id}.join(",") + ")"
@courses = Course.where("id in #{course_order_ids}").order("#{sort_name} #{sort_type}")
else
@courses = []
end
#根据 作业+资源数排序
if @order.to_i == 2
@type = 2
@courses.each do |course|
course[:infocount] = (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) ? (course.homework_commons.count + visable_attachemnts_incourse(course).count) : (course.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(course).count)
end
@c_sort == 1 ? (@courses = @courses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@courses = @courses.sort{|x,y| y[:infocount] <=> x[:infocount]})
else
@type = 1
end
#分页
@limit = 10
@is_remote = true
@atta_count = @courses.count
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset
@courses = paginateHelper @courses,@limit
respond_to do |format|
format.js
format.html {render :layout => 'new_base_user'}
end
end
def user_projectlist
@order, @c_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
#确定 sort_type
if @order.to_i == @type.to_i
@c_sort = @c_sort.to_i == 1 ? 2 : 1 #1升序 2降序
else
@c_sort = 2
end
sort_name = "created_on"
sort_type = @c_sort == 1 ? "asc" : "desc"
if @user.projects.visible.count > 0
project_order_ids = "(" +ForgeActivity.find_by_sql("SELECT p.project_id, p.created_at FROM (SELECT fa.project_id, MAX(fa.created_at) AS created_at FROM forge_activities fa WHERE fa.project_id IN (" + @user.projects.visible.select('projects.id').map{|p| p.id}.join(',') + ") GROUP BY fa.project_id) AS p ").map {|p| p.project_id}.join(",") + ")"
@projects = Project.where("projects.id in #{project_order_ids}").order("#{sort_name} #{sort_type}")
else
@projects = []
end
#根据 问题+资源数排序 @project.project_score.issue_num @project.project_score.attach_num
if @order.to_i == 2
@type = 2
@c_sort == 1 ? (@projects = @projects.sort{|x,y| x.project_score.issue_num+x.project_score.attach_num <=> y.project_score.issue_num+y.project_score.attach_num }) : (@projects = @projects.sort{|x,y| y.project_score.issue_num+y.project_score.attach_num <=> x.project_score.issue_num+x.project_score.attach_num })
else
@type = 1
end
#分页
@limit = 10
@is_remote = true
@atta_count = @projects.count
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset
@projects = paginateHelper @projects,@limit
respond_to do |format|
format.js
format.html {render :layout => 'new_base_user'}
end
end
private
def find_user

View File

@ -120,60 +120,53 @@ module ApplicationHelper
case type
when "HomeworkCommon"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :homework_journal_num => 1)
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :homework_journal_num => 1)
else
score = course_contributor_score.homework_journal_num + 1
course_contributor_score.update_attributes(:homework_journal_num => score)
score = course_contributor_score.homework_journal_num.to_i + 1
course_contributor_score.update_column(:homework_journal_num, score)
end
# 课程留言
when "Course"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 0, :journal_num => 1, :journal_reply_num => 0)
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :journal_num => 1)
else
score = course_contributor_score.journal_num + 1
course_contributor_score.update_attributes(:journal_num => score)
score = course_contributor_score.journal_num.to_i + 1
course_contributor_score.update_column(:journal_num, score)
end
when "Message"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 1, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0)
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 1)
else
score = course_contributor_score.message_num + 1
course_contributor_score.update_attributes(:message_num => score)
score = course_contributor_score.message_num.to_i + 1
course_contributor_score.update_column(:message_num, score)
end
when "MessageReply"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 1,
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0)
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_reply_num => 1)
else
score = course_contributor_score.message_reply_num + 1
course_contributor_score.update_attributes(:message_reply_num => score)
score = course_contributor_score.message_reply_num.to_i + 1
course_contributor_score.update_column(:message_reply_num, score)
end
when "NewReply"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0)
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :news_reply_num => 1)
else
score = course_contributor_score.news_reply_num + 1
course_contributor_score.update_attributes(:news_reply_num => score)
score = course_contributor_score.news_reply_num.to_i + 1
course_contributor_score.update_column(:news_reply_num, score)
end
when "News"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :news_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0)
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :news_num => 1)
else
score = course_contributor_score.news_num + 1
course_contributor_score.update_attributes(:news_num => score)
score = course_contributor_score.news_num.to_i + 1
course_contributor_score.update_column(:news_num, score)
end
when "Attachment"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :news_num => 0, :resource_num => 1, :journal_num => 0, :journal_reply_num => 0)
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :resource_num => 1)
else
score = course_contributor_score.resource_num + 1
course_contributor_score.update_attributes(:resource_num => score)
score = course_contributor_score.resource_num.to_i + 1
course_contributor_score.update_column(:resource_num, score)
end
end
end
@ -184,39 +177,39 @@ module ApplicationHelper
case type
when "HomeworkCommon"
unless course_contributor_score.nil?
score = course_contributor_score.homework_journal_num - 1
course_contributor_score.update_attribute(:homework_journal_num, score < 0 ? 0 : score)
score = course_contributor_score.homework_journal_num.to_i - 1
course_contributor_score.update_column(:homework_journal_num, score < 0 ? 0 : score)
end
# 课程留言
when "Course"
unless course_contributor_score.nil?
score = course_contributor_score.journal_num - 1
course_contributor_score.update_attribute(:journal_num, score < 0 ? 0 : score)
score = course_contributor_score.journal_num.to_i - 1
course_contributor_score.update_column(:journal_num, score < 0 ? 0 : score)
end
when "Message"
unless course_contributor_score.nil?
score = course_contributor_score.message_num - 1
course_contributor_score.update_attribute(:message_num, score < 0 ? 0 : score)
score = course_contributor_score.message_num.to_i - 1
course_contributor_score.update_column(:message_num, score < 0 ? 0 : score)
end
when "MessageReply"
unless course_contributor_score.nil?
score = course_contributor_score.message_reply_num - 1
course_contributor_score.update_attribute(:message_reply_num, score < 0 ? 0 : score)
score = course_contributor_score.message_reply_num.to_i - 1
course_contributor_score.update_column(:message_reply_num, score < 0 ? 0 : score)
end
when "NewReply"
unless course_contributor_score.nil?
score = course_contributor_score.news_reply_num - 1
course_contributor_score.update_attribute(:news_reply_num, score < 0 ? 0 : score)
score = course_contributor_score.news_reply_num.to_i - 1
course_contributor_score.update_column(:news_reply_num, score < 0 ? 0 : score)
end
when "News"
unless course_contributor_score.nil?
score = course_contributor_score.news_num - 1
course_contributor_score.update_attribute(:news_num, score < 0 ? 0 : score)
score = course_contributor_score.news_num.to_i - 1
course_contributor_score.update_column(:news_num, score < 0 ? 0 : score)
end
when "Attachment"
unless course_contributor_score.nil?
score = course_contributor_score.resource_num - 1
course_contributor_score.update_attribute(:resource_num, score < 0 ? 0 : score)
score = course_contributor_score.resource_num.to_i - 1
course_contributor_score.update_column(:resource_num, score < 0 ? 0 : score)
end
end
end
@ -2990,8 +2983,12 @@ def homework_common_index_url_in_org(course_id)
Setting.protocol + "://" + Setting.host_name + "/homework_common?course=" + course_id.to_s
end
def student_work_index_url_in_org(homework_id)
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s
def student_work_index_url_in_org(homework_id, is_focus = '')
if is_focus != ''
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&is_focus=" + is_focus.to_s
else
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s
end
end
def course_url_in_org(course_id)

View File

@ -63,14 +63,67 @@ module OrganizationsHelper
def subfield_status_option
type = []
option1 = []
option1 << "列表"
option1 << "左上"
option1 << "1"
type << option1
option2 = []
option2 << "图片"
option2 << "0"
option2 << "中一"
option2 << "2"
type << option2
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
def subfield_list_type subfield
case subfield.to_i
when 1
resulet = "左上"
when 2
resulet = "中一"
when 3
resulet = "中二"
when 4
resulet = "中下"
when 5
resulet = "左下"
when 6
resulet = "右上"
when 7
resulet = "右中"
when 8
resulet = "右下"
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
end

View File

@ -41,6 +41,23 @@ module RepositoriesHelper
identifiers.include?(iden) ? false :true
end
# 获取文件目录的最新动态
def get_trees_last_changes(project_id, rev, ent_name)
g = Gitlab.client
begin
tree_changes = g.rep_last_changes(project_id, :rev => rev, :path => ent_name)
tree_changes
rescue
logger.error("faile to get tress activities!")
end
end
def translate_time time
case time
when time.include("")
end
end
# 获取diff内容行号
def diff_line_num content
content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.join("").to_i

View File

@ -77,12 +77,10 @@ class Message < ActiveRecord::Base
validates_length_of :subject, :maximum => 255
validate :cannot_reply_to_locked_topic, :on => :create
after_create :add_author_as_watcher, :reset_counters!, :add_boards_count
# after_create :add_author_as_watcher, :reset_counters!, :add_boards_count
after_update :update_messages_board, :update_activity
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count, :down_course_score
after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity,
:act_as_system_message, :send_mail, :act_as_student_score, act_as_at_message(:content, :author_id)
after_create :act_as_course_activity, :act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score, act_as_at_message(:content, :author_id), :add_author_as_watcher, :reset_counters!, :add_boards_count
#before_save :be_user_score
scope :visible, lambda {|*args|
@ -134,11 +132,11 @@ class Message < ActiveRecord::Base
if self.project && !project.project_score.nil?
# 讨论区
if self.parent_id.nil?
count = self.project.project_score.board_num + 1
self.project.project_score.update_attribute(:board_num, count)
count = self.project.project_score.board_num.to_i + 1
self.project.project_score.update_column(:board_num, count)
else # 回复
count = self.project.project_score.board_message_num + 1
self.project.project_score.update_attribute(:board_message_num, count)
count = self.project.project_score.board_message_num.to_i + 1
self.project.project_score.update_column(:board_message_num, count)
end
end
end
@ -259,13 +257,13 @@ class Message < ActiveRecord::Base
def act_as_system_message
if self.course
if self.parent_id.nil? # 主贴
self.course.members.each do |m|
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)
end
end
else # 回帖
self.course.members.each do |m|
self.course.members.includes(:user).each do |m|
if m.user_id == Message.find(self.parent_id).author_id && m.user_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
end
@ -273,13 +271,13 @@ class Message < ActiveRecord::Base
end
elsif self.project # 项目相关
if self.parent_id.nil? # 主贴
self.project.members.each do |m|
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)
end
end
else # 回帖
self.project.members.each do |m|
self.project.members.includes(:user).each do |m|
if m.user_id == Message.find(self.parent_id).author_id && m.user_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.board.project_id, :viewed => false)
end

View File

@ -115,6 +115,7 @@ class Project < ActiveRecord::Base
has_many :org_projects,:dependent => :destroy
has_many :organization,:through => :org_projects
has_many :rep_statics, :class_name => 'RepStatics'
# has_many :journals

View File

@ -0,0 +1,4 @@
class RepStatics < ActiveRecord::Base
belongs_to :project
attr_accessible :add, :commits_num, :del, :email, :project_id, :uname, :changeset
end

View File

@ -44,7 +44,7 @@ class Repository < ActiveRecord::Base
# validates_uniqueness_of :identifier, :allow_blank => true
validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph)
# donwcase letters, digits, dashes, underscores but not digits only
validates_format_of :identifier, :with => /^[a-z0-9_\-]+$/, :allow_blank => true
validates_format_of :identifier, :with => /^[a-zA-Z0-9_\-]*[a-zA-Z_\-]+[a-zA-Z0-9_\-]*$/, :allow_blank => true
# Checks if the SCM is enabled when creating a repository
validate :repo_create_validation, :on => :create

View File

@ -1,226 +1,76 @@
<div class="resources mt10" id="user_activity_<%= user_activity_id%>" >
<div class="homepagePostBrief" onmouseover="$('#message_setting_<%=activity.id%>').show();" onmouseout="$('#message_setting_<%= activity.id%>').hide();">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
</div>
<div class="homepagePostDes">
<% if activity.author.id == User.current.id || User.current.admin? %>
<div class="homepagePostSetting" id="message_setting_<%= activity.id%>" style="display: none">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= link_to(
l(:button_edit),
{:controller => 'blog_comments',:action => 'edit',:user_id=>activity.author_id,:blog_id=>activity.blog_id, :id => activity.id},
:class => 'postOptionLink'
) if User.current.admin? || User.current.id == activity.author.id %>
</li>
<li>
<%= link_to(
l(:button_delete),
{:controller => 'blog_comments',:action => 'destroy',:user_id=>activity.author_id,:blog_id=>activity.blog_id, :id => activity.id},
:method => :delete,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if User.current.admin? || User.current.id == activity.author.id %>
</li>
<li>
<% if activity.id == activity.blog.homepage_id %>
<%= link_to(
l(:button_cancel_homepage),
{:controller => 'blogs',:action => 'cancel_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
:method => :post,
:class => 'postOptionLink'
) if User.current && User.current.id == activity.blog.author_id %>
<% else %>
<%= link_to(
l(:button_set_homepage),
{:controller => 'blogs',:action => 'set_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
:method => :post,
:class => 'postOptionLink'
) if User.current && User.current.id == activity.blog.author_id %>
<% end %>
</li>
</ul>
<div class = "cl"> </div>
<div id="blog-list">
<div class="listbox mt10" >
<h2 class="list-h2">博客列表</h2>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'blogs', :action => 'index', :id =>@user, :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 1 %>
<%= link_to "", {:controller => 'blogs', :action => 'index', :id =>@user, :type => @type, :sort => @b_sort, :order => 1 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<%= link_to "人气", {:controller => 'blogs', :action => 'index', :id =>@user, :type => @type, :sort => @b_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 2 %>
<%= link_to "", {:controller => 'blogs', :action => 'index', :id =>@user, :type => @type, :sort => @b_sort, :order => 2 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<div class="cl"></div>
</div>
<div class="bloglistbox">
<% topics.each do |activity| %>
<ul class="list-file">
<li><span class="item_list fl"></span>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id, :blog_id=>activity.blog.id,:id=>activity), :class=> "list-title fl" %>
<% else %>
<%= link_to activity.title.subject.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id, :blog_id=>activity.blog.id,:id=>activity), :class=> "list-title fl"%>
<% end %>
<% if activity.blog.homepage_id and activity.id == activity.blog.homepage_id %>
<span class="c_red ml10 fr">[已设为首页]</span>
<% end %>
<% if activity.sticky == 1 %>
<span class="fl ml10 red-cir-btn">顶</span>
<% end%>
<% if activity.locked %>
<span class="fl ml10 green-cir-btn" title="已锁定">锁</span>
<% end %>
<div class="cl"></div>
</li>
<% count=0 %>
<% if activity.parent %>
<% count=activity.parent.children.count%>
<% else %>
<% count=activity.children.count%>
<% end %>
<li class="ml15">
<span class="grayTxt">发帖时间:<%= format_time(activity.created_on) %></span>
<span class="grayTxt">更新时间:<%= format_time(activity.updated_on) %></span>
<p class="list-info fr grayTxt">
<span><%= count>0 ? "#{count}" :"0" %></span>
<span>回复</span>
<span>|</span>
<span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" :"0" %></span>
<span>赞</span>
</p>
</li>
</ul>
</div>
<%end%>
<div class="homepagePostTo mt-4 fl">
<% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
<% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
<% end %>
TO
<%= link_to activity.blog.name+" | 博客", user_blogs_path(:user_id=>activity.author_id,:host=>Setting.host_user), :class => "newsBlue ml15 mr5"%>
<% if activity.blog.homepage_id and activity.id == activity.blog.homepage_id %>
<span class="red_homework_btn_cir ml5">已设为首页</span>
<% end %>
</div>
<div class="cl"></div>
<div class="homepagePostTitle hidden m_w530 fl">
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id, :blog_id=>activity.blog.id,:id=>activity), :class=> "postGrey" %>
<% else %>
<%= link_to activity.title.subject.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id, :blog_id=>activity.blog.id,:id=>activity), :class=> "postGrey"%>
<% end %>
</div>
<% if activity.sticky == 1%>
<span class="sticky_btn_cir ml10">置顶</span>
<% end%>
<% if activity.locked%>
<span class="locked_btn_cir ml10 fl" title="已锁定">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<% end%>
<div class="cl"></div>
<div class="homepagePostDate fl">
发帖时间:<%= format_time(activity.created_on) %>
</div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(activity.updated_on) %>
</div>
<div class="cl"></div>
<% if activity.parent_id.nil? %>
<% content= activity.content%>
<% else %>
<% content= activity.parent.content%>
<% end %>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
<div class="cl"></div>
<!--<div class=" fl" style="width: 600px">
<%# if activity.attachments.any?%>
<%# options = {:author => true, :deletable => false } %>
<%#= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => activity.attachments, :options => options, :is_float => true} %>
<%# end %>
</div>
<div class="cl"></div>-->
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div>
<div class="mt10" style="font-weight:normal;">
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
</div>
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li><a href="javascript:void(0);" class="postOptionLink">编辑</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">复制</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="cl"></div>
</div>
<% count=0 %>
<% if activity.parent %>
<% count=activity.parent.children.count%>
<% else %>
<% count=activity.children.count%>
<% end %>
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<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" title="不能自己赞自己哦!"> <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 %>
</span>
</div>
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
<%if count > 3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
</a>
</div>
<% end %>
</div>
<% activity= activity.parent ? activity.parent : activity%>
<% replies_all_i = 0 %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<ul>
<% activity.children.reorder("created_on desc").each do |reply|%>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= reply.id %>');
});
</script>
<% replies_all_i=replies_all_i+1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher mt-4">
<% if reply.try(:author).try(:realname) == ' ' %>
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
<% else %>
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_time(reply.created_on) %>
<span id="reply_praise_count_<%=reply.id %>">
<% if reply.author == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "#{get_praise_num(reply)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
<% end %>
</span>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img" id="reply_content_<%= reply.id %>">
<%= reply.content.html_safe %>
</div>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>
</div>
<% end %>
<% if !activity.locked? %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller=>'blog_comments',:action => 'reply', :id => activity.id, :blog_id => activity.blog.id, :user_id => activity.author_id},:method => "post",:remote=>true) do |f|%>
<input type="hidden" name="quote[quote]" value="">
<input type="hidden" name="blog_comment[sticky]" value="0">
<input type="hidden" name="blog_comment[locked]" value="0">
<input type="hidden" name="blog_comment[title]" value="RE:<%= activity.title%>">
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="blog_comment[content]"></textarea>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
</ul>
<% end %>
<div>
<ul class="wlist" id="pages" >
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
</ul>
<div class="cl"></div>
</div>
<% end %>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$("#moreProject_<%=user_activity_id %>").click(function(){
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
$("#relatePWrap_<%=user_activity_id %>").css("height","auto");
$(this).hide();
});
$("#hideProject_<%=user_activity_id %>").click(function(){
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
$("#moreProject_<%=user_activity_id %>").show();
});
</script>
//如果右边的博客列表比左边的高度低则将右边的高度设为与左边对齐
var leftHeight = $("#LSide").height()-$(".fontGrey5").height()-10;
var rightHeight = $(".homepageRight").height();
if (rightHeight < leftHeight){
var diffHeight = leftHeight - rightHeight;
var tmpHeight = $(".listbox").height()+diffHeight;
$(".listbox").css("height",tmpHeight);
}
</script>

View File

@ -38,7 +38,7 @@
<div class="homepageRight mt0">
<div class="homepageRightBanner">
<div class="NewsBannerName">
<div class="f16 fl fontGrey3">
<%= @user.name%>的博客
</div>
</div>
@ -51,44 +51,9 @@
<% end %>
<% if topics%>
<% topics.each do |topic| %>
<script>
function expand_reply(container, btnid) {
var target = $(container);
var btn = $(btnid);
if (btn.data('init') == '0') {
btn.data('init', 1);
btn.html('收起回复');
target.show();
} else {
btn.data('init', 0);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
function expand_reply_input(id) {
$(id).toggle();
}
$(function () {
sd_create_editor_from_data(<%= topic.id%>, null, "100%", "<%=topic.class.to_s%>");
});
</script>
<% if topic %>
<%= render :partial => 'blogs/article', :locals => {:activity => topic, :user_activity_id => topic.id} %>
<% end %>
<% end %>
<%# if topics.count == 10 %>
<!--<div id="show_more_course_topic" class="loadMore mt10 f_grey">展开更多<%#= link_to "", boards_topic_path(@board, :course_id => @board.course.id ,:page => page), :id => "more_topic_link", :remote => "true", :class => "none" %></div>-->
<%# end %>
<%= render :partial => 'blogs/article', :locals => {:topics => topics} %>
<% end%>
</div>
<script type="text/javascript">
$("#show_more_course_topic").mouseover(function () {
$("#more_topic_link").click();

View File

@ -30,7 +30,7 @@
<%= import_ke(enable_at: false, prettify: false) %>
<%= render :partial => 'blogs/article_list', :locals => {:blog=>@user.blog,:topics => @user.blog.articles.reorder("#{BlogComment.table_name}.sticky desc,#{BlogComment.table_name}.updated_on desc"), :page => 0, :user => @user} %>
<%= render :partial => 'blogs/article_list', :locals => {:blog=>@user.blog,:topics => @topics, :page => 0, :user => @user} %>
<script type="text/javascript">//侧导航

View File

@ -0,0 +1 @@
$("#blog-list").replaceWith('<%= escape_javascript( render :partial => 'blogs/article', :locals => {:topics => @topics} ) %>');

View File

@ -2,41 +2,7 @@
<%= import_ke(enable_at: false, prettify: false) %>
<%= javascript_include_tag "create_kindeditor" %>
<% end %>
<% if topics %>
<% topics.each do |topic| %>
<script>
function expand_reply(container, btnid) {
var target = $(container);
var btn = $(btnid);
if (btn.data('init') == '0') {
btn.data('init', 1);
btn.html('收起回复');
target.show();
} else {
btn.data('init', 0);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
function expand_reply_input(id) {
$(id).toggle();
}
$(function () {
sd_create_editor_from_data(<%= topic.id%>, null, "100%", "<%=topic.class.to_s%>");
});
</script>
<% if topic %>
<%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id, :is_course => 1, :is_board=>1} %>
<% end %>
<% end %>
<% if topics.count == 10 %>
<%= link_to "点击展开更多",boards_topic_path(@board, :course_id => @board.course.id ,:page => page),:id => "show_more_course_topic",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end %>
<% end%>
<% if @topics || topics %>
<%= render :partial => 'users/course_boardlist', :locals => {:topics => @topics ? @topics: topics , :is_course => 1, :is_board=>1} %>
<% end %>

View File

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

View File

@ -1,5 +1,5 @@
<% if @course %>
$("#show_more_course_topic").replaceWith("<%= escape_javascript( render :partial => 'boards/course_show_detail',:locals => {:topics => @topics, :page => @page} )%>");
$("#course-boardlist").replaceWith('<%= escape_javascript( render :partial => 'users/course_boardlist', :locals => {:topics => @topics, :is_course => 1, :is_board=>1}) %>');
<% else %>
$("#show_more_project_topic").replaceWith("<%= escape_javascript( render :partial => 'boards/project_show_detail',:locals => {:topics => @topics, :page => @page} )%>");
$("#project-boardlist").replaceWith('<%= escape_javascript( render :partial => 'users/project_boardlist', :locals => {:topics => @topics, :is_course => 1, :is_board=>1}) %>');
<% end %>

View File

@ -5,17 +5,18 @@
<div class="fl">
<ul>
<li class="navHomepageMenu fl">
<%= link_to "首页",user_activities_path(User.current.id), :class => "c_white f16 db p10", :title => "回到个人首页"%>
<%= link_to "首页",user_activities_path(User.current), :class => "c_white f16 db p10", :title => "回到个人首页"%>
</li>
<li class="navHomepageMenu fl">
<a href="<%=url_for(:controller => 'users', :action => 'user_resource', :id => User.current.id, :type => 6) %>" class="c_white f16 db p10">资源库</a></li>
<%= link_to "资源库", user_resource_user_path(User.current, :type => 6), :class => "c_white f16 db p10" %>
</li>
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
<li class="navHomepageMenu fl">
<%= link_to "题库", user_homeworks_user_path(User.current.id), :class => "c_white f16 db p10"%>
<%= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
</li>
<% else %>
<li class="navHomepageMenu fl">
<%= link_to "我的作业", student_homeworks_user_path(User.current.id), :class => "c_white f16 db p10"%>
<%= link_to "我的作业", student_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
</li>
<% end %>
<li class="navHomepageMenu fl mr30">

View File

@ -72,4 +72,14 @@
<input type="hidden" value="<%= page%>" id="course_page_num">
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_course('<%= user_courses4show_user_path(user.id)%>');"></a>
</li>
<% end%>
<% end%>
<script type="text/javascript">
var coursecount = <%= @user.courses.visible.count%>;
var courseshowcount = document.getElementsByClassName("coursesLineGrey").length;
if((coursecount == courseshowcount)&&(coursecount > 5) ){
$("#user_show_more_course").hide();
$('#user_hide_course').show();
}
</script>

View File

@ -1,7 +1,7 @@
<% projects.each do |project|%>
<li class="homepageLeftMenuCoursesLine pr">
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count %>
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "coursesLineGrey hidden",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "projectsLineGrey hidden",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
<ul class="<%= count > 0 ? 'shild shildP':'subNavArrow'%>">
<li>
<ul class="subNavMenu boxShadow">
@ -53,4 +53,14 @@
<input type="hidden" value="<%= page%>" id="project_page_num">
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_project('<%= user_projects4show_user_path(user.id)%>');"></a>
</li>
<% end%>
<% end%>
<script type="text/javascript">
var projectcount = <%= @user.projects.visible.count%>;
var projectshowcount = document.getElementsByClassName("projectsLineGrey").length;
if((projectcount == projectshowcount)&&(projectcount > 5)){
$("#user_show_more_project").hide();
$('#user_hide_project').show();
}
</script>

View File

@ -113,6 +113,9 @@
<!--<span class="img_private"><%#= l(:label_private)%></span>-->
<!--<%# end %>-->
<!--</div>-->
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @organization %>
<%# over %>
<div class="cl"></div>
<div class="f12 fontGrey3">

View File

@ -0,0 +1,192 @@
<!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 'org2','jquery/jquery-ui-1.9.2' %>
<%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%>
<%= javascript_include_tag 'attachments' %>
<%#= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%#= yield :header_tags -%>
<!-- MathJax的配置 -->
<script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
<script type="text/javascript" src="/javascripts/jquery-1.8.3.min.js"></script><!--焦点图-->
<script type="text/javascript" src="/javascripts/koala.min.1.5.js"></script><!--焦点图-->
<script src="/javascripts/scrollPic.js"></script><!--滚动-->
<script>
window.onload = function(){
scrollPic();
}
function scrollPic() {
var scrollPic = new ScrollPic();
scrollPic.scrollContId = "scrollPic"; //内容容器ID
scrollPic.arrLeftId = "LeftArr";//左箭头ID
scrollPic.arrRightId = "RightArr"; //右箭头ID
scrollPic.frameWidth = 760;//显示框宽度
scrollPic.pageWidth = 760; //翻页宽度
scrollPic.speed = 10; //移动速度(单位毫秒,越小越快)
scrollPic.space = 10; //每次移动像素(单位px越大越快)
scrollPic.autoPlay = true; //自动播放
scrollPic.autoPlayTime = 3; //自动播放间隔时间(秒)
scrollPic.initialize(); //初始化
}
</script>
</head>
<!--add by huang-->
<script type="text/javascript">
function org_new_files_upload()
{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_org_new_files',:locals => {:org => @organization, :org_attachment_type => 0}) %>');
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
}
function org_new_files_banner_upload()
{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_org_new_files_banner',:locals => {:org => @organization, :org_attachment_type => 1}) %>');
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
}
</script>
<body onload="prettyPrint();">
<!--内容开始-->
<header>
<div class="sn-header">
<%= render :partial => 'organizations/org_logined_header' %>
<div class="sn-row sn-bg-white">
<div class="sn-logo"> <img src="/images/sn_logo.jpg" width="367" height="63" alt="logo" class="sn-mt13" /> <a href="javascript:void(0);" class="sn-search-button sn-mt28"></a>
<input type="text" class="sn-search-input sn-mt28" placeholder="搜索" />
</div>
</div>
<!--导航-->
<div class="sn-row sn-bg-blue">
<ul class="sn-nav">
<% @subfield_content.each do |field| %>
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'activity' %>
<li class="nav-element">
<%= link_to "首页", organization_path(@organization), :class => "sn-link-white" %>
</li>
<% when 'course' %>
<li class="nav-element">
<a href="#course_<%= field.id %>" class="sn-link-white"> 课程动态</a>
</li>
<% when 'project' %>
<li class="nav-element">
<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>
<% 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>
</div>
</div>
</header>
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @organization %>
<%# over %>
<!--内容开始-->
<div class="sn-content">
<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 == 2 %>
<%#= 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} %>
<% elsif field.status.to_i == 3 %>
<%= 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} %>
<% end %>
<% end %>
</div>
<div class="cl"></div>
</div>
<!--内容结束-->
<footer>
<!--footer-->
<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>
</footer>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<%#= call_hook :view_layouts_base_body_bottom %>
</body>
</html>

View File

@ -62,9 +62,9 @@
<!--add by huang-->
<script type="text/javascript">
function orge_new_files_upload()
function org_new_files_upload()
{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_org_new_files',:locals => {:org => @organization, :org_attachment_type => 1}) %>');
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_org_new_files',:locals => {:org => @organization, :org_attachment_type => 0}) %>');
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
@ -72,7 +72,7 @@
$('#ajax-modal').parent().addClass("popbox_polls");
}
function orge_new_files_banner_upload()
function org_new_files_banner_upload()
{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_org_new_files_banner',:locals => {:org => @organization, :org_attachment_type => 1}) %>');
showModal('ajax-modal', '513px');
@ -89,12 +89,20 @@
<div class="header-con">
<% if User.current.admin_of_org?(@organization) %>
<div class="logo fl">
<a class="logo-img"><img src="/images/org_new_style/logo.jpg" alt=""/></a>
<a href="" class="logo-add" title="点击替换LOGO" onclick="orge_new_files_upload();"></a>
<% if @org_logo_attchment.blank? %>
<a class="logo-img"><img src="/images/org_new_style/logo.jpg" alt=""/></a>
<% else %>
<img src="/attachments/<%= @org_logo_attchment.id %>/<%= @org_logo_attchment.filename %>" class="logo-img">
<% end %>
<a href="#" class="logo-add" title="点击替换LOGO" onclick="org_new_files_upload();"></a>
</div>
<% else %>
<div class="logo fl">
<a class="logo-img"><img src="/images/org_new_style/logo.jpg" alt=""/></a>
<% if @org_logo_attchment.blank? %>
<a class="logo-img"><img src="/images/org_new_style/logo.jpg" alt=""/></a>
<% else %>
<img src="/attachments/<%= @org_logo_attchment.id %>/<%= @org_logo_attchment.filename %>" class="logo-img">
<% end %>
</div>
<% end %>
<%= render :partial => 'organizations/org_logined_header' %>
@ -140,7 +148,7 @@
<% else %>
<img src="/attachments/<%= @org_banner_attchment.id %>/<%= @org_banner_attchment.filename %>" class="banner-img">
<% end %>
<a href="#" class="banner-add" title="点击替换图片" onclick="orge_new_files_banner_upload();"></a>
<a href="#" class="banner-add" title="点击替换图片" onclick="org_new_files_banner_upload();"></a>
<div class="banner-txt">
<p ><%= @organization.name %></p>
</div>
@ -389,6 +397,9 @@
<% end %>
<% end %>
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @organization %>
<%# over %>
<div class="footer">
<div class="footer-con">

View File

@ -105,13 +105,13 @@
<div class="homepagePortraitImage fl" id="homepage_portrait_image">
<%= image_tag(url_to_avatar(@user),width:"78", height: "78", :id=>'nh_user_tx') %>
<% if User.current.logged?%>
<% if is_current_user%>
<div id="edit_user_file_btn" class="none">
<div class="homepageEditProfile">
<a href="<%= url_for(:controller => 'my', :action => 'clear_user_avatar_temp') %>" data-remote="true" class="homepageEditProfileIcon"></a>
</div>
</div>
<% end %>
<% if is_current_user%>
<div id="edit_user_file_btn" class="none">
<div class="homepageEditProfile">
<a href="<%= url_for(:controller => 'my', :action => 'clear_user_avatar_temp') %>" data-remote="true" class="homepageEditProfileIcon"></a>
</div>
</div>
<% end %>
<% end%>
</div>
<div class="fl ml10">
@ -189,7 +189,8 @@
<% unvisiable = hidden_courses && hidden_courses.value == "1"%>
<% if !unvisiable %>
<div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a>
<%= link_to '课程',{:controller => "users", :action => "user_courselist", :id => @user.id}, :class => "homepageMenuText" %>
<% if is_current_user%>
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
<div class="courseMenu" id="courseMenu">
@ -212,50 +213,63 @@
<% end%>
<% end%>
</div>
<% if @user.courses.visible.count > 0
course_order_ids = "(" +
CourseActivity.find_by_sql("SELECT c.course_id, updated_at FROM
(SELECT ca.course_id, MAX(ca.updated_at) AS updated_at FROM course_activities ca WHERE ca.course_id IN (" + @user.courses.visible.select('courses.id').map{|c| c.id}.join(',') + ")
GROUP BY ca.course_id) AS c
ORDER BY c.updated_at DESC limit 5").map {|c| c.course_id}.join(",") + ")"
<% end %>
<% if @user.courses.visible.count > 0
course_order_ids = "(" +
CourseActivity.find_by_sql("SELECT c.course_id, updated_at FROM
(SELECT ca.course_id, MAX(ca.updated_at) AS updated_at FROM course_activities ca WHERE ca.course_id IN (" + @user.courses.visible.select('courses.id').map{|c| c.id}.join(',') + ")
GROUP BY ca.course_id) AS c
ORDER BY c.updated_at DESC limit 5").map {|c| c.course_id}.join(",") + ")"
courses = Course.where("id in #{course_order_ids}")
else
courses = []
else
courses = []
end
%>
<%# courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>" id="homepageLeftMenuCourses">
end
%>
<%# courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>" >
<div class = "leftCoursesList" id="homepageLeftMenuCourses">
<ul>
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %>
</ul>
</div>
<% end %>
</div>
<% if !courses.empty? %>
<div class="homepageLeftMenuMore" id="user_hide_course">
<a href="javascript:void(0);" class="homepageLeftMenuHideIcon" id="hide_show_courseicon" onclick="leftCourseslistChange();"></a>
</div>
<% end %>
</div>
<div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuForge').slideToggle();">项目</a>
<%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :class => "homepageMenuText" %>
<% if is_current_user%>
<%=link_to "", new_project_path(:host=> Setting.host_name), :class => "homepageMenuSetting fr", :style => "margin-right:10px;", :title => "新建项目"%>
<% end%>
</div>
<% if @user.projects.visible.count > 0
project_order_ids = "(" +
ForgeActivity.find_by_sql("SELECT p.project_id, p.created_at FROM
project_order_ids = "(" +
ForgeActivity.find_by_sql("SELECT p.project_id, p.created_at FROM
(SELECT fa.project_id, MAX(fa.created_at) AS created_at FROM forge_activities fa WHERE fa.project_id IN (" + @user.projects.visible.select('projects.id').map{|p| p.id}.join(',') + ")
GROUP BY fa.project_id) AS p
ORDER BY p.created_at DESC limit 5").map {|p| p.project_id}.join(",") + ")"
projects = Project.where("projects.id in #{project_order_ids}")
else
projects = Project.where("projects.id in #{project_order_ids}")
else
projects = []
end
%>
<%# projects = @user.projects.visible.select("projects.*, (SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%>
<div class="homepageLeftMenuCourses <%= projects.empty? ? 'none' : ''%>" id="homepageLeftMenuForge">
<ul>
<%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :page => 0} %>
</ul>
<div class="homepageLeftMenuCourses <%= projects.empty? ? 'none' : ''%>" >
<div class = "leftProjecsList" id="homepageLeftMenuForge">
<ul>
<%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :page => 0} %>
</ul>
</div>
<% if !projects.empty? %>
<div class="homepageLeftMenuMore" id="user_hide_project">
<a href="javascript:void(0);" class="homepageLeftMenuHideIcon" id="hide_show_projecticon" onclick="leftProjectslistChange();"></a>
</div>
<% end %>
</div>
<div class="homepageLeftMenuBlock">
<!--<a href="javascript:void(0);" class="homepageMenuText">留言</a>-->
@ -339,6 +353,22 @@
$("#courseMenu").mouseleave(function(){
$("#topnav_course_menu").hide();
});
$('#user_hide_course').hide();
function leftCourseslistChange(){
$('#homepageLeftMenuCourses').slideToggle();
$('#hide_show_courseicon').toggleClass("homepageLeftMenuHideIcon");
$('#hide_show_courseicon').toggleClass("homepageLeftMenuMoreIcon");
}
$('#user_hide_project').hide();
function leftProjectslistChange(){
$('#homepageLeftMenuForge').slideToggle();
$('#hide_show_projecticon').toggleClass("homepageLeftMenuHideIcon");
$('#hide_show_projecticon').toggleClass("homepageLeftMenuMoreIcon");
}
</script>
</body>
</html>

View File

@ -66,11 +66,16 @@
</div>
<% end %>
<% end %>
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
<div class="homepagePostSubmit">
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
<%= user_for_homework_common activity,is_teacher %>
</div>
<% work = cur_user_works_for_homework activity %>
<% if activity.end_time < Date.today && !is_teacher && !work.nil? %>
<div class="homepagePostSubmit">
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
</div>
<% end %>
<% if activity.homework_type == 2 && is_teacher%>
<div class="homepagePostSubmit">
<%= link_to "模拟答题", Setting.protocol + "://" + Setting.host_name + "/users/new_user_commit_homework?homework_id="+activity.id.to_s + "&is_test=true", class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>

View File

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

View File

@ -0,0 +1,117 @@
<div class="sn-index-leftbox" style="display:<%= field.hide == 0?'block':'none' %>;">
<h2 class="h2-title">合作伙伴<a href="javascript:void(0);" target="_blank" class="more">更多</a></h2>
<div class="sn-index-partnerbox " >
<ul id="scrollPic" >
<li>
<a href="javascript:void(0);" target="_blank" class="partnerimg"><img src="images/partner/img-dhyq.jpg" width="363" height="43" alt=""/></a>
<a href="javascript:void(0);" target="_blank" class="partnerimg"><img src="images/partner/img-qhdx.jpg" width="363" height="43" alt=""/></a>
</li>
<li>
<a href="javascript:void(0);" target="_blank" class="partnerimg"><img src="images/partner/img-jzdz.jpg" width="363" height="43" alt=""/></a>
<a href="javascript:void(0);" target="_blank" class="partnerimg"><img src="images/partner/img-zgdz.jpg" width="363" height="43" alt=""/></a>
</li>
</ul>
<div class="cl"></div>
<div class="partner-btnbox">
<div class="partner-prev partner-btn fl " id="LeftArr">&lt;</div>
<div class="partner-next partner-btn fl" id="RightArr">&gt;</div>
<div class="cl"></div>
</div>
</div>
</div>
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'course' %>
<p>暂无内容!</p>
<% when 'project' %>
<p>暂无内容!</p>
<% end %>
<% else %>
<% if field.field_type == "Post" %> <%# 讨论类型 %>
<% org_acts = get_subfield_acts field %>
<% unless org_acts.blank? %>
<% org_acts.each do |activity| %>
<div class="sn-index-leftbox" style="display:<%= field.hide == 0?'block':'none' %>;">
<h2 class="h2-title">合作伙伴<a href="javascript:void(0);" target="_blank" class="more">更多</a></h2>
<div class="sn-index-smallbanner" style="display:<%= field.hide == 0?'block':'none' %>;">
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %>
<% document = activity.org_act %>
<% org_subfield_id = params[:org_subfield_id] %>
<% flag = 2 %>
<% iamge_path = get_image_path_from_content(document.content) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "369", :height => "169"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %>
<% end %>
<% elsif activity.container_type == 'OrgSubfield' %>
<% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where("id=#{activity.org_act_id}").count > 0 %>
<% message = Message.find(activity.org_act_id) %>
<% if message.board.org_subfield_id %>
<% iamge_path = get_image_path_from_content(message.content) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), board_message_url_in_org(message.board.id,message.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "369", :height => "169"), board_message_url_in_org(message.board.id,message.id), :target => "_blank" %>
<% end %>
<% else %>
<% iamge_path = get_image_path_from_content(message.content) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "370", :height => "220"), board_message_path(message.board,activity), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_path(message.board,activity), :target => "_blank" %>
<% end %>
<% 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/ad-default.jpg", :width => "369", :height => "169"), news_path(news), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "369", :height => "169"), news_path(news), :target => "_blank" %>
<% end %>
<% end %>
<% end %>
</div>
</div>
<% end %>
<% else %>
<div class="sn-index-leftbox" style="display:<%= field.hide == 0?'block':'none' %>;">
<h2 class="h2-title">合作伙伴<a href="javascript:void(0);" target="_blank" class="more">更多</a></h2>
<div class="sn-index-partnerbox " >
<ul id="scrollPic" >
<li>
<a href="javascript:void(0);" target="_blank" class="partnerimg"><img src="images/partner/img-dhyq.jpg" width="363" height="43" alt=""/></a>
<a href="javascript:void(0);" target="_blank" class="partnerimg"><img src="images/partner/img-qhdx.jpg" width="363" height="43" alt=""/></a>
</li>
<li>
<a href="javascript:void(0);" target="_blank" class="partnerimg"><img src="images/partner/img-jzdz.jpg" width="363" height="43" alt=""/></a>
<a href="javascript:void(0);" target="_blank" class="partnerimg"><img src="images/partner/img-zgdz.jpg" width="363" height="43" alt=""/></a>
</li>
</ul>
<div class="cl"></div>
<div class="partner-btnbox">
<div class="partner-prev partner-btn fl " id="LeftArr">&lt;</div>
<div class="partner-next partner-btn fl" id="RightArr">&gt;</div>
<div class="cl"></div>
</div>
</div>
</div>
<% end %>
<% elsif field.field_type == "Resource" %>
<% org_attachs = get_attach_org2(field) %>
<div class="sn-index-smallbanner" style="display:<%= field.hide == 0?'block':'none' %>;">
<% 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 image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :target => "_blank" %>
<% end %>
<% else %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), org_subfield_files_path(field), :class => "more-btn-center mt30", :target => "_blank" %>
<% end %>
</div>
<% end %>
<% end %>

View File

@ -0,0 +1,256 @@
<h2 class="h2-title"><%= field.name %><a href="javascript:void(0);" target="_blank" class="more">更多</a></h2>
<div class="cl"></div>
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'course' %>
<% if @course_acts.blank? %>
<%= render :partial => 'organizations/org_subfield_leftM1_default', :locals => {:field => field} %>
<% else %>
<% @course_acts.first(1).each do |act| %>
<% if act.org_act_type == "HomeworkCommon" %>
<% activity = HomeworkCommon.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="sn-news-bigbox fl">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-bigimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-bigimg" %>
<% end %>
<h3>
<%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "h3-title" %>
</h3>
<span class="txt-grey"><%= format_date activity.updated_at %></span>
<div class="sn-news-txt">
<p><%= activity.description.to_s.html_safe %></p>
</div>
</div>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.content) %>
<div class="sn-news-bigbox fl">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-bigimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-bigimg" %>
<% end %>
<h3>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h3-title" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h3-title" %>
<% end %>
</h3>
<span class="txt-grey"><%= format_date activity.updated_on %></span>
<div class="sn-news-txt">
<p><%= activity.content.to_s.html_safe %></p>
</div>
</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="sn-news-bigbox fl">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-bigimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-bigimg" %>
<% end %>
<h3>
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "h3-title" %>
</h3>
<span class="txt-grey"><%= format_date activity.created_on %></span>
<div class="sn-news-txt">
<p><%= activity.description.to_s.html_safe %></p>
</div>
</div>
<% elsif act.org_act_type == "Poll" %>
<% activity = Poll.find(act.org_act_id) %>
<% has_commit = has_commit_poll?(activity.id ,User.current)%>
<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
<% iamge_path = get_image_path_from_content(activity.polls_description) %>
<% if ( activity.polls_status==2) %>
<div class="sn-news-bigbox fl">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-news-bigimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-news-bigimg" %>
<% end %>
<h3>
<% if has_commit %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "h3-title" %>
<% else %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "h3-title" %>
<% end %>
</h3>
<span class="txt-grey"><%= format_date activity.published_at %></span>
<div class="sn-news-txt">
<p><%= activity.polls_description.to_s.html_safe %></p>
</div>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
<% when 'project' %>
<% if @project_acts.blank? %>
<%= render :partial => 'organizations/org_subfield_leftM1_default', :locals => {:field => field} %>
<% else %>
<% @project_acts.first(4).each do |act| %>
<% if act.org_act_type == "Issue" %>
<% activity = Issue.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="sn-news-bigbox fl">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-bigimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-bigimg" %>
<% end %>
<h3>
<%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :target => '_blank', :class => "h3-title" %>
</h3>
<span class="txt-grey"><%= format_date activity.updated_on %></span>
<div class="sn-news-txt">
<p><%= activity.description.to_s.html_safe %></p>
</div>
</div>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.content) %>
<div class="sn-news-bigbox fl">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-bigimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-bigimg" %>
<% end %>
<h3>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h3-title" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h3-title" %>
<% end %>
</h3>
<span class="txt-grey"><%= format_date activity.updated_on %></span>
<div class="sn-news-txt">
<p><%= activity.content.to_s.html_safe %></p>
</div>
</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="sn-news-bigbox fl">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-bigimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-bigimg" %>
<% end %>
<h3>
<%= link_to activity.description.to_s.html_safe, news_url_in_org(activity.id), :target => '_blank', :class => "h3-title" %>
</h3>
<span class="txt-grey">2016-04-08</span>
<div class="sn-news-txt">
<p><%= activity.description.to_s.html_safe %></p>
</div>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
<% else %>
<% if field.field_type == "Post" %>
<% org_acts = get_subfield_acts field %>
<% if org_acts.blank? %>
<%= render :partial => 'organizations/org_subfield_leftM1_default', :locals => {:field => field} %>
<% else %>
<% org_acts.first(4).each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %>
<% document = activity.org_act %>
<% org_subfield_id = params[:org_subfield_id] %>
<% flag = 2 %>
<% iamge_path = get_image_path_from_content(document.content) %>
<div class="sn-news-bigbox fl">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-news-bigimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-news-bigimg" %>
<% end %>
<h3>
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "h3-title" %>
</h3>
<span class="txt-grey"><%= format_date document.created_at %></span>
<div class="sn-news-txt">
<p><%= document.content.to_s.html_safe %></p>
</div>
</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 = Message.find(activity.org_act_id) %>
<% if message.parent_id.nil? %>
<% content = message.content%>
<% else %>
<% content = message.parent.content%>
<% end %>
<% iamge_path = get_image_path_from_content(content) %>
<% if message.board.org_subfield_id %>
<div class="sn-news-bigbox fl">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-news-bigimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-news-bigimg" %>
<% end %>
<h3>
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to message.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "h3-title" %>
<% else %>
<%= link_to message.parent.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "h3-title" %>
<% end %>
</h3>
<span class="txt-grey"><%= format_date message.created_on %></span>
<div class="sn-news-txt">
<p><%= content.to_s.html_safe %></p>
</div>
</div>
<% else %>
<div class="sn-news-bigbox fl">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-news-bigimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-news-bigimg" %>
<% end %>
<h3>
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to message.subject.to_s.html_safe, board_message_path(message.board,message), :target => '_blank', :class => "h3-title" %>
<% else %>
<%= link_to message.parent.subject.to_s.html_safe, board_message_path(message.board,activity), :target => '_blank', :class => "h3-title" %>
<% end %>
</h3>
<span class="txt-grey"><%= format_date message.created_on %></span>
<div class="sn-news-txt">
<p><%= content.to_s.html_safe %></p>
</div>
</div>
<% 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) %>
<div class="sn-news-bigbox fl">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "380", :height => "165"), news_path(news), :target => "_blank", :class =>"sn-news-bigimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), news_path(news), :target => "_blank", :class =>"sn-news-bigimg" %>
<% end %>
<h3>
<%= link_to news.title.to_s, news_path(news), :target => '_blank', :class => "h3-title" %>
</h3>
<span class="txt-grey"><%= format_date news.created_on %></span>
<div class="sn-news-txt">
<p><%= news.description.to_s.html_safe %></p>
</div>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>

View File

@ -0,0 +1,8 @@
<div class="sn-news-bigbox fl">
<a href="javascript:void(0);" target="_blank" class="sn-news-bigimg"><img src="/images/news/img-news-big.jpg" width="380" height="165" alt=""/></a>
<h3><a href="javascript:void(0);" target="_blank" class="h3-title"></a></h3>
<span class="txt-grey"></span>
<div class="sn-news-txt">
<p></p>
</div>
</div>

View File

@ -0,0 +1,233 @@
<div class="sn-news-smallbox fl" style="display:<%= field.hide == 0?'block':'none' %>;">
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'course' %>
<% if @course_acts.blank? %>
<%= render :partial => 'organizations/org_subfield_leftM2_default', :locals => {:field => field} %>
<% else %>
<% @course_acts.first(4).each do |act| %>
<% if act.org_act_type == "HomeworkCommon" %>
<% activity = HomeworkCommon.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="sn-news-small mb18">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/right_top.jpg", :width => "85", :height => "85"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% end %>
<h3>
<%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "h4-title fl mt10" %>
</h3>
<span class="txt-grey fl "><%= format_date activity.updated_at %></span>
<div class="cl"></div>
</div>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.content) %>
<div class="sn-news-small mb18">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% end %>
<h3>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h4-title fl mt10" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h4-title fl mt10" %>
<% end %>
</h3>
<span class="txt-grey fl "><%= format_date activity.updated_on %></span>
<div class="cl"></div>
</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="sn-news-small mb18">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% end %>
<h3>
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "h4-title fl mt10" %>
</h3>
<span class="txt-grey fl "><%= format_date activity.created_on %></span>
<div class="cl"></div>
</div>
<% elsif act.org_act_type == "Poll" %>
<% activity = Poll.find(act.org_act_id) %>
<% has_commit = has_commit_poll?(activity.id ,User.current)%>
<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
<% iamge_path = get_image_path_from_content(activity.polls_description) %>
<% if ( activity.polls_status==2) %>
<div class="sn-news-small mb18">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% end %>
<h3>
<% if has_commit %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "h4-title fl mt10" %>
<% else %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "h4-title fl mt10" %>
<% end %>
</h3>
<span class="txt-grey fl "><%= format_date activity.published_at %></span>
<div class="cl"></div>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
<% when 'project' %>
<% if @project_acts.blank? %>
<%= render :partial => 'organizations/org_subfield_leftM2_default', :locals => {:field => field} %>
<% else %>
<% @project_acts.first(4).each do |act| %>
<% if act.org_act_type == "Issue" %>
<% activity = Issue.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="sn-news-small mb18">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% end %>
<h3>
<%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :target => '_blank', :class => "h4-title fl mt10" %>
</h3>
<span class="txt-grey fl "><%= format_date activity.updated_on %></span>
<div class="cl"></div>
</div>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.content) %>
<div class="sn-news-small mb18">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% end %>
<h3>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h4-title fl mt10" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h4-title fl mt10" %>
<% end %>
</h3>
<span class="txt-grey fl "><%= format_date activity.updated_on %></span>
<div class="cl"></div>
</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="sn-news-small mb18">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% end %>
<h3>
<%= link_to activity.description.to_s.html_safe, news_url_in_org(activity.id), :target => '_blank', :class => "h4-title fl mt10" %>
</h3>
<span class="txt-grey fl "><%= format_date activity.created_on %></span>
<div class="cl"></div>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
<% else %>
<% if field.field_type == "Post" %>
<% org_acts = get_subfield_acts field %>
<% if org_acts.blank? %>
<%= render :partial => 'organizations/org_subfield_leftM2_default', :locals => {:field => field} %>
<% else %>
<% org_acts.first(4).each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %>
<% document = activity.org_act %>
<% org_subfield_id = params[:org_subfield_id] %>
<% flag = 2 %>
<% iamge_path = get_image_path_from_content(document.content) %>
<div class="sn-news-small mb18">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% end %>
<h3>
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "h4-title fl mt10" %>
</h3>
<span class="txt-grey fl "><%= format_date document.created_at %></span>
<div class="cl"></div>
</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 = Message.find(activity.org_act_id) %>
<% if message.parent_id.nil? %>
<% content = message.content%>
<% else %>
<% content = message.parent.content%>
<% end %>
<% iamge_path = get_image_path_from_content(content) %>
<% if message.board.org_subfield_id %>
<div class="sn-news-small mb18">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% end %>
<h3>
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to message.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "h4-title fl mt10" %>
<% else %>
<%= link_to message.parent.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "h4-title fl mt10" %>
<% end %>
</h3>
<span class="txt-grey fl "><%= format_date message.created_on %></span>
<div class="cl"></div>
</div>
<% else %>
<div class="sn-news-small mb18">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% end %>
<h3>
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to message.subject.to_s.html_safe, board_message_path(message.board,message), :target => '_blank', :class => "h4-title fl mt10" %>
<% else %>
<%= link_to message.parent.subject.to_s.html_safe, board_message_path(message.board,activity), :target => '_blank', :class => "h4-title fl mt10" %>
<% end %>
</h3>
<span class="txt-grey fl "><%= format_date message.created_on %></span>
<div class="cl"></div>
</div>
<% 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) %>
<div class="sn-news-small mb18">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "85", :height => "85"), news_path(news), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "85", :height => "85"), news_path(news), :target => "_blank", :class =>"sn-news-smallimg fl" %>
<% end %>
<h3>
<%= link_to news.title.to_s, news_path(news), :target => '_blank', :class => "h4-title fl mt10" %>
</h3>
<span class="txt-grey fl "><%= format_date news.created_on %></span>
<div class="cl"></div>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<div class="cl"></div>
</div>

View File

@ -0,0 +1,26 @@
<div class="sn-news-smallbox fl">
<div class="sn-news-small mb18">
<a href="javascript:void()" target="_blank" class="sn-news-smallimg fl"><img src="/images/news/img-news-small01.jpg" width="85" height="85" alt=""/></a>
<h4><a href="javascript:void()" target="_blank" class="h4-title fl mt10">北斗开放实验室迎湖南省省直机关领导调研参观</a></h4>
<span class="txt-grey fl">2016-04-08</span>
<div class="cl"></div>
</div>
<div class="sn-news-small mb18">
<a href="javascript:void()" target="_blank" class="sn-news-smallimg fl"><img src="/images/news/img-news-small02.jpg" width="85" height="85" alt=""/></a>
<h4><a href="javascript:void()" target="_blank" class="h4-title fl mt10">北斗开放实验室迎湖南省省直机关领导调研参观</a></h4>
<span class="txt-grey fl">2016-04-08</span>
<div class="cl"></div>
</div>
<div class="sn-news-small mb18">
<a href="javascript:void()" target="_blank" class="sn-news-smallimg fl"><img src="/images/news/img-news-small03.jpg" width="85" height="85" alt=""/></a>
<h4><a href="javascript:void()" target="_blank" class="h4-title fl mt10">北斗开放实验室迎湖南省省直机关领导调研参观</a></h4>
<span class="txt-grey fl">2016-04-08</span>
<div class="cl"></div>
</div>
<div class="sn-news-small ">
<a href="javascript:void()" target="_blank" class="sn-news-smallimg fl"><img src="/images/news/img-news-small04.jpg" width="85" height="85" alt=""/></a>
<h4><a href="javascript:void()" target="_blank" class="h4-title fl mt10">北斗开放实验室迎湖南省省直机关领导调研参观</a></h4>
<span class="txt-grey fl">2016-04-08</span>
<div class="cl"></div>
</div>
</div>

View File

@ -0,0 +1,258 @@
<div class="sn-index-leftbox" style="display:<%= field.hide == 0?'block':'none' %>;">
<h2 class="h2-title"><%= field.name %><a href="javascript:void(0);" target="_blank" class="more">更多</a></h2>
<div class="sn-index-resourcescon">
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'course' %>
<% if @course_acts.blank? %>
<%= render :partial => 'organizations/org_subfield_leftMD_default', :locals => {:field => field} %>
<% else %>
<% @course_acts.first(4).each do |act| %>
<% if act.org_act_type == "HomeworkCommon" %>
<% activity = HomeworkCommon.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
<h3>
<%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "resources-title" %>
</h3>
<div class="resources-tagbox">
<%= link_to activity.description.to_s.html_safe, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "resources-tag" %>
</div>
<a href="javascript:void(0);" target="_blank" class="more-btn">更多</a>
</div>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.content) %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
<h3>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "resources-title" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "resources-title" %>
<% end %>
</h3>
<div class="resources-tagbox">
<%= link_to activity.content.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "resources-tag" %>
</div>
<a href="javascript:void(0);" target="_blank" class="more-btn">更多</a>
</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="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
<h3>
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "resources-title" %>
</h3>
<div class="resources-tagbox">
<%= link_to activity.description.to_s.html_safe, news_url_in_org(activity.id), :target => '_blank', :class => "resources-tag" %>
</div>
<a href="javascript:void(0);" target="_blank" class="more-btn">更多</a>
</div>
<% elsif act.org_act_type == "Poll" %>
<% activity = Poll.find(act.org_act_id) %>
<% has_commit = has_commit_poll?(activity.id ,User.current)%>
<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
<% iamge_path = get_image_path_from_content(activity.polls_description) %>
<% if ( activity.polls_status==2) %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
<h3>
<% if has_commit %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "resources-title" %>
<% else %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "resources-title" %>
<% end %>
</h3>
<div class="resources-tagbox">
<%= link_to activity.polls_description.to_s.html_safe, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "resources-tag" %>
</div>
<a href="javascript:void(0);" target="_blank" class="more-btn">更多</a>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
<% when 'project' %>
<% if @project_acts.blank? %>
<%= render :partial => 'organizations/org_subfield_leftMD_default', :locals => {:field => field} %>
<% else %>
<% @project_acts.first(4).each do |act| %>
<% if act.org_act_type == "Issue" %>
<% activity = Issue.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
<h3>
<%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :target => '_blank', :class => "resources-title" %>
</h3>
<div class="resources-tagbox">
<%= link_to activity.description.to_s.html_safe, issue_url_in_org(activity.id), :target => '_blank', :class => "resources-tag" %>
</div>
<a href="javascript:void(0);" target="_blank" class="more-btn">更多</a>
</div>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.content) %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
<h3>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "resources-title" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "resources-title" %>
<% end %>
</h3>
<div class="resources-tagbox">
<%= link_to activity.content.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "resources-tag" %>
</div>
<a href="javascript:void(0);" target="_blank" class="more-btn">更多</a>
</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="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
<h3>
<%= link_to activity.description.to_s.html_safe, news_url_in_org(activity.id), :target => '_blank', :class => "resources-title" %>
</h3>
<div class="resources-tagbox">
<%= link_to activity.content.to_s.html_safe, news_url_in_org(activity.id), :target => '_blank', :class => "resources-tag" %>
</div>
<a href="javascript:void(0);" target="_blank" class="more-btn">更多</a>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
<% else %>
<% if field.field_type == "Post" %>
<% org_acts = get_subfield_acts field %>
<% if org_acts.blank? %>
<%= render :partial => 'organizations/org_subfield_leftMD_default', :locals => {:field => field} %>
<% else %>
<% org_acts.first(4).each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %>
<% document = activity.org_act %>
<% org_subfield_id = params[:org_subfield_id] %>
<% flag = 2 %>
<% iamge_path = get_image_path_from_content(document.content) %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
<h3>
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "resources-title" %>
</h3>
<div class="resources-tagbox">
<%= link_to document.content.to_s.html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "resources-tag" %>
</div>
<a href="javascript:void(0);" target="_blank" class="more-btn">更多</a>
</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 = Message.find(activity.org_act_id) %>
<% if message.parent_id.nil? %>
<% content = message.content%>
<% else %>
<% content = message.parent.content%>
<% end %>
<% iamge_path = get_image_path_from_content(content) %>
<% if message.board.org_subfield_id %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
<h3>
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to message.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "resources-title" %>
<% else %>
<%= link_to message.parent.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "resources-title" %>
<% end %>
</h3>
<div class="resources-tagbox">
<%= link_to content.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "resources-tag" %>
</div>
<a href="javascript:void(0);" target="_blank" class="more-btn">更多</a>
</div>
<% else %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
<h3>
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to message.subject.to_s.html_safe, board_message_path(message.board,message), :target => '_blank', :class => "resources-title" %>
<% else %>
<%= link_to message.parent.subject.to_s.html_safe, board_message_path(message.board,activity), :target => '_blank', :class => "resources-title" %>
<% end %>
</h3>
<div class="resources-tagbox">
<%= link_to content.to_s.html_safe, board_message_path(message.board,activity), :target => '_blank', :class => "resources-tag" %>
</div>
<a href="javascript:void(0);" target="_blank" class="more-btn">更多</a>
</div>
<% 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) %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), news_path(news), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), news_path(news), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
<h3>
<%= link_to news.title.to_s, news_path(news), :target => '_blank', :class => "resources-title" %>
</h3>
<div class="resources-tagbox">
<%= link_to news.description.to_s.html_safe, news_path(news), :target => '_blank', :class => "resources-tag" %>
</div>
<a href="javascript:void(0);" target="_blank" class="more-btn">更多</a>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<div class="cl"></div>
</div>
</div>

View File

@ -0,0 +1,11 @@
<div class="sn-index-resourcesbox">
<a href="javascript:void()" target="_blank" class="sn-resourcesimg"><img src="/images/default_blank/files-default.jpg" width="185" height="125" alt=""/></a>
<h3><a href="javascript:void()" target="_blank" class="resources-title">仪器资源</a></h3>
<div class="resources-tagbox">
<a href="javascript:void()" target="_blank" class="resources-tag">测试服务</a>
<a href="javascript:void()" target="_blank" class="resources-tag">开放日</a>
<a href="javascript:void()" target="_blank" class="resources-tag">仪器共享</a>
<a href="javascript:void()" target="_blank" class="resources-tag">定制测试</a>
</div>
<a href="javascript:void()" target="_blank" class="more-btn">更多</a>
</div>

View File

@ -0,0 +1,276 @@
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'course' %>
<% if @course_acts.blank? %>
<%= render :partial => 'organizations/org_subfield_leftT_default', :locals => {:field => field} %>
<% else %>
<div class="sn-index-banner" style="display:<%= field.hide == 0?'block':'none' %>;">
<!-- 代码 开始 -->
<div id="fsD1" class="focus">
<div id="D1pic1" class="fPic">
<% @course_acts.first(4).each do |act| %>
<% if act.org_act_type == "HomeworkCommon" %>
<% activity = HomeworkCommon.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="fcon" style="display: none;">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/banner-default.jpg", :width => "820", :height => "435"), student_work_index_url_in_org(activity.id), :target => "_blank", :style =>"opacity: 1; " %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "820", :height => "435"), student_work_index_url_in_org(activity.id), :target => "_blank", :style =>"opacity: 1; " %>
<% end %>
<span class="shadow"><%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank' %></span>
</div>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.content) %>
<div class="fcon" style="display: none;">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/banner-default.jpg", :width => "820", :height => "435"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :style =>"opacity: 1; " %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "820", :height => "435"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :style =>"opacity: 1; " %>
<% end %>
<span class="shadow">
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %>
<% end %>
</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="fcon" style="display: none;">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/banner-default.jpg", :width => "820", :height => "435"), news_url_in_org(activity.id), :target => "_blank", :style =>"opacity: 1; " %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "820", :height => "435"), news_url_in_org(activity.id), :target => "_blank", :style =>"opacity: 1; " %>
<% end %>
<span class="shadow">
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank' %>
</span>
</div>
<% elsif act.org_act_type == "Poll" %>
<% activity = Poll.find(act.org_act_id) %>
<% has_commit = has_commit_poll?(activity.id ,User.current)%>
<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
<% iamge_path = get_image_path_from_content(activity.polls_description) %>
<% if ( activity.polls_status==2) %>
<div class="fcon" style="display: none;">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/banner-default.jpg", :width => "820", :height => "435"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :style =>"opacity: 1; " %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "820", :height => "435"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :style =>"opacity: 1; " %>
<% end %>
<span class="shadow">
<% if has_commit %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank' %>
<% else %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s, :target => '_blank' %>
<% end %>
</span>
</div>
<% end %>
<% end %>
<% end %>
</div>
<div class="fbg">
<div class="D1fBt" id="D1fBt">
<a href="javascript:void(0)" hidefocus="true" target="_self" class=""></a>
<a href="javascript:void(0)" hidefocus="true" target="_self" class=""></a>
<a href="javascript:void(0)" hidefocus="true" target="_self" class="current"></a>
<a href="javascript:void(0)" hidefocus="true" target="_self" class=""></a>
</div>
</div>
<span class="prev"></span>
<span class="next"></span>
</div>
</div>
<% end %>
<% when 'project' %>
<% if @project_acts.blank? %>
<%= render :partial => 'organizations/org_subfield_leftT_default', :locals => {:field => field} %>
<% else %>
<div class="sn-index-banner" style="display:<%= field.hide == 0?'block':'none' %>;">
<!-- 代码 开始 -->
<div id="fsD1" class="focus">
<div id="D1pic1" class="fPic">
<% @project_acts.first(4).each do |act| %>
<% if act.org_act_type == "Issue" %>
<% activity = Issue.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="fcon" style="display: none;">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/banner-default.jpg", :width => "820", :height => "435"), issue_url_in_org(activity.id), :target => "_blank", :style =>"opacity: 1; " %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "820", :height => "435"), issue_url_in_org(activity.id), :target => "_blank", :style =>"opacity: 1; " %>
<% end %>
<span class="shadow"><%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :target => '_blank' %></span>
</div>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.content) %>
<div class="fcon" style="display: none;">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/banner-default.jpg", :width => "820", :height => "435"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :style =>"opacity: 1; " %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "820", :height => "435"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :style =>"opacity: 1; " %>
<% end %>
<span class="shadow">
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank' %>
<% end %>
</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="fcon" style="display: none;">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/banner-default.jpg", :width => "820", :height => "435"), news_url_in_org(activity.id), :target => "_blank", :style =>"opacity: 1; " %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "820", :height => "435"), news_url_in_org(activity.id), :target => "_blank", :style =>"opacity: 1; " %>
<% end %>
<span class="shadow">
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank' %>
</span>
</div>
<% end %>
<% end %>
</div>
<div class="fbg">
<div class="D1fBt" id="D1fBt">
<a href="javascript:void(0)" hidefocus="true" target="_self" class=""></a>
<a href="javascript:void(0)" hidefocus="true" target="_self" class=""></a>
<a href="javascript:void(0)" hidefocus="true" target="_self" class="current"></a>
<a href="javascript:void(0)" hidefocus="true" target="_self" class=""></a>
</div>
</div>
<span class="prev"></span>
<span class="next"></span>
</div>
</div>
<% end %>
<% end %>
<% else %>
<% if field.field_type == "Post" %>
<% org_acts = get_subfield_acts field %>
<% if org_acts.blank? %>
<%= render :partial => 'organizations/org_subfield_leftT_default', :locals => {:field => field} %>
<% else %>
<div class="sn-index-banner" style="display:<%= field.hide == 0?'block':'none' %>;">
<!-- 代码 开始 -->
<div id="fsD1" class="focus">
<div id="D1pic1" class="fPic">
<% org_acts.first(4).each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %>
<% document = activity.org_act %>
<% org_subfield_id = params[:org_subfield_id] %>
<% flag = 2 %>
<% iamge_path = get_image_path_from_content(document.content) %>
<div class="fcon" style="display: none;">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/banner-default.jpg", :width => "820", :height => "435"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :style =>"opacity: 1; " %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "820", :height => "435"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :style =>"opacity: 1; " %>
<% end %>
<span class="shadow"><%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank' %></span>
</div>
<% elsif activity.container_type == 'OrgSubfield' %>
<% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where("id=#{activity.org_act_id}").count > 0 %>
<% message = Message.find(activity.org_act_id) %>
<% if message.board.org_subfield_id %>
<% if message.parent_id.nil? %>
<% content = message.content%>
<% else %>
<% content = message.parent.content%>
<% end %>
<% iamge_path = get_image_path_from_content(content) %>
<div class="fcon" style="display: none;">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/banner-default.jpg", :width => "820", :height => "435"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :style =>"opacity: 1; " %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "820", :height => "435"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :style =>"opacity: 1; " %>
<% end %>
<span class="shadow">
<% if message.parent_id.nil? %>
<%= link_to message.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank' %>
<% else %>
<%= link_to message.parent.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank'%>
<% end %>
</span>
</div>
<% else %>
<% if message.parent_id.nil? %>
<% content = message.content%>
<% else %>
<% content = message.parent.content%>
<% end %>
<% iamge_path = get_image_path_from_content(content) %>
<div class="fcon" style="display: none;">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/banner-default.jpg", :width => "820", :height => "435"), board_message_path(message.board,activity), :target => "_blank", :style =>"opacity: 1; " %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "820", :height => "435"), board_message_path(message.board,activity), :target => "_blank", :style =>"opacity: 1; " %>
<% end %>
<span class="shadow">
<% if message.parent_id.nil? %>
<%= link_to message.subject.to_s.html_safe, board_message_path(message.board,message), :class=> "postGrey" %>
<% else %>
<%= link_to message.parent.subject.to_s.html_safe, board_message_path(message.board,activity), :class=> "postGrey" %>
<% end %>
</span>
</div>
<% 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) %>
<div class="fcon" style="display: none;">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/banner-default.jpg", :width => "820", :height => "435"), news_path(news), :target => "_blank", :style =>"opacity: 1; " %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "820", :height => "435"), news_path(news), :target => "_blank", :style =>"opacity: 1; " %>
<% end %>
<span class="shadow"><%= link_to news.title.to_s, news_path(news), :target => '_blank' %></span>
</div>
<% end %>
<% end %>
<% end %>
</div>
<div class="fbg">
<div class="D1fBt" id="D1fBt">
<a href="javascript:void(0)" hidefocus="true" target="_self" class=""></a>
<a href="javascript:void(0)" hidefocus="true" target="_self" class=""></a>
<a href="javascript:void(0)" hidefocus="true" target="_self" class="current"></a>
<a href="javascript:void(0)" hidefocus="true" target="_self" class=""></a>
</div>
</div>
<span class="prev"></span>
<span class="next"></span>
</div>
</div>
<% end %>
<% end %>
<% end %>
<script type="text/javascript">
Qfast.add('widgets', { path: "/javascripts/terminator2.2.min.js", type: "js", requires: ['fx'] });
Qfast(false, 'widgets', function () {
K.tabs({
id: 'fsD1', //焦点图包裹id
conId: "D1pic1", //** 大图域包裹id
tabId:"D1fBt",
tabTn:"a",
conCn: '.fcon', //** 大图域配置class
auto: 1, //自动播放 1或0
effect: 'fade', //效果配置
eType: 'click', //** 鼠标事件
pageBt:true, //是否有按钮切换页码
bns: ['.prev', '.next'],//** 前后按钮配置class
interval: 3000 //** 停顿时间
})
})
</script>

View File

@ -0,0 +1,10 @@
<div class="sn-index-banner" style="display:<%= field.hide == 0?'block':'none' %>;">
<!-- 代码 开始 -->
<div id="fsD1" class="focus">
<div class="fPic">
<div class="fcon-default">
<a target="_blank" href="javascript:void(0);"><img src="/images/default_blank/banner-default.jpg" alt="" ></a>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,73 @@
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'course' %>
<p>暂无内容!</p>
<% when 'project' %>
<p>暂无内容!</p>
<% end %>
<% else %>
<% if field.field_type == "Post" %> <%# 讨论类型 %>
<% org_acts = get_subfield_acts field %>
<% unless org_acts.blank? %>
<% activity = org_acts.first %>
<div class="sn-index-smallbanner" style="display:<%= field.hide == 0?'block':'none' %>;">
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %>
<% document = activity.org_act %>
<% org_subfield_id = params[:org_subfield_id] %>
<% flag = 2 %>
<% iamge_path = get_image_path_from_content(document.content) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "369", :height => "169"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %>
<% end %>
<% elsif activity.container_type == 'OrgSubfield' %>
<% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where("id=#{activity.org_act_id}").count > 0 %>
<% message = Message.find(activity.org_act_id) %>
<% if message.board.org_subfield_id %>
<% iamge_path = get_image_path_from_content(message.content) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), board_message_url_in_org(message.board.id,message.id), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "369", :height => "169"), board_message_url_in_org(message.board.id,message.id), :target => "_blank" %>
<% end %>
<% else %>
<% iamge_path = get_image_path_from_content(message.content) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "370", :height => "220"), board_message_path(message.board,activity), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_path(message.board,activity), :target => "_blank" %>
<% end %>
<% 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/ad-default.jpg", :width => "369", :height => "169"), news_path(news), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "369", :height => "169"), news_path(news), :target => "_blank" %>
<% end %>
<% end %>
<% end %>
</div>
<% else %>
<div class="sn-index-smallbanner" style="display:<%= field.hide == 0?'block':'none' %>;">
<a href="javascript:void(0);" target="_blank" ><img src="/images/default_blank/ad-default.jpg" width="369" height="169" alt=""/></a>
</div>
<% end %>
<% elsif field.field_type == "Resource" %>
<% org_attachs = get_attach_org2(field) %>
<div class="sn-index-smallbanner" style="display:<%= field.hide == 0?'block':'none' %>;">
<% 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 image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :target => "_blank" %>
<% end %>
<% else %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "369", :height => "169"), org_subfield_files_path(field), :class => "more-btn-center mt30", :target => "_blank" %>
<% end %>
</div>
<% end %>
<% end %>

View File

@ -0,0 +1,98 @@
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'course' %>
<p>暂无内容!</p>
<% when 'project' %>
<p>暂无内容!</p>
<% end %>
<% else %>
<% if field.field_type == "Post" %> <%# 讨论类型 %>
<% org_acts = get_subfield_acts field %>
<% unless org_acts.blank? %>
<% activity = org_acts.first %>
<div class="sn-index-wxbox" style="display:<%= field.hide == 0?'block':'none' %>;">
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %>
<% document = activity.org_act %>
<% org_subfield_id = params[:org_subfield_id] %>
<% flag = 2 %>
<% iamge_path = get_image_path_from_content(document.content) %>
<h2 class="h2-title "><%= field.name %></h2>
<div class="sn-index-wx">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "104", :height => "104"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class => "fl sn-index-wximg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "104", :height => "104"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class => "fl sn-index-wximg" %>
<% end %>
<p class="fl sn-index-txt sn-w229"><%=link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %></p>
<div class="cl"></div>
</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 = Message.find(activity.org_act_id) %>
<% if message.board.org_subfield_id %>
<% iamge_path = get_image_path_from_content(message.content) %>
<h2 class="h2-title "><%= field.name %></h2>
<div class="sn-index-wx">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "104", :height => "104"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class => "fl sn-index-wximg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "104", :height => "104"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class => "fl sn-index-wximg" %>
<% end %>
<p class="fl sn-index-txt"><%=link_to message.content.to_s.html_safe, board_message_url_in_org(message.board.id, message.id), :target => "_blank" %></p>
<div class="cl"></div>
</div>
<% else %>
<% iamge_path = get_image_path_from_content(message.content) %>
<h2 class="h2-title "><%= field.name %></h2>
<div class="sn-index-wx">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "104", :height => "104"), board_message_path(message.board, activity), :target => "_blank", :class => "fl sn-index-wximg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "104", :height => "104"), board_message_path(message.board, activity), :target => "_blank", :class => "fl sn-index-wximg" %>
<% end %>
<p class="fl sn-index-txt"><%=link_to message.content.to_s.html_safe, board_message_path(message.board, activity), :target => "_blank" %></p>
<div class="cl"></div>
</div>
<% 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) %>
<h2 class="h2-title "><%= field.name %></h2>
<div class="sn-index-wx">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "104", :height => "104"), news_path(news), :target => "_blank", :class => "fl sn-index-wximg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "104", :height => "104"), news_path(news), :target => "_blank", :class => "fl sn-index-wximg" %>
<% end %>
<p class="fl sn-index-txt"><%=link_to news.description.to_s.html_safe, news_path(news), :target => "_blank" %></p>
<div class="cl"></div>
</div>
<% end %>
<% end %>
</div>
<% else %>
<div class="sn-index-wxbox" style="display:<%= field.hide == 0?'block':'none' %>;">
<h2 class="h2-title "><%= field.name %></h2>
<div class="sn-index-wx">
<img class="fl sn-index-wximg" src="/images/wx.gif" width="104" height="104" alt=""/>
<p class="fl sn-index-txt">暂无内容!</p>
<div class="cl"></div>
</div>
</div>
<% end %>
<% elsif field.field_type == "Resource" %>
<% org_attachs = get_attach_org2(field) %>
<div class="sn-index-smallbanner" style="display:<%= field.hide == 0?'block':'none' %>;">
<% 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 image_tag("/images/default_blank/ad-default.jpg", :width => "104", :height => "104"), show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :target => "_blank" %>
<% else %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "104", :height => "104"), show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :target => "_blank" %>
<% end %>
<% else %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "104", :height => "104"), org_subfield_files_path(field), :class => "more-btn-center mt30", :target => "_blank" %>
<% end %>
</div>
<% end %>
<% end %>

View File

@ -0,0 +1,223 @@
<div class="sn-index-activebox" style="display:<%= field.hide == 0?'block':'none' %>;">
<h2 class="h2-title mb18"><%= field.name %><a href="javascript:void(0);" target="_blank" class="more">更多</a></h2>
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'course' %>
<% if @course_acts.blank? %>
<%= render :partial => 'organizations/org_subfield_rightT_default', :locals => {:field => field} %>
<% else %>
<% @course_acts.first(4).each do |act| %>
<% if act.org_act_type == "HomeworkCommon" %>
<% activity = HomeworkCommon.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="sn-index-active">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/right_top.jpg", :width => "330", :height => "210"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-activeimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-activeimg" %>
<% end %>
<h3>
<%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :target => '_blank', :class => "active-title" %>
</h3>
<span class="txt-grey "><%= format_date activity.updated_at %></span>
</div>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.content) %>
<div class="sn-index-active">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-activeimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-activeimg" %>
<% end %>
<h3>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "active-title" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "active-title" %>
<% end %>
</h3>
<span class="txt-grey "><%= format_date 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="sn-index-active">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-activeimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-activeimg" %>
<% end %>
<h3>
<%= link_to activity.title.to_s, news_url_in_org(activity.id), :target => '_blank', :class => "active-title" %>
</h3>
<span class="txt-grey "><%= format_date activity.created_on %></span>
</div>
<% elsif act.org_act_type == "Poll" %>
<% activity = Poll.find(act.org_act_id) %>
<% has_commit = has_commit_poll?(activity.id ,User.current)%>
<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
<% iamge_path = get_image_path_from_content(activity.polls_description) %>
<% if ( activity.polls_status==2) %>
<div class="sn-index-active">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-activeimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-activeimg" %>
<% end %>
<h3>
<% if has_commit %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "active-title" %>
<% else %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "active-title" %>
<% end %>
</h3>
<span class="txt-grey "><%= format_date activity.published_at %></span>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
<% when 'project' %>
<% if @project_acts.blank? %>
<%= render :partial => 'organizations/org_subfield_leftMD_default', :locals => {:field => field} %>
<% else %>
<% @project_acts.first(4).each do |act| %>
<% if act.org_act_type == "Issue" %>
<% activity = Issue.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="sn-index-active">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-activeimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-activeimg" %>
<% end %>
<h3>
<%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :target => '_blank', :class => "active-title" %>
</h3>
<span class="txt-grey "><%= format_date activity.updated_on %></span>
</div>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.content) %>
<div class="sn-index-active">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-activeimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-activeimg" %>
<% end %>
<h3>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "active-title" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "active-title" %>
<% end %>
</h3>
<span class="txt-grey "><%= format_date 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="sn-index-active">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-activeimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-activeimg" %>
<% end %>
<h3>
<%= link_to activity.description.to_s.html_safe, news_url_in_org(activity.id), :target => '_blank', :class => "active-title" %>
</h3>
<span class="txt-grey "><%= format_date 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? %>
<%= render :partial => 'organizations/org_subfield_leftMD_default', :locals => {:field => field} %>
<% else %>
<% org_acts.first(4).each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %>
<% document = activity.org_act %>
<% org_subfield_id = params[:org_subfield_id] %>
<% flag = 2 %>
<% iamge_path = get_image_path_from_content(document.content) %>
<div class="sn-index-active">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-activeimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-activeimg" %>
<% end %>
<h3>
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => '_blank', :class => "active-title" %>
</h3>
<span class="txt-grey "><%= format_date 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 = Message.find(activity.org_act_id) %>
<% if message.parent_id.nil? %>
<% content = message.content%>
<% else %>
<% content = message.parent.content%>
<% end %>
<% iamge_path = get_image_path_from_content(content) %>
<% if message.board.org_subfield_id %>
<div class="sn-index-active">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-activeimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-activeimg" %>
<% end %>
<h3>
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to message.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "active-title" %>
<% else %>
<%= link_to message.parent.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "active-title" %>
<% end %>
</h3>
<span class="txt-grey "><%= format_date message.created_on %></span>
</div>
<% else %>
<div class="sn-index-active">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-activeimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-activeimg" %>
<% end %>
<h3>
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to message.subject.to_s.html_safe, board_message_path(message.board,message), :target => '_blank', :class => "active-title" %>
<% else %>
<%= link_to message.parent.subject.to_s.html_safe, board_message_path(message.board,activity), :target => '_blank', :class => "active-title" %>
<% end %>
</h3>
<span class="txt-grey "><%= format_date message.created_on %></span>
</div>
<% 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) %>
<div class="sn-index-active">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "330", :height => "210"), news_path(news), :target => "_blank", :class =>"sn-activeimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "330", :height => "210"), news_path(news), :target => "_blank", :class =>"sn-activeimg" %>
<% end %>
<h3>
<%= link_to news.title.to_s, news_path(news), :target => '_blank', :class => "active-title" %>
</h3>
<span class="txt-grey "><%= format_date news.created_on %></span>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<div class="cl"></div>
</div>

View File

@ -27,7 +27,7 @@
默认
<% else %>
<%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %>
<div class="update_status_class"><span class="hidden"><%=field.status== 1 ? "列表" : "图片" %></span>
<div class="update_status_class"><span class="hidden"><%= subfield_list_type(field.status) %></span>
<a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2"></a>
</div>
<%= select( :name,:group_id, subfield_status_option,
@ -63,7 +63,7 @@
列表
<% else %>
<%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %>
<div class="update_status_class"><span class="hidden"><%=field.status== 1 ? "列表" : "图片" %></span>
<div class="update_status_class"><span class="hidden"><%= subfield_list_type(field.status) %></span>
<a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2"></a>
</div>
<%= select( :name,:group_id, subfield_status_option,

View File

@ -0,0 +1,7 @@
<div class="sn-index-active">
<div class="sn-index-active">
<a href="javascript:void()" target="_blank" class="sn-activeimg"><img src="images/active/img-active01.jpg" width="330" height="210" alt=""/></a>
<h3><a href="javascript:void()" target="_blank" class="active-title"></a></h3>
<span class="txt-grey "></span>
</div>
</div>

View File

@ -10,14 +10,18 @@
type: 'line'
},
title: {
text: '版本库代码提交量'
text: '版本库代码提交行数',
style:{
fontSize: '14px'
}
},
subtitle: {
// text: 'Source: WorldClimate.com'
},
xAxis: {
// categories: ["Jan", "Jan", "Jan", 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
categories: <%= raw(@static_total_per_user.map{|c| c.uname}) %>
categories: <%= raw(@a_uname_code) %>
},
yAxis: {
title: {
@ -34,6 +38,12 @@
}
},
plotOptions: {
series: {
marker: {
radius: 3, //曲线点半径默认是4
symbol: 'circle' //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
}
},
line: {
dataLabels: {
enabled: true
@ -41,21 +51,55 @@
enableMouseTracking: false
}
},
series: [{
name: '改动或增加',
color: '#fd9e04',
// data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
data: <%= @static_total_per_user.map{|c| c.add.to_i} %>
series: [
{
name: '<b style="font-weight:normal ">总变更</b>',
color: '#d05d5a',
fontWeight: 'normal',
data: <%= @a_commits_changeset %>,
dataLabels: {
enabled: false,
style: {
fontSize: '13px',
color: '#aaa',
fontFamily: 'Arial',
textShadow: '0px 0px 6px rgb(0, 0, 0), 0px 0px 3px rgb(f, f, f)',
fontWeight: 'normal'
}
},
lineWidth: 1.5
},
{
name: '<b style="font-weight:normal ">改动或增加</b>',
color: '#5b6b76',
data: <%= @a_commits_add %>,
dataLabels: {
enabled: false,
style: {
fontSize: '13px',
color: '#aaa',
fontFamily: 'Arial',
textShadow: '0px 0px 6px rgb(0, 0, 0), 0px 0px 3px rgb(f, f, f)',
fontWeight: 'normal'
}
},
lineWidth: 1.5
},
{
name: '删除',
color: '#46baed ',
data: <%= @static_total_per_user.map{|c| c.del.to_i} %>
},{
name: '总变更',
color: '#d397d5',
data: <%= @static_total_per_user.map{|c| c.changes.to_i} %>
name: '<b style="font-weight:normal ">删除</b>',
color: '#84b5bb',
data: <%= @a_commits_del %>,
dataLabels: {
enabled: false,
style: {
fontSize: '13px',
color: '#aaa',
fontFamily: 'Arial',
textShadow: '0px 0px 6px rgb(0, 0, 0), 0px 0px 3px rgb(f, f, f)',
fontWeight: 'normal'
}
},
lineWidth: 1.5
}]
});
@ -68,14 +112,18 @@
enabled: false
},
title: {
text: '版本库代码提交次数'
text: '版本库代码提交次数',
style:{
fontSize: '14px'
}
},
subtitle: {
// text: 'Source: WorldClimate.com'
},
xAxis: {
// categories: ["Jan", "Jan", "Jan", 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
categories: <%= raw(@static_total_per_user.map{|c| c.uname}) %>
categories: <%= raw(@a_uname) %>
},
yAxis: {
title: {
@ -89,6 +137,12 @@
}
},
plotOptions: {
series: {
marker: {
radius: 3, //曲线点半径默认是4
symbol: 'circle' //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
}
},
line: {
dataLabels: {
enabled: true
@ -97,9 +151,24 @@
}
},
series: [{
name: '提交次数',
name: '<b style="font-weight:normal ">提交次数</b>',
fontWeight: 'normal',
color: '#d05d5a',
// data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
data: <%= @static_total_per_user.map{|c| c.commits_num.to_i} %>
data: <%= @a_commits_num %>,
dataLabels: {
enabled: false,
style: {
fontSize: '13px',
color: '#aaa',
fontFamily: 'Arial',
textShadow: '0px 0px 6px rgb(0, 0, 0), 0px 0px 3px rgb(f, f, f)',
fontWeight: 'normal'
}
},
lineWidth: 1.5
}
// {
// name: 'London',
@ -108,4 +177,5 @@
]
});
});
</script>
</script>
<div class="button-rep">当前分支:<%= @rev %></div>

View File

@ -29,12 +29,14 @@
<!--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>
<% end %>
<%= render :partial => "project_activities", :locals => {:forge_acts => @events_pages, :page => 0, :type => @type} %>
</div>

View File

@ -1,5 +1,5 @@
<div class="autoscroll">
<table class="list entries" id="browser">
<table class="list entries" id="browser" style="table-layout: fixed;">
<tbody>
<%= render :partial => 'dir_list_content' %>

View File

@ -1,33 +1,55 @@
<% @entries.each do |entry| %>
<% tr_id = Digest::MD5.hexdigest(entry.path)
depth = params[:depth].to_i %>
<% ent_path = Redmine::CodesetUtil.replace_invalid_utf8(entry.path) %>
<% ent_name = Redmine::CodesetUtil.replace_invalid_utf8(entry.name) %>
<tr id="<%= tr_id %>" class="<%= h params[:parent_id] %> entry <%= entry.kind %>">
<td style="padding-left: <%=18 * depth%>px;" class="<%=
@repository.report_last_commit ? "filename" : "filename_no_report" %>">
<% if entry.is_dir? %>
<% tr_id = Digest::MD5.hexdigest(entry.path)
depth = params[:depth].to_i %>
<% sub_path = entry.path[0] == "/" ? entry.path.sub("/", "") : entry.path %>
<% ent_path = Redmine::CodesetUtil.replace_invalid_utf8(sub_path) %>
<% ent_name = Redmine::CodesetUtil.replace_invalid_utf8(entry.name) %>
<% latest_changes = get_trees_last_changes(@project.gpid, @rev, ent_path) %>
<tr id="<%= tr_id %>" class="<%= h params[:parent_id] %> entry <%= entry.kind %>">
<td style="padding-left: <%=18 * depth%>px;" class="filename_no_report hidden">
<% if entry.is_dir? %>
<%# 展开文件目录 %>
<span class="expander" onclick="scmEntryClick('<%= tr_id %>', '<%= escape_javascript(url_for(
<span class="expander" onclick="scmEntryClick('<%= tr_id %>', '<%= escape_javascript(url_for(
:action => 'show',
:id => @project,
:repository_id => @repository.identifier_param,
:path => to_path_param(ent_path),
:rev => @rev,
:latest_changes => latest_changes,
:depth => (depth + 1),
:parent_id => tr_id)) %>');">&nbsp;</span>
<% end %>
<% end %>
<!--<a class="<%#= (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}") %>">-->
<!--<%#= h(ent_name) %>-->
<!--</a>-->
<%#= h(ent_name), :class => "(entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
<%= link_to h(ent_name),
{:action => (entry.is_dir? ? 'show' : 'entry'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev},
:class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
</td>
<!--<td class="size"><%#= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>-->
<!--<td class="size"><%#= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>-->
<% if @repository.report_last_commit %>
<td class="revision"><%= link_to_revision(entry.changeset, @repository) if entry.changeset %></td>
<td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td>
<td class="author"><%= entry.author %></td>
<td class="comments"><%=h truncate(entry.changeset.comments, :length => 50) if entry.changeset %></td>
<% end %>
</tr>
:class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
</td>
<!--<td class="size"><%#= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>-->
<!--<td class="size"><%#= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>-->
<%# if @repository.report_last_commit %>
<div id="children_tree">
<td class="tree-comments c_grey hidden">
<div class="hidden" title="<%= (latest_changes.message) if latest_changes && latest_changes.message %>">
<%= (latest_changes.message) if latest_changes && latest_changes.message %>
</div>
</td>
<td class="tree-author c_grey">
<div class="hidden" title="<%= (latest_changes.author) if latest_changes && latest_changes.author %>">
<%= (latest_changes.author) if latest_changes && latest_changes.author %>
</div>
</td>
<td class="tree-age c_grey">
<div class="hidden" title="<%= distance_of_time_in_words(latest_changes.time, Time.now + 8.hours) if latest_changes && latest_changes.time %>">
<%# 为了转换UTC时间时差8小时 %>
<%= distance_of_time_in_words(latest_changes.time, Time.now + 8.hours) if latest_changes && latest_changes.time %>
<%#= latest_changes.time if latest_changes && latest_changes.time %>
</div>
</td>
</div>
<%# end %>
</tr>
<% end %>

View File

@ -25,7 +25,7 @@
<textarea id="copy_rep_content" class="cloneUrl mt5 fl" type="input" ><%= @repository.type.to_s=="Repository::Gitlab" ? @repos_url.to_s.lstrip : @repository.url %></textarea>
<a href="javascript:void(0);" class="clone_btn mt5" onclick="jsCopy()"><span class="vl_copy" title="点击复制版本库地址"></span></a>
<div class="fl mt5 ml15">
<%=link_to "统计", stats_repository_project_path(:id => @project, :repository_id => @repository.identifier_param, :rev => @rev, :creator => @creator ), :class => "fl vl_zip" %>
<%=link_to "代码统计", stats_repository_project_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :creator => @creator, :default_branch => @g_default_branch ), :class => "fl vl_zip" %>
</div>
<%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %>
<% if User.current.id != @project.user_id %>

View File

@ -14,6 +14,7 @@
</div>
<div id = "container_code" class="mt30">
</div>
<script>
$(function () {
$('#container_code').highcharts({
@ -21,7 +22,11 @@
type: 'line'
},
title: {
text: '代码提交量'
text: '版本库代码提交行数',
style:{
fontSize: '14px'
}
},
subtitle: {
// text: 'Source: WorldClimate.com'
@ -45,6 +50,12 @@
}
},
plotOptions: {
series: {
marker: {
radius: 3, //曲线点半径默认是4
symbol: 'circle' //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
}
},
line: {
dataLabels: {
enabled: true
@ -52,18 +63,55 @@
enableMouseTracking: false
}
},
series: [{
name: '改动或增加',
// data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
data: <%= @static_total_per_user.map{|c| c.add.to_i} %>
},
{
name: '删除',
data: <%= @static_total_per_user.map{|c| c.del.to_i} %>
},{
name: '总变更',
data: <%= @static_total_per_user.map{|c| c.changes.to_i} %>
series: [
{
name: '<b style="font-weight:normal ">总变更</b>',
color: '#d05d5a',
fontWeight: 'normal',
data: <%= @static_total_per_user.map{|c| c.changes.to_i} %>,
dataLabels: {
enabled: true,
style: {
fontSize: '13px',
color: '#aaa',
fontFamily: 'Arial',
textShadow: '0px 0px 6px rgb(0, 0, 0), 0px 0px 3px rgb(f, f, f)',
fontWeight: 'normal'
}
},
lineWidth: 1.5
},
{
name: '<b style="font-weight:normal ">改动或增加</b>',
color: '#5b6b76',
data: <%= @static_total_per_user.map{|c| c.add.to_i} %>,
dataLabels: {
enabled: true,
style: {
fontSize: '13px',
color: '#aaa',
fontFamily: 'Arial',
textShadow: '0px 0px 6px rgb(0, 0, 0), 0px 0px 3px rgb(f, f, f)',
fontWeight: 'normal'
}
},
lineWidth: 1.5
},
{
name: '<b style="font-weight:normal ">删除</b>',
color: '#84b5bb',
data: <%= @static_total_per_user.map{|c| c.del.to_i} %>,
dataLabels: {
enabled: true,
style: {
fontSize: '13px',
color: '#aaa',
fontFamily: 'Arial',
textShadow: '0px 0px 6px rgb(0, 0, 0), 0px 0px 3px rgb(f, f, f)',
fontWeight: 'normal'
}
},
lineWidth: 1.5
}]
});
@ -76,14 +124,18 @@
enabled: false
},
title: {
text: '代码提交次数'
text: '版本库代码提交次数',
style:{
fontSize: '14px'
}
},
subtitle: {
// text: 'Source: WorldClimate.com'
},
xAxis: {
// categories: ["Jan", "Jan", "Jan", 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
categories: <%= raw(@static_total_per_user.map{|c| c.uname}) %>
categories: <%= raw(@static_total_per_user.map{|c| c.uname}) %>
},
yAxis: {
title: {
@ -97,6 +149,12 @@
}
},
plotOptions: {
series: {
marker: {
radius: 3, //曲线点半径默认是4
symbol: 'circle' //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
}
},
line: {
dataLabels: {
enabled: true
@ -105,9 +163,23 @@
}
},
series: [{
name: '提交次数',
name: '<b style="font-weight:normal ">提交次数</b>',
fontWeight: 'normal',
color: '#d05d5a',
// data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
data: <%= @static_total_per_user.map{|c| c.commits_num.to_i} %>
data: <%= @static_total_per_user.map{|c| c.commits_num.to_i} %>,
dataLabels: {
enabled: true,
style: {
fontSize: '13px',
color: '#aaa',
fontFamily: 'Arial',
textShadow: '0px 0px 6px rgb(0, 0, 0), 0px 0px 3px rgb(f, f, f)',
fontWeight: 'normal'
}
},
lineWidth: 1.5
}
// {
// name: 'London',

View File

@ -119,6 +119,11 @@
<div class="cl"></div>
</div>
<script type="text/javascript">
$(function(){
<% if defined?(is_focus) && is_focus.to_i == 1 %>
$("#upload_revise_attachment").click();
<% end %>
});
function show_upload(){
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>');
showModal('ajax-modal', '452px');

View File

@ -30,7 +30,7 @@
<% end %>
<div class="cl"></div>
<div class="mb10 mt5">
<a href="javascript:void(0);" onclick="show_upload();" class="blueCir ml5" title="请选择文件上传">上传附件</a>
<a href="javascript:void(0);" id="upload_revise_attachment" onclick="show_upload();" class="blueCir ml5" title="请选择文件上传">上传附件</a>
</div>
<% end %>
<% end %>
<% end %>

View File

@ -107,6 +107,9 @@
<script type="text/javascript">
$(function(){
showNormalImage('student_work_img_<%=work.id %>');
<% if defined?(is_focus) && is_focus.to_i == 1 %>
$("#upload_revise_attachment").click();
<% end %>
});
function show_upload(){
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>');

View File

@ -7,6 +7,7 @@
<% my_work = @homework.student_works.where("user_id = #{User.current.id}").first %>
<% if !@is_teacher && my_work.nil? && User.current.member_of_course?(@course) %>
<span class="f12 c_red">您尚未提交作品</span>
<%=link_to "提交作品", new_student_work_url_without_domain(@homework.id),:class => 'blueCir ml5 f12' %>
<% elsif !@is_teacher && my_work &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
<span class="f12 c_red">您已提交且不可再修改,因为截止日期已过</span>
<% elsif !@is_teacher && my_work &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
@ -58,7 +59,7 @@
<% end %>
<% unless work.nil? %>
<% if @homework.homework_type == 2 %>
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
var program_name = "text/x-csrc";
var language = <%= @homework.language %>;
@ -82,11 +83,11 @@
value: $("#work-src_<%= work.id%>").text()
});
<% elsif @homework.homework_type == 1 %>
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
<% elsif @homework.homework_type == 3 %>
<% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
<% if pro && pro.student_work_id == work.id %>
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
<% end %>
<% end %>
$('#score_<%= work.id%>').peSlider({range: 'min'});

View File

@ -0,0 +1,78 @@
<div class = "cl"> </div>
<div id="course-boardlist">
<div class="listbox mt10" >
<h2 class="list-h2">问答区列表</h2>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 1 %>
<%= link_to "", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 1 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<%= link_to "人气", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 2 %>
<%= link_to "", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 2 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<div class="cl"></div>
</div>
<div class="bloglistbox">
<% topics.each do |activity| %>
<div class="list-file">
<div><span class="item_list fl"></span>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "list-title fl" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "list-title f1" %>
<% end %>
<% if activity.sticky == 1 %>
<span class="fl ml10 red-cir-btn">顶</span>
<% end%>
<% if activity.locked %>
<span class="fl ml10 green-cir-btn" title="已锁定">锁</span>
<% end %>
<% u = User.where("id=?",activity.author_id).first%>
<span class="fr grayTxt">
发帖人: <%=(u.try(:realname) != " " ? u.lastname + u.firstname : u.try(:login)) %>
</span>
<div class="cl"></div>
</div>
<div class="massages-content ml15">
<% if activity.parent_id.nil? %>
<% content = activity.content %>
<% else %>
<% content = activity.parent.content %>
<% end %>
<p><%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54} %></p>
</div>
<div class="ml15 mt10">
<span class="grayTxt">发帖时间:<%= format_time(activity.created_on) %></span>
<span class="grayTxt">更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %></span>
<% count=0 %>
<% if activity.parent %>
<% count=activity.parent.children.count%>
<% else %>
<% count=activity.children.count%>
<% end %>
<p class="list-info fr grayTxt"><span><%= count>0 ? "#{count}" : "" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span><span>赞</span></p>
</div>
<div class="cl"></div>
</div>
<% end %>
<div>
<ul class="wlist" id="pages" >
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
</ul>
<div class="cl"></div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
//如果右边的博客列表比左边的高度低则将右边的高度设为与左边对齐
var leftHeight = $("#LSide").height()-$(".fontGrey5").height()-20;
var rightHeight = $(".homepageRight").height();
if (rightHeight < leftHeight){
var diffHeight = leftHeight - rightHeight;
var tmpHeight = $(".listbox").height()+diffHeight;
$(".listbox").css("height",tmpHeight);
}
</script>

View File

@ -71,7 +71,12 @@
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
<%= user_for_homework_common activity,is_teacher %>
</div>
<% work = cur_user_works_for_homework activity %>
<% if activity.end_time < Date.today && !is_teacher && !work.nil? %>
<div class="homepagePostSubmit">
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
</div>
<% end %>
<% if activity.homework_type == 2 && is_teacher%>
<div class="homepagePostSubmit">
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>

View File

@ -89,7 +89,7 @@
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;"></span>
<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" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
@ -174,5 +174,4 @@
</div>
<% end %>
</div>
</div>
</div>

View File

@ -0,0 +1,24 @@
<div class="homepagePostIntro break_word upload_img list_style table_maxWidth lh18" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>">
<%= content.to_s.html_safe%>
</div>
</div>
<script type="text/javascript">
$(function(){
var heightType = <%= maxheight %>;
if (heightType > 0){
$("#activity_description_<%= user_activity_id%>").css("max-height",heightType+"px");
}
$("#intro_content_<%= user_activity_id%> p,#intro_content_<%= user_activity_id%> span,#intro_content_<%= user_activity_id%> em").each(function(){
var postContent = $(this).html();
postContent = postContent.replace(/&nbsp;/g," ");
postContent= postContent.replace(/ {2}/g,"&nbsp; ");
postContent=postContent.replace(/&nbsp; &nbsp;/g,"&nbsp;&nbsp;&nbsp;");
postContent=postContent.replace(/&nbsp; /g,"&nbsp;&nbsp; ");
$(this).html(postContent);
});
description_show_hide(<%=user_activity_id %>);
});
</script>

View File

@ -0,0 +1,78 @@
<div class = "cl"> </div>
<div id="project-boardlist">
<div class="listbox mt10" >
<h2 class="list-h2">讨论区列表</h2>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 1 %>
<%= link_to "", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 1 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<%= link_to "人气", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 2 %>
<%= link_to "", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 2 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<div class="cl"></div>
</div>
<div class="bloglistbox">
<% topics.each do |activity| %>
<div class="list-file">
<div><span class="item_list fl"></span>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "list-title fl" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "list-title f1" %>
<% end %>
<% if activity.sticky == 1 %>
<span class="fl ml10 red-cir-btn">顶</span>
<% end%>
<% if activity.locked %>
<span class="fl ml10 green-cir-btn" title="已锁定">锁</span>
<% end %>
<% u = User.where("id=?",activity.author_id).first%>
<span class="fr grayTxt">
发帖人:<%=(u.try(:realname) != " " ? u.lastname + u.firstname : u.try(:login)) %>
</span>
<div class="cl"></div>
</div>
<div class="massages-content ml15">
<% if activity.parent_id.nil? %>
<% content = activity.content %>
<% else %>
<% content = activity.parent.content %>
<% end %>
<p><%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54 } %></p>
</div>
<div class="ml15 mt10">
<span class="grayTxt">发帖时间:<%= format_time(activity.created_on) %></span>
<span class="grayTxt">更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %></span>
<% count=0 %>
<% if activity.parent %>
<% count=activity.parent.children.count%>
<% else %>
<% count=activity.children.count%>
<% end %>
<p class="list-info fr grayTxt"><span><%= count>0 ? "#{count}" : "0" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %></span><span>赞</span></p>
</div>
<div class="cl"></div>
</div>
<% end %>
<div>
<ul class="wlist" id="pages" >
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
</ul>
<div class="cl"></div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
//如果右边的博客列表比左边的高度低则将右边的高度设为与左边对齐
var leftHeight = $("#LSide").height()-$(".fontGrey5").height()-20;
var rightHeight = $(".homepageRight").height();
if (rightHeight < leftHeight){
var diffHeight = leftHeight - rightHeight;
var tmpHeight = $(".listbox").height()+diffHeight;
$(".listbox").css("height",tmpHeight);
}
</script>

View File

@ -0,0 +1,61 @@
<div class="listbox" id="course-list">
<h2 class="list-h2">课程列表</h2>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 1 %>
<%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<%= link_to "人气", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 2 %>
<%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<div class="cl"></div>
</div>
<div class="bloglistbox">
<% @courses.each do |course|%>
<ul class="list-file">
<li>
<span class="item_list fl"></span>
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "course-title fl #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
:style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+""+current_time_and_term(course)+""%>
<% teacher = User.where("id=?",course.tea_id).first%>
<span class="fr grayTxt">
<%='主讲老师:'+(teacher.try(:realname) != " " ? teacher.lastname + teacher.firstname : teacher.try(:login)) %>
</span>
</li>
<div class="cl"></div>
<li class="ml15">
<span class="grayTxt">
开课学期:&nbsp;&nbsp;<span><%= current_time_and_term course %></span>
</span>
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,@course) %>
<% homework_num = course.homework_commons.count %>
<% else %>
<% homework_num = course.homework_commons.where("publish_time <= '#{Date.today}'").count %>
<% end %>
<p class="list-info fr grayTxt"><span><%= homework_num %></span><span>作业</span><span>|</span><span> <%= visable_attachemnts_incourse(course).count %></span><span>资源</span></p>
</li>
<div class="cl"></div>
</ul>
<% end %>
<div>
<ul class="wlist" id="pages" >
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
</ul>
<div class="cl"></div>
</div>
</div>
</div>
<script type="text/javascript">
//如果右边的列表比左边的高度低则将右边的高度设为与左边对齐
var leftHeight = $("#LSide").height()-$(".fontGrey5").height()-20;
var rightHeight = $(".homepageRight").height();
if (rightHeight < leftHeight){
var diffHeight = leftHeight - rightHeight;
var tmpHeight = $(".listbox").height()+diffHeight;
$(".listbox").css("height",tmpHeight);
}
</script>

View File

@ -70,6 +70,12 @@
<div class="homepagePostSubmit">
<%= user_for_homework_common homework_common,is_teacher %>
</div>
<% work = cur_user_works_for_homework homework_common %>
<% if homework_common.end_time < Date.today && !is_teacher && !work.nil? %>
<div class="homepagePostSubmit">
<%=link_to "追加附件", student_work_index_url_in_org(homework_common.id, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
</div>
<% end %>
<% if homework_common.homework_type == 2 && is_teacher%>
<div class="homepagePostSubmit">
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: homework_common.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>

View File

@ -0,0 +1,53 @@
<div class="listbox" id="project-list">
<h2 class="list-h2">项目列表</h2>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'users', :action => 'user_projectlist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 1 %>
<%= link_to "", {:controller => 'users', :action => 'user_projectlist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<%= link_to "人气", {:controller => 'users', :action => 'user_projectlist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 2 %>
<%= link_to "", {:controller => 'users', :action => 'user_projectlist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<div class="cl"></div>
</div>
<div class="bloglistbox">
<% @projects.each do |project|%>
<ul class="list-file">
<li>
<span class="item_list fl"></span>
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "course-title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
<% projectUser = User.where("id=?",project.user_id).first%>
<span class="fr grayTxt">
<%='创建者:'+(projectUser.try(:realname) != " " ? projectUser.lastname + projectUser.firstname : projectUser.try(:login)) %>
</span>
</li>
<div class="cl"></div>
<li class="ml15">
<span class="grayTxt">创建时间:<%= format_time(project.created_on) %></span>
<p class="list-info fr grayTxt"><span><%= project.project_score.issue_num %></span><span>问题</span><span>|</span><span> <%= project.project_score.attach_num %></span><span>资源</span></p>
</li>
<div class="cl"></div>
</ul>
<% end %>
<div>
<ul class="wlist" id="pages" >
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
</ul>
<div class="cl"></div>
</div>
</div>
</div>
<script type="text/javascript">
//如果右边的列表比左边的高度低则将右边的高度设为与左边对齐
var leftHeight = $("#LSide").height()-$(".fontGrey5").height()-20;
var rightHeight = $(".homepageRight").height();
if (rightHeight < leftHeight){
var diffHeight = leftHeight - rightHeight;
var tmpHeight = $(".listbox").height()+diffHeight;
$(".listbox").css("height",tmpHeight);
}
</script>

View File

@ -0,0 +1 @@
<%= render :partial => 'users/user_course_list'%>

View File

@ -0,0 +1 @@
$("#course-list").replaceWith('<%= escape_javascript( render :partial => 'users/user_course_list') %>');

View File

@ -0,0 +1 @@
<%= render :partial => 'users/user_project_list'%>

View File

@ -0,0 +1 @@
$("#project-list").replaceWith('<%= escape_javascript( render :partial => 'users/user_project_list') %>');

View File

@ -549,6 +549,11 @@ RedmineApp::Application.routes.draw do
match 'code_submit_score_index', :to => 'projects#code_submit_score_index', :via => [:get, :post]
match 'projects_topic_score_index', :to => 'projects#projects_topic_score_index', :via => [:get, :post]
match 'user_act_issue_assign_to', :to => 'users#user_act_issue_assign_to', :via => [:get, :post]
#addby yk
match 'user_courselist', :to => 'users#user_courselist', :via => :get, :as => "user_courselist"
match 'user_projectlist', :to => 'users#user_projectlist', :via => :get, :as => "user_projectlist"
get 'edit_brief_introduction'
get "user_resource"
get "import_resources"

View File

@ -1,35 +1,39 @@
class UpdateOneStudentScore < ActiveRecord::Migration
def up
student_work_score = StudentWorksScore.where("user_id = 11688 AND student_work_id = 34414").first
student_work_score.score = 100
student_work_score.save
student_works = StudentWork.where("user_id = 6456")
student_works.each do |work|
unless work.student_works_scores.empty?
if work.student_works_scores.where(:reviewer_role => 2).empty?
work.teaching_asistant_score = nil
else
work.teaching_asistant_score = work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f
begin
student_work_score = StudentWorksScore.where("user_id = 11688 AND student_work_id = 34414").first
student_work_score.score = 100
student_work_score.save
student_works = StudentWork.where("user_id = 6456")
student_works.each do |work|
unless work.student_works_scores.empty?
if work.student_works_scores.where(:reviewer_role => 2).empty?
work.teaching_asistant_score = nil
else
work.teaching_asistant_score = work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f
end
if work.student_works_scores.where(:reviewer_role => 3).empty?
work.student_score = nil
else
work.student_score = work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
end
end
if work.student_works_scores.where(:reviewer_role => 3).empty?
work.student_score = nil
if work.teaching_asistant_score.nil?
work.final_score = work.student_score
elsif work.student_score.nil?
work.final_score = work.teaching_asistant_score
else
work.student_score = work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
homework = HomeworkCommon.find work.homework_common_id
ta_proportion = homework.homework_detail_manual.ta_proportion
final_ta_score = BigDecimal.new("#{work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}")
final_s_score = BigDecimal.new("#{work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_ta_score + final_s_score
work.final_score = format("%.2f",final_score.to_f)
end
work.save
end
if work.teaching_asistant_score.nil?
work.final_score = work.student_score
elsif work.student_score.nil?
work.final_score = work.teaching_asistant_score
else
homework = HomeworkCommon.find work.homework_common_id
ta_proportion = homework.homework_detail_manual.ta_proportion
final_ta_score = BigDecimal.new("#{work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}")
final_s_score = BigDecimal.new("#{work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_ta_score + final_s_score
work.final_score = format("%.2f",final_score.to_f)
end
work.save
rescue => e
logger.error "[Errno::ENOENT] ===> #{e}"
end
end

View File

@ -1,15 +1,19 @@
class UpdateOneStudentTeacherScore < ActiveRecord::Migration
def up
work = StudentWork.find 49774
score = StudentWorksScore.new
score.score = 100
score.user_id = 7318
score.student_work_id = work.id
score.reviewer_role = 1
if score.save
work.teacher_score = score.score
begin
work = StudentWork.find 49774
score = StudentWorksScore.new
score.score = 100
score.user_id = 7318
score.student_work_id = work.id
score.reviewer_role = 1
if score.save
work.teacher_score = score.score
end
work.save
rescue => e
logger.error "[Errno::ENOENT] ===> #{e}"
end
work.save
end
def down

View File

@ -0,0 +1,14 @@
class CreateRepStatics < ActiveRecord::Migration
def change
create_table :rep_statics do |t|
t.integer :project_id
t.integer :commits_num
t.string :uname
t.string :email
t.integer :add
t.integer :del
t.timestamps
end
end
end

View File

@ -0,0 +1,5 @@
class AddChangesetToRepStatics < ActiveRecord::Migration
def change
add_column :rep_statics, :changeset, :integer
end
end

View File

@ -0,0 +1,26 @@
class SyncRepStatics < ActiveRecord::Migration
def up
g = Gitlab.client
# projects = Project.find_by_sql("SELECT p.* FROM projects p, project_scores ps where p.id = ps.project_id and p.gpid is not null and ps.changeset_num > 0")
projects = Project.where("gpid is not null")
count = projects.count / 30 + 2
transaction do
for i in 1 ... count do i
projects.page(i).per(30).each do |project|
begin
puts project.id
g.rep_stats(project.gpid).each do |static|
puts static.uname
RepStatics.create(:project_id => project.id, :uname => static.uname, :commits_num => static.commits_num, :email => static.email, :add => static.add, :del => static.del, :changeset => static.changes)
end
rescue
logger.error("Sync rep failed!")
end
end
end
end
end
def down
end
end

View File

@ -0,0 +1,21 @@
class AlterHomeworkEndTime < ActiveRecord::Migration
def up
homeworks = HomeworkCommon.where("id in (3229, 3234, 3235, 3236)");
unless homeworks.empty? || homeworks.nil?
homeworks.each do |hw|
hw.end_time = hw.end_time + 4
hm = hw.homework_detail_manual
hm.comment_status = 1
hw.student_works.each do |stu|
stu.late_penalty = 0
stu.save
end
hm.save
hw.save
end
end
end
def down
end
end

View File

@ -11,11 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160405021915) do
ActiveRecord::Schema.define(:version => 20160419074016) do
ActiveRecord::Schema.define(:version => 20160421011543) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -1714,8 +1710,8 @@ ActiveRecord::Schema.define(:version => 20160419074016) do
t.integer "absence_penalty", :default => 0
t.float "system_score", :default => 0.0
t.boolean "is_test", :default => false
t.integer "simi_id"
t.integer "simi_value"
t.integer "simi_id", :default => 0
t.integer "simi_value", :default => 0
end
add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id"
@ -1948,25 +1944,6 @@ ActiveRecord::Schema.define(:version => 20160419074016) do
add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade"
add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count"
create_table "user_wechats", :force => true do |t|
t.integer "subscribe"
t.string "openid"
t.string "nickname"
t.integer "sex"
t.string "language"
t.string "city"
t.string "province"
t.string "country"
t.string "headimgurl"
t.string "subscribe_time"
t.string "unionid"
t.string "remark"
t.integer "groupid"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "users", :force => true do |t|
t.string "login", :default => "", :null => false
t.string "hashed_password", :limit => 40, :default => "", :null => false
@ -2043,14 +2020,6 @@ ActiveRecord::Schema.define(:version => 20160419074016) do
t.datetime "updated_at", :null => false
end
create_table "wechat_logs", :force => true do |t|
t.string "openid", :null => false
t.text "request_raw"
t.text "response_raw"
t.text "session_raw"
t.datetime "created_at", :null => false
end
create_table "wiki_content_versions", :force => true do |t|
t.integer "wiki_content_id", :null => false
t.integer "page_id", :null => false

View File

@ -106,6 +106,23 @@ class Gitlab::Client
end
alias_method :repo_rep_stats, :rep_stats
# Gets a tree activities of project repository.
#
# @example
# Gitlab.commits('viking')
# Gitlab.repo_commits('gitlab', :ref_name => 'api')
#
# @param [Integer] project The ID of a project.
# @param [Hash] options A customizable set of options.
# @option options [String] :ref_name The branch or tag name of a project repository.
# @option options [String] :creator The user name of a project repository.
# @option options [Integer] :period Statistics over time. 1:total 2one month 3one week
# @return [Array<Gitlab::ObjectifiedHash>]
def rep_last_changes(project, options={})
get("/projects/#{project}/repository/rep_last_changes", :query => options)
end
alias_method :repo_rep_stats, :rep_stats
# Get the diff of a commit in a project.
#
# @example

View File

@ -11,6 +11,21 @@ namespace :gitlab do
end
end
task :members => :environment do
projects = Project.where("gpid is not null")
s = Trustie::Gitlab::Sync.new
g = Gitlab.client
projects.each do |project|
begin
if project.members.count != g.team_members(project.gpid).count
s.only_members(project)
end
rescue => e
puts e
end
end
end
desc "update user password"
task :password => :environment do
s = Trustie::Gitlab::Sync.new

38
lib/tasks/sync_files.rake Normal file
View File

@ -0,0 +1,38 @@
require 'trustie/gitlab/sync'
namespace :trustie do
namespace :files do
desc "sync course'file"
task :course => :environment do
# Course.all.each do |course|
# unless course.attachments.count.to_i == 0
# attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and container_type ='Course'").count
# project_score = ProjectScore.where("project_id=?", project.id).first
# if project_score.nil?
# ProjectScore.create(:project_id => project.id, :attach_num => 0)
# else
# project_score.attach_num = attachment_count
# project_score.save
# end
# end
# end
end
desc "sync project'file"
task :project => :environment do
Project.all.each do |project|
unless project.attachments.count.to_i == 0
attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{project.id} and container_type ='Project'").count
project_score = ProjectScore.where("project_id=?", project.id).first
if project_score.nil?
ProjectScore.create(:project_id => project.id, :attach_num => 0)
else
project_score.attach_num = attachment_count
project_score.save
end
end
end
end
end
end

View File

@ -122,7 +122,7 @@ module Trustie
project.members.each do |m|
begin
gid = m.user.gid
unless gid
if gid.nil?
gid = sync_user(m.user).id
end
self.g.add_team_member(project.gpid, gid, get_gitlab_role(m))

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

BIN
public/images/liststyle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

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